www.irobot.com
1
Creating a Script for iRobot Create
iRobot Create’s Open Interface (OI) supports a simple scripting language.
A script consists of a sequence of commands, including drive commands
and commands that wait for an event such as a button press, elapsed time,
or sensor trigger. These commands are documented in detail in the iRobot
®
Create Open Interface (OI) Specification. Scripts are stored in iRobot Create’s
RAM, which is cleared when the robot loses power.
using the script Command
To load a script onto iRobot Create, use the Script command (152), followed by
the number of bytes in the script, followed by the series of commands and
their arguments. Scripts can be up to 100 bytes long.
example:
Drive in a square:
152 17 137 1 44 128 0 156 1 144 137 1 44 0 1 157 0 90 153
The meaning of the above string of numbers is:
using the Play script Command
When you are ready for iRobot Create to perform the script, send the Play
Script command (153). This loads the script into the serial queue. iRobot
Create then immediately begins executing the script’s commands as if they
had been sent directly to the serial port.
To download a copy of the iRobot Create Open Interface Specification, go to
www.irobot.com/create
.
Commands and Arguments
Values
Script
152
Number of bytes
17
Drive
137
300 mm/s
1 44
Straight
128 0
Wait for Distance
156
400 mm
1 144
Drive
137
300 mm/s
1 44
Spinning counterclockwise
0 1
Wait for Angle
157
90 degrees
0 90
Restart Script
153