Wil je hier nog je PID controler kort uitleggen plus waarden aanpassen?

Dependencies:   HIDScope MODSERIAL QEI biquadFilter mbed

Fork of a_pid_kal_end by Daniqe Kottelenberg

Revision:
58:c91723359f62
Parent:
57:c546edf67c5c
--- a/main.cpp	Fri Nov 04 15:12:52 2016 +0000
+++ b/main.cpp	Tue Nov 08 07:16:08 2016 +0000
@@ -108,16 +108,16 @@
 //filter coefficients
 
 //b1 = biceps right arm
-BiQuad filterhigh_b1(9.5654e-01,-1.9131e+00,9.5654e-01,-1.9112e+00,9.1498e-01);                 // second order highpass filter, with frequency of 20 Hz
-BiQuad filternotch1_b1 (9.9376e-01 , -1.8902e-00,   9.9376e-01 , -1.8902e-00 ,  9.875e-01);     // second order notch filter, with frequency of 49-51 Hz
+BiQuad filterhigh_b1(9.5654e-01,-1.9131e+00,9.5654e-01,-1.9112e+00,9.1498e-01);                 // second order highpass filter, with frequency of 10 Hz
+BiQuad filternotch1_b1 (9.5654e-01, -1.9131e+00, 9.5654e-01 ,-1.9112e+00 ,9.1498e-01;           // IIRnotch filter, with frequency of 50 Hz
 
 //t1= triceps right arm
-BiQuad filterhigh_t1(9.5654e-01,-1.9131e+00,9.5654e-01,-1.9112e+00,9.1498e-01);                  // second order highpass filter, with frequency of 20 Hz
-BiQuad filternotch1_t1 (9.9376e-01 , -1.8902e-00,   9.9376e-01 , -1.8902e-00 ,  9.875e-01);      // second order notch filter, with frequency of 49-51 Hz
+BiQuad filterhigh_t1(9.5654e-01,-1.9131e+00,9.5654e-01,-1.9112e+00,9.1498e-01);                  // second order highpass filter, with frequency of 10 Hz
+BiQuad filternotch1_t1 (9.5654e-01, -1.9131e+00, 9.5654e-01 ,-1.9112e+00 ,9.1498e-01;           // IIRnotch filter, with frequency of 50 Hz
 
 //b2= biceps left arm
-BiQuad filterhigh_b2(9.5654e-01,-1.9131e+00,9.5654e-01,-1.9112e+00,9.1498e-01);                  // second order highpass filter, with frequency of 20 Hz
-BiQuad filternotch1_b2 (9.9376e-01 , -1.8902e-00,   9.9376e-01 , -1.8902e-00 ,  9.875e-01);      // second order notch filter, with frequency of 49-51 Hz
+BiQuad filterhigh_b2(9.5654e-01,-1.9131e+00,9.5654e-01,-1.9112e+00,9.1498e-01);                  // second order highpass filter, with frequency of 10 Hz
+BiQuad filternotch1_b2 (9.5654e-01, -1.9131e+00, 9.5654e-01 ,-1.9112e+00 ,9.1498e-01;           // IIRnotch filter, with frequency of 50 Hz
 
 //after abs filtering
 BiQuad filterlow_b1 (6.2942e-06, 1.2588e-05,6.2942e-06,-1.9929e+00,9.9292e-01);                 // second order lowpass filter, with frequency of 2 Hz
@@ -208,7 +208,7 @@
         scope.set(0, emg_filtered_biceps_right);                    //set emg signal of right biceps to scope in channel 0
         scope.set(1, emg_filtered_triceps_right);                   // set emg signal of right triceps to scope in channel 1
         scope.set(2, emg_filtered_biceps_left);                     // set emg signal of left biceps to scope in channel 2
-        scope.set(3, onoffsignal_biceps);                           // set on/off signal for the motors to scope in channel 3
+        scope.set(3, bicepstriceps_rightarm);                           // set on/off signal for the motors to scope in channel 3
         scope.set(4, switch_signal_triceps);                        // set the switch signal to scope in channel 4 
         
         scope.send();                                               //send all the signals to the scope
@@ -424,8 +424,9 @@
 {  
 
 pc.baud(115200); //connect with pc with baudrate 115200
-green=1;         //led is off (1), at beginning  
-red=0;           //led is on (0), at beginning
+green=1;            //led is off (1), at beginning  
+blue=1;             //led is off (1), at beginning
+red=0;              //led is on (0),  at beginning
 
 //attach tickers to functions
 sample_timer.attach(&filter, Ts);                             //continously execute the EMG reader and filter, it ensures that filter and sampling is executed every 1/frequency seconds