official library and example code for tracking X and Y positions on the dump truck

Dependencies:   QEI mbed

Dependents:   DUMP_TRUCK_TEST_V1 DUMP_TRUCK_SPR2017

Revision:
0:8038ea3ee241
Child:
5:757a984ac553
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Tracker.h	Thu Jan 26 20:06:55 2017 +0000
@@ -0,0 +1,48 @@
+#ifndef TRACKER_H
+#define TRACKER_H
+
+#include "mbed.h"
+#include "QEI.h"
+
+#define STRAIGHT    0
+#define CCW         1
+#define CW          2
+#define PI          3.14159265
+
+class Tracker {
+    public:
+        Tracker(PinName _chA, PinName _chB, PinName _pot);
+        void clear();
+        void potSetup();
+        void setDirection();
+        void checkToStart();
+        void calcDisplacement();
+    private:
+        QEI *wheel;
+        PinName chA;
+        PinName chB;
+        AnalogIn pot;
+        float pulseCount;
+        float encoding;
+        float circumference;
+        float constant;
+
+        float distance;
+
+        float x;
+        float y;
+
+        float value;
+        float turnAngle;
+        float zeroAngle;
+
+        int dir;
+
+        float df;
+        float db;
+        float W;
+        float R;
+        float dispAngle;
+
+};
+#endif
\ No newline at end of file