Robot secondaire

Dependencies:   RoboClaw mbed StepperMotor

Fork of RoboClaw by Simon Emarre

Revision:
33:7f8c29ddee61
Parent:
32:068bd2b2e1f3
Child:
35:4e3d9ab1b94b
diff -r 068bd2b2e1f3 -r 7f8c29ddee61 Odometry/Odometry.cpp
--- a/Odometry/Odometry.cpp	Tue Jan 26 17:02:41 2016 +0000
+++ b/Odometry/Odometry.cpp	Tue Jan 26 17:14:54 2016 +0000
@@ -73,15 +73,18 @@
         x = xO + R*sin(theta);
         y = yO - R*cos(theta);
     }*/
-
-    double dx = deltaS*cos(theta);
-    double dy = deltaS*sin(theta);
+    theta += deltaTheta;
+    while(theta > PI) theta -= 2*PI;
+    while(theta <= -PI) theta += 2*PI;
+    
+    
+    double dx = deltaS*cos(theta-deltaTheta/2);
+    double dy = deltaS*sin(theta-deltaTheta/2);
     x += dx;
     y += dy;
-    theta += deltaTheta;
+    
 
-    while(theta > PI) theta -= 2*PI;
-    while(theta <= -PI) theta += 2*PI;
+    
 }
 
 void Odometry::GotoXY(double x_goal, double y_goal)