Robot's source code
Dependencies: mbed
Diff: Odometry/Odometry.cpp
- Revision:
- 57:ab13f4e7a2b2
- Parent:
- 48:cb3ebbc27db3
- Child:
- 63:fd9af0693e50
--- a/Odometry/Odometry.cpp Thu Apr 09 15:54:43 2015 +0000 +++ b/Odometry/Odometry.cpp Thu Apr 09 16:46:48 2015 +0000 @@ -35,6 +35,10 @@ offsetVx = 0.0; offsetVy = 0.0; + // Vitesse du moteur gauche et droit + m_vitLeft = 0; + m_vitRight = 0; + updater.attach(this, &Odometry::update, dt); } @@ -90,6 +94,9 @@ delta_right = m_qei_right->getPulses() - m_pulses_right; m_pulses_right = m_qei_right->getPulses(); + m_vitLeft = m_distPerTick_left*delta_left/dt; + m_vitLeft = m_distPerTick_right*delta_right/dt; + float deltaS = (m_distPerTick_left*delta_left + m_distPerTick_right*delta_right) / 2.0; float deltaTheta = (m_distPerTick_right*delta_right - m_distPerTick_left*delta_left) / m_v;