Robot's source code

Dependencies:   mbed

Revision:
89:d05001d85a02
Parent:
71:95d76c181b22
--- a/Odometry/Odometry.cpp	Sat Apr 18 08:40:24 2015 +0000
+++ b/Odometry/Odometry.cpp	Thu Apr 23 16:29:31 2015 +0000
@@ -19,8 +19,8 @@
     this->delta_right = 0;
     this->delta_left = 0;
     
-    m_distPerTick_left = radius_left/qei_left->getPulsesPerRev()*2*3.1415;
-    m_distPerTick_right = radius_right/qei_right->getPulsesPerRev()*2*3.1415;
+    m_distPerTick_left = ((float)radius_left)/((float)qei_left->getPulsesPerRev())*2.0f*3.1415f;
+    m_distPerTick_right = ((float)radius_right)/((float)qei_right->getPulsesPerRev())*2.0f*3.1415f;    
     m_v = v;
     
     m_pulses_left = qei_left->getPulses();
@@ -99,7 +99,7 @@
     m_vitLeft = m_distPerTick_left*delta_left/dt;
     m_vitRight = m_distPerTick_right*delta_right/dt;
     
-    float deltaS = (m_distPerTick_left*delta_left + m_distPerTick_right*delta_right) / 2.0;
+    float deltaS = (m_distPerTick_left*delta_left + m_distPerTick_right*delta_right) / 2.0f;
     float deltaTheta = (m_distPerTick_right*delta_right - m_distPerTick_left*delta_left) / m_v;
     
     float dx = deltaS*cos(theta);;