sl-perception created pull request seb/saltylab-firmware#624

sl-perception
Sun, 15 Mar 2026 10:11:36 -0400

624#feat: Steering PID controller (Issue #616)#

Implements Issue #616: closed-loop yaw-rate PID controller for differential drive that converts Jetson Twist.angular.z to differential wheel speed offsets using IMU gyro Z feedback.

Changes

New: include/steering_pid.h + src/steering_pid.c

PID with Kp=2.0, Ki=0.5, Kd=0.05

Anti-windup: integral clamped to ±200 counts before Ki multiply

Rate limiter: max 10 counts/ms output change — protects balance PID

STEER_OMEGA_SCALE = 0.1 deg/s/unit: steer ±1000 → ±100 deg/s

STEER_OUTPUT_MAX = 400 (matches CRSF_STEER_MAX)

JLINK_TLM_STEERING (0x8A) at 10 Hz

Modified: include/mpu6000.h + src/mpu6000.c

Added yaw_rate field to IMUData (bias-corrected board_gz, deg/s)

Modified: include/jlink.h + src/jlink.c

Added JLINK_TLM_STEERING 0x8Au, jlink_tlm_steering_t (8 bytes), jlink_send_steering_tlm()

New: test/test_steering_pid.c

78 unit tests, all passing

Closes #616