Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@0:ff7b9471ae82, 2013-10-31 (annotated)
- Committer:
- Tess
- Date:
- Thu Oct 31 15:01:47 2013 +0000
- Revision:
- 0:ff7b9471ae82
Yeah doesn't work. inverse kinematics
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Tess | 0:ff7b9471ae82 | 1 | #include "mbed.h" |
Tess | 0:ff7b9471ae82 | 2 | #include "math.h" |
Tess | 0:ff7b9471ae82 | 3 | |
Tess | 0:ff7b9471ae82 | 4 | AnalogIn EMG1(PTB0); |
Tess | 0:ff7b9471ae82 | 5 | AnalogIn EMG2(PTB1); |
Tess | 0:ff7b9471ae82 | 6 | AnalogIn EMG3(PTB2); |
Tess | 0:ff7b9471ae82 | 7 | AnalogIn EMG4(PTB3); |
Tess | 0:ff7b9471ae82 | 8 | |
Tess | 0:ff7b9471ae82 | 9 | //float X_positiewaarde_waarheenwil; |
Tess | 0:ff7b9471ae82 | 10 | //float Y_positiewaarde_waarheenwil; |
Tess | 0:ff7b9471ae82 | 11 | //float phi_A; // motorhoek A in graden |
Tess | 0:ff7b9471ae82 | 12 | //float phi_B; // motorhoek B in graden |
Tess | 0:ff7b9471ae82 | 13 | float EMG_signaal_x; //ook wel x-dot, het verschil tussen flexoren en extensoren in onderarm |
Tess | 0:ff7b9471ae82 | 14 | float EMG_signaal_y; // ook wel y-dot, het verschil tussen biceps en triceps |
Tess | 0:ff7b9471ae82 | 15 | const float delta_t = 0.01; // tijd tussen twee meetpunten |
Tess | 0:ff7b9471ae82 | 16 | float X_positiewaarde_huidig; |
Tess | 0:ff7b9471ae82 | 17 | float Y_positiewaarde_huidig; |
Tess | 0:ff7b9471ae82 | 18 | float lengte_arm; |
Tess | 0:ff7b9471ae82 | 19 | |
Tess | 0:ff7b9471ae82 | 20 | |
Tess | 0:ff7b9471ae82 | 21 | X_positiewaarde_waarheenwil = EMG_signaal_x * delta_t + X_positiewaarde_huidig; |
Tess | 0:ff7b9471ae82 | 22 | Y_positiewaarde_waarheenwil = EMG_signaal_y * delta_t + Y_positiewaarde_huidig; |
Tess | 0:ff7b9471ae82 | 23 | |
Tess | 0:ff7b9471ae82 | 24 | phi_A = 180 - 1 / (cos(sqrt((X_positiewaarde_waarheenwil)^2 + (Y_positiewaarde_waarheenwil)^2)/(2 * lengte_arm^2)))) - 1 / tan(fabs(Y_positiewaarde_waarheenwil / X_positiewaarde_waarheenwil)); |
Tess | 0:ff7b9471ae82 | 25 | phi_B = 180 - 1 / (cos(sqrt((X_positiewaarde_waarheenwil)^2 + (Y_positiewaarde_waarheenwil)^2)/(2 * lengte_arm^2)))) - 1 / tan(Y_positiewaarde_waarheenwil / X_positiewaarde_waarheenwil) - 1/(cos(-(X_positiewaarde_waarheenwil^2 + Y_positiewaarde_waarheenwil^2)/(2*lengte_arm^2)+1)); |
Tess | 0:ff7b9471ae82 | 26 |