Skip to content

Commit

Permalink
honda pedal tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafaayesh committed Jul 6, 2022
1 parent 262a3f2 commit 53b6091
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
13 changes: 12 additions & 1 deletion selfdrive/car/honda/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -81,13 +84,21 @@ 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.]
ret.longitudinalTuning.kpV = [1.2, 0.8, 0.5]
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:
Expand Down
2 changes: 2 additions & 0 deletions selfdrive/car/honda/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/lib/longitudinal_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 53b6091

Please sign in to comment.