diff --git a/common/op_params.py b/common/op_params.py index abb272836d2f57..a319fb088ace71 100644 --- a/common/op_params.py +++ b/common/op_params.py @@ -92,6 +92,7 @@ def __init__(self): 'localizer might not work correctly'), 'prius_use_lqr': Param(False, bool, 'If you have a newer Prius with a good angle sensor, you can try enabling this to use LQR'), 'corolla_use_lqr': Param(False, bool, 'Enable this to use LQR for lat with your Corolla (2017)'), + 'corollaTSS2_use_indi': Param(False, bool, 'Enable this to use INDI for lat with your Corolla with TSS2'), 'username': Param(None, [type(None), str, bool], 'Your identifier provided with any crash logs sent to Sentry.\n' 'Helps the developer reach out to you if anything goes wrong'), diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py index c7da513acc543f..050d71a795a85e 100755 --- a/selfdrive/car/toyota/interface.py +++ b/selfdrive/car/toyota/interface.py @@ -10,6 +10,7 @@ op_params = opParams() prius_use_lqr = op_params.get('prius_use_lqr') corolla_use_lqr = op_params.get('corolla_use_lqr') +corollaTSS2_use_indi = op_params.get('corollaTSS2_use_indi') EventName = car.CarEvent.EventName class CarInterface(CarInterfaceBase): @@ -255,8 +256,20 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), has_relay=False, ret.steerRatio = 13.9 tire_stiffness_factor = 0.444 # not optimized yet ret.mass = 3060. * CV.LB_TO_KG + STD_CARGO_KG - ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.1]] - ret.lateralTuning.pid.kf = 0.00007818594 + + # birdman6450#7399's Corolla 2020 TSS2 Tune + if corollaTSS2_use_indi: + ret.steerRatio = 15.33 + tire_stiffness_factor = 0.996 + ret.lateralTuning.init('indi') + ret.lateralTuning.indi.innerLoopGain = 6.0 + ret.lateralTuning.indi.outerLoopGain = 15.0 + ret.lateralTuning.indi.timeConstant = 5.5 + ret.lateralTuning.indi.actuatorEffectiveness = 6.0 + ret.steerActuatorDelay = 0.57 + else: + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.1]] + ret.lateralTuning.pid.kf = 0.00007818594 elif candidate in [CAR.LEXUS_ES_TSS2, CAR.LEXUS_ESH_TSS2]: stop_and_go = True