Robot secondaire
Dependencies: RoboClaw mbed StepperMotor
Fork of RoboClaw by
Diff: Odometry/Odometry.h
- Revision:
- 0:ad9600df4a70
- Child:
- 2:abdf8c6823a1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Odometry/Odometry.h Mon Nov 16 11:32:44 2015 +0000 @@ -0,0 +1,57 @@ +#ifndef ODOMETRY_H +#define ODOMETRY_H + +#include "mbed.h" +#include "RoboClaw.h" + +#define PI 3.1415926535897932384626433832795 + +/* +* Author : Benjamin Bertelone, reworked by Simon Emarre +*/ + +class Odometry +{ + public: + Odometry(double diameter_right, double diameter_left, double v); + + void setPos(double x, double y, double theta); + void setX(double x); + void setY(double y); + void setTheta(double theta); + + void GotoXYT(double x, double y, double theta_goal); + void GotoThet(double theta_goal); + + double getX() {return x;} + double getY() {return y;} + double getTheta() {return theta;} // ]-PI;PI] + + double getVitLeft() {return m_vitLeft;} + double getVitRight() {return m_vitRight;} + + double getDistLeft() {return m_distLeft;} + double getDistRight() {return m_distRight;} + + void setDistLeft(double dist) {m_distLeft = dist;} + void setDistRight(double dist) {m_distRight = dist;} + + void update_odo(void); + double calcul_distance(double x, double y, double theta_goal); + + long getPulsesLeft(void) {return m_pulses_left;} + long getPulsesRight(void) {return m_pulses_right;} + + private: + + long m_pulses_left; + long m_pulses_right; + + double x, y, theta; + double m_vitLeft, m_vitRight; + double m_distLeft, m_distRight; + + double m_distPerTick_left, m_distPerTick_right, m_v; +}; + +#endif