Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rivian R1S / R1T Generation 1 #1613

Draft
wants to merge 105 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
31616d6
tesla model 3 dbc files
lukasloetkolben Mar 7, 2024
a2eb128
reduction to the most important signals
lukasloetkolben Mar 8, 2024
888ea26
Model3 port wip
lukasloetkolben Mar 10, 2024
0aae282
wip
lukasloetkolben Mar 10, 2024
e707cd5
wip model 3
lukasloetkolben Mar 10, 2024
5209d4b
wip model 3
lukasloetkolben Mar 10, 2024
759ddda
Model 3 wip
lukasloetkolben Mar 11, 2024
a07f67e
wip model 3
lukasloetkolben Mar 12, 2024
929fb27
wip model 3
lukasloetkolben Mar 12, 2024
27a900f
wip model 3
lukasloetkolben Mar 14, 2024
eca5794
Merge branch 'commaai:master' into master
lukasloetkolben Mar 15, 2024
f8c1176
wip model 3 partybus
lukasloetkolben Mar 16, 2024
743c1e4
bump opendbc
lukasloetkolben Mar 17, 2024
75b5ffd
tesla model 3
lukasloetkolben Mar 18, 2024
affe990
tesla model 3
lukasloetkolben Mar 18, 2024
b5771c4
tesla model 3
lukasloetkolben Mar 19, 2024
f3fb5e1
try to use STW_ACTN_RQ
lukasloetkolben Mar 23, 2024
a009275
new dbc
lukasloetkolben Mar 24, 2024
55ecbc6
dbc update
lukasloetkolben Mar 24, 2024
ac20062
remove neutral gear bug
lukasloetkolben Mar 29, 2024
b21e9e8
switch to party bus
lukasloetkolben Mar 29, 2024
dee1193
Merge remote-tracking branch 'origin/master'
lukasloetkolben Mar 29, 2024
8ca93cc
added doorOpen
lukasloetkolben Mar 31, 2024
2dfdfd4
VCFRONT_status back to 50hz updated dbc
lukasloetkolben Apr 4, 2024
e658bd9
anyDoor open use different signal
lukasloetkolben Apr 4, 2024
3c8e0dc
added VCRIGHT_status
lukasloetkolben Apr 7, 2024
c297a56
Merge branch 'commaai:master' into master
lukasloetkolben Apr 7, 2024
6705aa8
indentation
lukasloetkolben Apr 7, 2024
4a6a73d
Merge remote-tracking branch 'origin/master'
lukasloetkolben Apr 7, 2024
e2b0c4d
Merge branch 'commaai:master' into master
lukasloetkolben Apr 12, 2024
18c16b9
Merge branch 'commaai:master' into master
lukasloetkolben Apr 30, 2024
057d3ad
Merge branch 'commaai:master' into master
lukasloetkolben May 5, 2024
a5b4997
added Left & Right Seatbelt
lukasloetkolben May 8, 2024
7acc8fe
found DriverSeat signal
lukasloetkolben May 9, 2024
7f274b6
Merge branch 'commaai:master' into master
lukasloetkolben May 10, 2024
f132ad9
found DAS_status on Party can
lukasloetkolben May 12, 2024
e029ebe
Merge remote-tracking branch 'origin/master'
lukasloetkolben May 12, 2024
0ae1f7d
Merge branch 'commaai:master' into master
lukasloetkolben May 12, 2024
bb2353b
found "anyDoorOpen" signal
lukasloetkolben May 16, 2024
7a4f885
Merge remote-tracking branch 'origin/master'
lukasloetkolben May 16, 2024
6cd4604
Merge branch 'commaai:master' into master
lukasloetkolben May 16, 2024
1b35e84
Merge branch 'commaai:master' into master
lukasloetkolben Jun 12, 2024
2032db1
added rivian dbc
lukasloetkolben Jun 12, 2024
d49c159
auto format rivian dbc
lukasloetkolben Jun 12, 2024
a765c80
auto format rivian dbc
lukasloetkolben Jun 14, 2024
d90a6ac
added IndicatorLights
lukasloetkolben Jun 15, 2024
08b8597
Update rivian_can.dbc
lukasloetkolben Jun 21, 2024
ffa1011
fixed message sizes
lukasloetkolben Jun 23, 2024
b24a467
Merge remote-tracking branch 'origin/master'
lukasloetkolben Jun 23, 2024
e70a907
ACM_lkaHbaCmd filled missing signals
lukasloetkolben Jul 10, 2024
2fe6b40
Merge branch 'commaai:master' into master
lukasloetkolben Aug 13, 2024
e6b90a4
Merge branch 'commaai:master' into master
lukasloetkolben Aug 19, 2024
9a42090
Merge branch 'commaai:master' into master
lukasloetkolben Aug 20, 2024
05382bf
Merge branch 'commaai:master' into master
lukasloetkolben Sep 7, 2024
98ea643
Merge branch 'commaai:master' into master
lukasloetkolben Sep 10, 2024
d15a66c
Merge branch 'commaai:master' into master
lukasloetkolben Sep 15, 2024
5745b84
Merge branch 'commaai:master' into master
lukasloetkolben Oct 4, 2024
a19155c
Merge branch 'commaai:master' into master
lukasloetkolben Oct 5, 2024
dc6296c
Merge branch 'commaai:master' into master
lukasloetkolben Oct 9, 2024
c29d813
Merge remote-tracking branch 'upstream/master'
lukasloetkolben Oct 14, 2024
f487ae9
remove rivian_can.dbc
lukasloetkolben Oct 14, 2024
12f93b1
Merge branch 'commaai:master' into master
lukasloetkolben Oct 19, 2024
527bdc3
Merge branch 'commaai:master' into master
lukasloetkolben Oct 22, 2024
59c226e
Merge branch 'commaai:master' into master
lukasloetkolben Oct 31, 2024
4270b26
Merge branch 'commaai:master' into master
lukasloetkolben Nov 3, 2024
f2548c2
Merge branch 'commaai:master' into master
lukasloetkolben Nov 7, 2024
6708a89
Merge branch 'commaai:master' into master
lukasloetkolben Nov 9, 2024
fe96d2e
Merge branch 'commaai:master' into master
lukasloetkolben Nov 23, 2024
592192c
Merge branch 'commaai:master' into master
lukasloetkolben Dec 8, 2024
2b1e35c
Rivian R1S
lukasloetkolben Sep 15, 2024
c4b0e89
switch to LKAS torque-controlled message
lukasloetkolben Dec 12, 2024
3732174
tuning
lukasloetkolben Dec 13, 2024
9825499
tuning
lukasloetkolben Dec 15, 2024
104d0c7
remove old dbc
lukasloetkolben Dec 15, 2024
4ba320a
Merge remote-tracking branch 'origin/rivian' into rivian
lukasloetkolben Dec 15, 2024
dae1b71
spam ACM_Status
lukasloetkolben Dec 15, 2024
0be52dd
less friction
lukasloetkolben Dec 17, 2024
a3cb4c6
dont send ACM_Status
lukasloetkolben Dec 17, 2024
f015fc2
less friction
lukasloetkolben Dec 17, 2024
d457f0c
- clean up
lukasloetkolben Dec 23, 2024
523f632
cruiseState speed
lukasloetkolben Dec 24, 2024
b188f3f
cruise enabled only with ACC
lukasloetkolben Dec 24, 2024
5b84ce8
disable speed
lukasloetkolben Dec 27, 2024
1b50234
Merge branch 'commaai:master' into master
lukasloetkolben Jan 7, 2025
1c34027
revert mistake
lukasloetkolben Jan 7, 2025
bbbc7f9
Merge remote-tracking branch 'origin/master' into rivian
lukasloetkolben Jan 7, 2025
9ab660a
CAN parser dict
lukasloetkolben Jan 7, 2025
eb0f7f3
fixed can_parsers
lukasloetkolben Jan 9, 2025
46c8f89
Merge branch 'commaai:master' into master
lukasloetkolben Jan 13, 2025
10225d1
Merge remote-tracking branch 'origin/master' into rivian
lukasloetkolben Jan 13, 2025
8c49718
add Cluster Speed
lukasloetkolben Jan 13, 2025
194aada
Merge branch 'commaai:master' into master
lukasloetkolben Jan 14, 2025
e54bbdf
docs: Scheduled auto-update CARS.md
lukasloetkolben Jan 14, 2025
08cbdc4
Merge remote-tracking branch 'origin/master' into rivian
lukasloetkolben Jan 14, 2025
4678bec
fix new_actuators
lukasloetkolben Jan 14, 2025
2816b16
switch to ESP_Vehicle_Speed
lukasloetkolben Jan 21, 2025
f7b7cb9
implement stopping
lukasloetkolben Jan 21, 2025
780101e
Merge remote-tracking branch 'comma/master' into rivian
lukasloetkolben Jan 21, 2025
e5a4cb4
enable experimental long
lukasloetkolben Jan 21, 2025
4a5bdcc
remove comment
lukasloetkolben Jan 23, 2025
d0ba7c1
remove dashcam flag
lukasloetkolben Jan 23, 2025
d1ab46b
send ACM_Status
lukasloetkolben Jan 23, 2025
65d61d8
Merge remote-tracking branch 'origin/rivian' into rivian
lukasloetkolben Jan 23, 2025
880b02e
fix riviancan.py
lukasloetkolben Jan 23, 2025
60d1b1f
send ACM_longitudinalRequest if engaged
lukasloetkolben Jan 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/labeler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ nissan:
- changed-files:
- any-glob-to-any-file: 'opendbc/car/nissan/**'

rivian:
- changed-files:
- any-glob-to-any-file: 'opendbc/car/rivian/**'

subaru:
- changed-files:
- any-glob-to-any-file: 'opendbc/car/subaru/**'
Expand Down
1 change: 1 addition & 0 deletions opendbc/car/car.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ struct CarParams {
chryslerCusw @30;
psa @31;
fcaGiorgio @32;
rivian @33;
}

enum SteerControlType {
Expand Down
2 changes: 2 additions & 0 deletions opendbc/car/fingerprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from opendbc.car.mazda.values import CAR as MAZDA
from opendbc.car.mock.values import CAR as MOCK
from opendbc.car.nissan.values import CAR as NISSAN
from opendbc.car.rivian.values import CAR as RIVIAN
from opendbc.car.subaru.values import CAR as SUBARU
from opendbc.car.toyota.values import CAR as TOYOTA
from opendbc.car.volkswagen.values import CAR as VW
Expand Down Expand Up @@ -260,6 +261,7 @@ def all_legacy_fingerprint_cars():
"NISSAN LEAF 2018 Instrument Cluster": NISSAN.NISSAN_LEAF_IC,
"NISSAN ROGUE 2019": NISSAN.NISSAN_ROGUE,
"NISSAN ALTIMA 2020": NISSAN.NISSAN_ALTIMA,
"RIVIAN R1S": RIVIAN.RIVIAN_R1S,
"SUBARU ASCENT LIMITED 2019": SUBARU.SUBARU_ASCENT,
"SUBARU OUTBACK 6TH GEN": SUBARU.SUBARU_OUTBACK,
"SUBARU LEGACY 7TH GEN": SUBARU.SUBARU_LEGACY,
Expand Down
Empty file added opendbc/car/rivian/__init__.py
Empty file.
40 changes: 40 additions & 0 deletions opendbc/car/rivian/carcontroller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from opendbc.can.packer import CANPacker
from opendbc.car import Bus, apply_driver_steer_torque_limits, structs
from opendbc.car.interfaces import CarControllerBase
from opendbc.car.rivian.riviancan import create_lka_steering, create_longitudinal
from opendbc.car.rivian.values import CarControllerParams

LongCtrlState = structs.CarControl.Actuators.LongControlState

class CarController(CarControllerBase):
def __init__(self, dbc_names, CP):
super().__init__(dbc_names, CP)
self.CP = CP
self.apply_steer_last = 0
self.packer = CANPacker(dbc_names[Bus.pt])

def update(self, CC, CS, now_nanos):
actuators = CC.actuators
can_sends = []

apply_steer = 0
if CC.latActive:
new_steer = int(round(CC.actuators.steer * CarControllerParams.STEER_MAX))
apply_steer = apply_driver_steer_torque_limits(new_steer, self.apply_steer_last,
CS.out.steeringTorque, CarControllerParams)

# send steering command
self.apply_steer_last = apply_steer
can_sends.append(create_lka_steering(self.packer, CS.acm_lka_hba_cmd, apply_steer, CC.latActive))

# Longitudinal control
if self.CP.openpilotLongitudinalControl:
stopping = actuators.longControlState == LongCtrlState.stopping
can_sends.append(create_longitudinal(self.packer, self.frame % 15, actuators.accel, CC.enabled, stopping))

new_actuators = actuators.as_builder()
new_actuators.steer = apply_steer / CarControllerParams.STEER_MAX
new_actuators.steerOutputCan = apply_steer

self.frame += 1
return new_actuators, can_sends
107 changes: 107 additions & 0 deletions opendbc/car/rivian/carstate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import copy
from opendbc.can.parser import CANParser
from opendbc.car import Bus, structs
from opendbc.car.interfaces import CarStateBase
from opendbc.car.rivian.values import DBC, GEAR_MAP
from opendbc.car.common.conversions import Conversions as CV

class CarState(CarStateBase):
def __init__(self, CP):
super().__init__(CP)
self.last_speed = 30

# Needed by carcontroller
self.acm_lka_hba_cmd = None

def update(self, can_parsers) -> structs.CarState:
cp = can_parsers[Bus.pt]
cp_cam = can_parsers[Bus.cam]
cp_adas = can_parsers[Bus.adas]
ret = structs.CarState()

# Vehicle speed
ret.vEgoRaw = cp.vl["ESP_Status"]["ESP_Vehicle_Speed"] * CV.KPH_TO_MS
ret.vEgo, ret.aEgo = self.update_speed_kf(ret.vEgoRaw)
ret.standstill = abs(ret.vEgoRaw) < 0.01

# Gas pedal
pedal_status = cp.vl["VDM_PropStatus"]["VDM_AcceleratorPedalPosition"]
ret.gas = pedal_status / 100.0
ret.gasPressed = (pedal_status > 0)

# Brake pedal
ret.brake = 0
ret.brakePressed = cp.vl["iBESP2"]["iBESP2_BrakePedalApplied"] == 1

# Steering wheel
ret.steeringAngleDeg = cp.vl["EPAS_AdasStatus"]["EPAS_InternalSas"]
ret.steeringRateDeg = cp.vl["EPAS_AdasStatus"]["EPAS_SteeringAngleSpeed"]
ret.steeringTorque = cp.vl["EPAS_SystemStatus"]["EPAS_TorsionBarTorque"]
ret.steeringPressed = abs(ret.steeringTorque) > 1.0

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
ret.cruiseState.enabled = cp_cam.vl["ACM_Status"]["ACM_FeatureStatus"] == 1
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"]

# Gear
ret.gearShifter = GEAR_MAP[int(cp.vl["VDM_PropStatus"]["VDM_Prndl_Status"])]

# Doors
ret.doorOpen = False

# Blinkers
ret.leftBlinker = cp_adas.vl["IndicatorLights"]["TurnLightLeft"] in (1, 2)
ret.rightBlinker = cp_adas.vl["IndicatorLights"]["TurnLightRight"] in (1, 2)

# Seatbelt
ret.seatbeltUnlatched = cp.vl["RCM_Status"]["RCM_Status_IND_WARN_BELT_DRIVER"] != 0

# Blindspot
# ret.leftBlindspot = False
# ret.rightBlindspot = False

# AEB
ret.stockAeb = cp_cam.vl["ACM_AebRequest"]["ACM_EnableRequest"] != 0

# Messages needed by carcontroller
self.acm_lka_hba_cmd = copy.copy(cp_cam.vl["ACM_lkaHbaCmd"])
self.acm_status = copy.copy(cp_cam.vl["ACM_Status"])

return ret

@staticmethod
def get_can_parsers(CP):
pt_messages = [
# sig_address, frequency
("ESP_Status", 50),
("VDM_PropStatus", 50),
("iBESP2", 50),
("EPAS_AdasStatus", 100),
("EPAS_SystemStatus", 100),
("RCM_Status", 8),
("VDM_AdasSts", 100)
]

cam_messages = [
("ACM_longitudinalRequest", 100),
("ACM_AebRequest", 100),
("ACM_Status", 100),
("ACM_lkaHbaCmd", 100)
]

adas_messages = [
("IndicatorLights", 10),
("ACM_tsrCmd", 10),
]

return {
Bus.pt: CANParser(DBC[CP.carFingerprint][Bus.pt], pt_messages, 0),
Bus.cam: CANParser(DBC[CP.carFingerprint][Bus.pt], cam_messages, 2),
Bus.adas: CANParser(DBC[CP.carFingerprint][Bus.pt], adas_messages, 1)
}
13 changes: 13 additions & 0 deletions opendbc/car/rivian/fingerprints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from opendbc.car.structs import CarParams
from opendbc.car.rivian.values import CAR

Ecu = CarParams.Ecu

FW_VERSIONS = {
CAR.RIVIAN_R1S: {
(Ecu.eps, 0x730, None): [
],
(Ecu.engine, 0x606, None): [
],
},
}
30 changes: 30 additions & 0 deletions opendbc/car/rivian/interface.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python3
from opendbc.car import get_safety_config, structs
from opendbc.car.interfaces import CarInterfaceBase
from panda import Panda


class CarInterface(CarInterfaceBase):

@staticmethod
def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experimental_long, docs) -> structs.CarParams:
ret.carName = "rivian"

ret.safetyConfigs = [get_safety_config(structs.CarParams.SafetyModel.rivian)]

ret.steerActuatorDelay = 0.25
ret.steerLimitTimer = 0.4
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)

ret.steerControlType = structs.CarParams.SteerControlType.torque
ret.radarUnavailable = True

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

return ret
4 changes: 4 additions & 0 deletions opendbc/car/rivian/radar_interface.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from opendbc.car.interfaces import RadarInterfaceBase

class RadarInterface(RadarInterfaceBase):
pass
145 changes: 145 additions & 0 deletions opendbc/car/rivian/riviancan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
def checksum(data, poly, xor_output):
crc = 0
for byte in data:
crc ^= byte
for _ in range(8):
if crc & 0x80:
crc = (crc << 1) ^ poly
else:
crc <<= 1
crc &= 0xFF
return crc ^ xor_output


def create_lka_steering(packer, acm_lka_hba_cmd, apply_steer, enabled):
values = {s: acm_lka_hba_cmd[s] for s in [
"ACM_lkaHbaCmd_Counter",
"ACM_lkaHbaCmd_Checksum",
"ACM_HapticRequest",
"ACM_lkaStrToqReq",
"ACM_lkaSymbolState",
"ACM_lkaToiFlt",
"ACM_lkaActToi",
"ACM_hbaSysState",
"ACM_FailinfoAeb",
"ACM_lkaRHWarning",
"ACM_lkaLHWarning",
"ACM_lkaLaneRecogState",
"ACM_hbaOpt",
"ACM_hbaLamp",
"ACM_lkaHandsoffSoundWarning",
"ACM_lkaHandsoffDisplayWarning",
"ACM_unkown1",
"ACM_unkown2",
"ACM_unkown3",
"ACM_unkown4",
"ACM_unkown6",
]}

if enabled:
values["ACM_lkaActToi"] = 1
values["ACM_lkaSymbolState"] = 3
values["ACM_lkaLaneRecogState"] = 3
values["ACM_lkaStrToqReq"] = apply_steer
values["ACM_unkown2"] = 1
values["ACM_unkown3"] = 4
values["ACM_unkown4"] = 160
values["ACM_unkown6"] = 1

data = packer.make_can_msg("ACM_lkaHbaCmd", 0, values)[1]
values["ACM_lkaHbaCmd_Checksum"] = checksum(data[1:], 0x1D, 0x63)
return packer.make_can_msg("ACM_lkaHbaCmd", 0, values)


def create_longitudinal(packer, frame, accel, enabled, stopping):
values = {
"ACM_longitudinalRequest_Counter": frame % 15,
"ACM_AccelerationRequest": accel if enabled else 0,
"ACM_VehicleHoldRequired": 0,
"ACM_PrndRequired": 0,
"ACM_longInterfaceEnable": 1 if enabled else 0,
"ACM_AccelerationRequestType": 1 if stopping else 0,
}

data = packer.make_can_msg("ACM_longitudinalRequest", 0, values)[1]
values["ACM_longitudinalRequest_Checksum"] = checksum(data[1:], 0x1D, 0x12)
return packer.make_can_msg("ACM_longitudinalRequest", 0, values)

#################################################################
######################### ↓ NOT USED ↓ ##########################
#################################################################

def create_acm_status(packer, frame, acm_status, active):
values = {s: acm_status[s] for s in [
"ACM_Unkown1",
"ACM_Unkown2",
"ACM_FaultStatus",
]}

values["ACM_Status_Counter"] = frame % 15
values["ACM_FeatureStatus"] = 1 if active else 0

data = packer.make_can_msg("ACM_Status", 0, values)[1]
values["ACM_Status_Checksum"] = checksum(data[1:], 0x1D, 0x5F)
return packer.make_can_msg("ACM_Status", 0, values)

def create_epas_system_status(packer, epas_system_status_cmd, enabled):
values = {s: epas_system_status_cmd[s] for s in [
"EPAS_SytemStatus_Checksum",
"EPAS_SystemStatus_Counter",
"EPAS_SteeringReduced",
"EPAS_SteeringFault",
"EPAS_SteeringMode",
"EPAS_TorsionBarTorque",
"EPAS_StcFault",
"EPAS_StcActive",
"EPAS_StcUnavailable",
"H_CAN_EPSS_ToiFlt",
"H_CAN_EPSS_ToiActive",
"H_CAN_EPS_ToiUnavailable",
"EPAS_HandsOnLevel"
]}

if enabled:
values["EPAS_HandsOnLevel"] = 1

data = packer.make_can_msg("EPAS_SystemStatus", 2, values)[1]
values["EPAS_SytemStatus_Checksum"] = checksum(data[1:], 0x1D, 0x1E)
return packer.make_can_msg("EPAS_SystemStatus", 2, values)


def create_angle_steering(packer, frame, angle, active):
values = {
"ACM_SteeringControl_Counter": frame % 15,
"ACM_EacEnabled": 1 if active else 0,
"ACM_HapticRequired": 0,
"ACM_SteeringAngleRequest": angle,
}

data = packer.make_can_msg("ACM_SteeringControl", 0, values)[1]
values["ACM_SteeringControl_Checksum"] = checksum(data[1:], 0x1D, 0x41)
return packer.make_can_msg("ACM_SteeringControl", 0, values)

def create_vdm_adas_status(packer, vdm_adas_status, acc_on):
values = {s: vdm_adas_status[s] for s in [
"VDM_AdasStatus_Checksum",
"VDM_AdasStatus_Counter",
"VDM_AdasDecelLimit",
"VDM_AdasDriverAccelPriorityStatu",
"VDM_AdasFaultStatus",
"VDM_AdasAccelLimit",
"VDM_AdasDriverModeStatus",
"VDM_AdasAccelRequest",
"VDM_AdasInterfaceStatus",
"VDM_AdasAccelRequestAcknowledged",
"VDM_AdasVehicleHoldStatus"
]}

if acc_on:
values["VDM_AdasDriverModeStatus"] = 1
values["VDM_AdasAccelRequest"] = -10.16
values["VDM_AdasInterfaceStatus"] = 1

data = packer.make_can_msg("VDM_AdasSts", 2, values)[1]
values["VDM_AdasStatus_Checksum"] = checksum(data[1:], 0x1D, 0xD1)
return packer.make_can_msg("VDM_AdasSts", 2, values)
Loading
Loading