wip
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
from cereal import car
|
||||
from cereal import car, custom
|
||||
from openpilot.common.conversions import Conversions as CV
|
||||
from openpilot.selfdrive.car.mazda.values import CAR, LKAS_LIMITS
|
||||
from openpilot.selfdrive.car import get_safety_config
|
||||
from openpilot.selfdrive.car import create_button_events, get_safety_config
|
||||
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
|
||||
|
||||
ButtonType = car.CarState.ButtonEvent.Type
|
||||
EventName = car.CarEvent.EventName
|
||||
FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
|
||||
|
||||
class CarInterface(CarInterfaceBase):
|
||||
|
||||
@staticmethod
|
||||
def _get_params(ret, params, candidate, fingerprint, car_fw, experimental_long, docs):
|
||||
def _get_params(ret, params, candidate, fingerprint, car_fw, disable_openpilot_long, experimental_long, docs):
|
||||
ret.carName = "mazda"
|
||||
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.mazda)]
|
||||
ret.radarUnavailable = True
|
||||
@@ -20,27 +21,9 @@ class CarInterface(CarInterfaceBase):
|
||||
|
||||
ret.steerActuatorDelay = 0.1
|
||||
ret.steerLimitTimer = 0.8
|
||||
ret.tireStiffnessFactor = 0.70 # not optimized yet
|
||||
|
||||
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
|
||||
|
||||
if candidate in (CAR.CX5, CAR.CX5_2022):
|
||||
ret.mass = 3655 * CV.LB_TO_KG
|
||||
ret.wheelbase = 2.7
|
||||
ret.steerRatio = 15.5
|
||||
elif candidate in (CAR.CX9, CAR.CX9_2021):
|
||||
ret.mass = 4217 * CV.LB_TO_KG
|
||||
ret.wheelbase = 3.1
|
||||
ret.steerRatio = 17.6
|
||||
elif candidate == CAR.MAZDA3:
|
||||
ret.mass = 2875 * CV.LB_TO_KG
|
||||
ret.wheelbase = 2.7
|
||||
ret.steerRatio = 14.0
|
||||
elif candidate == CAR.MAZDA6:
|
||||
ret.mass = 3443 * CV.LB_TO_KG
|
||||
ret.wheelbase = 2.83
|
||||
ret.steerRatio = 15.5
|
||||
|
||||
if candidate not in (CAR.CX5_2022, ):
|
||||
ret.minSteerSpeed = LKAS_LIMITS.DISABLE_SPEED * CV.KPH_TO_MS
|
||||
|
||||
@@ -52,8 +35,14 @@ class CarInterface(CarInterfaceBase):
|
||||
def _update(self, c, frogpilot_variables):
|
||||
ret = self.CS.update(self.cp, self.cp_cam, frogpilot_variables)
|
||||
|
||||
# TODO: add button types for inc and dec
|
||||
ret.buttonEvents = [
|
||||
*create_button_events(self.CS.distance_button, self.CS.prev_distance_button, {1: ButtonType.gapAdjustCruise}),
|
||||
*create_button_events(self.CS.lkas_enabled, self.CS.lkas_previously_enabled, {1: FrogPilotButtonType.lkas}),
|
||||
]
|
||||
|
||||
# events
|
||||
events = self.create_common_events(ret, frogpilot_variables)
|
||||
events = self.create_common_events(ret)
|
||||
|
||||
if self.CS.lkas_disabled:
|
||||
events.add(EventName.lkasDisabled)
|
||||
|
||||
Reference in New Issue
Block a user