2025-03-08 09:09:31 +00:00
|
|
|
from opendbc.car import get_safety_config, structs
|
|
|
|
from opendbc.car.interfaces import CarInterfaceBase
|
2025-04-18 20:38:55 +09:00
|
|
|
from opendbc.car.rivian.carcontroller import CarController
|
|
|
|
from opendbc.car.rivian.carstate import CarState
|
|
|
|
from opendbc.car.rivian.radar_interface import RadarInterface
|
|
|
|
from opendbc.car.rivian.values import RivianSafetyFlags
|
2025-03-08 09:09:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
class CarInterface(CarInterfaceBase):
|
2025-04-18 20:38:55 +09:00
|
|
|
CarState = CarState
|
|
|
|
CarController = CarController
|
|
|
|
RadarInterface = RadarInterface
|
2025-03-08 09:09:31 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2025-04-18 20:38:55 +09:00
|
|
|
def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, alpha_long, docs) -> structs.CarParams:
|
2025-03-08 09:09:31 +00:00
|
|
|
ret.brand = "rivian"
|
|
|
|
|
|
|
|
ret.safetyConfigs = [get_safety_config(structs.CarParams.SafetyModel.rivian)]
|
|
|
|
|
2025-04-18 20:38:55 +09:00
|
|
|
ret.steerActuatorDelay = 0.15
|
2025-03-08 09:09:31 +00:00
|
|
|
ret.steerLimitTimer = 0.4
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
|
|
|
|
|
|
|
|
ret.steerControlType = structs.CarParams.SteerControlType.torque
|
|
|
|
ret.radarUnavailable = True
|
|
|
|
|
|
|
|
# TODO: pending finding/handling missing set speed and fixing up radar parser
|
2025-04-18 20:38:55 +09:00
|
|
|
ret.alphaLongitudinalAvailable = False
|
|
|
|
if alpha_long:
|
2025-03-08 09:09:31 +00:00
|
|
|
ret.openpilotLongitudinalControl = True
|
2025-04-18 20:38:55 +09:00
|
|
|
ret.safetyConfigs[0].safetyParam |= RivianSafetyFlags.LONG_CONTROL.value
|
2025-03-08 09:09:31 +00:00
|
|
|
|
|
|
|
ret.longitudinalActuatorDelay = 0.35
|
|
|
|
ret.vEgoStopping = 0.25
|
|
|
|
ret.stopAccel = 0
|
|
|
|
|
|
|
|
return ret
|