official library and example code for tracking X and Y positions on the dump truck
Dependents: DUMP_TRUCK_TEST_V1 DUMP_TRUCK_SPR2017
Diff: Tracker.h
- Revision:
- 0:8038ea3ee241
- Child:
- 5:757a984ac553
diff -r 000000000000 -r 8038ea3ee241 Tracker.h --- /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