interrfaces: more complete PID tests (#26422)

* more complete PID tests

* doesn't need to be fancy

* less fancy
pull/26423/head^2
Shane Smiskol 2 years ago committed by GitHub
parent c64e2c228a
commit 0ca9d1810c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      selfdrive/car/tests/test_car_interfaces.py

@ -34,15 +34,18 @@ class TestCarInterfaces(unittest.TestCase):
self.assertGreater(car_params.maxLateralAccel, 0) self.assertGreater(car_params.maxLateralAccel, 0)
if car_params.steerControlType != car.CarParams.SteerControlType.angle: if car_params.steerControlType != car.CarParams.SteerControlType.angle:
tuning = car_params.lateralTuning.which() tune = car_params.lateralTuning
if tuning == 'pid': if tune.which() == 'pid':
self.assertTrue(len(car_params.lateralTuning.pid.kpV)) self.assertTrue(not math.isnan(tune.pid.kf) and tune.pid.kf > 0)
elif tuning == 'torque': self.assertTrue(len(tune.pid.kpV) > 0 and len(tune.pid.kpV) == len(tune.pid.kpBP))
kf = car_params.lateralTuning.torque.kf self.assertTrue(len(tune.pid.kiV) > 0 and len(tune.pid.kiV) == len(tune.pid.kiBP))
self.assertTrue(not math.isnan(kf) and kf > 0)
self.assertTrue(not math.isnan(car_params.lateralTuning.torque.friction)) elif tune.which() == 'torque':
elif tuning == 'indi': self.assertTrue(not math.isnan(tune.torque.kf) and tune.torque.kf > 0)
self.assertTrue(len(car_params.lateralTuning.indi.outerLoopGainV)) self.assertTrue(not math.isnan(tune.torque.friction))
elif tune.which() == 'indi':
self.assertTrue(len(tune.indi.outerLoopGainV))
# Run car interface # Run car interface
CC = car.CarControl.new_message() CC = car.CarControl.new_message()

Loading…
Cancel
Save