MODSERIAL PID controller edit

Dependencies:   HIDScope MODSERIAL QEI biquadFilter mbed

Fork of PID_controller_Motor by BioBitches TN

Files at this revision

API Documentation at this revision

Comitter:
MBroek
Date:
Wed Oct 26 11:05:32 2016 +0000
Parent:
26:2726db5acc03
Commit message:
Alles werkt!!, Maar zonder EMG

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Oct 26 09:20:16 2016 +0000
+++ b/main.cpp	Wed Oct 26 11:05:32 2016 +0000
@@ -17,8 +17,8 @@
 MODSERIAL pc(USBTX, USBRX);
 #define SERIALBAUD 115200
 
-QEI encoder_motor1(D10,D11,NC,64);
-QEI encoder_motor2(D12,D13,NC,64);
+QEI encoder_motor1(D10,D11,NC,8400, QEI::X4_ENCODING);
+QEI encoder_motor2(D12,D13,NC,8400, QEI::X4_ENCODING);
 
 
 // Definieren van de Motorpins ---------------------------------------
@@ -72,13 +72,13 @@
 double error1_int = 0.00000;                 // Initiele error integral waardes
 double error2_int = 0.00000;
 
-const double T_motor_function = 0.01;           // Periode van de frequentie van het aanroepen van onder andere positiechecker (get_position) en de rest vd motor functie
+const double T_motor_function = 0.1;           // Periode van de frequentie van het aanroepen van onder andere positiechecker (get_position) en de rest vd motor functie
 
 volatile bool flag1 = false, flag2 = false;   // De flags voor de functies aangeroepen door de tickers
 
-const double Kp_1 = 0.1;                    // De PID variablen voor motor 1
-const double Kd_1 = 0.0;
-const double Ki_1 = 0.0;
+const double Kp_1 = 0.5;                    // De PID variablen voor motor 1
+const double Kd_1 = 0.1;
+const double Ki_1 = 0.1;
 
 const double Kp_2 = 1.0;                    // De PID variablen voor motor 2
 const double Kd_2 = 0.0;