Classes | |
class | kipr::create::CreateScript |
class | kipr::create::Create |
Facilitates communication with the iRobot (R) Create (TM) More... | |
Make sure to plug the usb side of the Create cable into the wombat and the other side into the Create.
Once you've done that, you can now use the roomba. The following example moves the roomba forward, swerves left, swerves right, and finally drives backwards.
EXPORT_SYM int _create_get_raw_encoders | ( | long * | lenc, |
long * | renc | ||
) |
Gets the displacement of the left wheel and right wheel and puts that data into the long
s provided
[out] | lenc | - where the left wheel's displacement is stored |
[out] | renc | - where the right wheel's displacement is stored |
EXPORT_SYM void create_clear_serial_buffer | ( | ) |
Flushes commands to the create.
EXPORT_SYM int create_connect | ( | ) |
Waits to establish a connection to the create.
EXPORT_SYM int create_connect_once | ( | ) |
Attempts to establish a connection to the create.
EXPORT_SYM void create_disconnect | ( | ) |
Disconnects the controller from the iRobot Create.
ALWAYS disconnect from the iRobot Create before ending your program.
EXPORT_SYM void create_drive | ( | int | speed, |
int | radius | ||
) |
Drive at the requested speed in an arc with the provided radius.
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. |
EXPORT_SYM void create_drive_direct | ( | int | l_speed, |
int | r_speed | ||
) |
Drive the create at the provided left wheel speed and right wheel speed.
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 |
EXPORT_SYM void create_drive_straight | ( | int | speed | ) |
Drive straight at the requested speed.
speed | The speed (in mm/s) to drive at. Range is -500 to 500. |
EXPORT_SYM void 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).
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.
EXPORT_SYM int create_load_song | ( | const unsigned char * | song, |
const unsigned char | length, | ||
const unsigned char | num | ||
) |
Loads a song for playing on the create
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 |
unsigned char example_song[] = {88, 20, 91, 32, 70, 15}; create_load_song(example_song, 3, 0);
EXPORT_SYM void 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
EXPORT_SYM int create_play_song | ( | const unsigned char | num | ) |
Plays a song that has been loaded. Use create_load_song first.
num | The song slot to play from; valid values are 0, 1, 2, and 3 |
EXPORT_SYM int create_read_block | ( | char * | data, |
int | count | ||
) |
Reads sensor data from the create.
data | - This is where the read sensor data is stored |
count | - How many bytes to read from the create. |
EXPORT_SYM void 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.
EXPORT_SYM void create_spin_block | ( | int | speed, |
int | angle | ||
) |
Turns the create the requested number of degrees at the requested speed.
speed | The speed (in mm/s) to turn at. Range is -500 to 500 |
angle | The angle (in degrees) to turn. |
EXPORT_SYM void create_spin_CCW | ( | int | speed | ) |
Spin counter-clockwise at the requested speed. Spins in place.
speed | The speed (in mm/s) to drive at. Range is -500 to 500. |
EXPORT_SYM void create_spin_CW | ( | int | speed | ) |
Spin clockwise at the requested speed. Spins in place.
speed | The speed (in mm/s) to drive at. Range is -500 to 500. |
EXPORT_SYM void create_stop | ( | ) |
Sets the create connection mode to off. No sensor data will be available, and the create will not respond to movement commands.
EXPORT_SYM void create_write_byte | ( | char | byte | ) |
Write a byte to the create. This is used to send commands directly to the create without using the functions provided in this library.
EXPORT_SYM int get_create_advance_button | ( | ) |
Returns if the "advance" button is pressed.
EXPORT_SYM int get_create_battery_capacity | ( | ) |
Returns the capacity of the battery in milliAmp-Hours (mAH)
EXPORT_SYM int get_create_battery_charge | ( | ) |
returns the current charge on the battery in milliAmp-Hours (mAH)
EXPORT_SYM int get_create_battery_charging_state | ( | ) |
returns the current charging state of the battery.
Not Charging: 0, Reconditioning Charging: 1, Full Charging: 2, Trickle Charging: 3, Waiting: 4, Charging Connection Fault: 5
EXPORT_SYM int get_create_battery_temp | ( | ) |
returns the temperature of the battery in degrees Celcius
EXPORT_SYM enum BaudRate get_create_baud_rate | ( | ) |
Returns the baud rate of the create.
EXPORT_SYM int get_create_cwdrop | ( | ) |
EXPORT_SYM int get_create_distance | ( | ) |
Gets the distance traveled based on encoder values in the wheels.
Units should be in millimeters (mm)
EXPORT_SYM int get_create_infrared | ( | ) |
The Docks, Virutal Walls, etc. send out infrared signals that the Create can pick up.
For example, Right of dock ("Green Buoy"): 164, Left of Dock ("Red Buoy"): 168, "Force Field": 161
You can also potentially control the Create with IR signals for forward, backward, etc.
See iRobot Create Manual for more information ("Characters sent by iRobot devices")
EXPORT_SYM int get_create_lbump | ( | ) |
Returns the status of the left bumper as a digital value (0 or 1).
EXPORT_SYM int get_create_lcliff | ( | ) |
reports if the left cliff/edge sensor is tripped.
EXPORT_SYM int get_create_lcliff_amt | ( | ) |
Returns the value measured by the left-most cliff sensor.
EXPORT_SYM int get_create_lclightbump | ( | ) |
returns the left-center light bumper sensor as described in the iRobot Create manual.
returns a binary/digital value rather than the raw sensor data (on or off/1 or 0).
EXPORT_SYM int get_create_lclightbump_amt | ( | ) |
returns the left-center light bumper sensor as described in the iRobot Create manual.
returns the amount the sensor is pressed, rather than a binary value.
EXPORT_SYM int get_create_lfcliff | ( | ) |
reports if the front-left cliff/edge sensor is tripped.
EXPORT_SYM int get_create_lfcliff_amt | ( | ) |
Returns the value measured by the left-front cliff sensor.
EXPORT_SYM int get_create_lflightbump | ( | ) |
returns the left-front light bumper sensor as described in the iRobot Create manual.
returns a binary/digital value rather than the raw sensor data (on or off/1 or 0).
EXPORT_SYM int get_create_lflightbump_amt | ( | ) |
returns the left-front light bumper sensor as described in the iRobot Create manual.
returns the amount the sensor is pressed, rather than a binary value.
EXPORT_SYM int get_create_llightbump | ( | ) |
returns the left light bumper sensor as described in the iRobot Create manual.
returns a binary/digital value rather than the raw sensor data (on or off/1 or 0).
EXPORT_SYM int get_create_llightbump_amt | ( | ) |
returns the left light bumper sensor as described in the iRobot Create manual.
returns the amount the sensor is pressed, rather than a binary value.
EXPORT_SYM int get_create_lwdrop | ( | ) |
Detects if the left wheel is dropped/lowered (the create is lifted)
EXPORT_SYM int get_create_mode | ( | ) |
Gets the current mode of the Create OI
Off: 0, Passive: 1, Safe: 2, Full: 3
EXPORT_SYM int get_create_normalized_angle | ( | ) |
returns the normalized angle that the create is at in degrees (angle mod 360).
"Normalized" means that the angle is converted to be between 0 and 360 degrees first.
EXPORT_SYM int get_create_play_button | ( | ) |
Returns if the "play" button is pressed.
EXPORT_SYM int get_create_rbump | ( | ) |
Returns the status of the right bumper as a digital value (0 or 1).
EXPORT_SYM int get_create_rcliff | ( | ) |
reports if the right cliff/edge sensor is tripped.
EXPORT_SYM int get_create_rcliff_amt | ( | ) |
Returns the value measured by the right-most cliff sensor.
EXPORT_SYM int get_create_rclightbump | ( | ) |
returns the right-center light bumper sensor as described in the iRobot Create manual.
returns a binary/digital value rather than the raw sensor data (on or off/1 or 0).
EXPORT_SYM int get_create_rclightbump_amt | ( | ) |
returns the right-center light bumper sensor as described in the iRobot Create manual.
returns the amount the sensor is pressed, rather than a binary value.
EXPORT_SYM int get_create_rfcliff | ( | ) |
reports if the front-right cliff/edge sensor is tripped.
EXPORT_SYM int get_create_rfcliff_amt | ( | ) |
Returns the value measured by the right-front cliff sensor.
EXPORT_SYM int get_create_rflightbump | ( | ) |
returns the right-front light bumper sensor as described in the iRobot Create manual.
returns a binary/digital value rather than the raw sensor data (on or off/1 or 0).
EXPORT_SYM int get_create_rflightbump_amt | ( | ) |
returns the right-front light bumper sensor as described in the iRobot Create manual.
returns the amount the sensor is pressed, rather than a binary value.
EXPORT_SYM int get_create_rlightbump | ( | ) |
returns the right light bumper sensor as described in the iRobot Create manual.
returns a binary/digital value rather than the raw sensor data (on or off/1 or 0).
EXPORT_SYM int get_create_rlightbump_amt | ( | ) |
returns the right light bumper sensor as described in the iRobot Create manual.
returns the amount the sensor is pressed, rather than a binary value.
EXPORT_SYM int get_create_rwdrop | ( | ) |
Detects if the right wheel is dropped/lowered (the create is lifted)
EXPORT_SYM int get_create_song_number | ( | ) |
EXPORT_SYM int get_create_song_playing | ( | ) |
EXPORT_SYM int get_create_total_angle | ( | ) |
returns the angle the Create is currently turned to (does not "normalize").
This value is any value as it is not normalized to a range of [0,360)
EXPORT_SYM int get_create_vwall | ( | ) |
Reports if there is a virutal wall.
EXPORT_SYM int get_create_wall | ( | ) |
Reports if the Create sees a physical wall.
EXPORT_SYM int get_create_wall_amt | ( | ) |
Returns the wall signal sensed by the create.
bool kipr::create::Create::loadSong | ( | const unsigned char * | song, |
const unsigned char | length, | ||
const unsigned char | songNum | ||
) |
Loads a song for playing on the create
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 |
unsigned char example_song[] = {88, 20, 91, 32, 70, 15}; create_load_song(example_song, 3, 0);
bool kipr::create::Create::playSong | ( | const unsigned char | songNum | ) |
Plays a song that has been loaded. Use create_load_song first.
num | The song slot to play from; valid values are 0, 1, 2, and 3 |
EXPORT_SYM void set_create_baud_rate | ( | const enum BaudRate | baudRate | ) |
Sets the create's baud rate to the provided baud rate.
EXPORT_SYM void set_create_distance | ( | int | dist | ) |
Sets the current distance the create thinks it has traveled.
Use this to set it's reference for where it is.
EXPORT_SYM void set_create_normalized_angle | ( | int | angle | ) |
Set the current angle that the create is at.
Sets what the create should use as a reference for its angle
EXPORT_SYM void set_create_total_angle | ( | int | angle | ) |
Set the current angle that the create is at for the total angle functions.
Sets what the create should use as a reference for its angle