Skip to content

Commit d8bfe2f

Browse files
authored
Cleanup car interfaces (#24948)
* remove interface overrides * Fix test * set torque tune for ev6
1 parent 2deaf69 commit d8bfe2f

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

selfdrive/car/hyundai/interface.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl
204204
ret.wheelbase = 2.80
205205
ret.steerRatio = 13.75
206206
tire_stiffness_factor = 0.5
207-
torque_params = CarInterfaceBase.get_torque_params(CAR.KIA_OPTIMA)
208207
set_torque_tune(ret.lateralTuning, torque_params['LAT_ACCEL_FACTOR'], torque_params['FRICTION'])
209208
elif candidate == CAR.KIA_STINGER:
210209
ret.lateralTuning.pid.kf = 0.00005
@@ -245,10 +244,7 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl
245244
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.noOutput),
246245
get_safety_config(car.CarParams.SafetyModel.hyundaiHDA2)]
247246
tire_stiffness_factor = 0.65
248-
249-
ret.maxLateralAccel = 2.
250-
# TODO override until there is more data
251-
set_torque_tune(ret.lateralTuning, 2.0, 0.05)
247+
set_torque_tune(ret.lateralTuning, torque_params['LAT_ACCEL_FACTOR'], torque_params['FRICTION'])
252248

253249
# Genesis
254250
elif candidate == CAR.GENESIS_G70:

selfdrive/car/interfaces.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,14 @@ def get_torque_params(candidate, default=float('NaN')):
119119
with open(TORQUE_PARAMS_PATH) as f:
120120
params = yaml.load(f, Loader=yaml.FullLoader)
121121
with open(TORQUE_OVERRIDE_PATH) as f:
122-
params_override = yaml.load(f, Loader=yaml.FullLoader)
122+
override = yaml.load(f, Loader=yaml.FullLoader)
123123

124-
assert len(set(sub.keys()) & set(params.keys()) & set(params_override.keys())) == 0
124+
# Ensure no overlap
125+
if sum([candidate in x for x in [sub, params, override]]) > 1:
126+
raise RuntimeError(f'{candidate} is defined twice in torque config')
125127

126-
if candidate in params_override:
127-
out = params_override[candidate]
128+
if candidate in override:
129+
out = override[candidate]
128130
elif candidate in params:
129131
out = params[candidate]
130132
else:

selfdrive/car/toyota/interface.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl
5454
ret.steerRatio = 17.4
5555
tire_stiffness_factor = 0.5533
5656
ret.mass = 3340. * CV.LB_TO_KG + STD_CARGO_KG
57-
# TODO override until there is enough data
58-
ret.maxLateralAccel = 1.8
59-
torque_params = CarInterfaceBase.get_torque_params(CAR.PRIUS)
6057
set_torque_tune(ret.lateralTuning, torque_params['LAT_ACCEL_FACTOR'], torque_params['FRICTION'], steering_angle_deadzone_deg)
6158

6259
elif candidate in (CAR.RAV4, CAR.RAV4H):
@@ -132,10 +129,6 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl
132129
ret.mass = 3585. * CV.LB_TO_KG + STD_CARGO_KG # Average between ICE and Hybrid
133130
set_lat_tune(ret.lateralTuning, LatTunes.PID_D)
134131

135-
# TODO: remove once there's data
136-
if candidate == CAR.RAV4_TSS2_2022:
137-
ret.maxLateralAccel = CarInterfaceBase.get_torque_params(CAR.RAV4H_TSS2_2022)['MAX_LAT_ACCEL_MEASURED']
138-
139132
# 2019+ RAV4 TSS2 uses two different steering racks and specific tuning seems to be necessary.
140133
# See https://github.com/commaai/openpilot/pull/21429#issuecomment-873652891
141134
for fw in car_fw:

0 commit comments

Comments
 (0)