Robot's source code
Dependencies: mbed
Diff: Odometry/Odometry.h
- Revision:
- 0:41149573d577
- Child:
- 1:c8dc3dee3b70
- Child:
- 30:33e970ba1fe5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Odometry/Odometry.h Sun Sep 28 19:53:31 2014 +0000 @@ -0,0 +1,38 @@ +#ifndef ODOMETRY_H +#define ODOMETRY_H + +#include "mbed.h" +#include "QEI.h" + +class Odometry +{ + public: + Odometry(QEI *qei_left, QEI *qei_right, float radius_left, float radius_right, float v); + + void setPos(float x, float y, float theta); + void setX(float x); + void setY(float Y); + void setTheta(float theta); + + float getX() {return x;} + float getY() {return y;} + float getTheta() {return theta;} + + void reset(); + + private: + QEI* m_qei_left; + int m_pulses_left; + QEI* m_qei_right; + int m_pulses_right; + + float x, y, theta; + + float m_radiusPerTick_left, m_radiusPerTick_right, m_v; + + Ticker updater; + + void update(); +}; + +#endif