mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-19 23:34:14 +08:00
e8c4fb0177
* Reapply "selfdrive/car: ban imports from external modules" (#32993) This reverts commit 626d78ec548fe19acfdf3c2c3e063fac3b257dc6. * controls will just use controls * also these * ignore old-commit-hash: d684d8f0f6900d80a2a1618099b0b8e19e6492a2
39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
import math
|
|
from cereal import car
|
|
from openpilot.selfdrive.car import DT_CTRL, get_safety_config
|
|
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
|
|
from openpilot.selfdrive.car.body.values import SPEED_FROM_RPM
|
|
|
|
class CarInterface(CarInterfaceBase):
|
|
@staticmethod
|
|
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
|
|
ret.notCar = True
|
|
ret.carName = "body"
|
|
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.body)]
|
|
|
|
ret.minSteerSpeed = -math.inf
|
|
ret.maxLateralAccel = math.inf # TODO: set to a reasonable value
|
|
ret.steerLimitTimer = 1.0
|
|
ret.steerActuatorDelay = 0.
|
|
|
|
ret.wheelSpeedFactor = SPEED_FROM_RPM
|
|
|
|
ret.radarUnavailable = True
|
|
ret.openpilotLongitudinalControl = True
|
|
ret.steerControlType = car.CarParams.SteerControlType.angle
|
|
|
|
return ret
|
|
|
|
def _update(self, c):
|
|
ret = self.CS.update(self.cp)
|
|
|
|
# wait for everything to init first
|
|
if self.frame > int(5. / DT_CTRL):
|
|
# body always wants to enable
|
|
ret.init('events', 1)
|
|
ret.events[0].name = car.CarEvent.EventName.pcmEnable
|
|
ret.events[0].enable = True
|
|
self.frame += 1
|
|
|
|
return ret
|