racecar_core Library

The racecar_core library exposes the intended interface for programming the RACECAR-MN. The Main module handles program execution, and several submodules encapsulate different aspects of the hardware.

Racecar Module

class racecar_core.Racecar

The top level racecar module containing several submodules which interface with and control the different pieces of the RACECAR hardware.

abstract get_delta_time()

Returns the number of seconds elapsed in the previous frame.

Return type



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


# Increases counter by the number of seconds elapsed in the previous frame
counter += rc.get_delta_time()
abstract go()

Starts the RACECAR, beginning in default drive mode.


go idles blocks execution until the program is exited when START + END are pressed simultaneously.

Return type


abstract set_start_update(start, update, update_slow=None)

Sets the start and update functions used in user program mode.

  • start (Callable[[], None]) – A function called once when the car enters user program mode.

  • update (Callable[[], None]) – A function called every frame in user program mode. Approximately 60 frames occur per second.

  • update_slow (Optional[Callable[[], None]]) – A function called once per fixed time interval in user program mode (by default once per second).


The provided functions should not take any parameters.


# Create a racecar object
rc = Racecar()

# Define a start function
def start():
    print("This function is called once")

# Define an update function
def update():
    print("This function is called every frame")

# Provide the racecar with the start and update functions
rc.set_start_update(start, update)

# Tell the racecar to run until the program is exited
Return type


abstract set_update_slow_time(time=1.0)

Changes the time between calls to update_slow.


time (float) – The time in seconds between calls to update_slow.


# Sets the time between calls to update_slow to 2 seconds
Return type