diff --git a/opendbc/car/rivian/carstate.py b/opendbc/car/rivian/carstate.py index 2637bd31d4..6996ba01fd 100644 --- a/opendbc/car/rivian/carstate.py +++ b/opendbc/car/rivian/carstate.py @@ -42,10 +42,10 @@ def update(self, can_parsers) -> structs.CarState: ret.steerFaultTemporary = cp.vl["EPAS_AdasStatus"]["EPAS_EacErrorCode"] != 0 # Cruise state - # speed = min(int(cp_adas.vl["ACM_tsrCmd"]["ACM_tsrSpdDisClsMain"]), 85) - # self.last_speed = speed if speed != 0 else self.last_speed + speed = min(int(cp_adas.vl["ACM_tsrCmd"]["ACM_tsrSpdDisClsMain"]), 85) + self.last_speed = speed if speed != 0 else self.last_speed ret.cruiseState.enabled = cp_cam.vl["ACM_Status"]["ACM_FeatureStatus"] == 1 - ret.cruiseState.speed = 15 # self.last_speed * CV.MPH_TO_MS # detected speed limit + ret.cruiseState.speed = self.last_speed * CV.MPH_TO_MS # detected speed limit ret.cruiseState.available = True # cp.vl["VDM_AdasSts"]["VDM_AdasInterfaceStatus"] == 1 ret.cruiseState.standstill = False # cp.vl["VDM_AdasSts"]["VDM_AdasAccelRequestAcknowledged"] diff --git a/opendbc/car/rivian/interface.py b/opendbc/car/rivian/interface.py index 8315adebb3..08d3d804d5 100644 --- a/opendbc/car/rivian/interface.py +++ b/opendbc/car/rivian/interface.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 from opendbc.car import get_safety_config, structs from opendbc.car.interfaces import CarInterfaceBase -from opendbc.car.rivian.values import CAR +from panda import Panda class CarInterface(CarInterfaceBase): @@ -20,14 +20,15 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experime ret.steerLimitTimer = 0.4 CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) - ret.steerControlType = structs.CarParams.SteerControlType.torque ret.radarUnavailable = True - # ret.safetyConfigs[0].safetyParam |= Panda.FLAG_RIVIAN_LONG_CONTROL + ret.experimentalLongitudinalAvailable = True + if experimental_long: + ret.openpilotLongitudinalControl = True + ret.safetyConfigs[0].safetyParam |= Panda.FLAG_RIVIAN_LONG_CONTROL + ret.vEgoStopping = 0.25 ret.stopAccel = 0 - ret.openpilotLongitudinalControl = False - return ret