From 1b8d4b1eef956596a5bc8a38da4eb9875ba24bd6 Mon Sep 17 00:00:00 2001 From: qadmus <42746943+qadmus@users.noreply.github.com> Date: Mon, 22 Mar 2021 05:01:33 -0700 Subject: [PATCH] int(round()) on apply_steer for correct comparison after rate limiting (#20425) old-commit-hash: 0d61d8a4b61287289632ec143f328efdf0c900b0 --- selfdrive/car/chrysler/carcontroller.py | 2 +- selfdrive/car/gm/carcontroller.py | 2 +- selfdrive/car/hyundai/carcontroller.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/chrysler/carcontroller.py b/selfdrive/car/chrysler/carcontroller.py index 83c6fcf3cf..46681b13e2 100644 --- a/selfdrive/car/chrysler/carcontroller.py +++ b/selfdrive/car/chrysler/carcontroller.py @@ -24,7 +24,7 @@ class CarController(): # *** compute control surfaces *** # steer torque - new_steer = actuators.steer * CarControllerParams.STEER_MAX + new_steer = int(round(actuators.steer * CarControllerParams.STEER_MAX)) apply_steer = apply_toyota_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorqueEps, CarControllerParams) self.steer_rate_limited = new_steer != apply_steer diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index dcd300c70c..116a562ac2 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -35,7 +35,7 @@ class CarController(): if (frame % P.STEER_STEP) == 0: lkas_enabled = enabled and not CS.out.steerWarning and CS.out.vEgo > P.MIN_STEER_SPEED if lkas_enabled: - new_steer = actuators.steer * P.STEER_MAX + new_steer = int(round(actuators.steer * P.STEER_MAX)) apply_steer = apply_std_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorque, P) self.steer_rate_limited = new_steer != apply_steer else: diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index d5e58ab688..cf4756e8fc 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -45,7 +45,7 @@ class CarController(): def update(self, enabled, CS, frame, actuators, pcm_cancel_cmd, visual_alert, left_lane, right_lane, left_lane_depart, right_lane_depart): # Steering Torque - new_steer = actuators.steer * self.p.STEER_MAX + new_steer = int(round(actuators.steer * self.p.STEER_MAX)) apply_steer = apply_std_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorque, self.p) self.steer_rate_limited = new_steer != apply_steer