Dan August
/
EMGtovelocity
nu met gains, threshold en eerst opvullen
Fork of EMGStdevV3 by
Revision 7:763117f8ef51, committed 2013-11-06
- Comitter:
- DanAuhust
- Date:
- Wed Nov 06 11:51:36 2013 +0000
- Parent:
- 6:33f0741dbb5b
- Commit message:
- EMG to velocity control: output tussen 0 en 1.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 33f0741dbb5b -r 763117f8ef51 main.cpp --- a/main.cpp Tue Nov 05 09:51:59 2013 +0000 +++ b/main.cpp Wed Nov 06 11:51:36 2013 +0000 @@ -10,7 +10,6 @@ Ticker timer; MODSERIAL pc(USBTX,USBRX,64,1024); -#define offset_biceps 0 // offset ruwe invoer met adapter motoren, waar toepassen? //high pass filter constantes 15Hz cutoff 4e orde, Fs = 312,5Hz (geeft een wat mooiere waarde voor periode en is geen veelvoud van 50Hz) #define NUM0 0.6731 // constante @@ -292,7 +291,7 @@ emg_value_biceps = 13; emg_value_biceps = 1.5 * emg_value_biceps; - if(emg_value_triceps < 5) + if(emg_value_triceps < 4.5) emg_value_triceps=0; else if (emg_value_triceps > 10) emg_value_triceps = 10; @@ -309,11 +308,14 @@ else if (emg_value_extensoren > 13) emg_value_extensoren = 13; - dy = emg_value_biceps - emg_value_triceps; - dx = (emg_value_flexoren - emg_value_extensoren); // was gain 2, wordt 1 + dy = (emg_value_biceps - emg_value_triceps) / 30 - .5; // output biceps en triceps tussen 0 en 15 + dx = (emg_value_flexoren - emg_value_extensoren) / 30 -.5; // nu dx en dy waarden tussen 1 en 0, net als de potmeters if(pc.rxBufferGetSize(0)-pc.rxBufferGetCount() > 30) - pc.printf("%.6f\n",dx); + pc.printf("%.6f, %.6f\n",dy,dx); + + + /**When not using the LED, the above could also have been done this way: * pc.printf("%.6\n", emg0.read()); */