mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-24 15:32:07 +08:00
Cleanup car interfaces (#24948)
* remove interface overrides * Fix test * set torque tune for ev6
This commit is contained in:
@@ -204,7 +204,6 @@ class CarInterface(CarInterfaceBase):
|
|||||||
ret.wheelbase = 2.80
|
ret.wheelbase = 2.80
|
||||||
ret.steerRatio = 13.75
|
ret.steerRatio = 13.75
|
||||||
tire_stiffness_factor = 0.5
|
tire_stiffness_factor = 0.5
|
||||||
torque_params = CarInterfaceBase.get_torque_params(CAR.KIA_OPTIMA)
|
|
||||||
set_torque_tune(ret.lateralTuning, torque_params['LAT_ACCEL_FACTOR'], torque_params['FRICTION'])
|
set_torque_tune(ret.lateralTuning, torque_params['LAT_ACCEL_FACTOR'], torque_params['FRICTION'])
|
||||||
elif candidate == CAR.KIA_STINGER:
|
elif candidate == CAR.KIA_STINGER:
|
||||||
ret.lateralTuning.pid.kf = 0.00005
|
ret.lateralTuning.pid.kf = 0.00005
|
||||||
@@ -245,10 +244,7 @@ class CarInterface(CarInterfaceBase):
|
|||||||
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.noOutput),
|
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.noOutput),
|
||||||
get_safety_config(car.CarParams.SafetyModel.hyundaiHDA2)]
|
get_safety_config(car.CarParams.SafetyModel.hyundaiHDA2)]
|
||||||
tire_stiffness_factor = 0.65
|
tire_stiffness_factor = 0.65
|
||||||
|
set_torque_tune(ret.lateralTuning, torque_params['LAT_ACCEL_FACTOR'], torque_params['FRICTION'])
|
||||||
ret.maxLateralAccel = 2.
|
|
||||||
# TODO override until there is more data
|
|
||||||
set_torque_tune(ret.lateralTuning, 2.0, 0.05)
|
|
||||||
|
|
||||||
# Genesis
|
# Genesis
|
||||||
elif candidate == CAR.GENESIS_G70:
|
elif candidate == CAR.GENESIS_G70:
|
||||||
|
|||||||
@@ -119,12 +119,14 @@ class CarInterfaceBase(ABC):
|
|||||||
with open(TORQUE_PARAMS_PATH) as f:
|
with open(TORQUE_PARAMS_PATH) as f:
|
||||||
params = yaml.load(f, Loader=yaml.FullLoader)
|
params = yaml.load(f, Loader=yaml.FullLoader)
|
||||||
with open(TORQUE_OVERRIDE_PATH) as f:
|
with open(TORQUE_OVERRIDE_PATH) as f:
|
||||||
params_override = yaml.load(f, Loader=yaml.FullLoader)
|
override = yaml.load(f, Loader=yaml.FullLoader)
|
||||||
|
|
||||||
assert len(set(sub.keys()) & set(params.keys()) & set(params_override.keys())) == 0
|
# Ensure no overlap
|
||||||
|
if sum([candidate in x for x in [sub, params, override]]) > 1:
|
||||||
|
raise RuntimeError(f'{candidate} is defined twice in torque config')
|
||||||
|
|
||||||
if candidate in params_override:
|
if candidate in override:
|
||||||
out = params_override[candidate]
|
out = override[candidate]
|
||||||
elif candidate in params:
|
elif candidate in params:
|
||||||
out = params[candidate]
|
out = params[candidate]
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -54,9 +54,6 @@ class CarInterface(CarInterfaceBase):
|
|||||||
ret.steerRatio = 17.4
|
ret.steerRatio = 17.4
|
||||||
tire_stiffness_factor = 0.5533
|
tire_stiffness_factor = 0.5533
|
||||||
ret.mass = 3340. * CV.LB_TO_KG + STD_CARGO_KG
|
ret.mass = 3340. * CV.LB_TO_KG + STD_CARGO_KG
|
||||||
# TODO override until there is enough data
|
|
||||||
ret.maxLateralAccel = 1.8
|
|
||||||
torque_params = CarInterfaceBase.get_torque_params(CAR.PRIUS)
|
|
||||||
set_torque_tune(ret.lateralTuning, torque_params['LAT_ACCEL_FACTOR'], torque_params['FRICTION'], steering_angle_deadzone_deg)
|
set_torque_tune(ret.lateralTuning, torque_params['LAT_ACCEL_FACTOR'], torque_params['FRICTION'], steering_angle_deadzone_deg)
|
||||||
|
|
||||||
elif candidate in (CAR.RAV4, CAR.RAV4H):
|
elif candidate in (CAR.RAV4, CAR.RAV4H):
|
||||||
@@ -132,10 +129,6 @@ class CarInterface(CarInterfaceBase):
|
|||||||
ret.mass = 3585. * CV.LB_TO_KG + STD_CARGO_KG # Average between ICE and Hybrid
|
ret.mass = 3585. * CV.LB_TO_KG + STD_CARGO_KG # Average between ICE and Hybrid
|
||||||
set_lat_tune(ret.lateralTuning, LatTunes.PID_D)
|
set_lat_tune(ret.lateralTuning, LatTunes.PID_D)
|
||||||
|
|
||||||
# TODO: remove once there's data
|
|
||||||
if candidate == CAR.RAV4_TSS2_2022:
|
|
||||||
ret.maxLateralAccel = CarInterfaceBase.get_torque_params(CAR.RAV4H_TSS2_2022)['MAX_LAT_ACCEL_MEASURED']
|
|
||||||
|
|
||||||
# 2019+ RAV4 TSS2 uses two different steering racks and specific tuning seems to be necessary.
|
# 2019+ RAV4 TSS2 uses two different steering racks and specific tuning seems to be necessary.
|
||||||
# See https://github.com/commaai/openpilot/pull/21429#issuecomment-873652891
|
# See https://github.com/commaai/openpilot/pull/21429#issuecomment-873652891
|
||||||
for fw in car_fw:
|
for fw in car_fw:
|
||||||
|
|||||||
Reference in New Issue
Block a user