Carlo Collodi / kangaroo

Dependencies:   QEI mbed

Revision:
34:f3a1273e3361
Parent:
23:112c0be5a7f3
--- a/include/dynamics.hpp	Tue Nov 19 19:12:42 2013 +0000
+++ b/include/dynamics.hpp	Tue Nov 19 20:22:14 2013 +0000
@@ -16,7 +16,13 @@
         void start();
         void run();
         void stop();
-        void updatePose();
+        void updatePose() {
+        
+        // position of foot is (x,y)
+        
+        double theta1 = 2 * atan(sqrt( ( (l2+l3+l4)^2 - x^2 - y^2) / (x^2 + y^2 - (l2+l4-l3)^2) ));
+        double theta2 = atan2(y,x) - atan2(l3*sin(theta1), l2 + l4 + l3*cost(theta1));
+        }
 };
 
 #endif
\ No newline at end of file