Ramon Waninge / Mbed 2 deprecated Bioroboticsmerge

Dependencies:   MODSERIAL biquadFilter mbed

Fork of Kinematics by Eva Krolis

Revision:
6:59744dfe8ea7
Parent:
5:d78ed3a3e66a
Child:
7:b59b762c537e
diff -r d78ed3a3e66a -r 59744dfe8ea7 main.cpp
--- a/main.cpp	Mon Oct 29 15:46:20 2018 +0000
+++ b/main.cpp	Mon Oct 29 16:00:08 2018 +0000
@@ -25,10 +25,10 @@
 double xendsqrt2;
 double xend;
 //Now define the pos. eq. of y
-double yendsum = -le + ll/2*(sin(theta1)+sin(theta4));
-double yendsqrt1 = (-xbase/ll + cos(theta1)+cos(theta4))*sqrt(-xbase*xbase/4 + lu*lu + ll/2*(xbase*(cos(theta1)+cos(theta4))- ll*(1+cos(theta1+theta4)))); 
-double yendsqrt2 = sqrt(pow((-xbase/ll + cos(theta1)+ cos(theta4)),2)+ pow((sin(theta1)-sin(theta4)),2));
-double yend = (yendsum + yendsqrt1/yendsqrt2);
+double yendsum;
+double yendsqrt1;
+double yendsqrt2;
+double yend;
 
 
 //Hier definieren we de functies
@@ -39,7 +39,7 @@
 void xcor(){
     
     if (button1 == 0){                          //als emg1==voorbij treshold, 
-        theta1 = PI*(theta1/PI + 0.1);          //double theta1-> plus een paar counts (emg*richting)
+        theta1 = PI*(theta1/PI - 0.001);          //double theta1-> plus een paar counts (emg*richting)
                                                 //double theta4-> plus een paar counts (emg*richting)
     //default = als x = xbase/2... break, okee dit moet hier niet
     }
@@ -48,15 +48,20 @@
     xendsqrt1 = 2*sqrt(-xbase*xbase/4 + lu*lu + ll*(xbase*(cos(theta1)+cos(theta4))/2) -ll*(1+ cos(theta1+theta4)))*(-sin(theta1)+sin(theta4));
     xendsqrt2 = sqrt(pow((-xbase/ll+cos(theta1)+cos(theta4)),2)+ pow(sin(theta1) - sin(theta4),2));
     xend = (xendsum + xendsqrt1/xendsqrt2)/2;
+    
+    yendsum = -le + ll/2*(sin(theta1)+sin(theta4));
+    yendsqrt1 = (-xbase/ll + cos(theta1)+cos(theta4))*sqrt(-xbase*xbase/4 + lu*lu + ll/2*(xbase*(cos(theta1)+cos(theta4))- ll*(1+cos(theta1+theta4)))); 
+    yendsqrt2 = sqrt(pow((-xbase/ll + cos(theta1)+ cos(theta4)),2)+ pow((sin(theta1)-sin(theta4)),2));
+    yend = (yendsum + yendsqrt1/yendsqrt2);
 }
-void ycor(){
-    //als emg2 == voorbij treshold,
-    //double theta1 -> plus counts (emg*richting)
-    //double theta4 -> plus counts (emg*richting)
-    //reken y door
-    //default = als y = default... break
-    //end
-    }
+void ycor(){}
+                   //als emg2 == voorbij treshold,
+            //double theta1 -> plus counts (emg*richting)
+                    //double theta4 -> plus counts (emg*richting)
+                    //reken y door
+                    //default = als y = default... break
+                    //end
+    
 void flip(){}
 
 int main()