Facilitates communication with the iRobot (R) Create (TM) More...
#include <create.hpp>
Public Types | |
enum | Mode { OffMode, PassiveMode, SafeMode, FullMode } |
enum | BaudRate { Baud57600 = 0, Baud115200 = 1 } |
Public Member Functions | |
~Create () | |
bool | connect () |
bool | connect (const BaudRate baudRate) |
bool | disconnect () |
bool | isConnected () const |
void | setOffMode () |
void | setPassiveMode () |
void | setSafeMode () |
void | setFullMode () |
void | setMode (const Create::Mode &mode) |
Create::Mode | mode () |
void | send (const CreateScript &script) |
bool | write (const unsigned char &c) |
bool | write (const unsigned char *data, const size_t &len) |
void | flush () |
short | read () |
int | read (unsigned char *data, const size_t &len) |
bool | blockingRead (unsigned char *data, const size_t &size, unsigned timeout=25) |
template<typename T > | |
bool | blockingRead (T &data, unsigned timeout=0) |
void | setLeds (const bool &advance, const bool &play, const unsigned char &color, const unsigned char &brightness) |
void | drive (const short &velocity, const short &radius) |
void | driveDirect (const short &left, const short &right) |
void | driveStraight (const short &speed) |
void | stop () |
void | turn (const short &angle, const unsigned short &speed) |
void | move (const short &millimeters, const unsigned short &speed) |
void | spin (const short &speed) |
short | angularVelocity () const |
void | spinClockwise (const short &speed) |
void | spinCounterClockwise (const short &speed) |
bool | setBaudRate (const unsigned char &baudCode) |
void | setDistance (const int distance) |
void | setAngle (const int angle) |
AbstractButton * | playButton () const |
AbstractButton * | advanceButton () const |
Sensor< bool > * | wall () const |
Sensor< bool > * | cliffLeft () const |
Sensor< bool > * | cliffFrontLeft () const |
Sensor< bool > * | cliffFrontRight () const |
Sensor< bool > * | cliffRight () const |
Sensor< bool > * | virtualWall () const |
Sensor< unsigned short > * | wallSignal () const |
Sensor< unsigned short > * | cliffLeftSignal () const |
Sensor< unsigned short > * | cliffFrontLeftSignal () const |
Sensor< unsigned short > * | cliffFrontRightSignal () const |
Sensor< unsigned short > * | cliffRightSignal () const |
Sensor< unsigned short > * | cargoBayAnalogSignal () const |
Sensor< unsigned char > * | cargoBayDigitalInputs () const |
Sensor< unsigned char > * | ir () const |
Sensor< unsigned char > * | chargingState () const |
Sensor< char > * | batteryTemperature () const |
Sensor< unsigned short > * | batteryCharge () const |
Sensor< unsigned short > * | batteryCapacity () const |
Sensor< int > * | angle () const |
Sensor< int > * | distance () const |
Sensor< bool > * | bumpLeft () const |
Sensor< bool > * | bumpRight () const |
Sensor< bool > * | wheelDropLeft () const |
Sensor< bool > * | wheelDropRight () const |
Sensor< bool > * | wheelDropCaster () const |
Sensor< bool > * | lightBumpLeft () const |
Sensor< bool > * | lightBumpFrontLeft () const |
Sensor< bool > * | lightBumpCenterLeft () const |
Sensor< bool > * | lightBumpCenterRight () const |
Sensor< bool > * | lightBumpFrontRight () const |
Sensor< bool > * | lightBumpRight () const |
Sensor< unsigned short > * | lightBumpLeftSignal () const |
Sensor< unsigned short > * | lightBumpFrontLeftSignal () const |
Sensor< unsigned short > * | lightBumpCenterLeftSignal () const |
Sensor< unsigned short > * | lightBumpCenterRightSignal () const |
Sensor< unsigned short > * | lightBumpFrontRightSignal () const |
Sensor< unsigned short > * | lightBumpRightSignal () const |
void | setRefreshRate (const unsigned short &refreshRate) |
const unsigned short & | refreshRate () const |
const CreateState * | state () |
const CreatePackets::_1 * | sensorPacket1 () |
const CreatePackets::_2 * | sensorPacket2 () |
const CreatePackets::_3 * | sensorPacket3 () |
const CreatePackets::_4 * | sensorPacket4 () |
const CreatePackets::_5 * | sensorPacket5 () |
const CreatePackets::_101 * | sensorPacket101 () |
void | beginAtomicOperation () |
void | endAtomicOperation () |
void | setDefaultBaudRate (const BaudRate defaultBaudRate) |
BaudRate | defaultBaudRate () const |
Static Public Member Functions | |
static Create * | instance () |
Facilitates communication with the iRobot (R) Create (TM)
Provides high level bindings for a significant majority of the iRobot Open Interface specification.
enum Create::BaudRate |
enum Create::Mode |
The "Mode" of the create.
Enumerator | |
---|---|
OffMode | |
PassiveMode | |
SafeMode | |
FullMode |
Create::~Create | ( | ) |
AbstractButton* Create::advanceButton | ( | ) | const |
Sensor<int>* Create::angle | ( | ) | const |
short Create::angularVelocity | ( | ) | const |
Returns the current angular velocity of the create. This value is positive for counter-clockwise velocity and negative for clockwise velocity.
Sensor<unsigned short>* Create::batteryCapacity | ( | ) | const |
Sensor<unsigned short>* Create::batteryCharge | ( | ) | const |
Sensor<char>* Create::batteryTemperature | ( | ) | const |
|
inline |
bool Create::blockingRead | ( | unsigned char * | data, |
const size_t & | size, | ||
unsigned | timeout = 25 |
||
) |
Reads until the specified number of bytes have been read.
data | Pointer to the buffer to read into |
size | Number of bytes to be read |
|
inline |
Sensor<bool>* Create::bumpLeft | ( | ) | const |
Sensor<bool>* Create::bumpRight | ( | ) | const |
Sensor<unsigned short>* Create::cargoBayAnalogSignal | ( | ) | const |
Sensor<unsigned char>* Create::cargoBayDigitalInputs | ( | ) | const |
Sensor<unsigned char>* Create::chargingState | ( | ) | const |
Sensor<bool>* Create::cliffFrontLeft | ( | ) | const |
Sensor<unsigned short>* Create::cliffFrontLeftSignal | ( | ) | const |
Sensor<bool>* Create::cliffFrontRight | ( | ) | const |
Sensor<unsigned short>* Create::cliffFrontRightSignal | ( | ) | const |
Sensor<bool>* Create::cliffLeft | ( | ) | const |
Sensor<unsigned short>* Create::cliffLeftSignal | ( | ) | const |
Sensor<bool>* Create::cliffRight | ( | ) | const |
Sensor<unsigned short>* Create::cliffRightSignal | ( | ) | const |
bool Create::connect | ( | ) |
Attempts to establish a connection to the create
bool Create::connect | ( | const BaudRate | baudRate | ) |
Attempts to establish a connection to the create
baudRate | The desired communication speed with the Create 1 or 2 |
|
inline |
bool Create::disconnect | ( | ) |
Cleans up connection to the create
Sensor<int>* Create::distance | ( | ) | const |
void Create::drive | ( | const short & | velocity, |
const short & | radius | ||
) |
void Create::driveDirect | ( | const short & | left, |
const short & | right | ||
) |
void Create::driveStraight | ( | const short & | speed | ) |
|
inline |
void Create::flush | ( | ) |
|
static |
Sensor<unsigned char>* Create::ir | ( | ) | const |
bool Create::isConnected | ( | ) | const |
Sensor<bool>* Create::lightBumpCenterLeft | ( | ) | const |
Sensor<unsigned short>* Create::lightBumpCenterLeftSignal | ( | ) | const |
Sensor<bool>* Create::lightBumpCenterRight | ( | ) | const |
Sensor<unsigned short>* Create::lightBumpCenterRightSignal | ( | ) | const |
Sensor<bool>* Create::lightBumpFrontLeft | ( | ) | const |
Sensor<unsigned short>* Create::lightBumpFrontLeftSignal | ( | ) | const |
Sensor<bool>* Create::lightBumpFrontRight | ( | ) | const |
Sensor<unsigned short>* Create::lightBumpFrontRightSignal | ( | ) | const |
Sensor<bool>* Create::lightBumpLeft | ( | ) | const |
Sensor<unsigned short>* Create::lightBumpLeftSignal | ( | ) | const |
Sensor<bool>* Create::lightBumpRight | ( | ) | const |
Sensor<unsigned short>* Create::lightBumpRightSignal | ( | ) | const |
Create::Mode Create::mode | ( | ) |
void Create::move | ( | const short & | millimeters, |
const unsigned short & | speed | ||
) |
A very accurate move method based on time rather than the create's own readings, which are often less than accurate.
millimeters | The amount to move, in millimeters. |
speed | The speed each wheel should move at, in mm/s. |
AbstractButton* Create::playButton | ( | ) | const |
short Create::read | ( | ) |
Reads one byte.
int Create::read | ( | unsigned char * | data, |
const size_t & | len | ||
) |
Reads a maximum of len bytes.
data | Pointer to the buffer to read into. |
len | Maxiumum number of bytes to read. Should be less than or equal to the size of data. |
const unsigned short& Create::refreshRate | ( | ) | const |
void Create::send | ( | const CreateScript & | script | ) |
const CreatePackets::_1* Create::sensorPacket1 | ( | ) |
const CreatePackets::_101* Create::sensorPacket101 | ( | ) |
const CreatePackets::_2* Create::sensorPacket2 | ( | ) |
const CreatePackets::_3* Create::sensorPacket3 | ( | ) |
const CreatePackets::_4* Create::sensorPacket4 | ( | ) |
const CreatePackets::_5* Create::sensorPacket5 | ( | ) |
void Create::setAngle | ( | const int | angle | ) |
bool Create::setBaudRate | ( | const unsigned char & | baudCode | ) |
|
inline |
void Create::setDistance | ( | const int | distance | ) |
void Create::setFullMode | ( | ) |
void Create::setLeds | ( | const bool & | advance, |
const bool & | play, | ||
const unsigned char & | color, | ||
const unsigned char & | brightness | ||
) |
void Create::setMode | ( | const Create::Mode & | mode | ) |
void Create::setOffMode | ( | ) |
void Create::setPassiveMode | ( | ) |
void Create::setRefreshRate | ( | const unsigned short & | refreshRate | ) |
void Create::setSafeMode | ( | ) |
void Create::spin | ( | const short & | speed | ) |
Spin the create at a constant velocity.
speed | The speed each motor should move at. Positive is counter-clockwise. |
void Create::spinClockwise | ( | const short & | speed | ) |
void Create::spinCounterClockwise | ( | const short & | speed | ) |
const CreateState* Create::state | ( | ) |
void Create::stop | ( | ) |
void Create::turn | ( | const short & | angle, |
const unsigned short & | speed | ||
) |
A very accurate turn method based on time rather than the create's own readings, which are often less than accurate.
angle | The angle to turn, in degrees. Positive is counter-clockwise. |
speed | The speed each wheel should move at, in mm/s. The angular velocity will be double this value. |
Sensor<bool>* Create::virtualWall | ( | ) | const |
Sensor<bool>* Create::wall | ( | ) | const |
Sensor<unsigned short>* Create::wallSignal | ( | ) | const |
Sensor<bool>* Create::wheelDropCaster | ( | ) | const |
Sensor<bool>* Create::wheelDropLeft | ( | ) | const |
Sensor<bool>* Create::wheelDropRight | ( | ) | const |
bool Create::write | ( | const unsigned char & | c | ) |
bool Create::write | ( | const unsigned char * | data, |
const size_t & | len | ||
) |