pid gecomment
Dependencies: HIDScope MODSERIAL QEI biquadFilter mbed
Fork of a_pid_kal_end_def by
Diff: main.cpp
- Revision:
- 22:eb8411807cca
- Parent:
- 21:9b8be3dff01a
- Child:
- 23:123d65f76236
- Child:
- 36:959f4719ab3a
--- a/main.cpp Tue Oct 25 13:06:23 2016 +0000 +++ b/main.cpp Tue Oct 25 13:40:55 2016 +0000 @@ -17,7 +17,7 @@ //other int onoffsignal_rightarm=0; // on/off signal: 1; biceps activation, 0: nothing, -1, triceps activation double cut_off_value_biceps =0.06; //gespecificeerd door floortje -double cut_off_value_triceps=-0.06; //gespecificeerd door floortje +double cut_off_value_triceps=-0.03; //gespecificeerd door floortje double signal_right_arm; //biceps arm 1, right arm @@ -37,30 +37,34 @@ double emg_filtered_high_notch_1_2_triceps_right; //before abs filtering -BiQuad filterhigh(9.5654e-01,-1.9131e+00,9.5654e-01,-1.9112e+00,9.1498e-01); -BiQuad filternotch1 (9.9115e-01, -1.8853e+00, 9.9115e-01 ,-1.8909e+00 , 9.9103e-01); -BiQuad filternotch2(1.0000e+00, -1.9022e+00, 1.0000e+00, -1.8965e+00 , 9.9127e-01); +BiQuad filterhigh_b1(9.5654e-01,-1.9131e+00,9.5654e-01,-1.9112e+00,9.1498e-01); +BiQuad filternotch1_b1 (9.9115e-01, -1.8853e+00, 9.9115e-01 ,-1.8909e+00 , 9.9103e-01); +BiQuad filternotch2_b1(1.0000e+00, -1.9022e+00, 1.0000e+00, -1.8965e+00 , 9.9127e-01); +BiQuad filterhigh_t1(9.5654e-01,-1.9131e+00,9.5654e-01,-1.9112e+00,9.1498e-01); +BiQuad filternotch1_t1 (9.9115e-01, -1.8853e+00, 9.9115e-01 ,-1.8909e+00 , 9.9103e-01); +BiQuad filternotch2_t1(1.0000e+00, -1.9022e+00, 1.0000e+00, -1.8965e+00 , 9.9127e-01); //after abs filtering -BiQuad filterlow (6.2942e-06, 1.2588e-05,6.2942e-06,-1.9929e+00,9.9292e-01); +BiQuad filterlow_b1 (6.2942e-06, 1.2588e-05,6.2942e-06,-1.9929e+00,9.9292e-01); +BiQuad filterlow_t1 (6.2942e-06, 1.2588e-05,6.2942e-06,-1.9929e+00,9.9292e-01); //functions which are called in ticker to sample the analog signal void filter(){ //biceps right arm read+filtering emg_biceps_right=emg_biceps_right_in.read(); //read the emg value from the elektrodes - emg_filtered_high_biceps_right= filterhigh.step(emg_biceps_right); - emg_filtered_high_notch_1_biceps_right=filternotch1.step(emg_filtered_high_biceps_right); - emg_filtered_high_notch_1_2_biceps_right=filternotch2.step(emg_filtered_high_notch_1_biceps_right); + emg_filtered_high_biceps_right= filterhigh_b1.step(emg_biceps_right); + emg_filtered_high_notch_1_biceps_right=filternotch1_b1.step(emg_filtered_high_biceps_right); + emg_filtered_high_notch_1_2_biceps_right=filternotch2_b1.step(emg_filtered_high_notch_1_biceps_right); emg_abs_biceps_right=fabs(emg_filtered_high_notch_1_2_biceps_right); //fabs because float - emg_filtered_biceps_right=filterlow.step(emg_abs_biceps_right); + emg_filtered_biceps_right=filterlow_b1.step(emg_abs_biceps_right); //triceps right arm read+filtering emg_triceps_right=emg_triceps_right_in.read(); //read the emg value from the elektrodes - emg_filtered_high_triceps_right= filterhigh.step(emg_triceps_right); - emg_filtered_high_notch_1_triceps_right=filternotch1.step(emg_filtered_high_triceps_right); - emg_filtered_high_notch_1_2_triceps_right=filternotch2.step(emg_filtered_high_notch_1_triceps_right); + emg_filtered_high_triceps_right= filterhigh_t1.step(emg_triceps_right); + emg_filtered_high_notch_1_triceps_right=filternotch1_t1.step(emg_filtered_high_triceps_right); + emg_filtered_high_notch_1_2_triceps_right=filternotch2_t1.step(emg_filtered_high_notch_1_triceps_right); emg_abs_triceps_right=fabs(emg_filtered_high_notch_1_2_triceps_right); //fabs because float - emg_filtered_triceps_right=filterlow.step(emg_abs_triceps_right); + emg_filtered_triceps_right=filterlow_t1.step(emg_abs_triceps_right); //signal substraction of filter biceps and triceps. Biceps +,triceps - signal_right_arm=emg_filtered_biceps_right-emg_filtered_triceps_right;