Robot's source code
Dependencies: mbed
Diff: Odometry/Odometry.cpp
- Revision:
- 63:fd9af0693e50
- Parent:
- 57:ab13f4e7a2b2
- Child:
- 71:95d76c181b22
--- a/Odometry/Odometry.cpp Thu Apr 09 17:05:06 2015 +0000 +++ b/Odometry/Odometry.cpp Thu Apr 09 17:32:36 2015 +0000 @@ -39,7 +39,7 @@ m_vitLeft = 0; m_vitRight = 0; - updater.attach(this, &Odometry::update, dt); + //updater.attach(this, &Odometry::update, dt); } void Odometry::setPos(float x, float y, float theta) @@ -87,7 +87,7 @@ initoffset = false; } -void Odometry::update() +void Odometry::update(float dt) { delta_left = m_qei_left->getPulses() - m_pulses_left; m_pulses_left = m_qei_left->getPulses(); @@ -95,7 +95,7 @@ m_pulses_right = m_qei_right->getPulses(); m_vitLeft = m_distPerTick_left*delta_left/dt; - m_vitLeft = m_distPerTick_right*delta_right/dt; + m_vitRight = 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;