mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-01 14:16:45 +08:00
20 lines
690 B
Python
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)
|