From 8f5ab5d687fffcb937664cc8040656c4d5f5bafb Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 7 Jul 2022 17:27:59 -0700 Subject: [PATCH] move kona limit to car controller old-commit-hash: bd432eb76bf4c2d99a0f66b3a1df0067adb81a1a --- selfdrive/car/hyundai/carcontroller.py | 7 ++++++- selfdrive/car/hyundai/values.py | 4 ---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index f3066bda03..73635375ad 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -52,7 +52,12 @@ class CarController: hud_control = CC.hudControl # Steering Torque - new_steer = int(round(actuators.steer * self.params.STEER_MAX)) + + # These cars have significantly more torque than most HKG. Limit to 70% of max. + steer = actuators.steer + if self.CP.carFingerprint in (CAR.KONA, CAR.KONA_EV, CAR.KONA_HEV): + steer = clip(steer, -0.7, 0.7) + new_steer = int(round(steer * self.params.STEER_MAX)) apply_steer = apply_std_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorque, self.params) self.steer_rate_limited = new_steer != apply_steer diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index c55a0dc639..4b3acf3f27 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -33,10 +33,6 @@ class CarControllerParams: CAR.KIA_OPTIMA_H, CAR.KIA_SORENTO, CAR.KIA_STINGER): self.STEER_MAX = 255 - # These cars have significantly more torque than most HKG. Limit to 70% of max. - elif CP.carFingerprint in (CAR.KONA, CAR.KONA_EV, CAR.KONA_HEV): - self.STEER_MAX = 270 - # Default for most HKG else: self.STEER_MAX = 384