These docs are public and open source.Edit on GitHub
API REFERENCE / PYTHON
RC.CONTROLLER.
The Controller module reads the manual controls through an Xbox-style mapping: buttons, triggers, and joysticks. On the car the physical remote is the FlySky transmitter, whose sticks and switches feed those same axes and buttons, so code written against this API runs unchanged against the on-screen controls in the Playground sim.
Same API, sim and carFlySky on the carXbox-style mapping
METHODS
THE METHODS.
//Enums you pass in
rc.controller.Button
A · B · X · Y · LB · RB · LJOY · RJOY
rc.controller.Joystick
LEFT · RIGHT
rc.controller.Trigger
LEFT · RIGHT
TYPICAL USE
A TYPICAL LOOP.
pythonimport racecar_core rc = racecar_core.create_racecar() def start(): rc.drive.stop() def update(): # B is a manual stop. was_pressed fires once, on the tap. if rc.controller.was_pressed(rc.controller.Button.B): rc.drive.stop() return # Left stick x steers; hold A to creep forward. x, _ = rc.controller.get_joystick(rc.controller.Joystick.LEFT) speed = 0.3 if rc.controller.is_down(rc.controller.Button.A) else 0.0 rc.drive.set_speed_angle(speed, x) rc.set_start_update(start, update) rc.go()
