Files
openpilot-evo/selfdrive/car/mazda/interface.py
T
Shane Smiskol b97ed10ea1 Car interface clean up (#33290)
* remove some defs

* now carstate

* remove carControl from CI update function

* almost merged that

* and that
old-commit-hash: 65fccbf7563ceca5ec84bb75ceb39556371a74de
2024-08-13 21:16:39 -07:00

40 lines
1.3 KiB
Python
Executable File

#!/usr/bin/env python3
from cereal import car
from openpilot.selfdrive.car import create_button_events, get_safety_config
from openpilot.selfdrive.car.conversions import Conversions as CV
from openpilot.selfdrive.car.mazda.values import CAR, LKAS_LIMITS
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
ButtonType = car.CarState.ButtonEvent.Type
class CarInterface(CarInterfaceBase):
@staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
ret.carName = "mazda"
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.mazda)]
ret.radarUnavailable = True
ret.dashcamOnly = candidate not in (CAR.MAZDA_CX5_2022, CAR.MAZDA_CX9_2021)
ret.steerActuatorDelay = 0.1
ret.steerLimitTimer = 0.8
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
if candidate not in (CAR.MAZDA_CX5_2022, ):
ret.minSteerSpeed = LKAS_LIMITS.DISABLE_SPEED * CV.KPH_TO_MS
ret.centerToFront = ret.wheelbase * 0.41
return ret
# returns a car.CarState
def _update(self):
ret = self.CS.update(self.cp, self.cp_cam)
# 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})
return ret