This file looks large and may slow your browser down if we attempt
to syntax highlight it, so we are showing it without any
pretty colors.
Highlight
it anyway.
| 1 |
#ifndef DRIVEROBOT_H |
| 2 |
#define DRIVEROBOT_H |
| 3 |
|
| 4 |
#include <libirobot/Robot.h> |
| 5 |
#include <libirobot/Drive.h> |
| 6 |
|
| 7 |
using namespace iRobot; |
| 8 |
|
| 9 |
/** |
| 10 |
* A robot that plays music, blinks lights, navigates a room, and docks when it |
| 11 |
* gets a chance. |
| 12 |
*/ |
| 13 |
class DriveRobot : public Robot |
| 14 |
{ |
| 15 |
public: |
| 16 |
typedef enum { |
| 17 |
Left, |
| 18 |
Right, |
| 19 |
Center |
| 20 |
} Side; |
| 21 |
DriveRobot ( const char ttyDevice[] ); |
| 22 |
void loop(); |
| 23 |
void disconnected(); |
| 24 |
|
| 25 |
Side cliffSide(); |
| 26 |
|
| 27 |
/** |
| 28 |
* Avoids whatever it bumped into or the cliff it almost fell off. |
| 29 |
*/ |
| 30 |
void avoid(); |
| 31 |
|
| 32 |
/** |
| 33 |
* Handles the home base docking logic |
| 34 |
*/ |
| 35 |
void dock(); |
| 36 |
|
| 37 |
/** |
| 38 |
* Determines if the robot has reached a cliff it probably doesn't want |
| 39 |
* to fall off of |
| 40 |
*/ |
| 41 |
bool reachedCliff(); |
| 42 |
bool fellOffCliff(); |
| 43 |
bool bumped(); |
| 44 |
bool bumpedLeft(); |
| 45 |
bool bumpedRight(); |
| 46 |
private: |
| 47 |
int m_speed; |
| 48 |
uint8_t m_powerColor; |
| 49 |
Drive::TurnDirection m_lastDir; |
| 50 |
bool m_tryingToDock; |
| 51 |
int m_dockTimeout; |
| 52 |
bool m_dockAttempted; |
| 53 |
}; |
| 54 |
|
| 55 |
#endif |