Carlo Collodi / kangaroo

Dependencies:   QEI mbed

Committer:
calamaridudeman
Date:
Tue Nov 26 21:26:44 2013 +0000
Revision:
43:68faf056ed5c
Parent:
39:b765b6dd01c3
Child:
46:4497e945de6b
trying to get setTorque to work

Who changed what in which revision?

UserRevisionLine numberNew contents of line
calamaridudeman 21:a9569c7b4379 1 #include "mbed.h"
calamaridudeman 23:112c0be5a7f3 2 #include "include/dynamics.hpp"
calamaridudeman 16:c21df8c0c458 3
calamaridudeman 37:bf257a0154db 4
calamaridudeman 37:bf257a0154db 5 Joints invKinBody(Point &in){
calamaridudeman 37:bf257a0154db 6 float x=in.x;
calamaridudeman 37:bf257a0154db 7 float y=in.y;
calamaridudeman 43:68faf056ed5c 8 //float theta1 = (float) 2 * atan(sqrt( ( (l2+l3+l4)*(l2+l3+l4) - x*x - y*y) / (x*x + y*y - (l2+l4-l3)*(l2+l4-l3)) ));
calamaridudeman 43:68faf056ed5c 9 //float theta2 = (float) atan2(y,x) - atan2(l3*sin(theta1), l2 + l4 + l3*cos(theta1));
calamaridudeman 43:68faf056ed5c 10 float theta2 = -3.14159+((float) acos((x*x+y*y-(l2+l4)*(l2+l4)-l3*l3)/(2*(l2+l4)*l3)))+3.1415/8;
calamaridudeman 43:68faf056ed5c 11 float theta1 = -atan2(y,x)-acos((l3*l3-x*x-y*y-(l2+l4)*(l2+l4))/(2*(l2+l4)*sqrt(x*x+y*y)));
calamaridudeman 37:bf257a0154db 12 return Joints(theta1, theta2);
sherryxy 39:b765b6dd01c3 13 }
sherryxy 39:b765b6dd01c3 14