These docs are public and open source.Edit on GitHub

RACECAR_CORE

The racecar_core module creates the car object, contains multiple submodules to interact with the car, and runs your program.

METHODS

racecar_core.create_racecar(isSimulation: bool | None = None)returns Racecar

Creates a racecar object.

rc.set_start_update(start: Callable[[], None], update: Callable[[], None], update_slow: Callable[[], None] | None = None)returns None

Sets a start function to run once at the beginning, an update function to run repeatedly, once per frame, and an optional update_slow function that runs once per set interval (default one second). The argument functions should not take any parameters.

rc.go()returns None

Starts the program. It blocks execution until the program exits.

rc.go_async()returns None

Starts the sensor streams in the background without blocking. Used in Jupyter Notebooks instead of go, so the *_async methods return data.

rc.get_delta_time()returns float

Returns the number of seconds between the start of the current frame and the start of the previous frame.

rc.set_update_slow_time(time: float = 1.0)returns None

Sets the interval in seconds between calls to the update_slow function registered with set_start_update.

EXAMPLE USAGE

python
import racecar_core rc = racecar_core.create_racecar() def start(): print("start: runs once") rc.drive.stop() def update(): # runs every frame print("update: runs every frame") def update_slow(): # runs once per second by default print("still driving") rc.set_start_update(start, update, update_slow) rc.go()