Merge PR #90: Rivian Angle Support

Original PR by TonyJOM (Anthony Orta).

Co-authored-by: TonyJOM <anthonyorta20@icloud.com>
This commit is contained in:
firestar5683
2026-08-16 11:17:21 -05:00
48 changed files with 3676 additions and 346 deletions
+7
View File
@@ -189,6 +189,8 @@ def get_selected_panda_firmware_name(app_fn, remote_start, hkg_remote_start, ign
def flash_panda(params_memory):
from openpilot.selfdrive.pandad.rivian_long_flasher import is_rivian_bridge_panda, is_rivian_vehicle
params = Params()
try:
remote_start = params.get_bool("RemoteStartBootsComma")
@@ -203,9 +205,14 @@ def flash_panda(params_memory):
except Exception:
ignore_ignition_line = False
rivian = is_rivian_vehicle()
usb_serials = set(Panda.usb_list())
for serial in Panda.list():
try:
with Panda(serial=serial) as panda:
if serial in usb_serials and is_rivian_bridge_panda(panda, rivian):
print(f"Skipping Rivian harness bridge {serial}")
continue
print(f"Flashing Panda {serial}")
flash_fn = None
app_fn = panda.get_mcu_type().config.app_fn
+5
View File
@@ -330,6 +330,9 @@ def get_starpilot_toggles(sm=messaging.SubMaster(["starpilotPlan"]), *, read_per
# Controller selection happens before the first live StarPilot broadcast. Do
# not let a cached CarParams/controller type hide the persisted user request.
toggles.force_torque_controller = get_starpilot_toggles._params.get_bool("ForceTorqueController")
# Controller selection happens before the first live StarPilot broadcast.
# Realtime callers use the serialized value to avoid blocking reads.
toggles.rivian_angle_control = get_starpilot_toggles._params.get_bool("RivianAngleControl")
return toggles
@cache
@@ -563,6 +566,7 @@ class StarPilotVariables:
toggle = self.starpilot_toggles
# CarParams uses this value to select the matching Panda safety configuration.
toggle.tesla_cooperative_steering = self.params.get_bool("TeslaCoopSteering")
toggle.rivian_angle_control = self.params.get_bool("RivianAngleControl")
fallback_platform = GM_CAR.CHEVROLET_BOLT_ACC_2022_2023 if HARDWARE.get_device_type() == "pc" else MOCK.MOCK
@@ -1422,6 +1426,7 @@ class StarPilotVariables:
"TeslaCoopSteering",
condition=toggle.car_make == "tesla" and toggle.car_model == TESLA_CAR.TESLA_MODEL_3,
)
toggle.rivian_angle_control = self.get_value("RivianAngleControl", condition=toggle.car_make == "rivian")
toggle.tethering_config = self.get_value("TetheringEnabled", cast=float)
@@ -64,6 +64,19 @@ def test_get_starpilot_toggles_realtime_path_does_not_read_persisted_force_param
assert toggles.force_torque_controller is False
def test_get_starpilot_toggles_uses_live_rivian_angle_request(monkeypatch):
params = SimpleNamespace(get_bool=lambda key: key == "RivianAngleControl")
monkeypatch.setattr(spv.get_starpilot_toggles, "_params", params, raising=False)
payload = '{"rivian_angle_control": false}'
toggles = spv.get_starpilot_toggles(
{"starpilotPlan": SimpleNamespace(starpilotToggles=payload)},
read_persisted_force_params=True,
)
assert toggles.rivian_angle_control is True
class _FakeParams:
def __init__(self, floats=None, ints=None, bools=None):
self.floats = dict(floats or {})