Terrabots
/
Tracker2
Made distance public
Fork of Tracker by
Diff: Tracker.h
- Revision:
- 5:757a984ac553
- Parent:
- 0:8038ea3ee241
- Child:
- 6:50f337affc44
--- a/Tracker.h Thu Feb 09 19:57:37 2017 +0000 +++ b/Tracker.h Tue Feb 14 21:04:20 2017 +0000 @@ -1,9 +1,26 @@ +/** +* @file Tracker.h +* +* @brief Tracker class implements API for sensing the position of the +* dump truck. +* +* @author Terrabots Team +* +*/ + #ifndef TRACKER_H #define TRACKER_H #include "mbed.h" #include "QEI.h" +/** +* @class Tracker +* +* @brief Interface for tracking the position of a Dump Truck configured +* "robot." +*/ + #define STRAIGHT 0 #define CCW 1 #define CW 2 @@ -11,11 +28,37 @@ class Tracker { public: + /** + * Constructor for the Tracker object. + * + * @param[in] _chA The interrupt pin used for channel A + * @param[in] _chB The interrupt pin used for channel B + * @param[in] _pot The AnalogIn pin used for the potentiometer + */ Tracker(PinName _chA, PinName _chB, PinName _pot); + /** + * Set initial position and distance traveled to 0. + */ void clear(); + /** + * Set a reference "zero angle" for the potentiometer and wait five + * seconds for the user to set a turning angle. + */ void potSetup(); + /** + * Set a direction, either clockwise or counterclockwise, for the + * dump truck, based on the turning angle. + */ void setDirection(); + /** + * Check if the dump truck has moved before starting position-tracking + * calculations. + */ void checkToStart(); + /** + * Calculate the x and y position of the dump truck based on sensor + * measurements. + */ void calcDisplacement(); private: QEI *wheel;