TI Rover Menu

Note: When creating a new program that uses this module, it is recommended to use the Rover Coding program type. This will ensure that all the relevant modules are imported.

Item

Description

import ti_rover as rv

Imports all methods (functions) from the ti_rover module in the "rv" namespace. As a result, all function names pasted from the menus will be preceded by "rv.".

 

Drive

Item

Description

forward(distance)

Moves Rover forward the specified distance in grid units.

backward(distance)

Moves Rover backward the specified distance in grid units.

left(angle_degrees)

Turns Rover left the specified angle in degrees.

right(angle_degrees)

Turns Rover right the specified angle in degrees.

stop()

Stops any current movement immediately.

stop_clear()

Stops any current movement immediately and clears all pending commands.

resume()

Resumes the processing of commands.

stay(time)

Rover stays in place for the specified amount of time in seconds (optional).

If no time is specified, the Rover stays for 30 seconds.

to_xy(x,y)

Moves Rover to coordinate position (x,y) on virtual grid.

to_polar(r,theta_degrees)

Moves Rover to polar coordinate position (r, theta) on virtual grid.

The angle is specified in degrees.

to_angle(angle,"unit")

Spins Rover to the specified angle in the virtual grid.

The angle is relative to a zero angle which points down the x-axis in the virtual grid.

 

Drive > Drive with Options

Item

Description

forward_time(time)

Moves Rover forward for the specified time.

backward_time(time)

Moves Rover backward for the specified time.

forward(distance,"unit")

Moves Rover forward at the default speed for the specified distance.

The distance can be specified in grid units, meters, or wheel revolutions.

backward(distance,"unit")

Moves Rover backward at the default speed for the specified distance.

The distance can be specified in grid units, meters, or wheel revolutions.

left(angle,"unit")

Turns Rover left the specified angle.

The angle can be in degrees, radians, or gradians.

right(angle,"unit")

Turns Rover right the specified angle.

The angle can be in degrees, radians, or gradians.

forward_time(time,speed,"rate")

Moves Rover forward for the specified time at the specified speed.

The speed can be specified in grid units/s, meters/s, or wheel revolutions/s.

backward_time(time,speed,"rate")

Moves Rover backward for the specified time at the specified speed.

The speed can be specified in grid units/s, meters/s, or wheel revolutions/s.

forward(distance,"unit",speed,"rate")

Moves Rover forward for the specified distance at the specified speed.

The distance can be specified in grid units, meters, or wheel revolutions.

The speed can be specified in grid units/s, meters/s, or wheel revolutions/s.

backward(distance,"unit",speed,"rate")

Moves Rover backward for the specified distance at the specified speed.

The distance can be specified in grid units, meters, or wheel revolutions.

The speed can be specified in grid units/s, meters/s, or wheel revolutions/s.

 

Inputs

Item

Description

ranger_measurement()

Reads the ultrasonic distance sensor on the front of the Rover, returning the current distance in meters.

color_measurement()

Returns a value from 1 to 9, indicating the predominant color being "seen" by the Rover color input sensor.

1 = red

2 = green

3 = blue

4 = cyan

5 = magenta

6 = yellow

7 = black

8 = grey

9 = white

red_measurement()

Returns a value between 0 and 255 that indicates the perceived red level being seen by the color input sensor.

green_measurement()

Returns a value between 0 and 255 that indicates the perceived green level being seen by the color input sensor.

blue_measurement()

Returns a value between 0 and 255 that indicates the perceived blue level being seen by the color input sensor.

gray_measurement()

Returns a value between 0 and 255 that indicates the perceived gray level being seen by the color input sensor.

encoders_gyro_measurement()

Returns a list of values that contains the left and right wheel encoder counts as well as the current gyro heading.

gyro_measurement()

Returns a value that represents the current gyro reading, including drift, in the degrees.

ranger_time()

Returns the time that the ultrasonic signal from the TI-Rover ranger takes to reach the object (the "time of flight").

 

Outputs

Item

Description

color_rgb(r,g,b)

Sets the color of the Rover RGB LED to the specific red, green, blue values.

color_blink(frequency,time)

Sets the blinking frequency and duration for the selected color.

color_off()

Turns the Rover RGB LED off.

motor_left(speed,time)

Sets the left motor power to the specified value for the specified duration.

The speed is in the range -255 to 255 with 0 being stop. Positive speed values are counter-clockwise rotation, and negative speed values are clockwise.

The optional time parameter, if specified, has a valid range of 0.05 to 655.35 seconds. If not specified, a default of 5 seconds is used.

motor_right(speed,time)

Sets the left motor power to the specified value for the specified duration.

The speed is in the range -255 to 255 with 0 being stop. Positive speed values are counter-clockwise rotation, and negative speed values are clockwise.

The optional time parameter, if specified, has a valid range of 0.05 to 655.35 seconds. If not specified, a default of 5 seconds is used.

motors("ldir",left_val,"rdir",right_val,time)

Sets the left and right wheel to the specified speed levels, for an optional amount of time in seconds.

The speed (left_val, right_val) values are in the range 0 to 255 with 0 being stop. The ldir and rdir parameters specify CW or CCW rotation of the respective wheels.

The optional time parameter, if specified, has a valid range of 0.05 to 655.35 seconds. If not specified, a default of 5 seconds is used.

 

Path

Item

Description

waypoint_xythdrn()

Reads the x-coord, y-coord, time, heading, distance traveled, number of wheel revolutions, command number of the current waypoint. Returns a list with all these values as elements.

waypoint_prev

Reads the x-coord, y-coord, time, heading, distance traveled, number of wheel revolutions, command number of the previous waypoint.

waypoint_eta

Returns the estimated time to drive to a waypoint.

path_done()

Returns a value of 0 or 1 depending on whether the Rover is moving (0) or finished with all movement (1).

pathlist_x()

Returns a list of X values from the beginning to and including the current Waypoint X value.

pathlist_y()

Returns a list of Y values from the beginning to and including the current Waypoint Y value.

pathlist_time()

Returns a list of the time in seconds from the beginning to and including the current Waypoint time value.

pathlist_heading()

Returns a list of the headings from the beginning to and including the current Waypoint heading value.

pathlist_distance()

Returns a list of the distances traveled from the beginning to and including the current Waypoint distance value.

pathlist_revs()

Returns a list of the number of revolutions traveled from the beginning to and including the current Waypoint revolutions value.

pathlist_cmdnum()

Returns a list of command numbers for the path.

waypoint_x()

Returns x coordinate of current waypoint.

waypoint_y()

Returns y coordinate of current waypoint.

waypoint_time()

Returns time spent traveling from previous to current waypoint.

waypoint_heading()

Returns absolute heading of current waypoint.

waypoint_distance()

Returns distance traveled between previous and current waypoint.

waypoint_revs()

Returns number of revolutions needed to travel between previous and current waypoint.

 

Settings

Item

Description

units/s

Option for speed in grid units per second.

m/s

Option for speed in meters per second.

revs/s

Option for speed in wheel revolutions per second.

units

Option for distance in grid units.

m

Option for distance in meters.

revs

Option for distance in wheel revolutions.

degrees

Option for turning in degrees.

radians

Option for turning in radians.

gradians

Option for turning in gradians.

clockwise

Option for specifying wheel direction.

counter-clockwise

Option for specifying wheel direction.

 

Commands

These commands are collection of functions from other modules as well as from the TI Rover module.

Item

Description

sleep(seconds)

Pauses the program for the specified number of seconds.

Imported from the time module.

text_at(row,"text","align")

Displays "text" in plotting area at specified "align".

Imported from the ti_plotlib module.

cls()

Clears the Shell screen for plotting.

Imported from the ti_plotlib module.

while get_key() != "esc":

Runs the commands in the "while" loop until the "esc" key is pressed.

wait_until_done()

Pauses the program until the Rover finishes the current command.

This is a helpful way to synchronize non-Rover commands with Rover's motion.

while not path_done()

Runs the commands in the "while" loop until the Rover is finished with all movement.

The path_done() function returns a value of 0 or 1 depending on whether the Rover is moving (0) or finished with all movement (1).

position(x,y)

Sets the Rover position on the virtual grid to the specified x,y coordinate.

position(x,y,heading,"unit")

Sets the Rover position on the virtual grid to the specified x,y coordinate, and the virtual heading, relative to the virtual x-axis is set if a heading is provided (in the units for angles specified).

Positive angles from 0 to 360 are assumed to be counter-clockwise from the positive x axis. Negative angles from 0 to -360 are assumed to be clockwise from the positive x axis.

grid_origin()

Sets RV as being at current grid origin point of (0,0).

grid_m_unit(scale_value)

Sets the virtual grid spacing in meters per unit (m/unit) to the value specified. 0.1 is the default m/unit and translates to 1 unit = 100 mm or 10 cm or 1 dm or 0.1 m.

The range of valid scale_value is from 0.01 to 10.0.

path_clear()

Clears any pre-existing path or waypoint information.

zero_gyro()

Resets the Rover gyro to 0.0 angle and clears the left and right wheel encoder counts.