marijn peters / Mbed 2 deprecated test_HIDScope

Dependencies:   HIDScope mbed

Fork of get_angles by marijn peters

Files at this revision

API Documentation at this revision

Comitter:
marijnstudent
Date:
Fri Oct 16 08:56:32 2015 +0000
Parent:
1:a93b870d3cf8
Commit message:
zat een foutje in de formule

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r a93b870d3cf8 -r e2af01393e16 main.cpp
--- a/main.cpp	Wed Oct 14 13:43:01 2015 +0000
+++ b/main.cpp	Fri Oct 16 08:56:32 2015 +0000
@@ -9,7 +9,8 @@
 
 const double L = 36;
 const double pi = 3.1415926535897;
-
+double theta1;
+double theta2;
 
 // functies die de hoeken berekend
 void getangles(double &theta_one,double &theta_two) // xy inputs
@@ -17,7 +18,7 @@
     double x = 60+ 20*potleft.read();
     double y = 40+40*potright.read();
     double r = sqrt(pow(L,2)+pow(L,2)); // vector naar end effector
-    double alfa = acos((2*pow(L,2))/(4*L)); // alfa is de hoek tussen upper en lower arm
+    double alfa = acos((2*pow(L,2)-pow(r,2))/(4*L)); // alfa is de hoek tussen upper en lower arm
     double beta = acos((pow(r,2))/(2*L*r)); // beta is de hoek tussen upper arm en r
     // hoeken berekenen
     theta_one = atan2(y,x)+beta;