irobot create introduction assembled from various online resources mainly slides and pictures from...

24
iRobot Create iRobot Create Introduction Introduction Assembled from various online resources Assembled from various online resources mainly slides and pictures from mainly slides and pictures from Rob Kremer and Jamie Snape

Upload: lilian-farmer

Post on 27-Dec-2015

224 views

Category:

Documents


0 download

TRANSCRIPT

iRobot CreateiRobot Create

IntroductionIntroduction

Assembled from various online resourcesAssembled from various online resourcesmainly slides and pictures frommainly slides and pictures fromRob Kremer and Jamie Snape

23-04-19 2

AnatomyAnatomy

23-04-19 3

AnatomyAnatomy

Bump Sensors

23-04-19 4

AnatomyAnatomy

OverviewOverview

Based on Based on RoombaRoomba robotic vacuum cleaner robotic vacuum cleaner

Programmable with open interface of over Programmable with open interface of over 100 commands100 commands

32 internal and external sensors including 32 internal and external sensors including bumpers and infraredbumpers and infrared

Expansion port to add microcontroller, Expansion port to add microcontroller, Bluetooth, and/or additional sensorsBluetooth, and/or additional sensors

Programming (Bluetooth)Programming (Bluetooth)

Send Send Open Interface Open Interface commands via a virtual commands via a virtual serial port: 57600 baud, 8 data bits, 1 stop bitserial port: 57600 baud, 8 data bits, 1 stop bit

Linux stty –F /dev/ttyUSB0 57600 cs8 -cstopbLinux stty –F /dev/ttyUSB0 57600 cs8 -cstopb

Receive sensor data back as packetsReceive sensor data back as packets

Using any scripting language (Perl, Python, etc.)Using any scripting language (Perl, Python, etc.)

Drive Drive CreateCreate forward (OI script): forward (OI script):128 131128 131 (Start in safe mode)(Start in safe mode)

137 0 100 128 0137 0 100 128 0 (Drive forward 100 mm/s)(Drive forward 100 mm/s)

23-04-19 7

ModesModes OFFOFF

Unresponsive (except START (128))Unresponsive (except START (128)) Can chargeCan charge

PASSIVEPASSIVE Sensor status commandsSensor status commands No Actuator commandsNo Actuator commands Can chargeCan charge

SAFE SAFE may be recommended may be recommended Sensor status commandsSensor status commands Actuator commandsActuator commands

But reverts to PASSIVE if moving But reverts to PASSIVE if moving forwardforward and any cliff sensor is activated; any wheel and any cliff sensor is activated; any wheel drop sensor is activated; or the charger is plugged indrop sensor is activated; or the charger is plugged in

No ChargingNo Charging FULLFULL

Sensor status commandsSensor status commands Actuator commandsActuator commands No ChargingNo Charging

23-04-19 8

ModesModes

OFF

FULLSAFE

PASSIVE

START (128)

FULL (132)

SAFE (131)

FULL (132)

SAFE (131)

START (128)START (128)

23-04-19 9

Modes: WAITModes: WAIT

A 5th Mode: WAITA 5th Mode: WAIT When in WAIT mode the robot does not respond to When in WAIT mode the robot does not respond to ANYANY

input.input. Goes into WAIT mode for 3 commands (see Goes into WAIT mode for 3 commands (see WAIT slideWAIT slide):):

WAIT-DISTANCEWAIT-DISTANCE WAIT-ANGLEWAIT-ANGLE WAIT-TIMEWAIT-TIME WAIT-EVENTWAIT-EVENT

If the robot is prevented, for some reason, from traveling If the robot is prevented, for some reason, from traveling the distance or the angle, it won’t respond to anything (try the distance or the angle, it won’t respond to anything (try the undocumented command 7).the undocumented command 7).

Use Use onlyonly in scripts, in scripts, NOT RECOMMENDEDNOT RECOMMENDED

Programming (Microprocessor)Programming (Microprocessor)

Command Module Command Module plugs into expansion portplugs into expansion port

8-bit RISC microprocessor (~18 MHz)8-bit RISC microprocessor (~18 MHz)

Upload C programs that send Upload C programs that send Open InterfaceOpen Interface commands and read sensor datacommands and read sensor data

Open source toolkit (Windows/Mac compatible)Open source toolkit (Windows/Mac compatible)

Four extra expansion ports to add custom Four extra expansion ports to add custom hardware (sensors, LCD display, etc.)hardware (sensors, LCD display, etc.)

Programming (Microprocessor)Programming (Microprocessor)

Drive Drive CreateCreate with specified velocity and radius (C function): with specified velocity and radius (C function):

void drive(int16_t velocity, int16_t radius) void drive(int16_t velocity, int16_t radius) { { byteTx(CmdDrive);byteTx(CmdDrive);

byteTx((uint8_t)((velocity >> 8) & byteTx((uint8_t)((velocity >> 8) & 0x00FF));0x00FF));

byteTx((uint8_t)(velocity & 0x00FF));byteTx((uint8_t)(velocity & 0x00FF));byteTx((uint8_t)((radius >> 8) & byteTx((uint8_t)((radius >> 8) &

0x00FF));0x00FF));byteTx((uint8_t)(radius & 0x00FF));byteTx((uint8_t)(radius & 0x00FF));

}}

23-04-19 12

Actuators: DriveActuators: Drive

DRIVE (137 DRIVE (137 <velocity<velocityhighhigh> <velocity> <velocitylowlow> <radius> <radiushighhigh> <radius> <radiuslowlow>>)) 2 short (16 bit) parameters2 short (16 bit) parameters Each represented by 2 bytes, high byte first (so a total of 5 bytes Each represented by 2 bytes, high byte first (so a total of 5 bytes

for this command)for this command)

Parameter 1: Parameter 1: velocityvelocity in mm/sec in mm/sec -500 to +500 (-ve means “backwards”)-500 to +500 (-ve means “backwards”)

Parameter 2: Parameter 2: curve radiuscurve radius in mm in mm -2000 to +2000 where -ve means clockwise and +ve means -2000 to +2000 where -ve means clockwise and +ve means

counterclockwisecounterclockwise 32768 means “go straight”32768 means “go straight” -1 and +1 mean spin in place clockwise, counterclockwise -1 and +1 mean spin in place clockwise, counterclockwise

respectivelyrespectively

23-04-19 13

Actuators: LEDsActuators: LEDs

LEDs (LEDs (139 <Adv&Play> <powerColor> <powerInten>139 <Adv&Play> <powerColor> <powerInten>))Adv&Play:Adv&Play:

Bit 1 (=2): Play LED Bit 1 (=2): Play LED Bit 3 (=8): Advance LEDBit 3 (=8): Advance LED

PowerColor (0-255):PowerColor (0-255):0=green; 255=red0=green; 255=red

PowerIntensity (0-255)PowerIntensity (0-255)0=off; 255=full intensity0=off; 255=full intensity

23-04-19 14

Actuators: Send IRActuators: Send IR

SEND-IR (151 <IRbyte>)SEND-IR (151 <IRbyte>)Sends a byte using an add-on circuit and a Sends a byte using an add-on circuit and a

IR LEDIR LEDCan be received by the omnidirectional IR Can be received by the omnidirectional IR

receiver at the front of the robotreceiver at the front of the robotCould be use to transmit short-distance Could be use to transmit short-distance

identifiers for each robotidentifiers for each robot

23-04-19 15

Actuators: SongsActuators: Songs

Load a songLoad a song 140 <song#> <length> {<note> <duration>}*140 <song#> <length> {<note> <duration>}*

<song#>: 0-15<song#>: 0-15 <length>: number of notes (1/2 of bytes) (up to 16 notes)<length>: number of notes (1/2 of bytes) (up to 16 notes) <note>: see table in OI Manual<note>: see table in OI Manual <duration>: in 1/64 second ([email protected] … <duration>: in 1/64 second ([email protected]

[email protected])[email protected])

Play a songPlay a song 141 <song#>141 <song#> Doesn’t work if a song is already playingDoesn’t work if a song is already playing

23-04-19 16

Inputs: SensorsInputs: Sensors

Read SensorsRead Sensors 142 <packetID>142 <packetID>

Packets 0-6 are “packet groups” (eg: 0 is sensors 7-26, Packets 0-6 are “packet groups” (eg: 0 is sensors 7-26, which is 26 bytes [some are two-byte returns])which is 26 bytes [some are two-byte returns])

Packets 7-42 are individual sensorsPackets 7-42 are individual sensors Either numerical values (1 or 2 bytes) or bitmapsEither numerical values (1 or 2 bytes) or bitmaps See OI ManualSee OI Manual

Also a commands for:Also a commands for: reading a list of sensors (149)reading a list of sensors (149) requesting a continuous stream of packet data (148)requesting a continuous stream of packet data (148) pausing/resuming a stream (150)pausing/resuming a stream (150)

23-04-19 17

Sensor Groups PacketsSensor Groups Packets

23-04-19 18

Sensor Single PacketsSensor Single Packets

23-04-19 19

ScriptsScripts

Load a scriptLoad a script 152 <length> <opcode>*152 <length> <opcode>*

<length>: number of bytes in script (up to 100)<length>: number of bytes in script (up to 100) <opcode>: OI commands<opcode>: OI commands

Play a scriptPlay a script 143143 No flow control except for WAIT commands (next slide)No flow control except for WAIT commands (next slide) Infinite cycle if script ends with 143Infinite cycle if script ends with 143

Show scriptShow script 154154 Returns the current scriptReturns the current script

23-04-19 20

Scripts: WaitScripts: Wait Wait timeWait time

155 <time>155 <time> <time> in 1/10 sec (resolution of 15ms)<time> in 1/10 sec (resolution of 15ms)

Wait DistanceWait Distance 156 <dist156 <disthighhigh> <dist> <distlowlow>>

<dist> distance in mm. +ve=forward, -ve=back<dist> distance in mm. +ve=forward, -ve=back Works for passively rotating the wheelsWorks for passively rotating the wheels

Wait AngleWait Angle 157 <angle157 <anglehighhigh> <angle> <anglelowlow>>

<angle> angle in deg. +ve=counterclockwise, -ve=clockwise<angle> angle in deg. +ve=counterclockwise, -ve=clockwise

Wait EventWait Event 158 <event#>158 <event#>

<event#>: eg: 1=wheel drop (see table in OI Manual, p.16)<event#>: eg: 1=wheel drop (see table in OI Manual, p.16) Use -ve for inverse of event (eg: -1 wheel drop stops)Use -ve for inverse of event (eg: -1 wheel drop stops)

23-04-19 21

Tasks: measuringTasks: measuring

You can track the distance traveled by using You can track the distance traveled by using sensor 19 (distance)sensor 19 (distance)

Angle with sensor 20 (angle)Angle with sensor 20 (angle) Note: reading these sensors causes them to be Note: reading these sensors causes them to be

resetreset Distance (angles) increment for forward Distance (angles) increment for forward

(counterclockwise) and decrement for backward (counterclockwise) and decrement for backward (clockwise)(clockwise)

Class iRobotCreate’s regular sensor reading Class iRobotCreate’s regular sensor reading keeps an accumulator for distance and anglekeeps an accumulator for distance and angle

23-04-19 22

Tasks: Following a wallTasks: Following a wall

You can track along a wall using the wall sensor You can track along a wall using the wall sensor (sensor 8)(sensor 8)

Use Drive straight (137 <velocity> 32687) when Use Drive straight (137 <velocity> 32687) when the wall is there; or a wide right curve (137 the wall is there; or a wide right curve (137 <velocity> -2000) when the wall goes away<velocity> -2000) when the wall goes away

You should expect the occasional right-bumpYou should expect the occasional right-bump If you get a left-bump, you’ve If you get a left-bump, you’ve probablyprobably hit a hit a

cornercorner

Commands from shellCommands from shell stty -F /dev/ttyUSB0 57600 cs8 –cstopbstty -F /dev/ttyUSB0 57600 cs8 –cstopb echo -e '\0200\0204' | cat > /dev/ttyUSB0 (full mode)echo -e '\0200\0204' | cat > /dev/ttyUSB0 (full mode) echo -e -n '\echo -e -n '\

0214\0000\0004\0076\0014\0102\0014\0107\0014\0112\0214\0000\0004\0076\0014\0102\0014\0107\0014\0112\0044\r\n' | cat > /dev/ttyUSB0 (defines song)0044\r\n' | cat > /dev/ttyUSB0 (defines song)

echo -e -n '\0215\0000\r\n' | cat > /dev/ttyUSB0 (plays echo -e -n '\0215\0000\r\n' | cat > /dev/ttyUSB0 (plays song) song)

echo -e -n '\0200\0203' | cat > /dev/ttyUSB0 (start move)echo -e -n '\0200\0203' | cat > /dev/ttyUSB0 (start move) echo -e -n '\0211\0000\0144\0200\0000' | cat > echo -e -n '\0211\0000\0144\0200\0000' | cat >

/dev/ttyUSB0 (go)/dev/ttyUSB0 (go)

Further ReadingFurther Reading

iRobot iRobot CreateCreate

http://www.irobot.com/sp.cfm?pageid=305http://www.irobot.com/sp.cfm?pageid=305

Manuals and downloadsManuals and downloads

http://www.irobot.com/sp.cfm?pageid=294http://www.irobot.com/sp.cfm?pageid=294