pid gecomment
Dependencies: HIDScope MODSERIAL QEI biquadFilter mbed
Fork of a_pid_kal_end_def by
Diff: main.cpp
- Revision:
- 31:9333d3f48c88
- Parent:
- 30:a7bae1c036a3
- Child:
- 32:955f9f235981
- Child:
- 33:cd3b5168cc8f
- Child:
- 34:e788565f5d70
--- a/main.cpp Fri Oct 28 09:19:35 2016 +0000 +++ b/main.cpp Fri Oct 28 09:35:32 2016 +0000 @@ -132,8 +132,8 @@ //send signals to scope scope.set(0, emg_biceps_right); //set emg signal to scope in channel 0 // change into raw signal! scope.set(1, emg_triceps_right); // set emg signal to scope in channel 1// change into raw signal! - scope.set(2, emg_filtered_biceps_left); // set emg signal to scope in channel 2 - scope.set(3, onoffsignal_rightarm); // set emg signal to scope in channel 3 + scope.set(2, emg_filtered_triceps_right); // set emg signal to scope in channel 2 + scope.set(3, onoffsignal_rightarm); // set emg signal to scope in channel 3 scope.set(4, switch_signal_leftarm); scope.send(); //send all the signals to the scope @@ -166,7 +166,7 @@ void calibration_triceps(){ for(int n =0; n<2000;n++) //read for 2000 samples as calibration { - emg_biceps_right=emg_biceps_right_in.read(); //read the emg value from the elektrodes + emg_triceps_right=emg_triceps_right_in.read(); //read the emg value from the elektrodes double emg_filtered_high_triceps_right= filterhigh_b1.step(emg_triceps_right); double emg_filtered_high_notch_1_triceps_right=filternotch1_b1.step(emg_filtered_high_triceps_right); double emg_filtered_high_notch_1_2_triceps_right=filternotch2_b1.step(emg_filtered_high_notch_1_triceps_right); @@ -180,7 +180,7 @@ } wait(0.001f); //to sample at same freq; 1000Hz } - cut_off_value_triceps=percentage_max_triceps*max_triceps; + cut_off_value_triceps=-percentage_max_triceps*max_triceps; pc.printf(" change of cv triceps: %f ",cut_off_value_triceps ); } @@ -192,7 +192,7 @@ pc.baud(115200); sample_timer.attach(&filter, 0.001); //continously execute the EMG reader and filter, it ensures that filter and sampling is executed every 1/frequency seconds switch_function.attach(&SwitchN,0.01); -button_calibration_biceps.fall(&calibration_biceps); //to call calibration biceps, stop everything else +button_calibration_biceps.fall (&calibration_biceps); //to call calibration biceps, stop everything else button_calibration_triceps.fall(&calibration_triceps); //to call calibration triceps, stop everything else //endless loop