Applies to v0.1.0.
Vehicle control · Python API
set_control takes two normalised values, both −1..1. Nothing is in physical units, so the only thing you have to get right is the speed scale.
Control
steering— −1..1 against full lock. Positive is right.±1.0is full lock at any speed.throttle— −1..1, negative is reverse.
Working in m/s
throttleis a fraction of the car's top speed, so convert once (at the point of transmission) and keep the rest of the program in m/s. Converting in more than one place is how the two drift apart.
c.call("connect")
veh = c.call("describe")["vehicle"]
vmax = veh["max_speed_ms"] # the speed at throttle = 1.0
speed_ms = 0.4 # what you actually want
c.call("set_control", {
"steering": -0.5, # normalised; + = RIGHT
"throttle": max(-1.0, min(1.0, speed_ms / vmax)),
})
c.call("tick")Clamping here and letting the simulator clamp produce the same motion, but only your clamp can tell you it happened. See the speed ceiling.
What the car actually did
tick returns the observation, and ego_state carries the applied speed, steering and throttle, read after the actuator latency, so they lag a fast input. A commanded-versus-measured gap that never closes means the speed scale is wrong, not the transport.
SimServer does not start automatically. Press Start in the Network panel before connecting (see Network · Python API).