Biorobotics / Robot-Software

Dependencies:   HIDScope MODSERIAL QEI biquadFilter mbed Servo

Revision:
19:e1e18746d98d
Parent:
6:8ff9566c91e2
Child:
20:31876566d70f
--- a/help_functions/kinematics.h	Fri Oct 26 10:54:16 2018 +0000
+++ b/help_functions/kinematics.h	Fri Oct 26 11:04:30 2018 +0000
@@ -1,15 +1,16 @@
 #include "mbed.h"
 
-double L1 = 0.5;
-double L2 = 0.7;
-double x01 = 0.0;
-double y01 = 0.2;
+double L_ua = 0.5;          //upper arm
+double L_la = 0.7;          //lower arm, attached to the end effector
+double x01 = 0.0;       
+double y01 = 0.2;           //height base joint
 
 void forwardkinematics_function(double q1, double q2) {
     // input are joint angles, output are x and y position of end effector
     
-    x = x01 - L1 * sin(q1) + L2 * cos(q1 + q2);
-    y = y01 + L1 * cos(q1) + L2 * sin(q1 + q2);    
+    double x = x01 + L_ua * cos(q1) - L_la * cos(q2);
+    double y = y01 + L_ua * sin(q1) - L_la * sin(q2);   
+     
 }
 
 double inversekinematics_function(double q1, double q2, double reference) {