Skip to content

Commit

Permalink
Safety replay: support Rivian
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane committed Feb 24, 2025
1 parent 7f4af6e commit e08311b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/safety_replay/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def is_steering_msg(mode, param, addr):
ret = addr == 0x3d3
elif mode == CarParams.SafetyModel.nissan:
ret = addr == 0x169
elif mode == CarParams.SafetyModel.rivian:
ret = addr == 0x120
return ret

def get_steer_value(mode, param, to_send):
Expand Down Expand Up @@ -55,6 +57,8 @@ def get_steer_value(mode, param, to_send):
elif mode == CarParams.SafetyModel.nissan:
angle = (to_send.data[0] << 10) | (to_send.data[1] << 2) | (to_send.data[2] >> 6)
angle = -angle + (1310 * 100)
elif mode == CarParams.SafetyModel.rivian:
torque = ((to_send.data[2] << 3) | (to_send.data[3] >> 5)) - 1024
return torque, angle

def package_can_msg(msg):
Expand Down

0 comments on commit e08311b

Please sign in to comment.