Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: RoboClaw StepperMotor mbed
Fork of Robot2016_2-0 by
Revision 32:068bd2b2e1f3, committed 2016-01-26
- Comitter:
- Near32
- Date:
- Tue Jan 26 17:02:41 2016 +0000
- Parent:
- 31:8bcc3a0bfa8a
- Child:
- 33:e5500418b0e7
- Child:
- 34:7f8c29ddee61
- Commit message:
- odometry::update_odo : change made with required to the queries to roboclaw.
Changed in this revision
| Odometry/Odometry.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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;
