78 #define ROOMBA_MASK_LED_NONE 0 79 #define ROOMBA_MASK_LED_PLAY 0x2 80 #define ROOMBA_MASK_LED_ADVANCE 0x8 83 #define ROOMBA_MASK_DIGITAL_OUT_0 0x1 84 #define ROOMBA_MASK_DIGITAL_OUT_1 0x2 85 #define ROOMBA_MASK_DIGITAL_OUT_2 0x4 88 #define ROOMBA_MASK_DRIVER_0 0x1 89 #define ROOMBA_MASK_DRIVER_1 0x2 90 #define ROOMBA_MASK_DRIVER_2 0x4 92 #define ROOMBA_MASK_SIDE_BRUSH 0x1 93 #define ROOMBA_MASK_VACUUM 0x2 94 #define ROOMBA_MASK_MAIN_BRUSH 0x4 97 #define ROOMBA_MASK_BUMP_RIGHT 0x1 98 #define ROOMBA_MASK_BUMP_LEFT 0x2 99 #define ROOMBA_MASK_WHEELDROP_RIGHT 0x4 100 #define ROOMBA_MASK_WHEELDROP_LEFT 0x8 101 #define ROOMBA_MASK_WHEELDROP_CASTER 0x10 104 #define ROOMBA_MASK_LD1 0x1 105 #define ROOMBA_MASK_LD0 0x2 106 #define ROOMBA_MASK_LD2 0x4 107 #define ROOMBA_MASK_RIGHT_WHEEL 0x8 108 #define ROOMBA_MASK_LEFT_WHEEL 0x10 113 #define ROOMBA_MASK_BUTTON_PLAY 0x1 114 #define ROOMBA_MASK_BUTTON_ADVANCE 0x4 116 #define ROOMBA_MASK_BUTTON_MAX 0x1 117 #define ROOMBA_MASK_BUTTON_CLEAN 0x2 118 #define ROOMBA_MASK_BUTTON_SPOT 0x4 119 #define ROOMBA_MASK_BUTTON_POWER 0x8 122 #define ROOMBA_MASK_DIGITAL_IN_0 0x1 123 #define ROOMBA_MASK_DIGITAL_IN_1 0x2 124 #define ROOMBA_MASK_DIGITAL_IN_2 0x4 125 #define ROOMBA_MASK_DIGITAL_IN_3 0x8 126 #define ROOMBA_MASK_DIGITAL_IN_DEVICE_DETECT 0x10 129 #define ROOMBA_MASK_INTERNAL_CHARGER 0x1 130 #define ROOMBA_MASK_HOME_BASE 0x2 135 #define ROOMBA_READ_TIMEOUT 200 231 DemoCoverAndDock = 1,
234 DemoDriveFigureEight = 4,
246 DriveStraight = 0x8000,
247 DriveInPlaceClockwise = 0xFFFF,
248 DriveInPlaceCounterClockwise = 0x0001,
255 StreamCommandPause = 0,
256 StreamCommandResume = 1,
263 EventTypeWheelDrop = 1,
264 EventTypeFronWheelDrop = 2,
265 EventTypeLeftWheelDrop = 3,
266 EventTypeRightWheelDrop = 4,
268 EventTypeLeftBump = 6,
269 EventTypeRightBump = 7,
270 EventTypeVirtualWall = 8,
273 EventTypeLeftCliff = 11,
274 EventTypeFrontLeftCliff = 12,
275 EventTypeFrontRightCliff = 13,
276 EventTypeRightCliff = 14,
277 EventTypeHomeBase = 15,
278 EventTypeAdvanceButton = 16,
279 EventTypePlayButton = 17,
280 EventTypeDigitalInput0 = 18,
281 EventTypeDigitalInput1 = 19,
282 EventTypeDigitalInput2 = 20,
283 EventTypeDigitalInput3 = 21,
284 EventTypeModePassive = 22,
293 IRCommandForward = 130,
294 IRCommandRight = 131,
297 IRCommandSmall = 134,
298 IRCommandMedium = 135,
299 IRCommandLargeClean = 136,
300 IRCommandPause = 137,
301 IRCommandPower = 138,
302 IRCommandArcForwardLeft = 139,
303 IRCommandArcForwardRight = 140,
304 IRCommandDriveStop = 141,
306 IRCommandSendAll = 142,
307 IRCommandSeekDock = 143,
309 IRCommandReserved1 = 240,
310 IRCommandRedBuoy = 248,
311 IRCommandGreenBuoy = 244,
312 IRCommandForceField = 242,
313 IRCommandRedGreenBuoy = 252,
314 IRCommandRedBuoyForceField = 250,
315 IRCommandGreenBuoyForceField = 246,
316 IRCommandRedGreenBuoyForceField = 254,
323 ChargeStateNotCharging = 0,
324 ChargeStateReconditioningCharging = 1,
325 ChargeStateFullChanrging = 2,
326 ChargeStateTrickleCharging = 3,
327 ChargeStateWaiting = 4,
328 ChargeStateFault = 5,
352 SensorBumpsAndWheelDrops = 7,
355 SensorCliffFrontLeft = 10,
356 SensorCliffFrontRight = 11,
357 SensorCliffRight = 12,
358 SensorVirtualWall = 13,
359 SensorOvercurrents = 14,
366 SensorChargingState = 21,
369 SensorBatteryTemperature = 24,
370 SensorBatteryCharge = 25,
371 SensorBatteryCapacity = 26,
372 SensorWallSignal = 27,
373 SensoCliffLeftSignal = 28,
374 SensoCliffFrontLeftSignal = 29,
375 SensoCliffFrontRightSignal = 30,
376 SensoCliffRightSignal = 31,
377 SensorUserDigitalInputs = 32,
378 SensorUserAnalogInput = 33,
379 SensorChargingSourcesAvailable = 34,
381 SensorSongNumber = 36,
382 SensorSongPlaying = 37,
383 SensorNumberOfStreamPackets = 38,
386 SensorRightVelocity = 41,
387 SensorLeftVelocity = 42,
453 void drive(int16_t velocity, int16_t radius);
459 void driveDirect(int16_t leftVelocity, int16_t rightVelocity);
466 void leds(uint8_t
leds, uint8_t powerColour, uint8_t powerIntensity);
479 void pwmDrivers(uint8_t dutyCycle0, uint8_t dutyCycle1, uint8_t dutyCycle2);
489 void sendIR(uint8_t data);
496 void song(uint8_t songNumber,
const uint8_t* notes,
int len);
510 void stream(
const uint8_t* packetIDs,
int len);
533 void wait(uint8_t ticks);
564 bool getData(uint8_t* dest, uint8_t len);
576 bool getSensors(uint8_t packetID, uint8_t* dest, uint8_t len);
589 bool getSensorsList(uint8_t* packetIDs, uint8_t numPacketIDs, uint8_t* dest, uint8_t len);
611 uint8_t
getScript(uint8_t* dest, uint8_t len);
619 PollStateWaitCount = 1,
620 PollStateWaitBytes = 2,
621 PollStateWaitChecksum = 3,
628 HardwareSerial* _serial;
634 uint8_t _pollChecksum;
void waitAngle(int16_t degrees)
Definition: Roomba.cpp:225
void start()
Definition: Roomba.cpp:23
void script(const uint8_t *script, uint8_t len)
Definition: Roomba.cpp:199
void leds(uint8_t leds, uint8_t powerColour, uint8_t powerIntensity)
Definition: Roomba.cpp:130
void dock()
Definition: Roomba.cpp:86
void waitDistance(int16_t mm)
Definition: Roomba.cpp:218
uint32_t baudCodeToBaudRate(Baud baud)
Definition: Roomba.cpp:29
void digitalOut(uint8_t out)
Definition: Roomba.cpp:138
void fullMode()
Definition: Roomba.cpp:76
void stream(const uint8_t *packetIDs, int len)
Definition: Roomba.cpp:185
void sendIR(uint8_t data)
Definition: Roomba.cpp:162
uint8_t getScript(uint8_t *dest, uint8_t len)
Definition: Roomba.cpp:315
Demo
Definition: Roomba.h:227
void playSong(uint8_t songNumber)
Definition: Roomba.cpp:178
void power()
Definition: Roomba.cpp:81
void playScript()
Definition: Roomba.cpp:206
void waitEvent(EventType type)
Definition: Roomba.cpp:233
void baud(Baud baud)
Definition: Roomba.cpp:62
void coverAndDock()
Definition: Roomba.cpp:102
void drivers(uint8_t out)
Definition: Roomba.cpp:154
bool pollSensors(uint8_t *dest, uint8_t len)
Definition: Roomba.cpp:276
void reset()
Definition: Roomba.cpp:16
void streamCommand(StreamCommand command)
Definition: Roomba.cpp:192
void driveDirect(int16_t leftVelocity, int16_t rightVelocity)
Definition: Roomba.cpp:121
void safeMode()
Definition: Roomba.cpp:71
Sensor
Definition: Roomba.h:343
void drive(int16_t velocity, int16_t radius)
Definition: Roomba.cpp:112
EventType
Definition: Roomba.h:261
Support for iRobot Roomba and Create platforms via serial port using the iRobot Open Interface (OI) p...
Definition: Roomba.h:204
bool getSensorsList(uint8_t *packetIDs, uint8_t numPacketIDs, uint8_t *dest, uint8_t len)
Definition: Roomba.cpp:267
void song(uint8_t songNumber, const uint8_t *notes, int len)
Definition: Roomba.cpp:170
StreamCommand
Definition: Roomba.h:253
void cover()
Definition: Roomba.cpp:97
ChargeState
Definition: Roomba.h:321
void pwmDrivers(uint8_t dutyCycle0, uint8_t dutyCycle1, uint8_t dutyCycle2)
Definition: Roomba.cpp:145
bool getData(uint8_t *dest, uint8_t len)
Definition: Roomba.cpp:244
Roomba(HardwareSerial *serial=&Serial, Baud baud=Baud57600)
Definition: Roomba.cpp:8
void wait(uint8_t ticks)
Definition: Roomba.cpp:212
Mode
Definition: Roomba.h:333
Drive
Definition: Roomba.h:244
Baud
Definition: Roomba.h:209
void spot()
Definition: Roomba.cpp:107
bool getSensors(uint8_t packetID, uint8_t *dest, uint8_t len)
Definition: Roomba.cpp:260
IRCommand
Definition: Roomba.h:289
void demo(Demo demo)
Definition: Roomba.cpp:91