Carlo Collodi / kangaroo

Dependencies:   QEI mbed

Committer:
Sparker
Date:
Tue Nov 19 20:22:14 2013 +0000
Revision:
34:f3a1273e3361
Parent:
23:112c0be5a7f3
includes equation for inverse kinematics;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
calamaridudeman 22:4d85d989af08 1 #include "mbed.h"
calamaridudeman 22:4d85d989af08 2
calamaridudeman 22:4d85d989af08 3 #ifndef DYNAMICS_HPP
calamaridudeman 22:4d85d989af08 4 #define DYNAMICS_HPP
calamaridudeman 22:4d85d989af08 5
calamaridudeman 22:4d85d989af08 6 #define l1 1 //gantry point to hip joint
calamaridudeman 22:4d85d989af08 7 #define l2 1 //hip length
calamaridudeman 22:4d85d989af08 8 #define l3 1 //leg length
calamaridudeman 22:4d85d989af08 9 #define l4 1 //foot length
calamaridudeman 16:c21df8c0c458 10
calamaridudeman 22:4d85d989af08 11 class Kangaroo {
calamaridudeman 22:4d85d989af08 12
calamaridudeman 22:4d85d989af08 13 public:
calamaridudeman 22:4d85d989af08 14 Kangaroo();
calamaridudeman 22:4d85d989af08 15 void zero();
calamaridudeman 22:4d85d989af08 16 void start();
calamaridudeman 22:4d85d989af08 17 void run();
calamaridudeman 22:4d85d989af08 18 void stop();
Sparker 34:f3a1273e3361 19 void updatePose() {
Sparker 34:f3a1273e3361 20
Sparker 34:f3a1273e3361 21 // position of foot is (x,y)
Sparker 34:f3a1273e3361 22
Sparker 34:f3a1273e3361 23 double theta1 = 2 * atan(sqrt( ( (l2+l3+l4)^2 - x^2 - y^2) / (x^2 + y^2 - (l2+l4-l3)^2) ));
Sparker 34:f3a1273e3361 24 double theta2 = atan2(y,x) - atan2(l3*sin(theta1), l2 + l4 + l3*cost(theta1));
Sparker 34:f3a1273e3361 25 }
calamaridudeman 22:4d85d989af08 26 };
calamaridudeman 22:4d85d989af08 27
calamaridudeman 22:4d85d989af08 28 #endif