pull/33208/head
Shane Smiskol 10 months ago
parent 134f523174
commit 989d898a4f
  1. 19
      selfdrive/car/tests/test_car_interfaces.py
  2. 4
      selfdrive/car/toyota/values.py

@ -83,16 +83,15 @@ class TestCarInterfaces:
# Lateral sanity checks # Lateral sanity checks
if car_params.steerControlType != CarParams.SteerControlType.angle: if car_params.steerControlType != CarParams.SteerControlType.angle:
tune = car_params.lateralTuning tune = car_params.lateralTuning
# TODO: we use which again, this is wrong if tune.which() == 'pid':
if isinstance(tune, CarParams.LateralPIDTuning):
if car_name != MOCK.MOCK: if car_name != MOCK.MOCK:
assert not math.isnan(tune.kf) and tune.kf > 0 assert not math.isnan(tune.pid.kf) and tune.pid.kf > 0
assert len(tune.kpV) > 0 and len(tune.kpV) == len(tune.kpBP) assert len(tune.pid.kpV) > 0 and len(tune.pid.kpV) == len(tune.pid.kpBP)
assert len(tune.kiV) > 0 and len(tune.kiV) == len(tune.kiBP) assert len(tune.pid.kiV) > 0 and len(tune.pid.kiV) == len(tune.pid.kiBP)
elif isinstance(tune, CarParams.LateralTorqueTuning): elif tune.which() == 'torque':
assert not math.isnan(tune.kf) and tune.kf > 0 assert not math.isnan(tune.torque.kf) and tune.torque.kf > 0
assert not math.isnan(tune.friction) and tune.friction > 0 assert not math.isnan(tune.torque.friction) and tune.torque.friction > 0
cc_msg = FuzzyGenerator.get_random_msg(data.draw, car.CarControl, real_floats=True) cc_msg = FuzzyGenerator.get_random_msg(data.draw, car.CarControl, real_floats=True)
# Run car interface # Run car interface
@ -118,9 +117,9 @@ class TestCarInterfaces:
LongControl(car_params) LongControl(car_params)
if car_params.steerControlType == CarParams.SteerControlType.angle: if car_params.steerControlType == CarParams.SteerControlType.angle:
LatControlAngle(car_params, car_interface) LatControlAngle(car_params, car_interface)
elif isinstance(car_params.lateralTuning, CarParams.LateralPIDTuning): elif car_params.lateralTuning.which() == 'pid':
LatControlPID(car_params, car_interface) LatControlPID(car_params, car_interface)
elif isinstance(car_params.lateralTuning, CarParams.LateralTorqueTuning): elif car_params.lateralTuning.which() == 'torque':
LatControlTorque(car_params, car_interface) LatControlTorque(car_params, car_interface)
# Test radar interface # Test radar interface

@ -31,8 +31,8 @@ class CarControllerParams:
ANGLE_RATE_LIMIT_UP = AngleRateLimit(speed_bp=[5, 25], angle_v=[0.3, 0.15]) ANGLE_RATE_LIMIT_UP = AngleRateLimit(speed_bp=[5, 25], angle_v=[0.3, 0.15])
ANGLE_RATE_LIMIT_DOWN = AngleRateLimit(speed_bp=[5, 25], angle_v=[0.36, 0.26]) ANGLE_RATE_LIMIT_DOWN = AngleRateLimit(speed_bp=[5, 25], angle_v=[0.36, 0.26])
def __init__(self, CP: CarParams): def __init__(self, CP):
if isinstance(CP.lateralTuning, CarParams.LateralTorqueTuning): if CP.lateralTuning.which == 'torque':
self.STEER_DELTA_UP = 15 # 1.0s time to peak torque self.STEER_DELTA_UP = 15 # 1.0s time to peak torque
self.STEER_DELTA_DOWN = 25 # always lower than 45 otherwise the Rav4 faults (Prius seems ok with 50) self.STEER_DELTA_DOWN = 25 # always lower than 45 otherwise the Rav4 faults (Prius seems ok with 50)
else: else:

Loading…
Cancel
Save