aangepaste PID waarden, waarden robert gedeeld door 5
Dependencies: HIDScope MODSERIAL QEI biquadFilter mbed
Fork of Motor_EMG_FinalV1 by
Diff: main.cpp
- Revision:
- 7:111e13da9bc0
- Parent:
- 6:d1d747050fcc
- Child:
- 8:86a13efe98c8
--- a/main.cpp Tue Oct 27 11:47:32 2015 +0000 +++ b/main.cpp Wed Oct 28 11:02:42 2015 +0000 @@ -261,7 +261,7 @@ wait(0.2); LedG.write(0); wait(2); - Threshold1 = 0.8*EMG_left_MAF; + Threshold1 = 0.5*EMG_left_MAF; Threshold2 = 0.2*EMG_left_MAF; LedG.write(1); LedR.write(0); @@ -281,7 +281,7 @@ wait(0.2); LedB.write(0); wait(2); - Threshold3 = 0.8*EMG_right_MAF; + Threshold3 = 0.5*EMG_right_MAF; Threshold4 = 0.2*EMG_right_MAF; LedB.write(1); pc.printf("T1 = %f, T2 = %f, T3 = %f, T4 = %f\n", Threshold1, Threshold2, Threshold3, Threshold4); @@ -349,17 +349,39 @@ { LedG = LedB = 1; LedR = 0; - if ((EMG_right_MAF <= Threshold3) && (EMG_left_MAF >= Threshold1)) // if(c == 't') // + //Linker grenzen + if ((EMG_right_MAF <= Threshold3) && (EMG_left_MAF >= Threshold1) && (m2_ref > 0)) // if(c == 't') // { m1_ref = m1_ref + Stapgrootte; - if (m1_ref > Grens1) + if (m1_ref > -1*m2_ref + 80 ) { - m1_ref = Grens1; + m1_ref = -1*m2_ref + 80; } wait(0.05); } - if ((EMG_left_MAF < Threshold1) && (EMG_right_MAF > Threshold3)) //if(c == 'g') // + if ((EMG_left_MAF < Threshold1) && (EMG_right_MAF > Threshold3) && (m2_ref > 0)) //if(c == 'g') // + { + m1_ref = m1_ref - Stapgrootte; + + if (m1_ref < -1*Grens1) + { + m1_ref = -1*Grens1; + } + wait(0.05); + } + //Rechter grenzen + if ((EMG_right_MAF <= Threshold3) && (EMG_left_MAF >= Threshold1) && (m2_ref <= 0)) // if(c == 't') // + { + m1_ref = m1_ref + Stapgrootte; + + if (m1_ref > -1*m2_ref - 80 ) + { + m1_ref = -1*m2_ref - 80; + } + wait(0.05); + } + if ((EMG_left_MAF < Threshold1) && (EMG_right_MAF > Threshold3) && (m2_ref <= 0)) //if(c == 'g') // { m1_ref = m1_ref - Stapgrootte;