Robot's source code

Dependencies:   mbed

Revision:
33:eab29f01e499
Child:
47:4909e97570f6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Odometry/Odometry.h	Tue Feb 03 18:47:02 2015 +0000
@@ -0,0 +1,46 @@
+#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 setVit(float Vx, float Vy, float W);
+        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();
+        
+        float getVx()   {return Vx;}
+        float getVy()   {return Vy;}
+        float getW()   {return W;}
+    
+    private:
+        QEI* m_qei_left;
+        int m_pulses_left;
+        QEI* m_qei_right;
+        int m_pulses_right;
+        
+        float x, y, theta;
+        float Vx,Vy,W;
+        float dt;
+        Timer timer;
+        
+        float m_distPerTick_left, m_distPerTick_right, m_v;
+        
+        Ticker updater;
+        
+        void update();
+};
+
+#endif