#include <irobot-create.hh>
Public Types | |
enum | Mode { IROBOT_CREATE_OFF, IROBOT_CREATE_PASSIVE, IROBOT_CREATE_SAFE, IROBOT_CREATE_FULL, IROBOT_CREATE_OFF, IROBOT_CREATE_PASSIVE, IROBOT_CREATE_SAFE, IROBOT_CREATE_FULL } |
iRobot Create modes The mode defines which commands are available and how the robot behaves when some events happens like wheel drop or if a cliff is detected. More... | |
enum | Baud { BAUD_300 = 0, BAUD_600 = 1, BAUD_1200 = 2, BAUD_2400 = 3, BAUD_4800 = 4, BAUD_9600 = 5, BAUD_14400 = 6, BAUD_19200 = 7, BAUD_28800 = 8, BAUD_38400 = 9, BAUD_57600 = 10, BAUD_115200 = 11, BAUD_300 = 0, BAUD_600 = 1, BAUD_1200 = 2, BAUD_2400 = 3, BAUD_4800 = 4, BAUD_9600 = 5, BAUD_14400 = 6, BAUD_19200 = 7, BAUD_28800 = 8, BAUD_38400 = 9, BAUD_57600 = 10, BAUD_115200 = 11 } |
Enumerate all possible communication speeds. More... | |
enum | Demo { DEMO_COVER = 0, DEMO_COVER_AND_DOCK = 1, DEMO_SPOT_COVER = 2, DEMO_MOUSE = 3, DEMO_DRIVE_FIGURE_EIGHT = 4, DEMO_WIMP = 5, DEMO_HOME = 6, DEMO_TAG = 7, DEMO_PACHELBEL = 8, DEMO_BANJO = 9, DEMO_ABORT = 255, DEMO_COVER = 0, DEMO_COVER_AND_DOCK = 1, DEMO_SPOT_COVER = 2, DEMO_MOUSE = 3, DEMO_DRIVE_FIGURE_EIGHT = 4, DEMO_WIMP = 5, DEMO_HOME = 6, DEMO_TAG = 7, DEMO_PACHELBEL = 8, DEMO_BANJO = 9, DEMO_ABORT = 255 } |
Enumerate built-in demos. More... | |
enum | DriveCommand { DRIVE_STRAIGHT, DRIVE_INPLACE_CLOCKWISE, DRIVE_INPLACE_COUNTERCLOCKWISE, DRIVE_STRAIGHT, DRIVE_INPLACE_CLOCKWISE, DRIVE_INPLACE_COUNTERCLOCKWISE } |
Enumerates special driving commands. More... | |
enum | Led { LED_NONE = 0, LED_PLAY = 2, LED_ADVANCE = 8, LED_ALL = LED_PLAY | LED_ADVANCE, LED_NONE = 0, LED_PLAY = 2, LED_ADVANCE = 8, LED_ALL = LED_PLAY | LED_ADVANCE } |
Enumerate available leds (and combinations). The power led is not in this list because it is handled differently (as its color is not fixed). More... | |
enum | StreamState { STREAM_STATE_OFF = 0, STREAM_STATE_ON = 1, STREAM_STATE_OFF = 0, STREAM_STATE_ON = 1 } |
Activate or disable sensor streaming. More... | |
enum | ChargingState { CHARGING_STATE_NOT_CHARGING = 0, CHARGING_STATE_RECONDITIONING_CHARGING = 1, CHARGING_STATE_FULL_CHARGING = 2, CHARGING_STATE_TRICKLE_CHARGING = 3, CHARGING_STATE_WAITING = 4, CHARGING_STATE_CHARGING_FAULT_CONDITION = 5, CHARGING_STATE_NOT_CHARGING = 0, CHARGING_STATE_RECONDITIONING_CHARGING = 1, CHARGING_STATE_FULL_CHARGING = 2, CHARGING_STATE_TRICKLE_CHARGING = 3, CHARGING_STATE_WAITING = 4, CHARGING_STATE_CHARGING_FAULT_CONDITION = 5 } |
Enumerate possible charging states. More... | |
enum | Event { EVENT_WHEEL_DROP = 1, EVENT_FRONT_WHEEL_DROP = 2, EVENT_LEFT_WHEEL_DROP = 3, EVENT_RIGHT_WHEEL_DROP = 4, EVENT_BUMP = 5, EVENT_LEFT_BUMP = 6, EVENT_RIGHT_BUMP = 7, EVENT_VIRTUAL_WALL = 8, EVENT_WALL = 9, EVENT_CLIFF = 10, EVENT_LEFT_CLIFF = 11, EVENT_FRONT_LEFT_CLIFF = 12, EVENT_FRONT_RIGHT_CLIFF = 13, EVENT_RIGHT_CLIFF = 14, EVENT_HOME_BASE = 15, EVENT_ADVANCE_BUTTON = 16, EVENT_PLAY_BUTTON = 17, EVENT_DIGITAL_INPUT_0 = 18, EVENT_DIGITAL_INPUT_1 = 19, EVENT_DIGITAL_INPUT_2 = 20, EVENT_DIGITAL_INPUT_3 = 21, EVENT_OI_MODE_PASSIVE = 22, EVENT_WHEEL_DROP = 1, EVENT_FRONT_WHEEL_DROP = 2, EVENT_LEFT_WHEEL_DROP = 3, EVENT_RIGHT_WHEEL_DROP = 4, EVENT_BUMP = 5, EVENT_LEFT_BUMP = 6, EVENT_RIGHT_BUMP = 7, EVENT_VIRTUAL_WALL = 8, EVENT_WALL = 9, EVENT_CLIFF = 10, EVENT_LEFT_CLIFF = 11, EVENT_FRONT_LEFT_CLIFF = 12, EVENT_FRONT_RIGHT_CLIFF = 13, EVENT_RIGHT_CLIFF = 14, EVENT_HOME_BASE = 15, EVENT_ADVANCE_BUTTON = 16, EVENT_PLAY_BUTTON = 17, EVENT_DIGITAL_INPUT_0 = 18, EVENT_DIGITAL_INPUT_1 = 19, EVENT_DIGITAL_INPUT_2 = 20, EVENT_DIGITAL_INPUT_3 = 21, EVENT_OI_MODE_PASSIVE = 22 } |
Enumerate available events. More... | |
enum | EventState { EVENT_OCCURRING, EVENT_NOT_OCCURRING, EVENT_OCCURRING, EVENT_NOT_OCCURRING } |
Indicate an event state. More... | |
enum | Opcode { OPCODE_START = 128, OPCODE_BAUD = 129, OPCODE_CONTROL = 130, OPCODE_SAFE = 131, OPCODE_FULL = 132, OPCODE_SPOT = 134, OPCODE_COVER = 135, OPCODE_DEMO = 136, OPCODE_DRIVE = 137, OPCODE_LOW_SIDE_DRIVERS = 138, OPCODE_LEDS = 139, OPCODE_SONG = 140, OPCODE_PLAY = 141, OPCODE_SENSORS = 142, OPCODE_COVER_AND_DOCK = 143, OPCODE_PWM_LOW_SIDE_DRIVERS = 144, OPCODE_DRIVE_DIRECT = 145, OPCODE_DIGITAL_OUTPUTS = 147, OPCODE_STREAM = 148, OPCODE_QUERY_LIST = 149, OPCODE_PAUSE_RESUME_STREAM = 150, OPCODE_SEND_IR = 151, OPCODE_SCRIPT = 152, OPCODE_PLAY_SCRIPT = 153, OPCODE_SHOW_SCRIPT = 154, OPCODE_WAIT_TIME = 155, OPCODE_WAIT_DISTANCE = 156, OPCODE_WAIT_ANGLE = 157, OPCODE_WAIT_EVENT = 158, OPCODE_START = 128, OPCODE_BAUD = 129, OPCODE_CONTROL = 130, OPCODE_SAFE = 131, OPCODE_FULL = 132, OPCODE_SPOT = 134, OPCODE_COVER = 135, OPCODE_DEMO = 136, OPCODE_DRIVE = 137, OPCODE_LOW_SIDE_DRIVERS = 138, OPCODE_LEDS = 139, OPCODE_SONG = 140, OPCODE_PLAY = 141, OPCODE_SENSORS = 142, OPCODE_COVER_AND_DOCK = 143, OPCODE_PWM_LOW_SIDE_DRIVERS = 144, OPCODE_DRIVE_DIRECT = 145, OPCODE_DIGITAL_OUTPUTS = 147, OPCODE_STREAM = 148, OPCODE_QUERY_LIST = 149, OPCODE_PAUSE_RESUME_STREAM = 150, OPCODE_SEND_IR = 151, OPCODE_SCRIPT = 152, OPCODE_PLAY_SCRIPT = 153, OPCODE_SHOW_SCRIPT = 154, OPCODE_WAIT_TIME = 155, OPCODE_WAIT_DISTANCE = 156, OPCODE_WAIT_ANGLE = 157, OPCODE_WAIT_EVENT = 158 } |
Enumerate available opcodes. Opcode are the basics instructions that the protocol support. This class wraps them to avoid using them directly. The only case where you have to use them is when you want to send an Open Interface script. More... | |
enum | SensorPacket { SENSOR_GROUP_0 = 0, SENSOR_GROUP_1 = 1, SENSOR_GROUP_2 = 2, SENSOR_GROUP_3 = 3, SENSOR_GROUP_4 = 4, SENSOR_GROUP_5 = 5, SENSOR_GROUP_6 = 6, SENSOR_BUMPS_WHEELS_DROPS = 7, SENSOR_WALL = 8, SENSOR_CLIFF_LEFT = 9, SENSOR_CLIFF_FRONT_LEFT = 10, SENSOR_CLIFF_FRONT_RIGHT = 11, SENSOR_CLIFF_RIGHT = 12, SENSOR_VIRTUAL_WALL = 13, SENSOR_OVERCURRENTS = 14, SENSOR_IR = 17, SENSOR_BUTTONS = 18, SENSOR_DISTANCE = 19, SENSOR_ANGLE = 20, SENSOR_CHARGING_STATE = 21, SENSOR_VOLTAGE = 22, SENSOR_CURRENT = 23, SENSOR_BATTERY_TEMPERATURE = 24, SENSOR_BATTERY_CHARGE = 25, SENSOR_BATTERY_CAPACITY = 26, SENSOR_WALL_SIGNAL = 27, SENSOR_CLIFF_LEFT_SIGNAL = 28, SENSOR_CLIFF_FRONT_LEFT_SIGNAL = 29, SENSOR_CLIFF_FRONT_RIGHT_SIGNAL = 30, SENSOR_CLIFF_RIGHT_SIGNAL = 31, SENSOR_CARGO_BAY_DIGITAL_INPUT = 32, SENSOR_CARGO_BAY_ANALOG_SIGNAL = 33, SENSOR_CHARGING_SOURCES_AVAILABLE = 34, SENSOR_OI_MODE = 35, SENSOR_SONG_NUMBER = 36, SENSOR_SONG_PLAYING = 37, SENSOR_NUMBER_STREAM_PACKETS = 38, SENSOR_REQUESTED_VELOCITY = 39, SENSOR_REQUESTED_RADIUS = 40, SENSOR_REQUESTED_RIGHT_VELOCITY = 41, SENSOR_REQUESTED_LEFT_VELOCITY = 42, SENSOR_GROUP_0 = 0, SENSOR_GROUP_1 = 1, SENSOR_GROUP_2 = 2, SENSOR_GROUP_3 = 3, SENSOR_GROUP_4 = 4, SENSOR_GROUP_5 = 5, SENSOR_GROUP_6 = 6, SENSOR_BUMPS_WHEELS_DROPS = 7, SENSOR_WALL = 8, SENSOR_CLIFF_LEFT = 9, SENSOR_CLIFF_FRONT_LEFT = 10, SENSOR_CLIFF_FRONT_RIGHT = 11, SENSOR_CLIFF_RIGHT = 12, SENSOR_VIRTUAL_WALL = 13, SENSOR_OVERCURRENTS = 14, SENSOR_IR = 17, SENSOR_BUTTONS = 18, SENSOR_DISTANCE = 19, SENSOR_ANGLE = 20, SENSOR_CHARGING_STATE = 21, SENSOR_VOLTAGE = 22, SENSOR_CURRENT = 23, SENSOR_BATTERY_TEMPERATURE = 24, SENSOR_BATTERY_CHARGE = 25, SENSOR_BATTERY_CAPACITY = 26, SENSOR_WALL_SIGNAL = 27, SENSOR_CLIFF_LEFT_SIGNAL = 28, SENSOR_CLIFF_FRONT_LEFT_SIGNAL = 29, SENSOR_CLIFF_FRONT_RIGHT_SIGNAL = 30, SENSOR_CLIFF_RIGHT_SIGNAL = 31, SENSOR_CARGO_BAY_DIGITAL_INPUT = 32, SENSOR_CARGO_BAY_ANALOG_SIGNAL = 33, SENSOR_CHARGING_SOURCES_AVAILABLE = 34, SENSOR_OI_MODE = 35, SENSOR_SONG_NUMBER = 36, SENSOR_SONG_PLAYING = 37, SENSOR_NUMBER_STREAM_PACKETS = 38, SENSOR_REQUESTED_VELOCITY = 39, SENSOR_REQUESTED_RADIUS = 40, SENSOR_REQUESTED_RIGHT_VELOCITY = 41, SENSOR_REQUESTED_LEFT_VELOCITY = 42 } |
Enumerate available sensor packets. More... | |
enum | Mode { IROBOT_CREATE_OFF, IROBOT_CREATE_PASSIVE, IROBOT_CREATE_SAFE, IROBOT_CREATE_FULL, IROBOT_CREATE_OFF, IROBOT_CREATE_PASSIVE, IROBOT_CREATE_SAFE, IROBOT_CREATE_FULL } |
iRobot Create modes The mode defines which commands are available and how the robot behaves when some events happens like wheel drop or if a cliff is detected. More... | |
enum | Baud { BAUD_300 = 0, BAUD_600 = 1, BAUD_1200 = 2, BAUD_2400 = 3, BAUD_4800 = 4, BAUD_9600 = 5, BAUD_14400 = 6, BAUD_19200 = 7, BAUD_28800 = 8, BAUD_38400 = 9, BAUD_57600 = 10, BAUD_115200 = 11, BAUD_300 = 0, BAUD_600 = 1, BAUD_1200 = 2, BAUD_2400 = 3, BAUD_4800 = 4, BAUD_9600 = 5, BAUD_14400 = 6, BAUD_19200 = 7, BAUD_28800 = 8, BAUD_38400 = 9, BAUD_57600 = 10, BAUD_115200 = 11 } |
Enumerate all possible communication speeds. More... | |
enum | Demo { DEMO_COVER = 0, DEMO_COVER_AND_DOCK = 1, DEMO_SPOT_COVER = 2, DEMO_MOUSE = 3, DEMO_DRIVE_FIGURE_EIGHT = 4, DEMO_WIMP = 5, DEMO_HOME = 6, DEMO_TAG = 7, DEMO_PACHELBEL = 8, DEMO_BANJO = 9, DEMO_ABORT = 255, DEMO_COVER = 0, DEMO_COVER_AND_DOCK = 1, DEMO_SPOT_COVER = 2, DEMO_MOUSE = 3, DEMO_DRIVE_FIGURE_EIGHT = 4, DEMO_WIMP = 5, DEMO_HOME = 6, DEMO_TAG = 7, DEMO_PACHELBEL = 8, DEMO_BANJO = 9, DEMO_ABORT = 255 } |
Enumerate built-in demos. More... | |
enum | DriveCommand { DRIVE_STRAIGHT, DRIVE_INPLACE_CLOCKWISE, DRIVE_INPLACE_COUNTERCLOCKWISE, DRIVE_STRAIGHT, DRIVE_INPLACE_CLOCKWISE, DRIVE_INPLACE_COUNTERCLOCKWISE } |
Enumerates special driving commands. More... | |
enum | Led { LED_NONE = 0, LED_PLAY = 2, LED_ADVANCE = 8, LED_ALL = LED_PLAY | LED_ADVANCE, LED_NONE = 0, LED_PLAY = 2, LED_ADVANCE = 8, LED_ALL = LED_PLAY | LED_ADVANCE } |
Enumerate available leds (and combinations). The power led is not in this list because it is handled differently (as its color is not fixed). More... | |
enum | StreamState { STREAM_STATE_OFF = 0, STREAM_STATE_ON = 1, STREAM_STATE_OFF = 0, STREAM_STATE_ON = 1 } |
Activate or disable sensor streaming. More... | |
enum | ChargingState { CHARGING_STATE_NOT_CHARGING = 0, CHARGING_STATE_RECONDITIONING_CHARGING = 1, CHARGING_STATE_FULL_CHARGING = 2, CHARGING_STATE_TRICKLE_CHARGING = 3, CHARGING_STATE_WAITING = 4, CHARGING_STATE_CHARGING_FAULT_CONDITION = 5, CHARGING_STATE_NOT_CHARGING = 0, CHARGING_STATE_RECONDITIONING_CHARGING = 1, CHARGING_STATE_FULL_CHARGING = 2, CHARGING_STATE_TRICKLE_CHARGING = 3, CHARGING_STATE_WAITING = 4, CHARGING_STATE_CHARGING_FAULT_CONDITION = 5 } |
Enumerate possible charging states. More... | |
enum | Event { EVENT_WHEEL_DROP = 1, EVENT_FRONT_WHEEL_DROP = 2, EVENT_LEFT_WHEEL_DROP = 3, EVENT_RIGHT_WHEEL_DROP = 4, EVENT_BUMP = 5, EVENT_LEFT_BUMP = 6, EVENT_RIGHT_BUMP = 7, EVENT_VIRTUAL_WALL = 8, EVENT_WALL = 9, EVENT_CLIFF = 10, EVENT_LEFT_CLIFF = 11, EVENT_FRONT_LEFT_CLIFF = 12, EVENT_FRONT_RIGHT_CLIFF = 13, EVENT_RIGHT_CLIFF = 14, EVENT_HOME_BASE = 15, EVENT_ADVANCE_BUTTON = 16, EVENT_PLAY_BUTTON = 17, EVENT_DIGITAL_INPUT_0 = 18, EVENT_DIGITAL_INPUT_1 = 19, EVENT_DIGITAL_INPUT_2 = 20, EVENT_DIGITAL_INPUT_3 = 21, EVENT_OI_MODE_PASSIVE = 22, EVENT_WHEEL_DROP = 1, EVENT_FRONT_WHEEL_DROP = 2, EVENT_LEFT_WHEEL_DROP = 3, EVENT_RIGHT_WHEEL_DROP = 4, EVENT_BUMP = 5, EVENT_LEFT_BUMP = 6, EVENT_RIGHT_BUMP = 7, EVENT_VIRTUAL_WALL = 8, EVENT_WALL = 9, EVENT_CLIFF = 10, EVENT_LEFT_CLIFF = 11, EVENT_FRONT_LEFT_CLIFF = 12, EVENT_FRONT_RIGHT_CLIFF = 13, EVENT_RIGHT_CLIFF = 14, EVENT_HOME_BASE = 15, EVENT_ADVANCE_BUTTON = 16, EVENT_PLAY_BUTTON = 17, EVENT_DIGITAL_INPUT_0 = 18, EVENT_DIGITAL_INPUT_1 = 19, EVENT_DIGITAL_INPUT_2 = 20, EVENT_DIGITAL_INPUT_3 = 21, EVENT_OI_MODE_PASSIVE = 22 } |
Enumerate available events. More... | |
enum | EventState { EVENT_OCCURRING, EVENT_NOT_OCCURRING, EVENT_OCCURRING, EVENT_NOT_OCCURRING } |
Indicate an event state. More... | |
enum | Opcode { OPCODE_START = 128, OPCODE_BAUD = 129, OPCODE_CONTROL = 130, OPCODE_SAFE = 131, OPCODE_FULL = 132, OPCODE_SPOT = 134, OPCODE_COVER = 135, OPCODE_DEMO = 136, OPCODE_DRIVE = 137, OPCODE_LOW_SIDE_DRIVERS = 138, OPCODE_LEDS = 139, OPCODE_SONG = 140, OPCODE_PLAY = 141, OPCODE_SENSORS = 142, OPCODE_COVER_AND_DOCK = 143, OPCODE_PWM_LOW_SIDE_DRIVERS = 144, OPCODE_DRIVE_DIRECT = 145, OPCODE_DIGITAL_OUTPUTS = 147, OPCODE_STREAM = 148, OPCODE_QUERY_LIST = 149, OPCODE_PAUSE_RESUME_STREAM = 150, OPCODE_SEND_IR = 151, OPCODE_SCRIPT = 152, OPCODE_PLAY_SCRIPT = 153, OPCODE_SHOW_SCRIPT = 154, OPCODE_WAIT_TIME = 155, OPCODE_WAIT_DISTANCE = 156, OPCODE_WAIT_ANGLE = 157, OPCODE_WAIT_EVENT = 158, OPCODE_START = 128, OPCODE_BAUD = 129, OPCODE_CONTROL = 130, OPCODE_SAFE = 131, OPCODE_FULL = 132, OPCODE_SPOT = 134, OPCODE_COVER = 135, OPCODE_DEMO = 136, OPCODE_DRIVE = 137, OPCODE_LOW_SIDE_DRIVERS = 138, OPCODE_LEDS = 139, OPCODE_SONG = 140, OPCODE_PLAY = 141, OPCODE_SENSORS = 142, OPCODE_COVER_AND_DOCK = 143, OPCODE_PWM_LOW_SIDE_DRIVERS = 144, OPCODE_DRIVE_DIRECT = 145, OPCODE_DIGITAL_OUTPUTS = 147, OPCODE_STREAM = 148, OPCODE_QUERY_LIST = 149, OPCODE_PAUSE_RESUME_STREAM = 150, OPCODE_SEND_IR = 151, OPCODE_SCRIPT = 152, OPCODE_PLAY_SCRIPT = 153, OPCODE_SHOW_SCRIPT = 154, OPCODE_WAIT_TIME = 155, OPCODE_WAIT_DISTANCE = 156, OPCODE_WAIT_ANGLE = 157, OPCODE_WAIT_EVENT = 158 } |
Enumerate available opcodes. Opcode are the basics instructions that the protocol support. This class wraps them to avoid using them directly. The only case where you have to use them is when you want to send an Open Interface script. More... | |
enum | SensorPacket { SENSOR_GROUP_0 = 0, SENSOR_GROUP_1 = 1, SENSOR_GROUP_2 = 2, SENSOR_GROUP_3 = 3, SENSOR_GROUP_4 = 4, SENSOR_GROUP_5 = 5, SENSOR_GROUP_6 = 6, SENSOR_BUMPS_WHEELS_DROPS = 7, SENSOR_WALL = 8, SENSOR_CLIFF_LEFT = 9, SENSOR_CLIFF_FRONT_LEFT = 10, SENSOR_CLIFF_FRONT_RIGHT = 11, SENSOR_CLIFF_RIGHT = 12, SENSOR_VIRTUAL_WALL = 13, SENSOR_OVERCURRENTS = 14, SENSOR_IR = 17, SENSOR_BUTTONS = 18, SENSOR_DISTANCE = 19, SENSOR_ANGLE = 20, SENSOR_CHARGING_STATE = 21, SENSOR_VOLTAGE = 22, SENSOR_CURRENT = 23, SENSOR_BATTERY_TEMPERATURE = 24, SENSOR_BATTERY_CHARGE = 25, SENSOR_BATTERY_CAPACITY = 26, SENSOR_WALL_SIGNAL = 27, SENSOR_CLIFF_LEFT_SIGNAL = 28, SENSOR_CLIFF_FRONT_LEFT_SIGNAL = 29, SENSOR_CLIFF_FRONT_RIGHT_SIGNAL = 30, SENSOR_CLIFF_RIGHT_SIGNAL = 31, SENSOR_CARGO_BAY_DIGITAL_INPUT = 32, SENSOR_CARGO_BAY_ANALOG_SIGNAL = 33, SENSOR_CHARGING_SOURCES_AVAILABLE = 34, SENSOR_OI_MODE = 35, SENSOR_SONG_NUMBER = 36, SENSOR_SONG_PLAYING = 37, SENSOR_NUMBER_STREAM_PACKETS = 38, SENSOR_REQUESTED_VELOCITY = 39, SENSOR_REQUESTED_RADIUS = 40, SENSOR_REQUESTED_RIGHT_VELOCITY = 41, SENSOR_REQUESTED_LEFT_VELOCITY = 42, SENSOR_GROUP_0 = 0, SENSOR_GROUP_1 = 1, SENSOR_GROUP_2 = 2, SENSOR_GROUP_3 = 3, SENSOR_GROUP_4 = 4, SENSOR_GROUP_5 = 5, SENSOR_GROUP_6 = 6, SENSOR_BUMPS_WHEELS_DROPS = 7, SENSOR_WALL = 8, SENSOR_CLIFF_LEFT = 9, SENSOR_CLIFF_FRONT_LEFT = 10, SENSOR_CLIFF_FRONT_RIGHT = 11, SENSOR_CLIFF_RIGHT = 12, SENSOR_VIRTUAL_WALL = 13, SENSOR_OVERCURRENTS = 14, SENSOR_IR = 17, SENSOR_BUTTONS = 18, SENSOR_DISTANCE = 19, SENSOR_ANGLE = 20, SENSOR_CHARGING_STATE = 21, SENSOR_VOLTAGE = 22, SENSOR_CURRENT = 23, SENSOR_BATTERY_TEMPERATURE = 24, SENSOR_BATTERY_CHARGE = 25, SENSOR_BATTERY_CAPACITY = 26, SENSOR_WALL_SIGNAL = 27, SENSOR_CLIFF_LEFT_SIGNAL = 28, SENSOR_CLIFF_FRONT_LEFT_SIGNAL = 29, SENSOR_CLIFF_FRONT_RIGHT_SIGNAL = 30, SENSOR_CLIFF_RIGHT_SIGNAL = 31, SENSOR_CARGO_BAY_DIGITAL_INPUT = 32, SENSOR_CARGO_BAY_ANALOG_SIGNAL = 33, SENSOR_CHARGING_SOURCES_AVAILABLE = 34, SENSOR_OI_MODE = 35, SENSOR_SONG_NUMBER = 36, SENSOR_SONG_PLAYING = 37, SENSOR_NUMBER_STREAM_PACKETS = 38, SENSOR_REQUESTED_VELOCITY = 39, SENSOR_REQUESTED_RADIUS = 40, SENSOR_REQUESTED_RIGHT_VELOCITY = 41, SENSOR_REQUESTED_LEFT_VELOCITY = 42 } |
Enumerate available sensor packets. More... | |
typedef std::pair< unsigned char, unsigned char > | note_t |
Define a song note (frequency, duration). | |
typedef std::vector< note_t > | song_t |
Define a song (a list of notes). | |
typedef std::vector< unsigned char > | opcodes_t |
Define a vector of opcodes and arguments (a script). | |
typedef std::vector< SensorPacket > | sensorPackets_t |
Define a vector of sensor packets. | |
typedef std::queue< SensorPacket > | queriedPackets_t |
typedef std::pair< unsigned char, unsigned char > | note_t |
Define a song note (frequency, duration). | |
typedef std::vector< note_t > | song_t |
Define a song (a list of notes). | |
typedef std::vector< unsigned char > | opcodes_t |
Define a vector of opcodes and arguments (a script). | |
typedef std::vector< SensorPacket > | sensorPackets_t |
Define a vector of sensor packets. | |
typedef std::queue< SensorPacket > | queriedPackets_t |
Public Member Functions | |
Create (std::iostream &stream) throw (InvalidArgument) | |
Construct an instance of Create. | |
Create (LibSerial::SerialStream &stream) throw (InvalidArgument, LibSerialNotAvailable) | |
Construct an instance of Create using serial port communication. | |
~Create () throw () | |
Destroy an instance of Create. | |
void | sendBaudCommand (Baud speed) throw (CommandNotAvailable, InvalidArgument) |
Change the communication speed. After changing the communication speed, it is required to wait at least 100ms. | |
void | sendStartCommand () |
Switch to passive mode. Automatically done when the class is instanciated. | |
void | sendSafeCommand () throw (CommandNotAvailable) |
Switch to safe mode. | |
void | sendFullCommand () throw (CommandNotAvailable) |
Switch to full mode. | |
void | sendDemoCommand (Demo demo) throw (CommandNotAvailable, InvalidArgument) |
Run a built-in demo. | |
void | sendDriveCommand (short v, short r) throw (CommandNotAvailable, InvalidArgument) |
Drive the robot. | |
void | sendDriveCommand (short v, DriveCommand dc) throw (CommandNotAvailable, InvalidArgument) |
Drive the robot using a special drigin mode. | |
void | sendDriveDirectCommand (short vr, short vl) throw (CommandNotAvailable, InvalidArgument) |
Drive the two wheels separately. | |
void | sendLedCommand (Led l, unsigned char c, unsigned char i) throw (CommandNotAvailable, InvalidArgument) |
Change led status. | |
void | sendDigitalOutputsCommand (bool d1, bool d2, bool d3) throw (CommandNotAvailable) |
Change the digital output values. | |
void | sendPwmLowSideDriversCommand (unsigned char lsd1, unsigned char lsd2, unsigned char lsd3) throw (CommandNotAvailable, InvalidArgument) |
Drive low side drivers with variable power. | |
void | sendLowSideDriversCommand (bool lsd1, bool lsd2, bool lsd3) throw (CommandNotAvailable) |
Switch on/off low side drivers. | |
void | sendIrCommand (unsigned char v) throw (CommandNotAvailable) |
Send an IR command on low side driver 1. The data will be encoded using the iRobot's Create receiver format. | |
void | sendSongCommand (unsigned char sid, const song_t &song) throw (CommandNotAvailable, InvalidArgument) |
Define a song. | |
void | sendPlaySongCommand (unsigned char sid) throw (CommandNotAvailable, InvalidArgument) |
Play a song. | |
void | sendSensorsCommand (SensorPacket sp) throw (CommandNotAvailable, InvalidArgument) |
Request the robot to send a particular sensor packet. | |
void | sendQueryListCommand (const sensorPackets_t &lsp) throw (CommandNotAvailable, InvalidArgument) |
Request the robot to send a list of sensor packets. | |
void | sendStreamCommand (const sensorPackets_t &lsp) throw (CommandNotAvailable, InvalidArgument) |
Request the robot to start streaming some sensor packets. After the streaming is started, the requested values will be sent every 15ms. | |
void | sendPauseStreamCommand (StreamState st) throw (CommandNotAvailable, InvalidArgument) |
Pause or resume sensor streaming. | |
void | sendScriptCommand (const opcodes_t &script) throw (CommandNotAvailable, InvalidArgument) |
Send a script. | |
void | sendPlayScriptCommand () throw (CommandNotAvailable) |
Play the current stored script. | |
void | sendShowScriptCommand () throw (CommandNotAvailable) |
Show the stored script. | |
void | sendWaitTimeCommand (unsigned char t) throw (CommandNotAvailable) |
Make the robot wait for a specific amount of time. | |
void | sendWaitDistanceCommand (short d) throw (CommandNotAvailable) |
Make the robot wait until it travelled a certain distance. | |
void | sendWaitAngleCommand (short a) throw (CommandNotAvailable) |
Make the robot wait until it has rotated enough. | |
void | sendWaitEventCommand (Event e, EventState es=EVENT_OCCURRING) throw (CommandNotAvailable, InvalidArgument) |
Make the robot wait for a specific event. | |
void | updateSensors () |
Read the stream to update sensors values. This handles both streamed data and specific queries through querylist or sensors commands. | |
void | readStream () |
Read streamed sensors and update sensors values. | |
Mode | mode () throw () |
bool | wheeldropCaster () |
bool | wheeldropLeft () |
bool | wheeldropRight () |
bool | bumpLeft () |
bool | bumpRight () |
bool | wall () |
Get wall sensor value. | |
bool | cliffLeft () |
bool | cliffFrontLeft () |
bool | cliffFrontRight () |
bool | cliffRight () |
bool | deviceDetect () |
bool | digitalInput3 () |
bool | digitalInput2 () |
bool | digitalInput1 () |
bool | digitalInput0 () |
short | analogSignal () |
bool | homeBaseChargerAvailable () |
bool | internalChargerAvailable () |
bool | virtualWall () |
bool | leftWheelOvercurrent () |
bool | rightWheelOvercurrent () |
bool | ld2Overcurrent () |
bool | ld1Overcurrent () |
bool | ld0Overcurrent () |
unsigned char | ir () |
bool | advanceButton () |
bool | playButton () |
short | distance () |
short | angle () |
ChargingState | chargingState () |
short | batteryVoltage () |
short | batteryCurrent () |
short | batteryTemperature () |
short | batteryCharge () |
short | batteryCapacity () |
short | wallSignal () |
short | cliffLeftSignal () |
short | cliffFrontLeftSignal () |
short | cliffFrontRightSignal () |
short | cliffRightSignal () |
unsigned char | songNumber () |
bool | songPlaying () |
unsigned char | streamPackets () |
short | requestedVelocity () |
short | requestedRadius () |
short | requestedLeftVelocity () |
short | requestedRightVelocity () |
Create (std::iostream &stream) throw (InvalidArgument) | |
Construct an instance of Create. | |
Create (LibSerial::SerialStream &stream) throw (InvalidArgument, LibSerialNotAvailable) | |
Construct an instance of Create using serial port communication. | |
~Create () throw () | |
Destroy an instance of Create. | |
void | sendBaudCommand (Baud speed) throw (CommandNotAvailable, InvalidArgument) |
Change the communication speed. After changing the communication speed, it is required to wait at least 100ms. | |
void | sendStartCommand () |
Switch to passive mode. Automatically done when the class is instanciated. | |
void | sendSafeCommand () throw (CommandNotAvailable) |
Switch to safe mode. | |
void | sendFullCommand () throw (CommandNotAvailable) |
Switch to full mode. | |
void | sendDemoCommand (Demo demo) throw (CommandNotAvailable, InvalidArgument) |
Run a built-in demo. | |
void | sendDriveCommand (short v, short r) throw (CommandNotAvailable, InvalidArgument) |
Drive the robot. | |
void | sendDriveCommand (short v, DriveCommand dc) throw (CommandNotAvailable, InvalidArgument) |
Drive the robot using a special drigin mode. | |
void | sendDriveDirectCommand (short vr, short vl) throw (CommandNotAvailable, InvalidArgument) |
Drive the two wheels separately. | |
void | sendLedCommand (Led l, unsigned char c, unsigned char i) throw (CommandNotAvailable, InvalidArgument) |
Change led status. | |
void | sendDigitalOutputsCommand (bool d1, bool d2, bool d3) throw (CommandNotAvailable) |
Change the digital output values. | |
void | sendPwmLowSideDriversCommand (unsigned char lsd1, unsigned char lsd2, unsigned char lsd3) throw (CommandNotAvailable, InvalidArgument) |
Drive low side drivers with variable power. | |
void | sendLowSideDriversCommand (bool lsd1, bool lsd2, bool lsd3) throw (CommandNotAvailable) |
Switch on/off low side drivers. | |
void | sendIrCommand (unsigned char v) throw (CommandNotAvailable) |
Send an IR command on low side driver 1. The data will be encoded using the iRobot's Create receiver format. | |
void | sendSongCommand (unsigned char sid, const song_t &song) throw (CommandNotAvailable, InvalidArgument) |
Define a song. | |
void | sendPlaySongCommand (unsigned char sid) throw (CommandNotAvailable, InvalidArgument) |
Play a song. | |
void | sendSensorsCommand (SensorPacket sp) throw (CommandNotAvailable, InvalidArgument) |
Request the robot to send a particular sensor packet. | |
void | sendQueryListCommand (const sensorPackets_t &lsp) throw (CommandNotAvailable, InvalidArgument) |
Request the robot to send a list of sensor packets. | |
void | sendStreamCommand (const sensorPackets_t &lsp) throw (CommandNotAvailable, InvalidArgument) |
Request the robot to start streaming some sensor packets. After the streaming is started, the requested values will be sent every 15ms. | |
void | sendPauseStreamCommand (StreamState st) throw (CommandNotAvailable, InvalidArgument) |
Pause or resume sensor streaming. | |
void | sendScriptCommand (const opcodes_t &script) throw (CommandNotAvailable, InvalidArgument) |
Send a script. | |
void | sendPlayScriptCommand () throw (CommandNotAvailable) |
Play the current stored script. | |
void | sendShowScriptCommand () throw (CommandNotAvailable) |
Show the stored script. | |
void | sendWaitTimeCommand (unsigned char t) throw (CommandNotAvailable) |
Make the robot wait for a specific amount of time. | |
void | sendWaitDistanceCommand (short d) throw (CommandNotAvailable) |
Make the robot wait until it travelled a certain distance. | |
void | sendWaitAngleCommand (short a) throw (CommandNotAvailable) |
Make the robot wait until it has rotated enough. | |
void | sendWaitEventCommand (Event e, EventState es=EVENT_OCCURRING) throw (CommandNotAvailable, InvalidArgument) |
Make the robot wait for a specific event. | |
void | updateSensors () |
Read the stream to update sensors values. This handles both streamed data and specific queries through querylist or sensors commands. | |
void | readStream () |
Read streamed sensors and update sensors values. | |
Mode | mode () throw () |
bool | wheeldropCaster () |
bool | wheeldropLeft () |
bool | wheeldropRight () |
bool | bumpLeft () |
bool | bumpRight () |
bool | wall () |
Get wall sensor value. | |
bool | cliffLeft () |
bool | cliffFrontLeft () |
bool | cliffFrontRight () |
bool | cliffRight () |
bool | deviceDetect () |
bool | digitalInput3 () |
bool | digitalInput2 () |
bool | digitalInput1 () |
bool | digitalInput0 () |
short | analogSignal () |
bool | homeBaseChargerAvailable () |
bool | internalChargerAvailable () |
bool | virtualWall () |
bool | leftWheelOvercurrent () |
bool | rightWheelOvercurrent () |
bool | ld2Overcurrent () |
bool | ld1Overcurrent () |
bool | ld0Overcurrent () |
unsigned char | ir () |
bool | advanceButton () |
bool | playButton () |
short | distance () |
short | angle () |
ChargingState | chargingState () |
short | batteryVoltage () |
short | batteryCurrent () |
short | batteryTemperature () |
short | batteryCharge () |
short | batteryCapacity () |
short | wallSignal () |
short | cliffLeftSignal () |
short | cliffFrontLeftSignal () |
short | cliffFrontRightSignal () |
short | cliffRightSignal () |
unsigned char | songNumber () |
bool | songPlaying () |
unsigned char | streamPackets () |
short | requestedVelocity () |
short | requestedRadius () |
short | requestedLeftVelocity () |
short | requestedRightVelocity () |
Static Public Attributes | |
static const unsigned char | LED_COLOR_GREEN = 0 |
Define the green color for power led. | |
static const unsigned char | LED_COLOR_RED = 255 |
Define the red color for power led. | |
static const unsigned char | LED_INTENSITY_OFF = 0 |
Define minimum intensity for power led (off). | |
static const unsigned char | LED_INTENSITY_FULL = 255 |
Define full intensity for power led. | |
static const unsigned char | LOW_SIDE_VELOCITY_MIN = 0 |
Define minimum velocity for low side drivers. | |
static const unsigned char | LOW_SIDE_VELOCITY_MAX = 128 |
Define maximum velocity for low side drivers. | |
static const int | VELOCITY_MIN = -500 |
Define minimum velocity for robot wheels motors. | |
static const int | VELOCITY_MAX = 500 |
Define maximum velocity for robot wheels motors. | |
static const int | RADIUS_MIN = -2000 |
Define minimum radius turn of the robot. | |
static const int | RADIUS_MAX = 2000 |
Define maximum radius turn of the robot. | |
static const unsigned char | SONG_MIN = 0 |
Define minimum song id. | |
static const unsigned char | SONG_MAX = 15 |
Define maximum song id. | |
static const unsigned char | SONG_MAX_SIZE = 16 |
Define song maximum size. | |
static const unsigned char | NO_NOTE = 30 |
Define the value for a rest node (no sound). | |
static const unsigned char | NOTE_MIN = 31 |
Define the minimum note (G). | |
static const unsigned char | NOTE_MAX = 127 |
Define the maximum note (G). | |
static const unsigned char | SCRIPT_MAX_SIZE = 100 |
Define maximum script size. | |
static const unsigned char | STREAM_HEADER = 19 |
Stream header ``magic value''. | |
static const unsigned char | SENSOR_BIT_WHEELDROP_CASTER = 4 |
Bit used to retrieve the wheeldrop caster status. | |
static const unsigned char | SENSOR_BIT_WHEELDROP_LEFT = 3 |
Bit used to retrieve the wheeldrop caster status. | |
static const unsigned char | SENSOR_BIT_WHEELDROP_RIGHT = 2 |
Bit used to retrieve the wheeldrop caster status. | |
static const unsigned char | SENSOR_BIT_BUMP_LEFT = 1 |
Bit used to retrieve the bump left status. | |
static const unsigned char | SENSOR_BIT_BUMP_RIGHT = 0 |
Bit used to retrieve the bump right status. | |
static const unsigned char | SENSOR_BIT_LEFTWHEELOVERCURRENT = 4 |
Bit used to retrieve the left wheel overcurrent status. | |
static const unsigned char | SENSOR_BIT_RIGHTWHEELOVERCURRENT = 3 |
Bit used to retrieve the right wheel overcurrent status. | |
static const unsigned char | SENSOR_BIT_LD2OVERCURRENT = 2 |
Bit used to retrieve the LD2 overcurrent status. | |
static const unsigned char | SENSOR_BIT_LD1OVERCURRENT = 1 |
Bit used to retrieve the LD1 overcurrent status. | |
static const unsigned char | SENSOR_BIT_LD0OVERCURRENT = 0 |
Bit used to retrieve the LD0 overcurrent status. | |
static const unsigned char | SENSOR_BIT_ADVANCEBUTTON = 2 |
Bit used to retrieve the advance button status. | |
static const unsigned char | SENSOR_BIT_PLAYBUTTON = 0 |
Bit used to retrieve the play button status. | |
static const unsigned char | SENSOR_BIT_DEVICEDETECT = 4 |
Bit used to retrieve the device detect pin status. | |
static const unsigned char | SENSOR_BIT_DIGITALINPUT3 = 3 |
Bit used to retrieve the digital input 3 pin status. | |
static const unsigned char | SENSOR_BIT_DIGITALINPUT2 = 2 |
Bit used to retrieve the digital input 2 pin status. | |
static const unsigned char | SENSOR_BIT_DIGITALINPUT1 = 1 |
Bit used to retrieve the digital input 1 pin status. | |
static const unsigned char | SENSOR_BIT_DIGITALINPUT0 = 0 |
Bit used to retrieve the digital input 0 pin status. | |
static const unsigned char | SENSOR_BIT_HOMEBASECHARGERAVAILABLE = 1 |
Bit used to retrieve whether the home base charger is available or not. | |
static const unsigned char | SENSOR_BIT_INTERNALCHARGERAVAILABLE = 0 |
Bit used to retrieve whether the internal charger is available or not. | |
Protected Member Functions | |
bool | readSensorPacket () |
Read a specific sensor packet and update sensors values. The next expected sensor packet will be read. | |
bool | readSensorPacket (SensorPacket, std::istream &) |
Read sensor packet on a specified stream, update sensor values. | |
bool | readSensorPacket () |
Read a specific sensor packet and update sensors values. The next expected sensor packet will be read. | |
bool | readSensorPacket (SensorPacket, std::istream &) |
Read sensor packet on a specified stream, update sensor values. |
This class allows easy and safe communication with an iRobot Create robot. When this class is instanciated, the specified std::iostream will be used for the communication.
After being initialized, the object automatically set the robot into the passive mode.
typedef std::pair<unsigned char, unsigned char> iRobot::Create::note_t |
Define a song note (frequency, duration).
typedef std::vector<note_t> iRobot::Create::song_t |
typedef std::vector<unsigned char> iRobot::Create::opcodes_t |
typedef std::vector<SensorPacket> iRobot::Create::sensorPackets_t |
typedef std::queue<SensorPacket> iRobot::Create::queriedPackets_t |
typedef std::pair<unsigned char, unsigned char> iRobot::Create::note_t |
Define a song note (frequency, duration).
typedef std::vector<note_t> iRobot::Create::song_t |
typedef std::vector<unsigned char> iRobot::Create::opcodes_t |
typedef std::vector<SensorPacket> iRobot::Create::sensorPackets_t |
typedef std::queue<SensorPacket> iRobot::Create::queriedPackets_t |
enum iRobot::Create::Mode |
iRobot Create modes The mode defines which commands are available and how the robot behaves when some events happens like wheel drop or if a cliff is detected.
IROBOT_CREATE_OFF |
Start-up mode, no command can be sent except start.
|
IROBOT_CREATE_PASSIVE | Passive mode, actuators can not be controlled. |
IROBOT_CREATE_SAFE | Safe mode, all commands are available. iRobot Create will stop if the wheels are dropped, if a cliff is detected or if the charger is plugged in and powered. |
IROBOT_CREATE_FULL | Full mode, all commands are available. No safety check is done in this mode. The robot may fall from cliffs and will keep running if the wheels are dropped. |
IROBOT_CREATE_OFF |
Start-up mode, no command can be sent except start.
|
IROBOT_CREATE_PASSIVE | Passive mode, actuators can not be controlled. |
IROBOT_CREATE_SAFE | Safe mode, all commands are available. iRobot Create will stop if the wheels are dropped, if a cliff is detected or if the charger is plugged in and powered. |
IROBOT_CREATE_FULL | Full mode, all commands are available. No safety check is done in this mode. The robot may fall from cliffs and will keep running if the wheels are dropped. |
00100 { 00103 IROBOT_CREATE_OFF, 00105 IROBOT_CREATE_PASSIVE, 00110 IROBOT_CREATE_SAFE, 00115 IROBOT_CREATE_FULL 00116 };
enum iRobot::Create::Baud |
Enumerate all possible communication speeds.
00120 { 00122 BAUD_300 = 0, 00124 BAUD_600 = 1, 00126 BAUD_1200 = 2, 00128 BAUD_2400 = 3, 00130 BAUD_4800 = 4, 00132 BAUD_9600 = 5, 00134 BAUD_14400 = 6, 00136 BAUD_19200 = 7, 00138 BAUD_28800 = 8, 00140 BAUD_38400 = 9, 00142 BAUD_57600 = 10, 00145 BAUD_115200 = 11 00146 };
enum iRobot::Create::Demo |
Enumerate built-in demos.
DEMO_COVER | iRobot Create covers an entire room using a combination of behaviors,such as bouncing off of walls, following walls, and spiraling. |
DEMO_COVER_AND_DOCK | Identical to the Cover demo, with one exception; if iRobot Create sees the Home Base’s* infrared signals, it uses these to move towards the Home Base and dock with it. |
DEMO_SPOT_COVER | iRobot Create spirals outward, then inward, to cover an area around its starting position. |
DEMO_MOUSE | iRobot Create tries to follow around the edges of a room using its wall sensor and bumper. |
DEMO_DRIVE_FIGURE_EIGHT | iRobot Create continuously drives in a figure 8 pattern. |
DEMO_WIMP | iRobot Create drives forward when pushed from behind. If iRobot Create hits an obstacle while driving, it drives away from the obstacle. |
DEMO_HOME | iRobot Create drives toward a Virtual Wall when the back and sides of its Omnidirectional IR Receiver are covered with black electrical tape. When it touches the Virtual Wall or another obstacle, it stops. |
DEMO_TAG | Identical to the Home demo, except iRobot Create goes back and forth between multiple Virtual Walls by bumping into one, turning around, driving to the next Virtual Wall, bumping into it and turning around to bump into the next Virtual Wall. |
DEMO_PACHELBEL | iRobot Create plays the notes of Pachelbel’s Canon in sequence when its cliff sensors are activated. |
DEMO_BANJO | iRobot Create’s four cliff sensors play the notes of a chord, depending on how the bumper is pressed: No bumper: G major Right or left bumper: D major7 Both bumpers (center): C major |
DEMO_ABORT | Abort current running demo. |
DEMO_COVER | iRobot Create covers an entire room using a combination of behaviors,such as bouncing off of walls, following walls, and spiraling. |
DEMO_COVER_AND_DOCK | Identical to the Cover demo, with one exception; if iRobot Create sees the Home Base’s* infrared signals, it uses these to move towards the Home Base and dock with it. |
DEMO_SPOT_COVER | iRobot Create spirals outward, then inward, to cover an area around its starting position. |
DEMO_MOUSE | iRobot Create tries to follow around the edges of a room using its wall sensor and bumper. |
DEMO_DRIVE_FIGURE_EIGHT | iRobot Create continuously drives in a figure 8 pattern. |
DEMO_WIMP | iRobot Create drives forward when pushed from behind. If iRobot Create hits an obstacle while driving, it drives away from the obstacle. |
DEMO_HOME | iRobot Create drives toward a Virtual Wall when the back and sides of its Omnidirectional IR Receiver are covered with black electrical tape. When it touches the Virtual Wall or another obstacle, it stops. |
DEMO_TAG | Identical to the Home demo, except iRobot Create goes back and forth between multiple Virtual Walls by bumping into one, turning around, driving to the next Virtual Wall, bumping into it and turning around to bump into the next Virtual Wall. |
DEMO_PACHELBEL | iRobot Create plays the notes of Pachelbel’s Canon in sequence when its cliff sensors are activated. |
DEMO_BANJO | iRobot Create’s four cliff sensors play the notes of a chord, depending on how the bumper is pressed: No bumper: G major Right or left bumper: D major7 Both bumpers (center): C major |
DEMO_ABORT | Abort current running demo. |
00150 { 00154 DEMO_COVER = 0, 00155 00159 DEMO_COVER_AND_DOCK = 1, 00160 00163 DEMO_SPOT_COVER = 2, 00164 00167 DEMO_MOUSE = 3, 00168 00170 DEMO_DRIVE_FIGURE_EIGHT = 4, 00171 00175 DEMO_WIMP = 5, 00176 00181 DEMO_HOME = 6, 00182 00187 DEMO_TAG = 7, 00188 00191 DEMO_PACHELBEL = 8, 00192 00198 DEMO_BANJO = 9, 00199 00201 DEMO_ABORT = 255 00202 };
Enumerates special driving commands.
00206 { 00208 DRIVE_STRAIGHT, 00210 DRIVE_INPLACE_CLOCKWISE, 00212 DRIVE_INPLACE_COUNTERCLOCKWISE 00213 };
enum iRobot::Create::Led |
Enumerate available leds (and combinations). The power led is not in this list because it is handled differently (as its color is not fixed).
LED_NONE | No led. |
LED_PLAY | Play led only. |
LED_ADVANCE | Advance led only. |
LED_ALL | All leds. |
LED_NONE | No led. |
LED_PLAY | Play led only. |
LED_ADVANCE | Advance led only. |
LED_ALL | All leds. |
00219 { 00221 LED_NONE = 0, 00223 LED_PLAY = 2, 00225 LED_ADVANCE = 8, 00227 LED_ALL = LED_PLAY | LED_ADVANCE 00228 };
Activate or disable sensor streaming.
STREAM_STATE_OFF | Disable sensor streaming. |
STREAM_STATE_ON | Activate sensor streaming. |
STREAM_STATE_OFF | Disable sensor streaming. |
STREAM_STATE_ON | Activate sensor streaming. |
00232 { 00234 STREAM_STATE_OFF = 0, 00236 STREAM_STATE_ON = 1 00237 };
Enumerate possible charging states.
00241 { 00242 CHARGING_STATE_NOT_CHARGING = 0, 00243 CHARGING_STATE_RECONDITIONING_CHARGING = 1, 00244 CHARGING_STATE_FULL_CHARGING = 2, 00245 CHARGING_STATE_TRICKLE_CHARGING = 3, 00246 CHARGING_STATE_WAITING = 4, 00247 CHARGING_STATE_CHARGING_FAULT_CONDITION = 5 00248 00249 };
Enumerate available events.
00253 { 00255 EVENT_WHEEL_DROP = 1, 00257 EVENT_FRONT_WHEEL_DROP = 2, 00259 EVENT_LEFT_WHEEL_DROP = 3, 00261 EVENT_RIGHT_WHEEL_DROP = 4, 00263 EVENT_BUMP = 5, 00265 EVENT_LEFT_BUMP = 6, 00267 EVENT_RIGHT_BUMP = 7, 00269 EVENT_VIRTUAL_WALL = 8, 00271 EVENT_WALL = 9, 00273 EVENT_CLIFF = 10, 00275 EVENT_LEFT_CLIFF = 11, 00277 EVENT_FRONT_LEFT_CLIFF = 12, 00279 EVENT_FRONT_RIGHT_CLIFF = 13, 00281 EVENT_RIGHT_CLIFF = 14, 00283 EVENT_HOME_BASE = 15, 00285 EVENT_ADVANCE_BUTTON = 16, 00287 EVENT_PLAY_BUTTON = 17, 00289 EVENT_DIGITAL_INPUT_0 = 18, 00291 EVENT_DIGITAL_INPUT_1 = 19, 00293 EVENT_DIGITAL_INPUT_2 = 20, 00295 EVENT_DIGITAL_INPUT_3 = 21, 00297 EVENT_OI_MODE_PASSIVE = 22 00298 };
Indicate an event state.
00302 { 00304 EVENT_OCCURRING, 00306 EVENT_NOT_OCCURRING 00307 };
Enumerate available opcodes. Opcode are the basics instructions that the protocol support. This class wraps them to avoid using them directly. The only case where you have to use them is when you want to send an Open Interface script.
00315 { 00317 OPCODE_START = 128, 00319 OPCODE_BAUD = 129, 00321 OPCODE_CONTROL = 130, 00323 OPCODE_SAFE = 131, 00325 OPCODE_FULL = 132, 00327 OPCODE_SPOT = 134, 00329 OPCODE_COVER = 135, 00331 OPCODE_DEMO = 136, 00333 OPCODE_DRIVE = 137, 00335 OPCODE_LOW_SIDE_DRIVERS = 138, 00337 OPCODE_LEDS = 139, 00339 OPCODE_SONG = 140, 00341 OPCODE_PLAY = 141, 00343 OPCODE_SENSORS = 142, 00345 OPCODE_COVER_AND_DOCK = 143, 00347 OPCODE_PWM_LOW_SIDE_DRIVERS = 144, 00349 OPCODE_DRIVE_DIRECT = 145, 00351 OPCODE_DIGITAL_OUTPUTS = 147, 00353 OPCODE_STREAM = 148, 00355 OPCODE_QUERY_LIST = 149, 00357 OPCODE_PAUSE_RESUME_STREAM = 150, 00359 OPCODE_SEND_IR = 151, 00361 OPCODE_SCRIPT = 152, 00363 OPCODE_PLAY_SCRIPT = 153, 00365 OPCODE_SHOW_SCRIPT = 154, 00367 OPCODE_WAIT_TIME = 155, 00369 OPCODE_WAIT_DISTANCE = 156, 00371 OPCODE_WAIT_ANGLE = 157, 00373 OPCODE_WAIT_EVENT = 158 00374 };
Enumerate available sensor packets.
00378 { 00380 SENSOR_GROUP_0 = 0, 00382 SENSOR_GROUP_1 = 1, 00384 SENSOR_GROUP_2 = 2, 00386 SENSOR_GROUP_3 = 3, 00388 SENSOR_GROUP_4 = 4, 00390 SENSOR_GROUP_5 = 5, 00392 SENSOR_GROUP_6 = 6, 00394 SENSOR_BUMPS_WHEELS_DROPS = 7, 00396 SENSOR_WALL = 8, 00398 SENSOR_CLIFF_LEFT = 9, 00400 SENSOR_CLIFF_FRONT_LEFT = 10, 00402 SENSOR_CLIFF_FRONT_RIGHT = 11, 00404 SENSOR_CLIFF_RIGHT = 12, 00406 SENSOR_VIRTUAL_WALL = 13, 00408 SENSOR_OVERCURRENTS = 14, 00410 SENSOR_IR = 17, 00412 SENSOR_BUTTONS = 18, 00414 SENSOR_DISTANCE = 19, 00416 SENSOR_ANGLE = 20, 00418 SENSOR_CHARGING_STATE = 21, 00420 SENSOR_VOLTAGE = 22, 00422 SENSOR_CURRENT = 23, 00424 SENSOR_BATTERY_TEMPERATURE = 24, 00426 SENSOR_BATTERY_CHARGE = 25, 00428 SENSOR_BATTERY_CAPACITY = 26, 00430 SENSOR_WALL_SIGNAL = 27, 00432 SENSOR_CLIFF_LEFT_SIGNAL = 28, 00434 SENSOR_CLIFF_FRONT_LEFT_SIGNAL = 29, 00436 SENSOR_CLIFF_FRONT_RIGHT_SIGNAL = 30, 00438 SENSOR_CLIFF_RIGHT_SIGNAL = 31, 00440 SENSOR_CARGO_BAY_DIGITAL_INPUT = 32, 00442 SENSOR_CARGO_BAY_ANALOG_SIGNAL = 33, 00444 SENSOR_CHARGING_SOURCES_AVAILABLE = 34, 00446 SENSOR_OI_MODE = 35, 00448 SENSOR_SONG_NUMBER = 36, 00450 SENSOR_SONG_PLAYING = 37, 00452 SENSOR_NUMBER_STREAM_PACKETS = 38, 00454 SENSOR_REQUESTED_VELOCITY = 39, 00456 SENSOR_REQUESTED_RADIUS = 40, 00458 SENSOR_REQUESTED_RIGHT_VELOCITY = 41, 00460 SENSOR_REQUESTED_LEFT_VELOCITY = 42 00461 };
enum iRobot::Create::Mode |
iRobot Create modes The mode defines which commands are available and how the robot behaves when some events happens like wheel drop or if a cliff is detected.
IROBOT_CREATE_OFF |
Start-up mode, no command can be sent except start.
|
IROBOT_CREATE_PASSIVE | Passive mode, actuators can not be controlled. |
IROBOT_CREATE_SAFE | Safe mode, all commands are available. iRobot Create will stop if the wheels are dropped, if a cliff is detected or if the charger is plugged in and powered. |
IROBOT_CREATE_FULL | Full mode, all commands are available. No safety check is done in this mode. The robot may fall from cliffs and will keep running if the wheels are dropped. |
IROBOT_CREATE_OFF |
Start-up mode, no command can be sent except start.
|
IROBOT_CREATE_PASSIVE | Passive mode, actuators can not be controlled. |
IROBOT_CREATE_SAFE | Safe mode, all commands are available. iRobot Create will stop if the wheels are dropped, if a cliff is detected or if the charger is plugged in and powered. |
IROBOT_CREATE_FULL | Full mode, all commands are available. No safety check is done in this mode. The robot may fall from cliffs and will keep running if the wheels are dropped. |
00100 { 00103 IROBOT_CREATE_OFF, 00105 IROBOT_CREATE_PASSIVE, 00110 IROBOT_CREATE_SAFE, 00115 IROBOT_CREATE_FULL 00116 };
enum iRobot::Create::Baud |
Enumerate all possible communication speeds.
00120 { 00122 BAUD_300 = 0, 00124 BAUD_600 = 1, 00126 BAUD_1200 = 2, 00128 BAUD_2400 = 3, 00130 BAUD_4800 = 4, 00132 BAUD_9600 = 5, 00134 BAUD_14400 = 6, 00136 BAUD_19200 = 7, 00138 BAUD_28800 = 8, 00140 BAUD_38400 = 9, 00142 BAUD_57600 = 10, 00145 BAUD_115200 = 11 00146 };
enum iRobot::Create::Demo |
Enumerate built-in demos.
DEMO_COVER | iRobot Create covers an entire room using a combination of behaviors,such as bouncing off of walls, following walls, and spiraling. |
DEMO_COVER_AND_DOCK | Identical to the Cover demo, with one exception; if iRobot Create sees the Home Base’s* infrared signals, it uses these to move towards the Home Base and dock with it. |
DEMO_SPOT_COVER | iRobot Create spirals outward, then inward, to cover an area around its starting position. |
DEMO_MOUSE | iRobot Create tries to follow around the edges of a room using its wall sensor and bumper. |
DEMO_DRIVE_FIGURE_EIGHT | iRobot Create continuously drives in a figure 8 pattern. |
DEMO_WIMP | iRobot Create drives forward when pushed from behind. If iRobot Create hits an obstacle while driving, it drives away from the obstacle. |
DEMO_HOME | iRobot Create drives toward a Virtual Wall when the back and sides of its Omnidirectional IR Receiver are covered with black electrical tape. When it touches the Virtual Wall or another obstacle, it stops. |
DEMO_TAG | Identical to the Home demo, except iRobot Create goes back and forth between multiple Virtual Walls by bumping into one, turning around, driving to the next Virtual Wall, bumping into it and turning around to bump into the next Virtual Wall. |
DEMO_PACHELBEL | iRobot Create plays the notes of Pachelbel’s Canon in sequence when its cliff sensors are activated. |
DEMO_BANJO | iRobot Create’s four cliff sensors play the notes of a chord, depending on how the bumper is pressed: No bumper: G major Right or left bumper: D major7 Both bumpers (center): C major |
DEMO_ABORT | Abort current running demo. |
DEMO_COVER | iRobot Create covers an entire room using a combination of behaviors,such as bouncing off of walls, following walls, and spiraling. |
DEMO_COVER_AND_DOCK | Identical to the Cover demo, with one exception; if iRobot Create sees the Home Base’s* infrared signals, it uses these to move towards the Home Base and dock with it. |
DEMO_SPOT_COVER | iRobot Create spirals outward, then inward, to cover an area around its starting position. |
DEMO_MOUSE | iRobot Create tries to follow around the edges of a room using its wall sensor and bumper. |
DEMO_DRIVE_FIGURE_EIGHT | iRobot Create continuously drives in a figure 8 pattern. |
DEMO_WIMP | iRobot Create drives forward when pushed from behind. If iRobot Create hits an obstacle while driving, it drives away from the obstacle. |
DEMO_HOME | iRobot Create drives toward a Virtual Wall when the back and sides of its Omnidirectional IR Receiver are covered with black electrical tape. When it touches the Virtual Wall or another obstacle, it stops. |
DEMO_TAG | Identical to the Home demo, except iRobot Create goes back and forth between multiple Virtual Walls by bumping into one, turning around, driving to the next Virtual Wall, bumping into it and turning around to bump into the next Virtual Wall. |
DEMO_PACHELBEL | iRobot Create plays the notes of Pachelbel’s Canon in sequence when its cliff sensors are activated. |
DEMO_BANJO | iRobot Create’s four cliff sensors play the notes of a chord, depending on how the bumper is pressed: No bumper: G major Right or left bumper: D major7 Both bumpers (center): C major |
DEMO_ABORT | Abort current running demo. |
00150 { 00154 DEMO_COVER = 0, 00155 00159 DEMO_COVER_AND_DOCK = 1, 00160 00163 DEMO_SPOT_COVER = 2, 00164 00167 DEMO_MOUSE = 3, 00168 00170 DEMO_DRIVE_FIGURE_EIGHT = 4, 00171 00175 DEMO_WIMP = 5, 00176 00181 DEMO_HOME = 6, 00182 00187 DEMO_TAG = 7, 00188 00191 DEMO_PACHELBEL = 8, 00192 00198 DEMO_BANJO = 9, 00199 00201 DEMO_ABORT = 255 00202 };
Enumerates special driving commands.
00206 { 00208 DRIVE_STRAIGHT, 00210 DRIVE_INPLACE_CLOCKWISE, 00212 DRIVE_INPLACE_COUNTERCLOCKWISE 00213 };
enum iRobot::Create::Led |
Enumerate available leds (and combinations). The power led is not in this list because it is handled differently (as its color is not fixed).
LED_NONE | No led. |
LED_PLAY | Play led only. |
LED_ADVANCE | Advance led only. |
LED_ALL | All leds. |
LED_NONE | No led. |
LED_PLAY | Play led only. |
LED_ADVANCE | Advance led only. |
LED_ALL | All leds. |
00219 { 00221 LED_NONE = 0, 00223 LED_PLAY = 2, 00225 LED_ADVANCE = 8, 00227 LED_ALL = LED_PLAY | LED_ADVANCE 00228 };
Activate or disable sensor streaming.
STREAM_STATE_OFF | Disable sensor streaming. |
STREAM_STATE_ON | Activate sensor streaming. |
STREAM_STATE_OFF | Disable sensor streaming. |
STREAM_STATE_ON | Activate sensor streaming. |
00232 { 00234 STREAM_STATE_OFF = 0, 00236 STREAM_STATE_ON = 1 00237 };
Enumerate possible charging states.
00241 { 00242 CHARGING_STATE_NOT_CHARGING = 0, 00243 CHARGING_STATE_RECONDITIONING_CHARGING = 1, 00244 CHARGING_STATE_FULL_CHARGING = 2, 00245 CHARGING_STATE_TRICKLE_CHARGING = 3, 00246 CHARGING_STATE_WAITING = 4, 00247 CHARGING_STATE_CHARGING_FAULT_CONDITION = 5 00248 00249 };
Enumerate available events.
00253 { 00255 EVENT_WHEEL_DROP = 1, 00257 EVENT_FRONT_WHEEL_DROP = 2, 00259 EVENT_LEFT_WHEEL_DROP = 3, 00261 EVENT_RIGHT_WHEEL_DROP = 4, 00263 EVENT_BUMP = 5, 00265 EVENT_LEFT_BUMP = 6, 00267 EVENT_RIGHT_BUMP = 7, 00269 EVENT_VIRTUAL_WALL = 8, 00271 EVENT_WALL = 9, 00273 EVENT_CLIFF = 10, 00275 EVENT_LEFT_CLIFF = 11, 00277 EVENT_FRONT_LEFT_CLIFF = 12, 00279 EVENT_FRONT_RIGHT_CLIFF = 13, 00281 EVENT_RIGHT_CLIFF = 14, 00283 EVENT_HOME_BASE = 15, 00285 EVENT_ADVANCE_BUTTON = 16, 00287 EVENT_PLAY_BUTTON = 17, 00289 EVENT_DIGITAL_INPUT_0 = 18, 00291 EVENT_DIGITAL_INPUT_1 = 19, 00293 EVENT_DIGITAL_INPUT_2 = 20, 00295 EVENT_DIGITAL_INPUT_3 = 21, 00297 EVENT_OI_MODE_PASSIVE = 22 00298 };
Indicate an event state.
00302 { 00304 EVENT_OCCURRING, 00306 EVENT_NOT_OCCURRING 00307 };
Enumerate available opcodes. Opcode are the basics instructions that the protocol support. This class wraps them to avoid using them directly. The only case where you have to use them is when you want to send an Open Interface script.
00315 { 00317 OPCODE_START = 128, 00319 OPCODE_BAUD = 129, 00321 OPCODE_CONTROL = 130, 00323 OPCODE_SAFE = 131, 00325 OPCODE_FULL = 132, 00327 OPCODE_SPOT = 134, 00329 OPCODE_COVER = 135, 00331 OPCODE_DEMO = 136, 00333 OPCODE_DRIVE = 137, 00335 OPCODE_LOW_SIDE_DRIVERS = 138, 00337 OPCODE_LEDS = 139, 00339 OPCODE_SONG = 140, 00341 OPCODE_PLAY = 141, 00343 OPCODE_SENSORS = 142, 00345 OPCODE_COVER_AND_DOCK = 143, 00347 OPCODE_PWM_LOW_SIDE_DRIVERS = 144, 00349 OPCODE_DRIVE_DIRECT = 145, 00351 OPCODE_DIGITAL_OUTPUTS = 147, 00353 OPCODE_STREAM = 148, 00355 OPCODE_QUERY_LIST = 149, 00357 OPCODE_PAUSE_RESUME_STREAM = 150, 00359 OPCODE_SEND_IR = 151, 00361 OPCODE_SCRIPT = 152, 00363 OPCODE_PLAY_SCRIPT = 153, 00365 OPCODE_SHOW_SCRIPT = 154, 00367 OPCODE_WAIT_TIME = 155, 00369 OPCODE_WAIT_DISTANCE = 156, 00371 OPCODE_WAIT_ANGLE = 157, 00373 OPCODE_WAIT_EVENT = 158 00374 };
Enumerate available sensor packets.
00378 { 00380 SENSOR_GROUP_0 = 0, 00382 SENSOR_GROUP_1 = 1, 00384 SENSOR_GROUP_2 = 2, 00386 SENSOR_GROUP_3 = 3, 00388 SENSOR_GROUP_4 = 4, 00390 SENSOR_GROUP_5 = 5, 00392 SENSOR_GROUP_6 = 6, 00394 SENSOR_BUMPS_WHEELS_DROPS = 7, 00396 SENSOR_WALL = 8, 00398 SENSOR_CLIFF_LEFT = 9, 00400 SENSOR_CLIFF_FRONT_LEFT = 10, 00402 SENSOR_CLIFF_FRONT_RIGHT = 11, 00404 SENSOR_CLIFF_RIGHT = 12, 00406 SENSOR_VIRTUAL_WALL = 13, 00408 SENSOR_OVERCURRENTS = 14, 00410 SENSOR_IR = 17, 00412 SENSOR_BUTTONS = 18, 00414 SENSOR_DISTANCE = 19, 00416 SENSOR_ANGLE = 20, 00418 SENSOR_CHARGING_STATE = 21, 00420 SENSOR_VOLTAGE = 22, 00422 SENSOR_CURRENT = 23, 00424 SENSOR_BATTERY_TEMPERATURE = 24, 00426 SENSOR_BATTERY_CHARGE = 25, 00428 SENSOR_BATTERY_CAPACITY = 26, 00430 SENSOR_WALL_SIGNAL = 27, 00432 SENSOR_CLIFF_LEFT_SIGNAL = 28, 00434 SENSOR_CLIFF_FRONT_LEFT_SIGNAL = 29, 00436 SENSOR_CLIFF_FRONT_RIGHT_SIGNAL = 30, 00438 SENSOR_CLIFF_RIGHT_SIGNAL = 31, 00440 SENSOR_CARGO_BAY_DIGITAL_INPUT = 32, 00442 SENSOR_CARGO_BAY_ANALOG_SIGNAL = 33, 00444 SENSOR_CHARGING_SOURCES_AVAILABLE = 34, 00446 SENSOR_OI_MODE = 35, 00448 SENSOR_SONG_NUMBER = 36, 00450 SENSOR_SONG_PLAYING = 37, 00452 SENSOR_NUMBER_STREAM_PACKETS = 38, 00454 SENSOR_REQUESTED_VELOCITY = 39, 00456 SENSOR_REQUESTED_RADIUS = 40, 00458 SENSOR_REQUESTED_RIGHT_VELOCITY = 41, 00460 SENSOR_REQUESTED_LEFT_VELOCITY = 42 00461 };
iRobot::Create::Create | ( | std::iostream & | stream | ) | throw (InvalidArgument) [explicit] |
Construct an instance of Create.
stream | Stream used for communication. |
00192 : currentMode_ (IROBOT_CREATE_OFF), 00193 stream_ (stream), 00194 INITIALIZE_SENSORS () 00195 { 00196 init (); 00197 }
iRobot::Create::Create | ( | LibSerial::SerialStream & | stream | ) | throw (InvalidArgument, LibSerialNotAvailable) [explicit] |
Construct an instance of Create using serial port communication.
stream | Stream used for communication. |
00220 : stream_ ((std::iostream&)stream) 00221 { 00222 throw LibSerialNotAvailable (); 00223 assert (0); 00224 }
iRobot::Create::~Create | ( | ) | throw () |
iRobot::Create::Create | ( | std::iostream & | stream | ) | throw (InvalidArgument) [explicit] |
iRobot::Create::Create | ( | LibSerial::SerialStream & | stream | ) | throw (InvalidArgument, LibSerialNotAvailable) [explicit] |
Construct an instance of Create using serial port communication.
stream | Stream used for communication. |
iRobot::Create::~Create | ( | ) | throw () |
Destroy an instance of Create.
void iRobot::Create::sendBaudCommand | ( | Baud | speed | ) | throw (CommandNotAvailable, InvalidArgument) |
Change the communication speed. After changing the communication speed, it is required to wait at least 100ms.
speed | New communication speed. |
HAVE_LIBSERIAL
00254 { 00255 if (currentMode_ < IROBOT_CREATE_PASSIVE) 00256 throw CommandNotAvailable (); 00257 if (baud < 0 || baud > BAUD_115200) 00258 throw InvalidArgument (); 00259 const unsigned char op = OPCODE_BAUD; 00260 const unsigned char b = baud; 00261 stream_ << op << b; 00262 stream_.flush (); 00263 00264 #ifdef HAVE_LIBSERIAL 00265 { 00266 LibSerial::SerialStream* stream = 00267 dynamic_cast<LibSerial::SerialStream*> (&stream_); 00268 if (!!stream) 00269 stream->SetBaudRate (toLibSerialBaud (baud)); 00270 } 00271 #endif 00272 00273 usleep (100 * 1000); 00274 }
void iRobot::Create::sendStartCommand | ( | ) |
Switch to passive mode. Automatically done when the class is instanciated.
00278 { 00279 if (currentMode_ != IROBOT_CREATE_OFF) 00280 return; 00281 const unsigned char op = OPCODE_START; 00282 00283 stream_ << op; 00284 stream_.flush (); 00285 currentMode_ = IROBOT_CREATE_PASSIVE; 00286 }
void iRobot::Create::sendSafeCommand | ( | ) | throw (CommandNotAvailable) |
Switch to safe mode.
00291 { 00292 if (currentMode_ < IROBOT_CREATE_PASSIVE) 00293 throw CommandNotAvailable (); 00294 const unsigned char op = OPCODE_SAFE; 00295 stream_ << op; 00296 stream_.flush (); 00297 currentMode_ = IROBOT_CREATE_SAFE; 00298 }
void iRobot::Create::sendFullCommand | ( | ) | throw (CommandNotAvailable) |
Switch to full mode.
00303 { 00304 if (currentMode_ < IROBOT_CREATE_PASSIVE) 00305 throw CommandNotAvailable (); 00306 const unsigned char op = OPCODE_FULL; 00307 stream_ << op; 00308 stream_.flush (); 00309 currentMode_ = IROBOT_CREATE_FULL; 00310 }
void iRobot::Create::sendDemoCommand | ( | Demo | demo | ) | throw (CommandNotAvailable, InvalidArgument) |
Run a built-in demo.
demo | Demo id. |
00315 { 00316 if (currentMode_ < IROBOT_CREATE_PASSIVE) 00317 throw CommandNotAvailable (); 00318 if (demo != DEMO_ABORT && (demo < 0 || demo > DEMO_BANJO)) 00319 throw InvalidArgument (); 00320 const unsigned char op = OPCODE_DEMO; 00321 const unsigned char d = demo; 00322 stream_ << op << d; 00323 stream_.flush (); 00324 currentMode_ = IROBOT_CREATE_PASSIVE; 00325 }
void iRobot::Create::sendDriveCommand | ( | short | v, | |
short | r | |||
) | throw (CommandNotAvailable, InvalidArgument) |
Drive the robot.
v | Robot's velocity. | |
r | Robot's turning radius. |
00330 { 00331 if (currentMode_ < IROBOT_CREATE_SAFE) 00332 throw CommandNotAvailable (); 00333 if (velocity < VELOCITY_MIN || velocity > VELOCITY_MAX) 00334 throw InvalidArgument (); 00335 if (radius < RADIUS_MIN || radius > RADIUS_MAX) 00336 throw InvalidArgument (); 00337 00338 const unsigned char op = OPCODE_DRIVE; 00339 00340 stream_ << op; 00341 sendInt16 (stream_, velocity); 00342 sendInt16 (stream_, radius); 00343 stream_.flush (); 00344 }
void iRobot::Create::sendDriveCommand | ( | short | v, | |
DriveCommand | dc | |||
) | throw (CommandNotAvailable, InvalidArgument) |
Drive the robot using a special drigin mode.
v | Robot's velocity. | |
dc | Special driving mode. |
00349 { 00350 if (currentMode_ < IROBOT_CREATE_SAFE) 00351 throw CommandNotAvailable (); 00352 if (velocity < VELOCITY_MIN || velocity > VELOCITY_MAX) 00353 throw InvalidArgument (); 00354 00355 int arg = 0; 00356 switch (cmd) 00357 { 00358 case DRIVE_STRAIGHT: 00359 arg = 0x8000; 00360 break; 00361 case DRIVE_INPLACE_CLOCKWISE: 00362 arg = 0xFFFF; 00363 break; 00364 case DRIVE_INPLACE_COUNTERCLOCKWISE: 00365 arg = 0x0001; 00366 break; 00367 default: 00368 throw InvalidArgument (); 00369 } 00370 00371 const unsigned char op = OPCODE_DRIVE; 00372 stream_ << op; 00373 sendInt16 (stream_, velocity); 00374 sendInt16 (stream_, arg); 00375 stream_.flush (); 00376 }
void iRobot::Create::sendDriveDirectCommand | ( | short | vr, | |
short | vl | |||
) | throw (CommandNotAvailable, InvalidArgument) |
Drive the two wheels separately.
vr | Right wheel's velocity. | |
vl | Left wheel's velocity. |
00381 { 00382 if (currentMode_ < IROBOT_CREATE_SAFE) 00383 throw CommandNotAvailable (); 00384 if (velocityL < VELOCITY_MIN || velocityL > VELOCITY_MAX) 00385 throw InvalidArgument (); 00386 if (velocityR < VELOCITY_MIN || velocityR > VELOCITY_MAX) 00387 throw InvalidArgument (); 00388 00389 const unsigned char op = OPCODE_DRIVE_DIRECT; 00390 stream_ << op; 00391 sendInt16 (stream_, velocityR); 00392 sendInt16 (stream_, velocityL); 00393 stream_.flush (); 00394 }
void iRobot::Create::sendLedCommand | ( | Led | l, | |
unsigned char | c, | |||
unsigned char | i | |||
) | throw (CommandNotAvailable, InvalidArgument) |
Change led status.
l | Switch on/off advance or play leds. | |
c | Power led color. | |
i | Power led light intensity. |
00401 { 00402 if (currentMode_ < IROBOT_CREATE_SAFE) 00403 throw CommandNotAvailable (); 00404 if (ledBits < LED_NONE || ledBits > LED_ALL) 00405 throw InvalidArgument (); 00406 00407 const unsigned char op = OPCODE_LEDS; 00408 const unsigned char b = ledBits; 00409 stream_ << op << b << powerColor << powerIntensity; 00410 stream_.flush (); 00411 }
void iRobot::Create::sendDigitalOutputsCommand | ( | bool | d1, | |
bool | d2, | |||
bool | d3 | |||
) | throw (CommandNotAvailable) |
Change the digital output values.
d1 | Switch on/off first digital output. | |
d2 | Switch on/off second digital output. | |
d3 | Switch on/off third digital output. |
00416 { 00417 if (currentMode_ < IROBOT_CREATE_SAFE) 00418 throw CommandNotAvailable (); 00419 00420 const unsigned char op = OPCODE_DIGITAL_OUTPUTS; 00421 const unsigned char v = d0 + d1 * 2 + d2 * 4; 00422 stream_ << op << v; 00423 stream_.flush (); 00424 }
void iRobot::Create::sendPwmLowSideDriversCommand | ( | unsigned char | lsd1, | |
unsigned char | lsd2, | |||
unsigned char | lsd3 | |||
) | throw (CommandNotAvailable, InvalidArgument) |
Drive low side drivers with variable power.
lsd1 | Low side driver 1 power. | |
lsd2 | Low side driver 2 power. | |
lsd3 | Low side driver 3 power. |
00431 { 00432 if (currentMode_ < IROBOT_CREATE_SAFE) 00433 throw CommandNotAvailable (); 00434 if (d1 > LOW_SIDE_VELOCITY_MAX 00435 || d2 > LOW_SIDE_VELOCITY_MAX 00436 || d3 > LOW_SIDE_VELOCITY_MAX) 00437 throw InvalidArgument (); 00438 00439 const unsigned char op = OPCODE_PWM_LOW_SIDE_DRIVERS; 00440 stream_ << op << d1 << d2 << d3; 00441 stream_.flush (); 00442 }
void iRobot::Create::sendLowSideDriversCommand | ( | bool | lsd1, | |
bool | lsd2, | |||
bool | lsd3 | |||
) | throw (CommandNotAvailable) |
Switch on/off low side drivers.
lsd1 | Switch on/off low side driver 1. | |
lsd2 | Switch on/off low side driver 2. | |
lsd3 | Switch on/off low side driver 3. |
00447 { 00448 if (currentMode_ < IROBOT_CREATE_SAFE) 00449 throw CommandNotAvailable (); 00450 00451 const unsigned char op = OPCODE_LOW_SIDE_DRIVERS; 00452 const unsigned char v = ld0 + ld1 * 2 + sd * 4; 00453 stream_ << op << v; 00454 stream_.flush (); 00455 }
void iRobot::Create::sendIrCommand | ( | unsigned char | v | ) | throw (CommandNotAvailable) |
Send an IR command on low side driver 1. The data will be encoded using the iRobot's Create receiver format.
v | Sent value. |
00460 { 00461 if (currentMode_ < IROBOT_CREATE_SAFE) 00462 throw CommandNotAvailable (); 00463 00464 const unsigned char op = OPCODE_SEND_IR; 00465 stream_ << op << v; 00466 stream_.flush (); 00467 }
void iRobot::Create::sendSongCommand | ( | unsigned char | sid, | |
const song_t & | song | |||
) | throw (CommandNotAvailable, InvalidArgument) |
Define a song.
sid | Song id. | |
song | Song to send. |
00472 { 00473 if (currentMode_ < IROBOT_CREATE_PASSIVE) 00474 throw CommandNotAvailable (); 00475 if (songN > SONG_MAX) 00476 throw InvalidArgument (); 00477 if (song.size () > SONG_MAX_SIZE) 00478 throw InvalidArgument (); 00479 00480 std::stringstream ss; 00481 for (song_t::const_iterator it = song.begin (); it != song.end (); ++it) 00482 { 00483 if (it->first < NO_NOTE || it->first > NOTE_MAX) 00484 throw InvalidArgument (); 00485 ss << it->first << it->second; 00486 } 00487 const unsigned char op = OPCODE_SONG; 00488 const unsigned char size = song.size (); 00489 stream_ << op << songN << size << ss.str (); 00490 stream_.flush (); 00491 }
void iRobot::Create::sendPlaySongCommand | ( | unsigned char | sid | ) | throw (CommandNotAvailable, InvalidArgument) |
Play a song.
sid | Sond id to play. |
00497 { 00498 if (currentMode_ < IROBOT_CREATE_SAFE) 00499 throw CommandNotAvailable (); 00500 if (v > SONG_MAX) 00501 throw InvalidArgument (); 00502 00503 const unsigned char op = OPCODE_PLAY; 00504 stream_ << op << v; 00505 stream_.flush (); 00506 }
void iRobot::Create::sendSensorsCommand | ( | SensorPacket | sp | ) | throw (CommandNotAvailable, InvalidArgument) |
Request the robot to send a particular sensor packet.
sp | Sensor packet to send. |
00513 { 00514 if (currentMode_ < IROBOT_CREATE_PASSIVE) 00515 throw CommandNotAvailable (); 00516 if (packet < SENSOR_GROUP_0 00517 || packet > SENSOR_REQUESTED_LEFT_VELOCITY) 00518 throw InvalidArgument (); 00519 00520 const unsigned char op = OPCODE_SENSORS; 00521 const unsigned char p = packet; 00522 stream_ << op << p; 00523 00524 queriedSensors_.push (packet); 00525 stream_.flush (); 00526 }
void iRobot::Create::sendQueryListCommand | ( | const sensorPackets_t & | lsp | ) | throw (CommandNotAvailable, InvalidArgument) |
Request the robot to send a list of sensor packets.
lsp | List of sensor packets to send |
00557 { 00558 MAKE_SENSOR_CMD (OPCODE_QUERY_LIST, 00559 queriedSensors_.push (*it)); 00560 }
void iRobot::Create::sendStreamCommand | ( | const sensorPackets_t & | lsp | ) | throw (CommandNotAvailable, InvalidArgument) |
Request the robot to start streaming some sensor packets. After the streaming is started, the requested values will be sent every 15ms.
lsp | List of sensor packets to stream. |
00566 { 00567 MAKE_SENSOR_CMD (OPCODE_STREAM, 00568 streamedSensors_.push_back (*it)); 00569 }
void iRobot::Create::sendPauseStreamCommand | ( | StreamState | st | ) | throw (CommandNotAvailable, InvalidArgument) |
Pause or resume sensor streaming.
st | Stream state to set. |
00576 { 00577 if (currentMode_ < IROBOT_CREATE_PASSIVE) 00578 throw CommandNotAvailable (); 00579 if (state < 0 || state > STREAM_STATE_ON) 00580 throw InvalidArgument (); 00581 00582 const unsigned char op = OPCODE_PAUSE_RESUME_STREAM; 00583 const unsigned char st = state; 00584 stream_ << op << st; 00585 stream_.flush (); 00586 }
void iRobot::Create::sendScriptCommand | ( | const opcodes_t & | script | ) | throw (CommandNotAvailable, InvalidArgument) |
Send a script.
script | Script to send. |
00591 { 00592 if (currentMode_ < IROBOT_CREATE_PASSIVE) 00593 throw CommandNotAvailable (); 00594 if (opcodes.size () > SCRIPT_MAX_SIZE) 00595 throw InvalidArgument (); 00596 00597 std::stringstream ss; 00598 for (opcodes_t::const_iterator it = opcodes.begin (); 00599 it != opcodes.end (); ++it) 00600 { 00601 if (*it < OPCODE_START 00602 || *it > OPCODE_WAIT_EVENT) 00603 throw InvalidArgument (); 00604 const unsigned char opcode = *it; 00605 ss << opcode; 00606 } 00607 00608 const unsigned char op = OPCODE_SCRIPT; 00609 const unsigned char size = opcodes.size (); 00610 stream_ << op << size << ss.str (); 00611 stream_.flush (); 00612 }
void iRobot::Create::sendPlayScriptCommand | ( | ) | throw (CommandNotAvailable) |
Play the current stored script.
00617 { 00618 if (currentMode_ < IROBOT_CREATE_PASSIVE) 00619 throw CommandNotAvailable (); 00620 00621 const unsigned char op = OPCODE_PLAY_SCRIPT; 00622 stream_ << op; 00623 stream_.flush (); 00624 }
void iRobot::Create::sendShowScriptCommand | ( | ) | throw (CommandNotAvailable) |
Show the stored script.
00629 { 00630 if (currentMode_ < IROBOT_CREATE_PASSIVE) 00631 throw CommandNotAvailable (); 00632 00633 const unsigned char op = OPCODE_SHOW_SCRIPT; 00634 stream_ << op; 00635 stream_.flush (); 00636 }
void iRobot::Create::sendWaitTimeCommand | ( | unsigned char | t | ) | throw (CommandNotAvailable) |
Make the robot wait for a specific amount of time.
t | Time to wait in tenth of a second (resolution of 15 ms). |
00641 { 00642 if (currentMode_ < IROBOT_CREATE_PASSIVE) 00643 throw CommandNotAvailable (); 00644 00645 const unsigned char op = OPCODE_WAIT_TIME; 00646 stream_ << op << t; 00647 stream_.flush (); 00648 }
void iRobot::Create::sendWaitDistanceCommand | ( | short | d | ) | throw (CommandNotAvailable) |
Make the robot wait until it travelled a certain distance.
d | Distance to travel |
00653 { 00654 if (currentMode_ < IROBOT_CREATE_PASSIVE) 00655 throw CommandNotAvailable (); 00656 00657 const unsigned char op = OPCODE_WAIT_DISTANCE; 00658 stream_ << op; 00659 sendInt16 (stream_, d); 00660 stream_.flush (); 00661 }
void iRobot::Create::sendWaitAngleCommand | ( | short | a | ) | throw (CommandNotAvailable) |
Make the robot wait until it has rotated enough.
a | Angle (in degrees) |
00666 { 00667 if (currentMode_ < IROBOT_CREATE_PASSIVE) 00668 throw CommandNotAvailable (); 00669 00670 const unsigned char op = OPCODE_WAIT_ANGLE; 00671 stream_ << op; 00672 sendInt16 (stream_, a); 00673 stream_.flush (); 00674 }
void iRobot::Create::sendWaitEventCommand | ( | Event | e, | |
EventState | es = EVENT_OCCURRING | |||
) | throw (CommandNotAvailable, InvalidArgument) |
Make the robot wait for a specific event.
e | Wait for this event. | |
es | Wait for this event state. |
00679 { 00680 if (currentMode_ < IROBOT_CREATE_PASSIVE) 00681 throw CommandNotAvailable (); 00682 if (event < EVENT_WHEEL_DROP || event > EVENT_OI_MODE_PASSIVE) 00683 throw InvalidArgument (); 00684 if (state < EVENT_OCCURRING || state > EVENT_NOT_OCCURRING) 00685 throw InvalidArgument (); 00686 00687 const unsigned char op = OPCODE_WAIT_EVENT; 00688 const char e = (state == EVENT_OCCURRING) ? event : -event; 00689 stream_ << op << e; 00690 stream_.flush (); 00691 }
void iRobot::Create::updateSensors | ( | ) |
Read the stream to update sensors values. This handles both streamed data and specific queries through querylist or sensors commands.
00695 { 00696 while (!!stream_.good () && !queriedSensors_.empty ()) 00697 { 00698 if (!!stream_.good () && safePeek (stream_) == STREAM_HEADER) 00699 readStream (); 00700 if (!readSensorPacket ()) 00701 if (stream_.rdbuf ()->in_avail () > 0) 00702 stream_.ignore (); 00703 else 00704 break; 00705 } 00706 00707 while (!!stream_.good () && stream_.rdbuf ()->in_avail () > 0) 00708 { 00709 if (safePeek (stream_) == STREAM_HEADER) 00710 readStream (); 00711 else 00712 stream_.ignore (); 00713 } 00714 }
void iRobot::Create::readStream | ( | ) |
Read streamed sensors and update sensors values.
00913 { 00914 if (!stream_.good ()) 00915 return; 00916 if (safePeek (stream_) != STREAM_HEADER) 00917 return; 00918 00919 // Ignore header. 00920 stream_.ignore (); 00921 00922 std::stringstream ss; 00923 unsigned char checksum = STREAM_HEADER; 00924 unsigned char size = 0; 00925 00926 stream_ >> size; 00927 checksum += size; 00928 for (unsigned i = 0; i < size; ++i) 00929 { 00930 unsigned char c; 00931 stream_ >> c; 00932 ss << c; 00933 checksum += c; 00934 } 00935 00936 unsigned char sentChecksum = 0; 00937 stream_ >> sentChecksum; 00938 00939 if (checksum + sentChecksum != 256) 00940 return; 00941 00942 for (sensorPackets_t::const_iterator it = streamedSensors_.begin (); 00943 it != streamedSensors_.end (); ++it) 00944 { 00945 unsigned char packet = 0; 00946 ss >> packet; 00947 if (packet != *it) 00948 return; 00949 if (!readSensorPacket (*it, ss)) 00950 return; 00951 } 00952 }
Create::Mode iRobot::Create::mode | ( | ) | throw () |
bool iRobot::Create::wheeldropCaster | ( | ) |
bool iRobot::Create::wheeldropLeft | ( | ) |
bool iRobot::Create::wheeldropRight | ( | ) |
bool iRobot::Create::bumpLeft | ( | ) |
bool iRobot::Create::bumpRight | ( | ) |
bool iRobot::Create::wall | ( | ) |
Get wall sensor value.
bool iRobot::Create::cliffLeft | ( | ) |
bool iRobot::Create::cliffFrontLeft | ( | ) |
bool iRobot::Create::cliffFrontRight | ( | ) |
bool iRobot::Create::cliffRight | ( | ) |
bool iRobot::Create::deviceDetect | ( | ) |
bool iRobot::Create::digitalInput3 | ( | ) |
bool iRobot::Create::digitalInput2 | ( | ) |
bool iRobot::Create::digitalInput1 | ( | ) |
bool iRobot::Create::digitalInput0 | ( | ) |
short iRobot::Create::analogSignal | ( | ) |
bool iRobot::Create::homeBaseChargerAvailable | ( | ) |
bool iRobot::Create::internalChargerAvailable | ( | ) |
bool iRobot::Create::virtualWall | ( | ) |
bool iRobot::Create::leftWheelOvercurrent | ( | ) |
bool iRobot::Create::rightWheelOvercurrent | ( | ) |
bool iRobot::Create::ld2Overcurrent | ( | ) |
bool iRobot::Create::ld1Overcurrent | ( | ) |
bool iRobot::Create::ld0Overcurrent | ( | ) |
unsigned char iRobot::Create::ir | ( | ) |
bool iRobot::Create::advanceButton | ( | ) |
bool iRobot::Create::playButton | ( | ) |
short iRobot::Create::distance | ( | ) |
short iRobot::Create::angle | ( | ) |
ChargingState iRobot::Create::chargingState | ( | ) |
short iRobot::Create::batteryVoltage | ( | ) |
short iRobot::Create::batteryCurrent | ( | ) |
short iRobot::Create::batteryTemperature | ( | ) |
short iRobot::Create::batteryCharge | ( | ) |
short iRobot::Create::batteryCapacity | ( | ) |
short iRobot::Create::wallSignal | ( | ) |
short iRobot::Create::cliffLeftSignal | ( | ) |
short iRobot::Create::cliffFrontLeftSignal | ( | ) |
short iRobot::Create::cliffFrontRightSignal | ( | ) |
short iRobot::Create::cliffRightSignal | ( | ) |
unsigned char iRobot::Create::songNumber | ( | ) |
bool iRobot::Create::songPlaying | ( | ) |
unsigned char iRobot::Create::streamPackets | ( | ) |
short iRobot::Create::requestedVelocity | ( | ) |
short iRobot::Create::requestedRadius | ( | ) |
short iRobot::Create::requestedLeftVelocity | ( | ) |
short iRobot::Create::requestedRightVelocity | ( | ) |
bool iRobot::Create::readSensorPacket | ( | ) | [protected] |
Read a specific sensor packet and update sensors values. The next expected sensor packet will be read.
00718 { 00719 if (!!queriedSensors_.empty ()) 00720 return false; 00721 if (!!readSensorPacket (queriedSensors_.front (), stream_)) 00722 { 00723 queriedSensors_.pop (); 00724 return true; 00725 } 00726 return false; 00727 }
bool iRobot::Create::readSensorPacket | ( | SensorPacket | sensor, | |
std::istream & | stream | |||
) | [protected] |
Read sensor packet on a specified stream, update sensor values.
00768 { 00769 if (!stream.good ()) 00770 return false; 00771 if (safePeek (stream) == STREAM_HEADER) 00772 return false; 00773 00774 switch (sensor) 00775 { 00776 GROUP_SENSOR(SENSOR_GROUP_0, 7, 26); 00777 GROUP_SENSOR(SENSOR_GROUP_1, 7, 16); 00778 GROUP_SENSOR(SENSOR_GROUP_2, 17, 20); 00779 GROUP_SENSOR(SENSOR_GROUP_3, 21, 26); 00780 GROUP_SENSOR(SENSOR_GROUP_4, 27, 34); 00781 GROUP_SENSOR(SENSOR_GROUP_5, 35, 42); 00782 GROUP_SENSOR(SENSOR_GROUP_6, 7, 42); 00783 00784 case SENSOR_BUMPS_WHEELS_DROPS: 00785 { 00786 std::bitset<8> v = 0; 00787 unsigned char tmp = 0; 00788 if (!safeGet (stream, tmp)) 00789 return false; 00790 v = tmp; 00791 wheeldropCaster_ = v.test (SENSOR_BIT_WHEELDROP_CASTER); 00792 wheeldropLeft_ = v.test (SENSOR_BIT_WHEELDROP_LEFT); 00793 wheeldropRight_ = v.test (SENSOR_BIT_WHEELDROP_RIGHT); 00794 bumpLeft_ = v.test (SENSOR_BIT_BUMP_LEFT); 00795 bumpRight_ = v.test (SENSOR_BIT_BUMP_RIGHT); 00796 break; 00797 } 00798 00799 UCHAR_SENSOR (SENSOR_WALL, wall_); 00800 UCHAR_SENSOR (SENSOR_CLIFF_LEFT, cliffLeft_); 00801 UCHAR_SENSOR (SENSOR_CLIFF_FRONT_LEFT, cliffFrontLeft_); 00802 UCHAR_SENSOR (SENSOR_CLIFF_FRONT_RIGHT, cliffFrontRight_); 00803 UCHAR_SENSOR (SENSOR_CLIFF_RIGHT, cliffRight_); 00804 UCHAR_SENSOR (SENSOR_VIRTUAL_WALL, virtualWall_); 00805 00806 case SENSOR_OVERCURRENTS: 00807 { 00808 std::bitset<8> v = 0; 00809 unsigned char tmp = 0; 00810 if (!safeGet (stream, tmp)) 00811 return false; 00812 v = tmp; 00813 leftWheelOvercurrent_ = v.test (SENSOR_BIT_LEFTWHEELOVERCURRENT); 00814 rightWheelOvercurrent_ = v.test (SENSOR_BIT_RIGHTWHEELOVERCURRENT); 00815 ld2Overcurrent_ = v.test (SENSOR_BIT_LD2OVERCURRENT); 00816 ld1Overcurrent_ = v.test (SENSOR_BIT_LD1OVERCURRENT); 00817 ld0Overcurrent_ = v.test (SENSOR_BIT_LD0OVERCURRENT); 00818 break; 00819 } 00820 00821 // Unused. 00822 case 15: 00823 case 16: 00824 { 00825 unsigned char tmp = 0; 00826 if (!safeGet (stream, tmp)) 00827 return false; 00828 break; 00829 } 00830 00831 UCHAR_SENSOR (SENSOR_IR, ir_); 00832 00833 case SENSOR_BUTTONS: 00834 { 00835 std::bitset<8> v = 0; 00836 unsigned char tmp = 0; 00837 if (!safeGet (stream, tmp)) 00838 return false; 00839 v = tmp; 00840 advanceButton_ = v.test (SENSOR_BIT_ADVANCEBUTTON); 00841 playButton_ = v.test (SENSOR_BIT_PLAYBUTTON); 00842 break; 00843 } 00844 00845 INT_SENSOR (SENSOR_DISTANCE, distance_); 00846 INT_SENSOR (SENSOR_ANGLE, angle_); 00847 00848 GEN_SENSOR (SENSOR_CHARGING_STATE, chargingState_, ChargingState); 00849 00850 INT_SENSOR (SENSOR_VOLTAGE, batteryVoltage_); 00851 INT_SENSOR (SENSOR_CURRENT, batteryCurrent_); 00852 CHAR_SENSOR (SENSOR_BATTERY_TEMPERATURE, batteryTemperature_); 00853 INT_SENSOR (SENSOR_BATTERY_CHARGE, batteryCharge_); 00854 INT_SENSOR (SENSOR_BATTERY_CAPACITY, batteryCapacity_); 00855 INT_SENSOR (SENSOR_WALL_SIGNAL, wallSignal_); 00856 INT_SENSOR (SENSOR_CLIFF_LEFT_SIGNAL, cliffLeftSignal_); 00857 INT_SENSOR (SENSOR_CLIFF_FRONT_LEFT_SIGNAL, cliffFrontLeftSignal_); 00858 INT_SENSOR (SENSOR_CLIFF_FRONT_RIGHT_SIGNAL, cliffFrontRightSignal_); 00859 INT_SENSOR (SENSOR_CLIFF_RIGHT_SIGNAL, cliffRightSignal_); 00860 00861 case SENSOR_CARGO_BAY_DIGITAL_INPUT: 00862 { 00863 std::bitset<8> v = 0; 00864 unsigned char tmp = 0; 00865 if (!safeGet (stream, tmp)) 00866 return false; 00867 v = tmp; 00868 deviceDetect_ = v.test (SENSOR_BIT_DEVICEDETECT); 00869 digitalInput3_ = v.test (SENSOR_BIT_DIGITALINPUT3); 00870 digitalInput2_ = v.test (SENSOR_BIT_DIGITALINPUT2); 00871 digitalInput1_ = v.test (SENSOR_BIT_DIGITALINPUT1); 00872 digitalInput0_ = v.test (SENSOR_BIT_DIGITALINPUT0); 00873 break; 00874 } 00875 00876 INT_SENSOR(SENSOR_CARGO_BAY_ANALOG_SIGNAL, analogSignal_); 00877 00878 case SENSOR_CHARGING_SOURCES_AVAILABLE: 00879 { 00880 std::bitset<8> v = 0; 00881 unsigned char tmp = 0; 00882 if (!safeGet (stream, tmp)) 00883 return false; 00884 v = tmp; 00885 homeBaseChargerAvailable_ = 00886 v.test (SENSOR_BIT_HOMEBASECHARGERAVAILABLE); 00887 internalChargerAvailable_ = 00888 v.test (SENSOR_BIT_INTERNALCHARGERAVAILABLE); 00889 break; 00890 } 00891 00892 //FIXME: trigger a warning if not corresponding to current value? 00893 GEN_SENSOR (SENSOR_OI_MODE, currentMode_, Mode); 00894 00895 UCHAR_SENSOR (SENSOR_SONG_NUMBER, songNumber_); 00896 UCHAR_SENSOR (SENSOR_SONG_PLAYING, songPlaying_); 00897 UCHAR_SENSOR (SENSOR_NUMBER_STREAM_PACKETS, streamPackets_); 00898 00899 INT_SENSOR (SENSOR_REQUESTED_VELOCITY, requestedVelocity_); 00900 INT_SENSOR (SENSOR_REQUESTED_RADIUS, requestedRadius_); 00901 INT_SENSOR (SENSOR_REQUESTED_LEFT_VELOCITY, requestedLeftVelocity_); 00902 INT_SENSOR (SENSOR_REQUESTED_RIGHT_VELOCITY, requestedRightVelocity_); 00903 00904 default: 00905 break; 00906 } 00907 return true; 00908 }
void iRobot::Create::sendBaudCommand | ( | Baud | speed | ) | throw (CommandNotAvailable, InvalidArgument) |
Change the communication speed. After changing the communication speed, it is required to wait at least 100ms.
speed | New communication speed. |
void iRobot::Create::sendStartCommand | ( | ) |
Switch to passive mode. Automatically done when the class is instanciated.
void iRobot::Create::sendSafeCommand | ( | ) | throw (CommandNotAvailable) |
Switch to safe mode.
void iRobot::Create::sendFullCommand | ( | ) | throw (CommandNotAvailable) |
Switch to full mode.
void iRobot::Create::sendDemoCommand | ( | Demo | demo | ) | throw (CommandNotAvailable, InvalidArgument) |
Run a built-in demo.
demo | Demo id. |
void iRobot::Create::sendDriveCommand | ( | short | v, | |
short | r | |||
) | throw (CommandNotAvailable, InvalidArgument) |
Drive the robot.
v | Robot's velocity. | |
r | Robot's turning radius. |
void iRobot::Create::sendDriveCommand | ( | short | v, | |
DriveCommand | dc | |||
) | throw (CommandNotAvailable, InvalidArgument) |
Drive the robot using a special drigin mode.
v | Robot's velocity. | |
dc | Special driving mode. |
void iRobot::Create::sendDriveDirectCommand | ( | short | vr, | |
short | vl | |||
) | throw (CommandNotAvailable, InvalidArgument) |
Drive the two wheels separately.
vr | Right wheel's velocity. | |
vl | Left wheel's velocity. |
void iRobot::Create::sendLedCommand | ( | Led | l, | |
unsigned char | c, | |||
unsigned char | i | |||
) | throw (CommandNotAvailable, InvalidArgument) |
Change led status.
l | Switch on/off advance or play leds. | |
c | Power led color. | |
i | Power led light intensity. |
void iRobot::Create::sendDigitalOutputsCommand | ( | bool | d1, | |
bool | d2, | |||
bool | d3 | |||
) | throw (CommandNotAvailable) |
Change the digital output values.
d1 | Switch on/off first digital output. | |
d2 | Switch on/off second digital output. | |
d3 | Switch on/off third digital output. |
void iRobot::Create::sendPwmLowSideDriversCommand | ( | unsigned char | lsd1, | |
unsigned char | lsd2, | |||
unsigned char | lsd3 | |||
) | throw (CommandNotAvailable, InvalidArgument) |
Drive low side drivers with variable power.
lsd1 | Low side driver 1 power. | |
lsd2 | Low side driver 2 power. | |
lsd3 | Low side driver 3 power. |
void iRobot::Create::sendLowSideDriversCommand | ( | bool | lsd1, | |
bool | lsd2, | |||
bool | lsd3 | |||
) | throw (CommandNotAvailable) |
Switch on/off low side drivers.
lsd1 | Switch on/off low side driver 1. | |
lsd2 | Switch on/off low side driver 2. | |
lsd3 | Switch on/off low side driver 3. |
void iRobot::Create::sendIrCommand | ( | unsigned char | v | ) | throw (CommandNotAvailable) |
Send an IR command on low side driver 1. The data will be encoded using the iRobot's Create receiver format.
v | Sent value. |
void iRobot::Create::sendSongCommand | ( | unsigned char | sid, | |
const song_t & | song | |||
) | throw (CommandNotAvailable, InvalidArgument) |
Define a song.
sid | Song id. | |
song | Song to send. |
void iRobot::Create::sendPlaySongCommand | ( | unsigned char | sid | ) | throw (CommandNotAvailable, InvalidArgument) |
Play a song.
sid | Sond id to play. |
void iRobot::Create::sendSensorsCommand | ( | SensorPacket | sp | ) | throw (CommandNotAvailable, InvalidArgument) |
Request the robot to send a particular sensor packet.
sp | Sensor packet to send. |
void iRobot::Create::sendQueryListCommand | ( | const sensorPackets_t & | lsp | ) | throw (CommandNotAvailable, InvalidArgument) |
Request the robot to send a list of sensor packets.
lsp | List of sensor packets to send |
void iRobot::Create::sendStreamCommand | ( | const sensorPackets_t & | lsp | ) | throw (CommandNotAvailable, InvalidArgument) |
Request the robot to start streaming some sensor packets. After the streaming is started, the requested values will be sent every 15ms.
lsp | List of sensor packets to stream. |
void iRobot::Create::sendPauseStreamCommand | ( | StreamState | st | ) | throw (CommandNotAvailable, InvalidArgument) |
Pause or resume sensor streaming.
st | Stream state to set. |
void iRobot::Create::sendScriptCommand | ( | const opcodes_t & | script | ) | throw (CommandNotAvailable, InvalidArgument) |
Send a script.
script | Script to send. |
void iRobot::Create::sendPlayScriptCommand | ( | ) | throw (CommandNotAvailable) |
Play the current stored script.
void iRobot::Create::sendShowScriptCommand | ( | ) | throw (CommandNotAvailable) |
Show the stored script.
void iRobot::Create::sendWaitTimeCommand | ( | unsigned char | t | ) | throw (CommandNotAvailable) |
Make the robot wait for a specific amount of time.
t | Time to wait in tenth of a second (resolution of 15 ms). |
void iRobot::Create::sendWaitDistanceCommand | ( | short | d | ) | throw (CommandNotAvailable) |
Make the robot wait until it travelled a certain distance.
d | Distance to travel |
void iRobot::Create::sendWaitAngleCommand | ( | short | a | ) | throw (CommandNotAvailable) |
Make the robot wait until it has rotated enough.
a | Angle (in degrees) |
void iRobot::Create::sendWaitEventCommand | ( | Event | e, | |
EventState | es = EVENT_OCCURRING | |||
) | throw (CommandNotAvailable, InvalidArgument) |
Make the robot wait for a specific event.
e | Wait for this event. | |
es | Wait for this event state. |
void iRobot::Create::updateSensors | ( | ) |
Read the stream to update sensors values. This handles both streamed data and specific queries through querylist or sensors commands.
void iRobot::Create::readStream | ( | ) |
Read streamed sensors and update sensors values.
Mode iRobot::Create::mode | ( | ) | throw () |
bool iRobot::Create::wheeldropCaster | ( | ) |
bool iRobot::Create::wheeldropLeft | ( | ) |
bool iRobot::Create::wheeldropRight | ( | ) |
bool iRobot::Create::bumpLeft | ( | ) |
bool iRobot::Create::bumpRight | ( | ) |
bool iRobot::Create::wall | ( | ) |
Get wall sensor value.
bool iRobot::Create::cliffLeft | ( | ) |
bool iRobot::Create::cliffFrontLeft | ( | ) |
bool iRobot::Create::cliffFrontRight | ( | ) |
bool iRobot::Create::cliffRight | ( | ) |
bool iRobot::Create::deviceDetect | ( | ) |
bool iRobot::Create::digitalInput3 | ( | ) |
bool iRobot::Create::digitalInput2 | ( | ) |
bool iRobot::Create::digitalInput1 | ( | ) |
bool iRobot::Create::digitalInput0 | ( | ) |
short iRobot::Create::analogSignal | ( | ) |
bool iRobot::Create::homeBaseChargerAvailable | ( | ) |
bool iRobot::Create::internalChargerAvailable | ( | ) |
bool iRobot::Create::virtualWall | ( | ) |
bool iRobot::Create::leftWheelOvercurrent | ( | ) |
bool iRobot::Create::rightWheelOvercurrent | ( | ) |
bool iRobot::Create::ld2Overcurrent | ( | ) |
bool iRobot::Create::ld1Overcurrent | ( | ) |
bool iRobot::Create::ld0Overcurrent | ( | ) |
unsigned char iRobot::Create::ir | ( | ) |
bool iRobot::Create::advanceButton | ( | ) |
bool iRobot::Create::playButton | ( | ) |
short iRobot::Create::distance | ( | ) |
short iRobot::Create::angle | ( | ) |
ChargingState iRobot::Create::chargingState | ( | ) |
short iRobot::Create::batteryVoltage | ( | ) |
short iRobot::Create::batteryCurrent | ( | ) |
short iRobot::Create::batteryTemperature | ( | ) |
short iRobot::Create::batteryCharge | ( | ) |
short iRobot::Create::batteryCapacity | ( | ) |
short iRobot::Create::wallSignal | ( | ) |
short iRobot::Create::cliffLeftSignal | ( | ) |
short iRobot::Create::cliffFrontLeftSignal | ( | ) |
short iRobot::Create::cliffFrontRightSignal | ( | ) |
short iRobot::Create::cliffRightSignal | ( | ) |
unsigned char iRobot::Create::songNumber | ( | ) |
bool iRobot::Create::songPlaying | ( | ) |
unsigned char iRobot::Create::streamPackets | ( | ) |
short iRobot::Create::requestedVelocity | ( | ) |
short iRobot::Create::requestedRadius | ( | ) |
short iRobot::Create::requestedLeftVelocity | ( | ) |
short iRobot::Create::requestedRightVelocity | ( | ) |
bool iRobot::Create::readSensorPacket | ( | ) | [protected] |
Read a specific sensor packet and update sensors values. The next expected sensor packet will be read.
bool iRobot::Create::readSensorPacket | ( | SensorPacket | , | |
std::istream & | ||||
) | [protected] |
Read sensor packet on a specified stream, update sensor values.
static const unsigned char iRobot::Create::LED_COLOR_GREEN = 0 [static] |
Define the green color for power led.
static const unsigned char iRobot::Create::LED_COLOR_RED = 255 [static] |
Define the red color for power led.
static const unsigned char iRobot::Create::LED_INTENSITY_OFF = 0 [static] |
Define minimum intensity for power led (off).
static const unsigned char iRobot::Create::LED_INTENSITY_FULL = 255 [static] |
Define full intensity for power led.
static const unsigned char iRobot::Create::LOW_SIDE_VELOCITY_MIN = 0 [static] |
Define minimum velocity for low side drivers.
static const unsigned char iRobot::Create::LOW_SIDE_VELOCITY_MAX = 128 [static] |
Define maximum velocity for low side drivers.
static const int iRobot::Create::VELOCITY_MIN = -500 [static] |
Define minimum velocity for robot wheels motors.
static const int iRobot::Create::VELOCITY_MAX = 500 [static] |
Define maximum velocity for robot wheels motors.
static const int iRobot::Create::RADIUS_MIN = -2000 [static] |
Define minimum radius turn of the robot.
static const int iRobot::Create::RADIUS_MAX = 2000 [static] |
Define maximum radius turn of the robot.
static const unsigned char iRobot::Create::SONG_MIN = 0 [static] |
Define minimum song id.
static const unsigned char iRobot::Create::SONG_MAX = 15 [static] |
Define maximum song id.
static const unsigned char iRobot::Create::SONG_MAX_SIZE = 16 [static] |
Define song maximum size.
static const unsigned char iRobot::Create::NO_NOTE = 30 [static] |
Define the value for a rest node (no sound).
static const unsigned char iRobot::Create::NOTE_MIN = 31 [static] |
Define the minimum note (G).
static const unsigned char iRobot::Create::NOTE_MAX = 127 [static] |
Define the maximum note (G).
static const unsigned char iRobot::Create::SCRIPT_MAX_SIZE = 100 [static] |
Define maximum script size.
static const unsigned char iRobot::Create::STREAM_HEADER = 19 [static] |
Stream header ``magic value''.
static const unsigned char iRobot::Create::SENSOR_BIT_WHEELDROP_CASTER = 4 [static] |
Bit used to retrieve the wheeldrop caster status.
static const unsigned char iRobot::Create::SENSOR_BIT_WHEELDROP_LEFT = 3 [static] |
Bit used to retrieve the wheeldrop caster status.
static const unsigned char iRobot::Create::SENSOR_BIT_WHEELDROP_RIGHT = 2 [static] |
Bit used to retrieve the wheeldrop caster status.
static const unsigned char iRobot::Create::SENSOR_BIT_BUMP_LEFT = 1 [static] |
Bit used to retrieve the bump left status.
static const unsigned char iRobot::Create::SENSOR_BIT_BUMP_RIGHT = 0 [static] |
Bit used to retrieve the bump right status.
static const unsigned char iRobot::Create::SENSOR_BIT_LEFTWHEELOVERCURRENT = 4 [static] |
Bit used to retrieve the left wheel overcurrent status.
static const unsigned char iRobot::Create::SENSOR_BIT_RIGHTWHEELOVERCURRENT = 3 [static] |
Bit used to retrieve the right wheel overcurrent status.
static const unsigned char iRobot::Create::SENSOR_BIT_LD2OVERCURRENT = 2 [static] |
Bit used to retrieve the LD2 overcurrent status.
static const unsigned char iRobot::Create::SENSOR_BIT_LD1OVERCURRENT = 1 [static] |
Bit used to retrieve the LD1 overcurrent status.
static const unsigned char iRobot::Create::SENSOR_BIT_LD0OVERCURRENT = 0 [static] |
Bit used to retrieve the LD0 overcurrent status.
static const unsigned char iRobot::Create::SENSOR_BIT_ADVANCEBUTTON = 2 [static] |
Bit used to retrieve the advance button status.
static const unsigned char iRobot::Create::SENSOR_BIT_PLAYBUTTON = 0 [static] |
Bit used to retrieve the play button status.
static const unsigned char iRobot::Create::SENSOR_BIT_DEVICEDETECT = 4 [static] |
Bit used to retrieve the device detect pin status.
static const unsigned char iRobot::Create::SENSOR_BIT_DIGITALINPUT3 = 3 [static] |
Bit used to retrieve the digital input 3 pin status.
static const unsigned char iRobot::Create::SENSOR_BIT_DIGITALINPUT2 = 2 [static] |
Bit used to retrieve the digital input 2 pin status.
static const unsigned char iRobot::Create::SENSOR_BIT_DIGITALINPUT1 = 1 [static] |
Bit used to retrieve the digital input 1 pin status.
static const unsigned char iRobot::Create::SENSOR_BIT_DIGITALINPUT0 = 0 [static] |
Bit used to retrieve the digital input 0 pin status.
static const unsigned char iRobot::Create::SENSOR_BIT_HOMEBASECHARGERAVAILABLE = 1 [static] |
Bit used to retrieve whether the home base charger is available or not.
static const unsigned char iRobot::Create::SENSOR_BIT_INTERNALCHARGERAVAILABLE = 0 [static] |
Bit used to retrieve whether the internal charger is available or not.