These docs are public and open source.Edit on GitHub
API REFERENCE / PYTHON
RC.PHYSICS.
The Physics module is the : it reports how the car is accelerating and rotating. It is what you reach for when you want to turn a precise number of degrees or detect a bump, and the acceleration and angular-velocity calls behave the same in the Playground sim and on the car.
Sim ↔ car identicalaccel · m/s²gyro · rad/s
METHODS
THE METHODS.
TYPICAL USE
A WORKED EXAMPLE.
pythonimport racecar_core rc = racecar_core.create_racecar() def start(): pass def update(): ax, ay, az = rc.physics.get_linear_acceleration() # m/s^2 wx, wy, wz = rc.physics.get_angular_velocity() # rad/s # wz is the yaw rate: positive one way, negative the other. print(f"down accel {az:.1f} m/s^2, yaw rate {wz:.2f} rad/s") rc.set_start_update(start, update) rc.go()
