Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of get_angles by
Revision 2:e2af01393e16, committed 2015-10-16
- 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;
