Robot's source code
Dependencies: mbed
Odometry/Odometry2.h@85:8e95432d99d3, 2015-04-18 (annotated)
- Committer:
- sype
- Date:
- Sat Apr 18 09:39:15 2015 +0000
- Revision:
- 85:8e95432d99d3
- Parent:
- 79:d97090bb6470
- Child:
- 94:5c37bcf73d14
Mise en place de l'asserv de l'ETAT 2
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 | |
sype | 85:8e95432d99d3 | 24 | float getDistLeft() {return m_distLeft;} |
sype | 85:8e95432d99d3 | 25 | float getDistRight() {return m_distRight;} |
sype | 85:8e95432d99d3 | 26 | |
sype | 85:8e95432d99d3 | 27 | void setDistLeft(float dist) {m_distLeft = dist;} |
sype | 85:8e95432d99d3 | 28 | void setDistRight(float dist) {m_distRight = dist;} |
sype | 85:8e95432d99d3 | 29 | |
Jagang | 71:95d76c181b22 | 30 | void update(float dt); |
sype | 85:8e95432d99d3 | 31 | |
sype | 85:8e95432d99d3 | 32 | int getPulsesLeft(void) {return m_pulses_left;} |
sype | 85:8e95432d99d3 | 33 | int getPulsesRight(void) {return m_pulses_right;} |
Jagang | 71:95d76c181b22 | 34 | |
Jagang | 71:95d76c181b22 | 35 | private: |
Jagang | 71:95d76c181b22 | 36 | QEI* m_qei_left; |
Jagang | 71:95d76c181b22 | 37 | int m_pulses_left; |
Jagang | 71:95d76c181b22 | 38 | QEI* m_qei_right; |
Jagang | 71:95d76c181b22 | 39 | int m_pulses_right; |
Jagang | 71:95d76c181b22 | 40 | |
Jagang | 71:95d76c181b22 | 41 | float x, y, theta; |
Jagang | 71:95d76c181b22 | 42 | float m_vitLeft, m_vitRight; |
sype | 85:8e95432d99d3 | 43 | float m_distLeft, m_distRight; |
Jagang | 71:95d76c181b22 | 44 | |
Jagang | 71:95d76c181b22 | 45 | float m_distPerTick_left, m_distPerTick_right, m_v; |
Jagang | 71:95d76c181b22 | 46 | }; |
Jagang | 71:95d76c181b22 | 47 | |
Jagang | 71:95d76c181b22 | 48 | #endif |