Neobotics Foundation Inc.
These docs are public and open source.Edit on GitHub

RC.PHYSICS

The physics module provides the IMU's acceleration, rotation, and magnetic field readings.

METHODS

rc.physics.get_linear_acceleration()returns NDArray[3, Float]

The car’s acceleration as an (x, y, z) vector in metres per second squared.

rc.physics.get_angular_velocity()returns NDArray[3, Float]

The car’s rotation rate as an (x, y, z) vector in radians per second. The z component is the yaw rate.

rc.physics.get_magnetic_field()returns NDArray[3, Float]

The magnetic field as an (x, y, z) vector in teslas.

rc.physics.get_encoder_speed()returns float

The wheel speed from the drivetrain encoder, in metres per second. Positive is forward.

rc.physics.get_battery_voltage()returns float

The battery pack voltage in volts.

rc.physics.get_rc_channels()returns NDArray[8, Float]

The raw channel values from the FlySky receiver, normalized. A channel with no signal reads -1.

EXAMPLE USAGE

python
import 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. print(f"down accel {az:.1f} m/s^2, yaw rate {wz:.2f} rad/s") rc.set_start_update(start, update) rc.go()

For full documentation, visit the racecar-neo-library documentation.