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) |
button::AbstractButton * | playButton () const |
button::AbstractButton * | advanceButton () const |
sensor::Sensor< bool > * | wall () const |
sensor::Sensor< bool > * | cliffLeft () const |
sensor::Sensor< bool > * | cliffFrontLeft () const |
sensor::Sensor< bool > * | cliffFrontRight () const |
sensor::Sensor< bool > * | cliffRight () const |
sensor::Sensor< bool > * | virtualWall () const |
sensor::Sensor< unsigned short > * | wallSignal () const |
sensor::Sensor< unsigned short > * | cliffLeftSignal () const |
sensor::Sensor< unsigned short > * | cliffFrontLeftSignal () const |
sensor::Sensor< unsigned short > * | cliffFrontRightSignal () const |
sensor::Sensor< unsigned short > * | cliffRightSignal () const |
sensor::Sensor< unsigned short > * | cargoBayAnalogSignal () const |
sensor::Sensor< unsigned char > * | cargoBayDigitalInputs () const |
sensor::Sensor< unsigned char > * | ir () const |
sensor::Sensor< unsigned char > * | chargingState () const |
sensor::Sensor< char > * | batteryTemperature () const |
sensor::Sensor< unsigned short > * | batteryCharge () const |
sensor::Sensor< unsigned short > * | batteryCapacity () const |
sensor::Sensor< int > * | angle () const |
sensor::Sensor< int > * | distance () const |
sensor::Sensor< bool > * | bumpLeft () const |
sensor::Sensor< bool > * | bumpRight () const |
sensor::Sensor< bool > * | wheelDropLeft () const |
sensor::Sensor< bool > * | wheelDropRight () const |
sensor::Sensor< bool > * | wheelDropCaster () const |
sensor::Sensor< bool > * | lightBumpLeft () const |
sensor::Sensor< bool > * | lightBumpFrontLeft () const |
sensor::Sensor< bool > * | lightBumpCenterLeft () const |
sensor::Sensor< bool > * | lightBumpCenterRight () const |
sensor::Sensor< bool > * | lightBumpFrontRight () const |
sensor::Sensor< bool > * | lightBumpRight () const |
sensor::Sensor< unsigned short > * | lightBumpLeftSignal () const |
sensor::Sensor< unsigned short > * | lightBumpFrontLeftSignal () const |
sensor::Sensor< unsigned short > * | lightBumpCenterLeftSignal () const |
sensor::Sensor< unsigned short > * | lightBumpCenterRightSignal () const |
sensor::Sensor< unsigned short > * | lightBumpFrontRightSignal () const |
sensor::Sensor< unsigned short > * | lightBumpRightSignal () const |
sensor::Sensor< unsigned char > * | songPlaying () const |
sensor::Sensor< unsigned char > * | songNumber () const |
void | setRefreshRate (const unsigned short &refreshRate) |
const unsigned short & | refreshRate () const |
bool | loadSong (const unsigned char *song, const unsigned char length, const unsigned char songNum) |
bool | playSong (const unsigned char songNum) |
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.
The "Mode" of the create.
Enumerator | |
---|---|
OffMode | |
PassiveMode | |
SafeMode | |
FullMode |
kipr::create::Create::~Create | ( | ) |
button::AbstractButton* kipr::create::Create::advanceButton | ( | ) | const |
sensor::Sensor<int>* kipr::create::Create::angle | ( | ) | const |
short kipr::create::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::Sensor<unsigned short>* kipr::create::Create::batteryCapacity | ( | ) | const |
sensor::Sensor<unsigned short>* kipr::create::Create::batteryCharge | ( | ) | const |
sensor::Sensor<char>* kipr::create::Create::batteryTemperature | ( | ) | const |
|
inline |
|
inline |
bool kipr::create::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 |
sensor::Sensor<bool>* kipr::create::Create::bumpLeft | ( | ) | const |
sensor::Sensor<bool>* kipr::create::Create::bumpRight | ( | ) | const |
sensor::Sensor<unsigned short>* kipr::create::Create::cargoBayAnalogSignal | ( | ) | const |
sensor::Sensor<unsigned char>* kipr::create::Create::cargoBayDigitalInputs | ( | ) | const |
sensor::Sensor<unsigned char>* kipr::create::Create::chargingState | ( | ) | const |
sensor::Sensor<bool>* kipr::create::Create::cliffFrontLeft | ( | ) | const |
sensor::Sensor<unsigned short>* kipr::create::Create::cliffFrontLeftSignal | ( | ) | const |
sensor::Sensor<bool>* kipr::create::Create::cliffFrontRight | ( | ) | const |
sensor::Sensor<unsigned short>* kipr::create::Create::cliffFrontRightSignal | ( | ) | const |
sensor::Sensor<bool>* kipr::create::Create::cliffLeft | ( | ) | const |
sensor::Sensor<unsigned short>* kipr::create::Create::cliffLeftSignal | ( | ) | const |
sensor::Sensor<bool>* kipr::create::Create::cliffRight | ( | ) | const |
sensor::Sensor<unsigned short>* kipr::create::Create::cliffRightSignal | ( | ) | const |
bool kipr::create::Create::connect | ( | ) |
Attempts to establish a connection to the create
bool kipr::create::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 kipr::create::Create::disconnect | ( | ) |
Cleans up connection to the create
sensor::Sensor<int>* kipr::create::Create::distance | ( | ) | const |
void kipr::create::Create::drive | ( | const short & | velocity, |
const short & | radius | ||
) |
void kipr::create::Create::driveDirect | ( | const short & | left, |
const short & | right | ||
) |
void kipr::create::Create::driveStraight | ( | const short & | speed | ) |
|
inline |
void kipr::create::Create::flush | ( | ) |
|
static |
sensor::Sensor<unsigned char>* kipr::create::Create::ir | ( | ) | const |
bool kipr::create::Create::isConnected | ( | ) | const |
sensor::Sensor<bool>* kipr::create::Create::lightBumpCenterLeft | ( | ) | const |
sensor::Sensor<unsigned short>* kipr::create::Create::lightBumpCenterLeftSignal | ( | ) | const |
sensor::Sensor<bool>* kipr::create::Create::lightBumpCenterRight | ( | ) | const |
sensor::Sensor<unsigned short>* kipr::create::Create::lightBumpCenterRightSignal | ( | ) | const |
sensor::Sensor<bool>* kipr::create::Create::lightBumpFrontLeft | ( | ) | const |
sensor::Sensor<unsigned short>* kipr::create::Create::lightBumpFrontLeftSignal | ( | ) | const |
sensor::Sensor<bool>* kipr::create::Create::lightBumpFrontRight | ( | ) | const |
sensor::Sensor<unsigned short>* kipr::create::Create::lightBumpFrontRightSignal | ( | ) | const |
sensor::Sensor<bool>* kipr::create::Create::lightBumpLeft | ( | ) | const |
sensor::Sensor<unsigned short>* kipr::create::Create::lightBumpLeftSignal | ( | ) | const |
sensor::Sensor<bool>* kipr::create::Create::lightBumpRight | ( | ) | const |
sensor::Sensor<unsigned short>* kipr::create::Create::lightBumpRightSignal | ( | ) | const |
Create::Mode kipr::create::Create::mode | ( | ) |
void kipr::create::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. |
button::AbstractButton* kipr::create::Create::playButton | ( | ) | const |
short kipr::create::Create::read | ( | ) |
Reads one byte.
int kipr::create::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& kipr::create::Create::refreshRate | ( | ) | const |
void kipr::create::Create::send | ( | const CreateScript & | script | ) |
const CreatePackets::_1* kipr::create::Create::sensorPacket1 | ( | ) |
const CreatePackets::_101* kipr::create::Create::sensorPacket101 | ( | ) |
const CreatePackets::_2* kipr::create::Create::sensorPacket2 | ( | ) |
const CreatePackets::_3* kipr::create::Create::sensorPacket3 | ( | ) |
const CreatePackets::_4* kipr::create::Create::sensorPacket4 | ( | ) |
const CreatePackets::_5* kipr::create::Create::sensorPacket5 | ( | ) |
void kipr::create::Create::setAngle | ( | const int | angle | ) |
bool kipr::create::Create::setBaudRate | ( | const unsigned char & | baudCode | ) |
|
inline |
void kipr::create::Create::setDistance | ( | const int | distance | ) |
void kipr::create::Create::setFullMode | ( | ) |
void kipr::create::Create::setLeds | ( | const bool & | advance, |
const bool & | play, | ||
const unsigned char & | color, | ||
const unsigned char & | brightness | ||
) |
void kipr::create::Create::setMode | ( | const Create::Mode & | mode | ) |
void kipr::create::Create::setOffMode | ( | ) |
void kipr::create::Create::setPassiveMode | ( | ) |
void kipr::create::Create::setRefreshRate | ( | const unsigned short & | refreshRate | ) |
void kipr::create::Create::setSafeMode | ( | ) |
sensor::Sensor<unsigned char>* kipr::create::Create::songNumber | ( | ) | const |
sensor::Sensor<unsigned char>* kipr::create::Create::songPlaying | ( | ) | const |
void kipr::create::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 kipr::create::Create::spinClockwise | ( | const short & | speed | ) |
void kipr::create::Create::spinCounterClockwise | ( | const short & | speed | ) |
const CreateState* kipr::create::Create::state | ( | ) |
void kipr::create::Create::stop | ( | ) |
void kipr::create::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::Sensor<bool>* kipr::create::Create::virtualWall | ( | ) | const |
sensor::Sensor<bool>* kipr::create::Create::wall | ( | ) | const |
sensor::Sensor<unsigned short>* kipr::create::Create::wallSignal | ( | ) | const |
sensor::Sensor<bool>* kipr::create::Create::wheelDropCaster | ( | ) | const |
sensor::Sensor<bool>* kipr::create::Create::wheelDropLeft | ( | ) | const |
sensor::Sensor<bool>* kipr::create::Create::wheelDropRight | ( | ) | const |
bool kipr::create::Create::write | ( | const unsigned char & | c | ) |
bool kipr::create::Create::write | ( | const unsigned char * | data, |
const size_t & | len | ||
) |