Skip to content

Commit 37f1d3c

Browse files
haraschaxnetadvanced
authored andcommitted
Couple more cars to torque tune (commaai#24848)
* try sonata on torque tune * Couple known cars to torque control * fix * more fix
1 parent bbf489e commit 37f1d3c

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

selfdrive/car/hyundai/interface.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl
5555
ret.stopAccel = 0.0
5656

5757
ret.longitudinalActuatorDelayUpperBound = 1.0 # s
58-
58+
torque_params = CarInterfaceBase.get_torque_params(candidate)
5959
if candidate in (CAR.SANTA_FE, CAR.SANTA_FE_2022, CAR.SANTA_FE_HEV_2022, CAR.SANTA_FE_PHEV_2022):
6060
ret.lateralTuning.pid.kf = 0.00005
6161
ret.mass = 3982. * CV.LB_TO_KG + STD_CARGO_KG
@@ -66,13 +66,11 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl
6666
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[9., 22.], [9., 22.]]
6767
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2, 0.35], [0.05, 0.09]]
6868
elif candidate in (CAR.SONATA, CAR.SONATA_HYBRID):
69-
ret.lateralTuning.pid.kf = 0.00005
7069
ret.mass = 1513. + STD_CARGO_KG
7170
ret.wheelbase = 2.84
7271
ret.steerRatio = 13.27 * 1.15 # 15% higher at the center seems reasonable
7372
tire_stiffness_factor = 0.65
74-
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0.], [0.]]
75-
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.25], [0.05]]
73+
set_torque_tune(ret.lateralTuning, torque_params['LAT_ACCEL_FACTOR'], torque_params['FRICTION'])
7674
elif candidate == CAR.SONATA_LF:
7775
ret.lateralTuning.pid.kf = 0.00005
7876
ret.mass = 4497. * CV.LB_TO_KG
@@ -98,21 +96,17 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl
9896
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.25], [0.05]]
9997
ret.minSteerSpeed = 32 * CV.MPH_TO_MS
10098
elif candidate == CAR.ELANTRA_2021:
101-
ret.lateralTuning.pid.kf = 0.00005
10299
ret.mass = (2800. * CV.LB_TO_KG) + STD_CARGO_KG
103100
ret.wheelbase = 2.72
104101
ret.steerRatio = 12.9
105102
tire_stiffness_factor = 0.65
106-
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0.], [0.]]
107-
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.25], [0.05]]
103+
set_torque_tune(ret.lateralTuning, torque_params['LAT_ACCEL_FACTOR'], torque_params['FRICTION'])
108104
elif candidate == CAR.ELANTRA_HEV_2021:
109-
ret.lateralTuning.pid.kf = 0.00005
110105
ret.mass = (3017. * CV.LB_TO_KG) + STD_CARGO_KG
111106
ret.wheelbase = 2.72
112107
ret.steerRatio = 12.9
113108
tire_stiffness_factor = 0.65
114-
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0.], [0.]]
115-
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.25], [0.05]]
109+
set_torque_tune(ret.lateralTuning, torque_params['LAT_ACCEL_FACTOR'], torque_params['FRICTION'])
116110
elif candidate == CAR.HYUNDAI_GENESIS:
117111
ret.lateralTuning.pid.kf = 0.00005
118112
ret.mass = 2060. + STD_CARGO_KG
@@ -210,13 +204,12 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl
210204
ret.lateralTuning.indi.actuatorEffectivenessBP = [0.]
211205
ret.lateralTuning.indi.actuatorEffectivenessV = [1.8]
212206
elif candidate in (CAR.KIA_OPTIMA, CAR.KIA_OPTIMA_H):
213-
ret.lateralTuning.pid.kf = 0.00005
214207
ret.mass = 3558. * CV.LB_TO_KG
215208
ret.wheelbase = 2.80
216209
ret.steerRatio = 13.75
217210
tire_stiffness_factor = 0.5
218-
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0.], [0.]]
219-
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.25], [0.05]]
211+
torque_params = CarInterfaceBase.get_torque_params(CAR.KIA_OPTIMA)
212+
set_torque_tune(ret.lateralTuning, torque_params['LAT_ACCEL_FACTOR'], torque_params['FRICTION'])
220213
elif candidate == CAR.KIA_STINGER:
221214
ret.lateralTuning.pid.kf = 0.00005
222215
ret.mass = 1825. + STD_CARGO_KG
@@ -258,7 +251,8 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl
258251
tire_stiffness_factor = 0.65
259252

260253
ret.maxLateralAccel = 2.
261-
set_torque_tune(ret.lateralTuning, ret.maxLateralAccel, 0.01)
254+
# TODO override until there is more data
255+
set_torque_tune(ret.lateralTuning, 2.0, 0.05)
262256

263257
# Genesis
264258
elif candidate == CAR.GENESIS_G70:

0 commit comments

Comments
 (0)