Robot secondaire

Dependencies:   RoboClaw mbed StepperMotor

Fork of RoboClaw by Simon Emarre

Committer:
sype
Date:
Mon Nov 16 11:32:44 2015 +0000
Revision:
0:ad9600df4a70
Child:
2:abdf8c6823a1
oklm;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sype 0:ad9600df4a70 1 #ifndef ODOMETRY_H
sype 0:ad9600df4a70 2 #define ODOMETRY_H
sype 0:ad9600df4a70 3
sype 0:ad9600df4a70 4 #include "mbed.h"
sype 0:ad9600df4a70 5 #include "RoboClaw.h"
sype 0:ad9600df4a70 6
sype 0:ad9600df4a70 7 #define PI 3.1415926535897932384626433832795
sype 0:ad9600df4a70 8
sype 0:ad9600df4a70 9 /*
sype 0:ad9600df4a70 10 * Author : Benjamin Bertelone, reworked by Simon Emarre
sype 0:ad9600df4a70 11 */
sype 0:ad9600df4a70 12
sype 0:ad9600df4a70 13 class Odometry
sype 0:ad9600df4a70 14 {
sype 0:ad9600df4a70 15 public:
sype 0:ad9600df4a70 16 Odometry(double diameter_right, double diameter_left, double v);
sype 0:ad9600df4a70 17
sype 0:ad9600df4a70 18 void setPos(double x, double y, double theta);
sype 0:ad9600df4a70 19 void setX(double x);
sype 0:ad9600df4a70 20 void setY(double y);
sype 0:ad9600df4a70 21 void setTheta(double theta);
sype 0:ad9600df4a70 22
sype 0:ad9600df4a70 23 void GotoXYT(double x, double y, double theta_goal);
sype 0:ad9600df4a70 24 void GotoThet(double theta_goal);
sype 0:ad9600df4a70 25
sype 0:ad9600df4a70 26 double getX() {return x;}
sype 0:ad9600df4a70 27 double getY() {return y;}
sype 0:ad9600df4a70 28 double getTheta() {return theta;} // ]-PI;PI]
sype 0:ad9600df4a70 29
sype 0:ad9600df4a70 30 double getVitLeft() {return m_vitLeft;}
sype 0:ad9600df4a70 31 double getVitRight() {return m_vitRight;}
sype 0:ad9600df4a70 32
sype 0:ad9600df4a70 33 double getDistLeft() {return m_distLeft;}
sype 0:ad9600df4a70 34 double getDistRight() {return m_distRight;}
sype 0:ad9600df4a70 35
sype 0:ad9600df4a70 36 void setDistLeft(double dist) {m_distLeft = dist;}
sype 0:ad9600df4a70 37 void setDistRight(double dist) {m_distRight = dist;}
sype 0:ad9600df4a70 38
sype 0:ad9600df4a70 39 void update_odo(void);
sype 0:ad9600df4a70 40 double calcul_distance(double x, double y, double theta_goal);
sype 0:ad9600df4a70 41
sype 0:ad9600df4a70 42 long getPulsesLeft(void) {return m_pulses_left;}
sype 0:ad9600df4a70 43 long getPulsesRight(void) {return m_pulses_right;}
sype 0:ad9600df4a70 44
sype 0:ad9600df4a70 45 private:
sype 0:ad9600df4a70 46
sype 0:ad9600df4a70 47 long m_pulses_left;
sype 0:ad9600df4a70 48 long m_pulses_right;
sype 0:ad9600df4a70 49
sype 0:ad9600df4a70 50 double x, y, theta;
sype 0:ad9600df4a70 51 double m_vitLeft, m_vitRight;
sype 0:ad9600df4a70 52 double m_distLeft, m_distRight;
sype 0:ad9600df4a70 53
sype 0:ad9600df4a70 54 double m_distPerTick_left, m_distPerTick_right, m_v;
sype 0:ad9600df4a70 55 };
sype 0:ad9600df4a70 56
sype 0:ad9600df4a70 57 #endif