irobotcreate module
- irobotcreate.create_clear_serial_buffer()
Flushes commands to the create.
Note
This library already automatically flushes commands to the create
- irobotcreate.create_connect()
Waits to establish a connection to the create.
This function blocks until A connection to a create is established.
- Returns:
0 on success
See also
create_disconnect
- irobotcreate.create_connect_once()
Attempts to establish a connection to the create.
- Returns:
1 if connection succeeded, 0 if connection failed
See also
create_disconnect
- irobotcreate.create_disconnect()
Disconnects the controller from the iRobot Create.
ALWAYS disconnect from the iRobot Create before ending your program.
See also
create_connect
- irobotcreate.create_drive(speed, radius)
Drive at the requested speed in an arc with the provided radius.
- Parameters:
speed – The speed (in mm/s) to drive at. Range is -500 to 500.
radius – The radius (in mm) of the arc to drive through. Range is -2000 to 2000.
- irobotcreate.create_drive_direct(l_speed, r_speed)
Drive the create at the provided left wheel speed and right wheel speed.
- Parameters:
l_speed – The speed (in mm/s) to drive the left wheel at. Range is -500 to 500
r_speed – The speed (in mm/s) to drive the right wheel at. Range is -500 to 500
- irobotcreate.create_drive_straight(speed)
Drive straight at the requested speed.
- Parameters:
speed – The speed (in mm/s) to drive at. Range is -500 to 500.
- irobotcreate.create_full()
Puts the iRobot Create in “Full Mode”
“Full Mode” allows the programmer to completely control all functions of the Create (disables safety blocks).
“Full Mode” allows the programmer to completely control all functions of the Create (disables safety blocks).
With this mode enabled, the Create will not prevent use of motors in situations where it detects an edge/cliff/etc.
Use this if you are having issues with the Create not moving after lifting it, falling, etc.
See also
create_safe, create_passive, get_create_mode
- irobotcreate.create_load_song(song, length, num)
Loads a song for playing on the create
- Parameters:
song – It should be an array of unsigned chars (positive integers 0-255) The first value in a pair will be the midi value of the note the second value in the pair will be the duration (in 64ths of a second) for example, a song {88, 20, 91, 32, 70, 15} will play midi value 88 for 20/64ths of a second, midi value 91 for 32/64ths of a second, and midi value 70 for 15/64ths of a second. A full list of notes playable on the create is found at https://cdn-shop.adafruit.com/datasheets/create_2_Open_Interface_Spec.pdf on page 34
length – The length of the song. It is how many notes are in the song, not how many items are in your song array.
num – The song slot to load the song into; valid values are 0, 1, 2, and 3
- Returns:
1 on success, 0 on failure
Note
Example use: unsigned char example_song[] = {88, 20, 91, 32, 70, 15}; create_load_song(example_song, 3, 0);
- irobotcreate.create_passive()
When the Create is in Passive mode, you can request and receive sensor data using any of the sensor commands,
but you cannot change the current command parameters for the actuators (motors, speaker, lights, low side drivers, digital outputs) to something else.
To change how one of the actuators operates, you must switch from Passive mode to Full mode or Safe mode.
While in Passive mode, you can read Roomba’s sensors, watch Roomba perform a cleaning cycle, and charge the battery.
In Passive mode, Roomba will go into power saving mode to conserve battery power after five minutes of inactivity
Note
Appears to crash controller, do not use or use serial communication.
- irobotcreate.create_play_song(num)
Plays a song that has been loaded. Use create_load_song first.
- Parameters:
num – The song slot to play from; valid values are 0, 1, 2, and 3
- Returns:
1 on success, 0 on failure
See also
create_load_song
- irobotcreate.create_read_block(data, count)
Reads sensor data from the create.
- Parameters:
data – This is where the read sensor data is stored
count – How many bytes to read from the create.
- Returns:
1 on success, 0 on failure.
- irobotcreate.create_safe()
Puts the iRobot Create in “Safe Mode”
Safe mode gives you full control of Roomba, with the exception of the following safety-related conditions.
Safety-related conditions include: Cliff detection, wheel drop, and charging.
If your Create is refusing to move, try setting it to full mode.
See also
create_full, create_passive, get_create_mode
- irobotcreate.create_spin_CCW(speed)
Spin counter-clockwise at the requested speed. Spins in place.
- Parameters:
speed – The speed (in mm/s) to drive at. Range is -500 to 500.
Note
Negative speeds will result in spinning clockwise
- irobotcreate.create_spin_CW(speed)
Spin clockwise at the requested speed. Spins in place.
- Parameters:
speed – The speed (in mm)
- irobotcreate.create_spin_block(speed, angle)
Turns the create the requested number of degrees at the requested speed.
- Parameters:
speed – The speed (in mm/s) to turn at. Range is -500 to 500
angle – The angle (in degrees) to turn.
Note
This is a blocking function, so you DO NOT need an msleep after it. It already sleeps for the time that it needs to execute the turn and doesn’t need extra msleeps.