coucou

Dependencies:   RoboClaw mbed

Fork of Robot2016_2-0 by ARES

Revision:
32:068bd2b2e1f3
Parent:
31:8bcc3a0bfa8a
Child:
33:e5500418b0e7
Child:
34:7f8c29ddee61
diff -r 8bcc3a0bfa8a -r 068bd2b2e1f3 Odometry/Odometry.cpp
--- a/Odometry/Odometry.cpp	Tue Jan 26 16:39:43 2016 +0000
+++ b/Odometry/Odometry.cpp	Tue Jan 26 17:02:41 2016 +0000
@@ -48,10 +48,12 @@
 
 void Odometry::update_odo(void)
 {
-    int32_t delta_right = roboclaw.ReadEncM1(ADR) - m_pulses_right;
-    m_pulses_right = roboclaw.ReadEncM1(ADR);
-    int32_t delta_left = roboclaw.ReadEncM2(ADR) - m_pulses_left;
-    m_pulses_left = roboclaw.ReadEncM2(ADR);
+    int32_t roboclawENCM1 = roboclaw.ReadEncM1(ADR); 
+    int32_t roboclawENCM2 = roboclaw.ReadEncM2(ADR); 
+    int32_t delta_right = roboclawENCM1 - m_pulses_right;
+    m_pulses_right = roboclawENCM1;
+    int32_t delta_left = roboclawENCM2 - m_pulses_left;
+    m_pulses_left = roboclawENCM2;
     
     double deltaS = (m_distPerTick_left*delta_left + m_distPerTick_right*delta_right)*C / 2.0f;
     double deltaTheta = (m_distPerTick_left*delta_left - m_distPerTick_right*delta_right)*C / m_v;