Files
StarPilot/selfdrive/selfdrived/tests/test_selfdrived.py
firestar5683 2c7e6e72c5 PID Alerts
2026-07-21 11:45:22 -05:00

20 lines
690 B
Python

from cereal import car
from openpilot.selfdrive.selfdrived.selfdrived import commanded_torque_at_max_for_saturation
def test_immediate_max_output_saturation_is_torque_controller_only():
CP = car.CarParams.new_message()
CP.steerControlType = car.CarParams.SteerControlType.torque
CP.lateralTuning.init("torque")
assert commanded_torque_at_max_for_saturation(CP, 1.0)
assert not commanded_torque_at_max_for_saturation(CP, 0.99)
CP.lateralTuning.init("pid")
assert not commanded_torque_at_max_for_saturation(CP, 1.0)
CP.lateralTuning.init("torque")
CP.steerControlType = car.CarParams.SteerControlType.angle
assert not commanded_torque_at_max_for_saturation(CP, 1.0)