|
|
@ -12,28 +12,38 @@ class CarInterface(CarInterfaceBase): |
|
|
|
ret.carName = "chrysler" |
|
|
|
ret.carName = "chrysler" |
|
|
|
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.chrysler)] |
|
|
|
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.chrysler)] |
|
|
|
|
|
|
|
|
|
|
|
# Speed conversion: 20, 45 mph |
|
|
|
|
|
|
|
ret.wheelbase = 3.089 # in meters for Pacifica Hybrid 2017 |
|
|
|
|
|
|
|
ret.steerRatio = 16.2 # Pacifica Hybrid 2017 |
|
|
|
|
|
|
|
ret.mass = 2242. + STD_CARGO_KG # kg curb weight Pacifica Hybrid 2017 |
|
|
|
|
|
|
|
ret.lateralTuning.pid.kpBP, ret.lateralTuning.pid.kiBP = [[9., 20.], [9., 20.]] |
|
|
|
|
|
|
|
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.15, 0.30], [0.03, 0.05]] |
|
|
|
|
|
|
|
ret.lateralTuning.pid.kf = 0.00006 # full torque for 10 deg at 80mph means 0.00007818594 |
|
|
|
|
|
|
|
ret.steerActuatorDelay = 0.1 |
|
|
|
ret.steerActuatorDelay = 0.1 |
|
|
|
ret.steerLimitTimer = 0.4 |
|
|
|
ret.steerLimitTimer = 0.4 |
|
|
|
|
|
|
|
|
|
|
|
if candidate in (CAR.JEEP_CHEROKEE, CAR.JEEP_CHEROKEE_2019): |
|
|
|
|
|
|
|
ret.wheelbase = 2.91 # in meters |
|
|
|
|
|
|
|
ret.steerRatio = 12.7 |
|
|
|
|
|
|
|
ret.steerActuatorDelay = 0.2 # in seconds |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ret.centerToFront = ret.wheelbase * 0.44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ret.minSteerSpeed = 3.8 # m/s |
|
|
|
ret.minSteerSpeed = 3.8 # m/s |
|
|
|
if candidate in (CAR.PACIFICA_2019_HYBRID, CAR.PACIFICA_2020, CAR.JEEP_CHEROKEE_2019): |
|
|
|
if candidate in (CAR.PACIFICA_2019_HYBRID, CAR.PACIFICA_2020, CAR.JEEP_CHEROKEE_2019): |
|
|
|
# TODO allow 2019 cars to steer down to 13 m/s if already engaged. |
|
|
|
# TODO: allow 2019 cars to steer down to 13 m/s if already engaged. |
|
|
|
ret.minSteerSpeed = 17.5 # m/s 17 on the way up, 13 on the way down once engaged. |
|
|
|
ret.minSteerSpeed = 17.5 # m/s 17 on the way up, 13 on the way down once engaged. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Chrysler |
|
|
|
|
|
|
|
if candidate in (CAR.PACIFICA_2017_HYBRID, CAR.PACIFICA_2018, CAR.PACIFICA_2018_HYBRID, CAR.PACIFICA_2019_HYBRID, CAR.PACIFICA_2020): |
|
|
|
|
|
|
|
ret.mass = 2242. + STD_CARGO_KG |
|
|
|
|
|
|
|
ret.wheelbase = 3.089 |
|
|
|
|
|
|
|
ret.steerRatio = 16.2 # Pacifica Hybrid 2017 |
|
|
|
|
|
|
|
ret.lateralTuning.pid.kpBP, ret.lateralTuning.pid.kiBP = [[9., 20.], [9., 20.]] |
|
|
|
|
|
|
|
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.15, 0.30], [0.03, 0.05]] |
|
|
|
|
|
|
|
ret.lateralTuning.pid.kf = 0.00006 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Jeep |
|
|
|
|
|
|
|
elif candidate in (CAR.JEEP_CHEROKEE, CAR.JEEP_CHEROKEE_2019): |
|
|
|
|
|
|
|
ret.mass = 1778 + STD_CARGO_KG |
|
|
|
|
|
|
|
ret.wheelbase = 2.71 |
|
|
|
|
|
|
|
ret.steerRatio = 16.7 |
|
|
|
|
|
|
|
ret.steerActuatorDelay = 0.2 |
|
|
|
|
|
|
|
ret.lateralTuning.pid.kpBP, ret.lateralTuning.pid.kiBP = [[9., 20.], [9., 20.]] |
|
|
|
|
|
|
|
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.15, 0.30], [0.03, 0.05]] |
|
|
|
|
|
|
|
ret.lateralTuning.pid.kf = 0.00006 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
raise ValueError(f"Unsupported car: {candidate}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ret.centerToFront = ret.wheelbase * 0.44 |
|
|
|
|
|
|
|
|
|
|
|
# starting with reasonable value for civic and scaling by mass and wheelbase |
|
|
|
# starting with reasonable value for civic and scaling by mass and wheelbase |
|
|
|
ret.rotationalInertia = scale_rot_inertia(ret.mass, ret.wheelbase) |
|
|
|
ret.rotationalInertia = scale_rot_inertia(ret.mass, ret.wheelbase) |
|
|
|
|
|
|
|
|
|
|
@ -45,7 +55,6 @@ class CarInterface(CarInterfaceBase): |
|
|
|
|
|
|
|
|
|
|
|
return ret |
|
|
|
return ret |
|
|
|
|
|
|
|
|
|
|
|
# returns a car.CarState |
|
|
|
|
|
|
|
def _update(self, c): |
|
|
|
def _update(self, c): |
|
|
|
ret = self.CS.update(self.cp, self.cp_cam) |
|
|
|
ret = self.CS.update(self.cp, self.cp_cam) |
|
|
|
|
|
|
|
|
|
|
@ -54,14 +63,17 @@ class CarInterface(CarInterfaceBase): |
|
|
|
# events |
|
|
|
# events |
|
|
|
events = self.create_common_events(ret, extra_gears=[car.CarState.GearShifter.low]) |
|
|
|
events = self.create_common_events(ret, extra_gears=[car.CarState.GearShifter.low]) |
|
|
|
|
|
|
|
|
|
|
|
if ret.vEgo < self.CP.minSteerSpeed: |
|
|
|
# Low speed steer alert hysteresis logic |
|
|
|
|
|
|
|
if self.CP.minSteerSpeed > 0. and ret.vEgo < (self.CP.minSteerSpeed + 1.): |
|
|
|
|
|
|
|
self.low_speed_alert = True |
|
|
|
|
|
|
|
elif ret.vEgo > (self.CP.minSteerSpeed + 2.): |
|
|
|
|
|
|
|
self.low_speed_alert = False |
|
|
|
|
|
|
|
if self.low_speed_alert: |
|
|
|
events.add(car.CarEvent.EventName.belowSteerSpeed) |
|
|
|
events.add(car.CarEvent.EventName.belowSteerSpeed) |
|
|
|
|
|
|
|
|
|
|
|
ret.events = events.to_msg() |
|
|
|
ret.events = events.to_msg() |
|
|
|
|
|
|
|
|
|
|
|
return ret |
|
|
|
return ret |
|
|
|
|
|
|
|
|
|
|
|
# pass in a car.CarControl |
|
|
|
|
|
|
|
# to be called @ 100hz |
|
|
|
|
|
|
|
def apply(self, c): |
|
|
|
def apply(self, c): |
|
|
|
return self.CC.update(c, self.CS) |
|
|
|
return self.CC.update(c, self.CS) |
|
|
|