Dependencies: HIDScope MODSERIAL QEI biquadFilter mbed
Fork of Robot-Software by
help_functions/kinematics.h@5:0dd66c757f24, 2018-10-22 (annotated)
- Committer:
- SvenD97
- Date:
- Mon Oct 22 19:12:42 2018 +0000
- Revision:
- 5:0dd66c757f24
- Parent:
- 4:88d28354e023
- Child:
- 6:8ff9566c91e2
In the main file, i made the position (x,y) of the end effector global. I removed the previous commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MaikOvermars | 0:4cb1de41d049 | 1 | #include "mbed.h" |
MaikOvermars | 0:4cb1de41d049 | 2 | |
MaikOvermars | 0:4cb1de41d049 | 3 | double L1 = 0.5; |
MaikOvermars | 0:4cb1de41d049 | 4 | double L2 = 0.7; |
MaikOvermars | 0:4cb1de41d049 | 5 | double x01 = 0.0; |
MaikOvermars | 0:4cb1de41d049 | 6 | double y01 = 0.2; |
MaikOvermars | 0:4cb1de41d049 | 7 | |
SvenD97 | 3:40e0e9404f82 | 8 | double forwardkinematics_function(double q1, double q2) { |
MaikOvermars | 0:4cb1de41d049 | 9 | // input are joint angles, output are x and y position of end effector |
MaikOvermars | 0:4cb1de41d049 | 10 | |
SvenD97 | 5:0dd66c757f24 | 11 | double x; // WE SHOULD MAKE x and y global. Discuss this!! |
SvenD97 | 4:88d28354e023 | 12 | double y; |
SvenD97 | 4:88d28354e023 | 13 | |
MaikOvermars | 0:4cb1de41d049 | 14 | x = x01 - L1 * sin(q1) + L2 * cos(q1 + q2); |
MaikOvermars | 0:4cb1de41d049 | 15 | y = y01 + L1 * cos(q1) + L2 * sin(q1 + q2); |
MaikOvermars | 0:4cb1de41d049 | 16 | return x; |
MaikOvermars | 0:4cb1de41d049 | 17 | } |
MaikOvermars | 0:4cb1de41d049 | 18 | |
SvenD97 | 3:40e0e9404f82 | 19 | double inversekinematics_function(double q1, double q2, double reference) { |
MaikOvermars | 0:4cb1de41d049 | 20 | // pseudo inverse jacobian to get joint speeds |
MaikOvermars | 0:4cb1de41d049 | 21 | // input are desired vx and vy of end effector, output joint angle speeds |
MaikOvermars | 0:4cb1de41d049 | 22 | |
MaikOvermars | 0:4cb1de41d049 | 23 | return 5.5; |
MaikOvermars | 0:4cb1de41d049 | 24 | } |