Beta

RacingInterface

In addition to the methods and attributes described in the overview, this interface provides the method and attributes below.

Methods

Method Returns Description
RacingInterface.set_controls(
    throttle=None,
    brake=None,
    steering=None,
)
None Sets the controls of your car. The throttle takes values from -1 to 1 where -1 is full throttle reverse an 1 is full throttle forward. The brake takes values from 0 to 1 where 0 is no brakes and 1 is full brakes. The steering takes values from -1 to 1 where -1 is full torque on the steering wheel to turn left, and 1 is full torque on the steering wheel to turn right. Leave an argument blank to leave it as it was.

Attributes

Every car is the same size, and this is the box, centered on car.pos, that it hits the walls and the other cars with, and how far its front wheels can turn. The track’s own measurements are on the track your setup is given: see RacingGameState.

Name Type Value Description
RacingInterface.CAR_LENGTH float 5.6 The car's length, nose to tail, in meters.
RacingInterface.CAR_WIDTH float 2.0 The car's width, side to side, in meters.
RacingInterface.MAX_STEERING_ANGLE float 0.35 Full lock: how far the front wheels can turn either way, in radians (about 20°). car.steering_angle is never further from 0.