Robot's source code
Dependencies: mbed
Odometry/Odometry2.h@79:d97090bb6470, 2015-04-14 (annotated)
- Committer:
- sype
- Date:
- Tue Apr 14 18:27:53 2015 +0000
- Revision:
- 79:d97090bb6470
- Parent:
- 72:b2a128486332
- Child:
- 85:8e95432d99d3
PID posey
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jagang | 71:95d76c181b22 | 1 | #ifndef ODOMETRY2_H |
Jagang | 71:95d76c181b22 | 2 | #define ODOMETRY2_H |
Jagang | 71:95d76c181b22 | 3 | |
Jagang | 71:95d76c181b22 | 4 | #include "mbed.h" |
Jagang | 71:95d76c181b22 | 5 | #include "QEI.h" |
Jagang | 71:95d76c181b22 | 6 | |
Jagang | 71:95d76c181b22 | 7 | class Odometry2 |
Jagang | 71:95d76c181b22 | 8 | { |
Jagang | 71:95d76c181b22 | 9 | public: |
Jagang | 71:95d76c181b22 | 10 | Odometry2(QEI *qei_left, QEI *qei_right, float radius_left, float radius_right, float v); |
Jagang | 71:95d76c181b22 | 11 | |
Jagang | 71:95d76c181b22 | 12 | void setPos(float x, float y, float theta); |
Jagang | 71:95d76c181b22 | 13 | void setX(float x); |
sype | 79:d97090bb6470 | 14 | void setY(float y); |
Jagang | 71:95d76c181b22 | 15 | void setTheta(float theta); |
Jagang | 71:95d76c181b22 | 16 | |
Jagang | 71:95d76c181b22 | 17 | float getX() {return x;} |
Jagang | 71:95d76c181b22 | 18 | float getY() {return y;} |
Jagang | 72:b2a128486332 | 19 | float getTheta() {return theta;} // ]-PI;PI] |
Jagang | 71:95d76c181b22 | 20 | |
Jagang | 71:95d76c181b22 | 21 | float getVitLeft() {return m_vitLeft;} |
Jagang | 71:95d76c181b22 | 22 | float getVitRight() {return m_vitRight;} |
Jagang | 71:95d76c181b22 | 23 | |
Jagang | 71:95d76c181b22 | 24 | void update(float dt); |
Jagang | 71:95d76c181b22 | 25 | |
Jagang | 71:95d76c181b22 | 26 | private: |
Jagang | 71:95d76c181b22 | 27 | QEI* m_qei_left; |
Jagang | 71:95d76c181b22 | 28 | int m_pulses_left; |
Jagang | 71:95d76c181b22 | 29 | QEI* m_qei_right; |
Jagang | 71:95d76c181b22 | 30 | int m_pulses_right; |
Jagang | 71:95d76c181b22 | 31 | |
Jagang | 71:95d76c181b22 | 32 | float x, y, theta; |
Jagang | 71:95d76c181b22 | 33 | float m_vitLeft, m_vitRight; |
Jagang | 71:95d76c181b22 | 34 | |
Jagang | 71:95d76c181b22 | 35 | float m_distPerTick_left, m_distPerTick_right, m_v; |
Jagang | 71:95d76c181b22 | 36 | }; |
Jagang | 71:95d76c181b22 | 37 | |
Jagang | 71:95d76c181b22 | 38 | #endif |