The Racer API¶
Every lab that drives the car calls one function.
racer.drive(steer, throttle)
| Argument | Range | Meaning |
|---|---|---|
steer |
-1.0 to 1.0 | Steering command. |
throttle |
-1.0 to 1.0 | Drive command. |
TODO (Rob): state the sign convention. Which sign of steer turns left, and what a negative throttle does in teleop and under the Racer API.
One action space¶
The car has one action space: steer and throttle, each in [-1, 1].
- Your lab code sends it.
- The gamepad sends it.
- The trained policy sends it. The two outputs of
policy.onnxare the same two numbers.
Calibration lives inside the Racer. You never see servo math or motor currents. The motor bridge on the car is the one place where the [-1, 1] contract becomes amps. Change the mapping there, and every commander changes with it.
The same call everywhere¶
| Where | What runs |
|---|---|
| Your browser | The simulated car in the lab page. Nothing you write leaves your browser. |
| The cloud | The same code against a simulated car. |
| The car | The same code in a lab container on the Jetson. |
Under the hood¶
On the car the command is a message on a ROS 2 topic. Exactly one process publishes it at a time: the gamepad in teleop mode, or the policy runner in policy mode. The Motor Lab introduces ROS 2. The labs before it hide it on purpose.