From 4704670b33cf21454d3ea82bfac7fd4c165b7271 Mon Sep 17 00:00:00 2001 From: Mostafa Ayesh Date: Tue, 24 May 2022 13:10:07 -0400 Subject: [PATCH] honda pedal tuning --- selfdrive/car/honda/interface.py | 13 ++++++++++++- selfdrive/car/honda/values.py | 2 ++ .../controls/lib/longitudinal_mpc_lib/long_mpc.py | 4 ++-- selfdrive/controls/lib/longitudinal_planner.py | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 2176da452e2f19..955e94b166ba78 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -31,7 +31,10 @@ def get_pid_accel_limits(CP, current_speed, cruise_speed): else: # NIDECs don't allow acceleration near cruise_speed, # so limit limits of pid to prevent windup - ACCEL_MAX_VALS = [CarControllerParams.NIDEC_ACCEL_MAX, 0.2] + if CP.enableGasInterceptor: + ACCEL_MAX_VALS = [CarControllerParams.PEDAL_ACCEL_MAX, 1.5] + else: + ACCEL_MAX_VALS = [CarControllerParams.NIDEC_ACCEL_MAX, 0.2] ACCEL_MAX_BP = [cruise_speed - 2., cruise_speed - .2] return CarControllerParams.NIDEC_ACCEL_MIN, interp(current_speed, ACCEL_MAX_BP, ACCEL_MAX_VALS) @@ -81,6 +84,11 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[]): # py ret.longitudinalTuning.kpV = [0.25] ret.longitudinalTuning.kiV = [0.05] ret.longitudinalActuatorDelayUpperBound = 0.5 # s + elif ret.enableGasInterceptor: + ret.longitudinalTuning.kpBP = [0., 11., 24., 37.] # 0, 25, 55, 85 mph, + ret.longitudinalTuning.kpV = [1.2, 1.6, 1.9, 2.1] + ret.longitudinalTuning.kiBP = [0., 35.] + ret.longitudinalTuning.kiV = [0.54, 0.36] else: # default longitudinal tuning for all hondas ret.longitudinalTuning.kpBP = [0., 5., 35.] @@ -88,6 +96,9 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[]): # py ret.longitudinalTuning.kiBP = [0., 35.] ret.longitudinalTuning.kiV = [0.18, 0.12] + + + eps_modified = False for fw in car_fw: if fw.ecu == "eps" and b"," in fw.fwVersion: diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index e62bd0a6d9248a..5a4f91e1cf8a5f 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -30,6 +30,8 @@ class CarControllerParams(): BOSCH_GAS_LOOKUP_BP = [-0.2, 2.0] # 2m/s^2 BOSCH_GAS_LOOKUP_V = [0, 1600] + PEDAL_ACCEL_MAX = 3.2 # m/s^2 + def __init__(self, CP): self.STEER_MAX = CP.lateralParams.torqueBP[-1] # mirror of list (assuming first item is zero) for interp of signed request values diff --git a/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py b/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py index e0e0208d67f230..075df76f86b93a 100644 --- a/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py +++ b/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py @@ -295,8 +295,8 @@ def process_lead(self, lead): return lead_xv def set_accel_limits(self, min_a, max_a): - self.cruise_min_a = min_a - self.cruise_max_a = max_a + self.cruise_min_a = -3.2 + self.cruise_max_a = 3.2 def update(self, carstate, radarstate, v_cruise, prev_accel_constraint=False): v_ego = self.x0[1] diff --git a/selfdrive/controls/lib/longitudinal_planner.py b/selfdrive/controls/lib/longitudinal_planner.py index 42965952e519d5..39c16276ba459d 100755 --- a/selfdrive/controls/lib/longitudinal_planner.py +++ b/selfdrive/controls/lib/longitudinal_planner.py @@ -21,7 +21,7 @@ LON_MPC_STEP = 0.2 # first step is 0.2s AWARENESS_DECEL = -0.2 # car smoothly decel at .2m/s^2 when user is distracted A_CRUISE_MIN = -1.2 -A_CRUISE_MAX_VALS = [1.2, 1.2, 0.8, 0.6] +A_CRUISE_MAX_VALS = [1.3, 1.2, 1.1, 1.0] A_CRUISE_MAX_BP = [0., 15., 25., 40.] # Lookup table for turns