diff --git a/opendbc_repo/opendbc/car/gm/carcontroller.py b/opendbc_repo/opendbc/car/gm/carcontroller.py index dc9f014696..078e12d536 100644 --- a/opendbc_repo/opendbc/car/gm/carcontroller.py +++ b/opendbc_repo/opendbc/car/gm/carcontroller.py @@ -116,12 +116,12 @@ def get_testing_ground_1_brake_switch_bias(v_ego: float) -> int: return int(round(np.interp(v_ego, [0.0, 6.0, 15.0, 30.0], [40.0, 85.0, 130.0, 170.0]))) -def supports_volt_auto_hold(CP, starpilot_toggles): +def supports_volt_auto_hold(CP, auto_hold_enabled: bool): safety_cfg = getattr(CP, "safetyConfigs", ()) safety_param = safety_cfg[0].safetyParam if safety_cfg else 0 stock_hold_safety_ready = CP.openpilotLongitudinalControl or bool(safety_param & GMSafetyFlags.FLAG_GM_PANDA_PADDLE_SCHED.value) return ( - getattr(starpilot_toggles, "gm_auto_hold", False) and + auto_hold_enabled and stock_hold_safety_ready and CP.carFingerprint in AUTO_HOLD_VOLT_CARS ) @@ -134,13 +134,15 @@ def estimate_auto_hold_brake(driver_brake: float, op_brake: float) -> int: def should_activate_auto_hold(hold_ready: bool, auto_hold_armed: bool, auto_hold_engaged: bool, - brake_pressed: bool, long_active: bool, regen_braking: bool, v_ego: float) -> bool: + brake_pressed: bool, standstill: bool, long_active: bool, + regen_braking: bool, v_ego: float) -> bool: + stopped = standstill or v_ego < 0.02 return ( hold_ready and (auto_hold_armed or auto_hold_engaged or brake_pressed) and + stopped and not long_active and - not regen_braking and - v_ego < 0.02 + not regen_braking ) @@ -214,6 +216,10 @@ class CarController(CarControllerBase): self.malibu_button_phase = 0 self.malibu_last_button_ts_nanos = 0 self.auto_hold_brake = 0 + try: + self.gm_auto_hold_enabled = self.params_.get_bool("GMAutoHold") + except UnknownKeyName: + self.gm_auto_hold_enabled = False def calc_pedal_command(self, accel: float, long_active: bool, v_ego: float): if not long_active: @@ -363,7 +369,7 @@ class CarController(CarControllerBase): self.aego = CS.out.aEgo accel = actuators.accel press_regen_paddle = False - auto_hold_enabled = supports_volt_auto_hold(self.CP, starpilot_toggles) + auto_hold_enabled = supports_volt_auto_hold(self.CP, self.gm_auto_hold_enabled) stock_hold_apply_brake = self.apply_brake if self.CP.openpilotLongitudinalControl else 0 hold_ready = ( @@ -376,7 +382,7 @@ class CarController(CarControllerBase): CS.auto_hold_armed = False elif CS.regen_release_timer > 0.0: CS.auto_hold_armed = False - elif not CS.auto_hold_armed and (CS.out.vEgo > 0.03 or (CS.out.vEgo < 0.02 and CS.out.brakePressed)): + elif not CS.auto_hold_armed and (CS.out.vEgo > 0.03 or ((CS.out.standstill or CS.out.vEgo < 0.02) and CS.out.brakePressed)): CS.auto_hold_armed = True if CS.out.vEgo > 0.1 or CS.out.gasPressed or CS.out.gearShifter not in AUTO_HOLD_DRIVE_GEARS: @@ -385,6 +391,10 @@ class CarController(CarControllerBase): self.auto_hold_brake = estimate_auto_hold_brake(CS.out.brake, stock_hold_apply_brake) if self.frame % 25 == 0: + try: + self.gm_auto_hold_enabled = self.params_.get_bool("GMAutoHold") + except UnknownKeyName: + self.gm_auto_hold_enabled = False try: mode = self.params_.get("LongitudinalManeuverPaddleMode") except UnknownKeyName: @@ -469,6 +479,7 @@ class CarController(CarControllerBase): CS.auto_hold_armed, CS.auto_hold_engaged, CS.out.brakePressed, + CS.out.standstill, CC.longActive, CS.out.regenBraking, CS.out.vEgo, diff --git a/opendbc_repo/opendbc/car/honda/carcontroller.py b/opendbc_repo/opendbc/car/honda/carcontroller.py index 493c413a21..609e57db96 100644 --- a/opendbc_repo/opendbc/car/honda/carcontroller.py +++ b/opendbc_repo/opendbc/car/honda/carcontroller.py @@ -31,12 +31,19 @@ def get_civic_bosch_modified_torque_lpf_tau(torque_cmd: float, prev_torque_cmd: low_speed = v_ego < (30.0 * 0.44704) if highway: + if torque_cmd_abs < 0.12: + return 0.18 if sign_change else 0.16 if sign_change and torque_delta > 0.15: return 0.10 return 0.12 if sign_change and torque_cmd_abs < 0.25: - return 0.22 if low_speed else 0.18 + return 0.28 if low_speed else 0.22 + + # Extra damping for the tiny near-center commands where both modified EPS + # firmwares still show hunting and escalating sway. + if torque_cmd_abs < 0.12: + return 0.28 if low_speed else 0.20 if low_speed: if torque_delta > 0.50: diff --git a/opendbc_repo/opendbc/car/honda/tests/test_honda.py b/opendbc_repo/opendbc/car/honda/tests/test_honda.py index 456200e124..c174c7bafe 100644 --- a/opendbc_repo/opendbc/car/honda/tests/test_honda.py +++ b/opendbc_repo/opendbc/car/honda/tests/test_honda.py @@ -41,8 +41,10 @@ class TestHondaFingerprint: def test_modified_civic_torque_lpf_tau_reacts_to_sign_change(self): assert get_civic_bosch_modified_torque_lpf_tau(0.7, -0.1, 25.0) == 0.10 - assert get_civic_bosch_modified_torque_lpf_tau(0.02, -0.01, 8.0) == 0.22 - assert get_civic_bosch_modified_torque_lpf_tau(0.02, 0.01, 12.0) == 0.22 + assert get_civic_bosch_modified_torque_lpf_tau(0.02, -0.01, 8.0) == 0.28 + assert get_civic_bosch_modified_torque_lpf_tau(0.02, 0.01, 12.0) == 0.28 + assert get_civic_bosch_modified_torque_lpf_tau(0.02, 0.01, 20.0) == 0.20 + assert get_civic_bosch_modified_torque_lpf_tau(0.02, 0.01, 25.0) == 0.16 assert get_civic_bosch_modified_torque_lpf_tau(0.30, 0.0, 12.0) == 0.16 assert get_civic_bosch_modified_torque_lpf_tau(0.30, 0.0, 20.0) == 0.13 diff --git a/selfdrive/controls/lib/latcontrol_torque.py b/selfdrive/controls/lib/latcontrol_torque.py index adf2f4c804..0789dcd354 100644 --- a/selfdrive/controls/lib/latcontrol_torque.py +++ b/selfdrive/controls/lib/latcontrol_torque.py @@ -226,24 +226,24 @@ IONIQ_6_TURN_IN_FRICTION_BOOST_LEFT = 0.12 IONIQ_6_TURN_IN_FRICTION_BOOST_RIGHT = 0.19 IONIQ_6_UNWIND_FRICTION_REDUCTION_LEFT = 1.22 IONIQ_6_UNWIND_FRICTION_REDUCTION_RIGHT = 2.70 -IONIQ_6_CENTER_TAPER_MAX = 0.042 +IONIQ_6_CENTER_TAPER_MAX = 0.046 IONIQ_6_CENTER_TAPER_LAT = 0.18 IONIQ_6_CENTER_TAPER_LAT_WIDTH = 0.02 IONIQ_6_CENTER_TAPER_SPEED = 18.0 IONIQ_6_CENTER_TAPER_SPEED_WIDTH = 2.5 -IONIQ_6_LOW_MID_CENTER_TAPER_MAX = 0.080 +IONIQ_6_LOW_MID_CENTER_TAPER_MAX = 0.088 IONIQ_6_LOW_MID_CENTER_TAPER_LAT = 0.28 IONIQ_6_LOW_MID_CENTER_TAPER_LAT_WIDTH = 0.06 -IONIQ_6_LOW_MID_CENTER_TAPER_SPEED_MIN = 7.0 +IONIQ_6_LOW_MID_CENTER_TAPER_SPEED_MIN = 8.5 IONIQ_6_LOW_MID_CENTER_TAPER_SPEED_MAX = 16.5 IONIQ_6_LOW_MID_CENTER_TAPER_SPEED_WIDTH = 1.5 IONIQ_6_DIRECTIONAL_TAPER_LAT_START = 0.15 IONIQ_6_DIRECTIONAL_TAPER_LAT_END = 0.90 IONIQ_6_DIRECTIONAL_TAPER_LAT_WIDTH = 0.08 IONIQ_6_DIRECTIONAL_TAPER_BASE_LEFT = 0.05 -IONIQ_6_DIRECTIONAL_TAPER_BASE_RIGHT = 0.44 +IONIQ_6_DIRECTIONAL_TAPER_BASE_RIGHT = 0.47 IONIQ_6_DIRECTIONAL_TAPER_UNWIND_LEFT = 0.72 -IONIQ_6_DIRECTIONAL_TAPER_UNWIND_RIGHT = 1.64 +IONIQ_6_DIRECTIONAL_TAPER_UNWIND_RIGHT = 1.74 IONIQ_6_OUTPUT_TAPER_SPEED = 8.5 IONIQ_6_OUTPUT_TAPER_SPEED_WIDTH = 2.5 IONIQ_6_OUTPUT_CENTER_TAPER_BLEND = 0.90