|  |  |  | @ -5,7 +5,7 @@ from common.conversions import Conversions as CV | 
			
		
	
		
			
				
					|  |  |  |  | from common.numpy_fast import interp | 
			
		
	
		
			
				
					|  |  |  |  | from selfdrive.car.honda.values import CarControllerParams, CruiseButtons, HondaFlags, CAR, HONDA_BOSCH, HONDA_NIDEC_ALT_SCM_MESSAGES, \ | 
			
		
	
		
			
				
					|  |  |  |  |                                                                                             HONDA_BOSCH_ALT_BRAKE_SIGNAL, HONDA_BOSCH_RADARLESS | 
			
		
	
		
			
				
					|  |  |  |  | from selfdrive.car import STD_CARGO_KG, CivicParams, create_button_event, scale_tire_stiffness, get_safety_config | 
			
		
	
		
			
				
					|  |  |  |  | from selfdrive.car import STD_CARGO_KG, CivicParams, create_button_event, get_safety_config | 
			
		
	
		
			
				
					|  |  |  |  | from selfdrive.car.interfaces import CarInterfaceBase | 
			
		
	
		
			
				
					|  |  |  |  | from selfdrive.car.disable_ecu import disable_ecu | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -105,7 +105,6 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |       else: | 
			
		
	
		
			
				
					|  |  |  |  |         ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560], [0, 2560]] | 
			
		
	
		
			
				
					|  |  |  |  |         ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[1.1], [0.33]] | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 1. | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     elif candidate in (CAR.CIVIC_BOSCH, CAR.CIVIC_BOSCH_DIESEL, CAR.CIVIC_2022): | 
			
		
	
		
			
				
					|  |  |  |  |       ret.mass = CivicParams.MASS | 
			
		
	
	
		
			
				
					|  |  |  | @ -113,7 +112,6 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |       ret.centerToFront = CivicParams.CENTER_TO_FRONT | 
			
		
	
		
			
				
					|  |  |  |  |       ret.steerRatio = 15.38  # 10.93 is end-to-end spec | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]]  # TODO: determine if there is a dead zone at the top end | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 1. | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]] | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     elif candidate in (CAR.ACCORD, CAR.ACCORDH): | 
			
		
	
	
		
			
				
					|  |  |  | @ -122,7 +120,7 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |       ret.centerToFront = ret.wheelbase * 0.39 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.steerRatio = 16.33  # 11.82 is spec end-to-end | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]]  # TODO: determine if there is a dead zone at the top end | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 0.8467 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.tireStiffnessFactor = 0.8467 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |       if eps_modified: | 
			
		
	
		
			
				
					|  |  |  |  |         ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.3], [0.09]] | 
			
		
	
	
		
			
				
					|  |  |  | @ -135,7 +133,7 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |       ret.centerToFront = ret.wheelbase * 0.37 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.steerRatio = 18.61  # 15.3 is spec end-to-end | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 3840], [0, 3840]]  # TODO: determine if there is a dead zone at the top end | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 0.72 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.tireStiffnessFactor = 0.72 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]] | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     elif candidate in (CAR.CRV, CAR.CRV_EU): | 
			
		
	
	
		
			
				
					|  |  |  | @ -144,7 +142,7 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |       ret.centerToFront = ret.wheelbase * 0.41 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.steerRatio = 16.89  # as spec | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 1000], [0, 1000]]  # TODO: determine if there is a dead zone at the top end | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 0.444 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.tireStiffnessFactor = 0.444 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]] | 
			
		
	
		
			
				
					|  |  |  |  |       ret.wheelSpeedFactor = 1.025 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -162,7 +160,7 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |       else: | 
			
		
	
		
			
				
					|  |  |  |  |         ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 3840], [0, 3840]] | 
			
		
	
		
			
				
					|  |  |  |  |         ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.64], [0.192]] | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 0.677 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.tireStiffnessFactor = 0.677 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.wheelSpeedFactor = 1.025 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     elif candidate == CAR.CRV_HYBRID: | 
			
		
	
	
		
			
				
					|  |  |  | @ -171,7 +169,7 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |       ret.centerToFront = ret.wheelbase * 0.41 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.steerRatio = 16.0  # 12.3 is spec end-to-end | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]]  # TODO: determine if there is a dead zone at the top end | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 0.677 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.tireStiffnessFactor = 0.677 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]] | 
			
		
	
		
			
				
					|  |  |  |  |       ret.wheelSpeedFactor = 1.025 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -181,7 +179,7 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |       ret.centerToFront = ret.wheelbase * 0.39 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.steerRatio = 13.06 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]]  # TODO: determine if there is a dead zone at the top end | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 0.75 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.tireStiffnessFactor = 0.75 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.05]] | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     elif candidate == CAR.FREED: | 
			
		
	
	
		
			
				
					|  |  |  | @ -191,7 +189,7 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |       ret.centerToFront = ret.wheelbase * 0.39 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.steerRatio = 13.06 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 0.75 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.tireStiffnessFactor = 0.75 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.05]] | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     elif candidate in (CAR.HRV, CAR.HRV_3G): | 
			
		
	
	
		
			
				
					|  |  |  | @ -200,7 +198,7 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |       ret.centerToFront = ret.wheelbase * 0.41 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.steerRatio = 15.2 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 0.5 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.tireStiffnessFactor = 0.5 | 
			
		
	
		
			
				
					|  |  |  |  |       if candidate == CAR.HRV: | 
			
		
	
		
			
				
					|  |  |  |  |         ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.16], [0.025]] | 
			
		
	
		
			
				
					|  |  |  |  |         ret.wheelSpeedFactor = 1.025 | 
			
		
	
	
		
			
				
					|  |  |  | @ -212,7 +210,7 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |       ret.wheelbase = 2.68 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.centerToFront = ret.wheelbase * 0.38 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.steerRatio = 15.0  # as spec | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 0.444 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.tireStiffnessFactor = 0.444 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 1000], [0, 1000]]  # TODO: determine if there is a dead zone at the top end | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]] | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -223,14 +221,14 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |       ret.steerRatio = 11.95  # as spec | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 3840], [0, 3840]] | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.06]] | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 0.677 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.tireStiffnessFactor = 0.677 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     elif candidate in (CAR.ODYSSEY, CAR.ODYSSEY_CHN): | 
			
		
	
		
			
				
					|  |  |  |  |       ret.mass = 1900. + STD_CARGO_KG | 
			
		
	
		
			
				
					|  |  |  |  |       ret.wheelbase = 3.00 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.centerToFront = ret.wheelbase * 0.41 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.steerRatio = 14.35  # as spec | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 0.82 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.tireStiffnessFactor = 0.82 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.28], [0.08]] | 
			
		
	
		
			
				
					|  |  |  |  |       if candidate == CAR.ODYSSEY_CHN: | 
			
		
	
		
			
				
					|  |  |  |  |         ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 32767], [0, 32767]]  # TODO: determine if there is a dead zone at the top end | 
			
		
	
	
		
			
				
					|  |  |  | @ -243,7 +241,7 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |       ret.centerToFront = ret.wheelbase * 0.428 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.steerRatio = 16.0  # as spec | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]]  # TODO: determine if there is a dead zone at the top end | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 0.444 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.tireStiffnessFactor = 0.444 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.38], [0.11]] | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     elif candidate == CAR.RIDGELINE: | 
			
		
	
	
		
			
				
					|  |  |  | @ -252,7 +250,7 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |       ret.centerToFront = ret.wheelbase * 0.41 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.steerRatio = 15.59  # as spec | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]]  # TODO: determine if there is a dead zone at the top end | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 0.444 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.tireStiffnessFactor = 0.444 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.38], [0.11]] | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     elif candidate == CAR.INSIGHT: | 
			
		
	
	
		
			
				
					|  |  |  | @ -261,7 +259,7 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |       ret.centerToFront = ret.wheelbase * 0.39 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.steerRatio = 15.0  # 12.58 is spec end-to-end | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]]  # TODO: determine if there is a dead zone at the top end | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 0.82 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.tireStiffnessFactor = 0.82 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]] | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     elif candidate == CAR.HONDA_E: | 
			
		
	
	
		
			
				
					|  |  |  | @ -270,7 +268,7 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |       ret.centerToFront = ret.wheelbase * 0.5 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.steerRatio = 16.71 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]]  # TODO: determine if there is a dead zone at the top end | 
			
		
	
		
			
				
					|  |  |  |  |       tire_stiffness_factor = 0.82 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.tireStiffnessFactor = 0.82 | 
			
		
	
		
			
				
					|  |  |  |  |       ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]] # TODO: can probably use some tuning | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     else: | 
			
		
	
	
		
			
				
					|  |  |  | @ -296,11 +294,6 @@ class CarInterface(CarInterfaceBase): | 
			
		
	
		
			
				
					|  |  |  |  |     ret.autoResumeSng = candidate in (HONDA_BOSCH | {CAR.CIVIC}) or ret.enableGasInterceptor | 
			
		
	
		
			
				
					|  |  |  |  |     ret.minEnableSpeed = -1. if ret.autoResumeSng else 25.5 * CV.MPH_TO_MS | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     # TODO: start from empirically derived lateral slip stiffness for the civic and scale by | 
			
		
	
		
			
				
					|  |  |  |  |     # mass and CG position, so all cars will have approximately similar dyn behaviors | 
			
		
	
		
			
				
					|  |  |  |  |     ret.tireStiffnessFront, ret.tireStiffnessRear = scale_tire_stiffness(ret.mass, ret.wheelbase, ret.centerToFront, | 
			
		
	
		
			
				
					|  |  |  |  |                                                                          tire_stiffness_factor=tire_stiffness_factor) | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     ret.steerActuatorDelay = 0.1 | 
			
		
	
		
			
				
					|  |  |  |  |     ret.steerLimitTimer = 0.8 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | 
 |