Skip to content

Steer Controller Tuning

The steer controller has a large influence on the performance of the car. Bad tracking of the steer angle can ruin your day even with the best MPC!

Understanding steer angle control

The cars run a low-level control loop on the hardware, which tracks the reference steering angle \(\delta_r\). The reference angle \(\delta_r\) is converted using a steer map \(U_\delta: \delta \to U\) to a reference voltage. A servo-like PID controller then tracks said voltage \(U = U_\delta^{-1}(\delta_r)\).

flowchart LR
    A[CRS Steer Reference] -->|Wi-Fi| B[Car control loop]
    B -->|Steer Map| C[Reference voltage]
    C --> D[Low-level voltage control loop]

Tuning the steer controller gains

The gains of the steer controller can be changed in the configuration interface. Since the gains affect the voltage controller, it makes the most sense to tune using direct voltage references from CRS:

  1. Launch a Wi-Fi Communication node:
roslaunch ros_wifi_com wifi_com_default.launch
  1. In a separate, attached terminal (crs-docker attach, or just use a development container), you can publish steer commands manually on the command-line:

rostopic pub -r 10 /control_input crs_msgs/car_input <tab> <tab>
This will auto-complete a message for you to modify. Set steer_angle to a voltage of your choosing (mV, a good starting value is 1500. Then, set steer_override: True to make sure that the car tracks the voltage without going through the steer map.

  1. Open PlotJuggler to visualize the /telemetry/steer_state and /telemetry/actuator_inputs messages. You can see the raw steer voltage measured there, the control output of the PID and inspect the performance.
  2. To adjust the gains, open the car's configuration interface. After adjusting them, make sure to restart the car.

Diagnosing problems

The issue might not be the steer controller, but rather the steer map. To observe if the steer map is correct, also look at the configuration interface. A live map will show you what the car thinks its current steer angle is. If the angle is not correct, perform steer calibration