Skip to content

About

Fork for combining xnor angle features with adventurepilot rivian features.

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

 
 

Latest commit

 

History

88 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GaryPilot: Rivian R1T & R1S (GaryPilot)

A personal sunnypilot-based openpilot fork for the Rivian R1T & R1S. It combines:

  • xnor-tech rx-dev: angle-based lateral control through the angle harness, plus low-speed oscillation smoothing.
  • AdventurePilot stg-a gear-stalk MADS semantics: an upward stalk flick toggles or disengages lateral control, and lateral control disengages in Park and Reverse. Includes the matching panda safety support.

Warning

This is alpha-quality research software, not a product. It modifies lateral control and panda safety firmware. You are responsible for complying with local laws and for driving attentively at all times. No warranty, expressed or implied.

Status

Area State
Base xnor-tech/openpilot rx-dev prebuilt 8a627abb0
Fork infrastructure (docs, commit conventions, CI) ✅
Gear-stalk MADS parity (panda safety + Python) ✅
Custom Outrun Screensaver (optimized for Comma 4) ✅
GaryPilot Longitudinal Control (hardware-gated on 0x131a) ✅
Rivian Vehicle Tab (Diagnostics & Customization) ✅
Safety Gate (MISRA C:2012, 100% Coverage, Mutation Testing) ✅
Releases Released! See FORK_CHANGELOG.md

Integration, Behavior & Safety Matrix

The table below summarizes GaryPilot's integration with the Rivian R1 platform, detailing system behavior, driver interaction, safety thresholds, and direct source code references:

Integration Area & Driver Question System Behavior & Driver Experience Safety Limits & Thresholds Source Code Reference
Regen vs. Friction Braking
Does the system use one-pedal regen or physical brake pads?
Emulates Rivian Autonomous Control Module (ACM). Sends unified acceleration request 0x160 (ACM_longitudinalRequest) to Rivian's VDM (Vehicle Dynamics Module). VDM commands 100% regenerative braking via drive units first; blends Bosch ESP friction brakes only during heavy braking, cold/full battery, or standstill hold. Brake lights automatically trigger over $\approx 0.13\text{g}$. Panda Safety Limits:
Max accel: $+2.0\text{ m/s}^2$
Min accel: $-3.5\text{ m/s}^2$
Factory AEB (ACM_AebRequest) immediately overrides openpilot.
carcontroller.py
riviancan.py
rivian_primary_actuator.dbc
rivian.h
Follow Distance Control
Does follow distance adjust via the Rivian steering wheel?
Scrolling the right steering wheel thumbwheel (RightButton_Scroll) emits gapAdjustCruise to cycle openpilot's LongitudinalPersonality via decrement: Standard (1) $\rightarrow$ Aggressive (0) $\rightarrow$ Relaxed (2). Accompanied by on-screen chevron update and confirmation chime. Software debounced against rapid misfires. Default initial personality is Standard (1). carstate_ext.py
selfdrived.py
ACC Set Speed Adjustments
How are cruise speed steps commanded on the steering wheel?
Single click Left/Right on the right thumbpad steps set speed by $\pm 1\text{ mph}$ ($\pm 1\text{ km/h}$) by default, or configurable to $\pm 5\text{ mph}$ ($\pm 5\text{ km/h}$) via Settings $\rightarrow$ Vehicle $\rightarrow$ Thumbpad Speed Click Step. Long press/hold steps by $\pm 5\text{ mph}$ ($\pm 10\text{ km/h}$). Flicking the gear stalk down raises set speed to match current speed if driving faster than set speed (never decreases below current set speed). Cruise speed strictly clamped to $[20\text{ mph}, 85\text{ mph}]$ ($[32\text{ km/h}, 137\text{ km/h}]$). carstate_ext.py
rivian.py
Native Radar & Sensor Fusion
Does openpilot blend Rivian native radar readings for ACC?
Reads 32 object tracking channels (RADAR_TRACK_500 through 51f) from Rivian's front millimeter-wave radar on Bus.radar. Filters stationary road clutter (guardrails) and fuses radar distance/velocity with vision model leads in radard.py for all-weather lead tracking. Lead Kalman filter tracks distance (dRel) and closing rate (vRel). Vision model vetoes false positives from overhead bridges. interface.py
radar_interface.py
radard.py
Blind Spot Detection (BSM)
Are native Rivian blind spot sensors used for lane changes?
Ingests corner radar status (BSM_BlindSpotIndicator_Fwd / 0x1350). When AutoLaneChangeBsmDelay is active, automated lane changes pause and wait while adjacent vehicles are detected until clear. Screen borders glow amber/red to mirror side mirrors. Prevents lane change initiation if leftBlindspot or rightBlindspot is true. Inhibits low-speed turn assist into occupied paths. carstate_ext.py
desire_helper.py
blind_spot_indicators.py
Dynamic Experimental Control (DEC)
How does DEC stop at red lights and avoid jerky hesitation?
Dynamically switches between ACC (speed-holding) and Blended (stopping for lights/signs). Employs 4 internal SmoothKalmanFilter instances (Lead, Slow Down, Slowness, MPC FCW) to filter trajectory endpoint shortages and eliminate mode flapping. Hysteresis thresholds require minimum mode duration (10 frames) unless emergency FCW triggers immediate override. dec.py (#L145-L172, #L242-L304)
Stop Signs & Traffic Lights
Does GaryPilot brake automatically for stop signs and red lights?
When Dynamic Experimental Control (DEC) or Experimental Mode is active, the vision model predicts stopping trajectories for detected stop lines, signs, and traffic signals. Stopping behavior is probabilistic based on model confidence, lighting, and approach distance. Because there are no hard CAN failsafes for stop signs, the driver must always actively supervise intersections and be prepared to brake manually. Factory Bosch ESP AEB remains active as an emergency safety net. Turning off Disengage on Accelerator allows the driver to override and accelerate through intersections without dropping cruise engagement. dec.py
longitudinal_planner.py
modeld.py
Accelerator Override & Resumption
What happens when pressing the gas pedal while engaged?
Pressing the accelerator allows the driver to manually override openpilot speed commands. When Disengage on Accelerator is turned OFF, releasing the accelerator returns the vehicle smoothly to the set speed without cancelling cruise or dropping MADS lateral steering. When turned ON, pressing the accelerator disengages cruise control. Acceleration is strictly controlled by driver foot; openpilot resumes command only once driver lifts off below or at target set speed. carcontroller.py
selfdrived.py
controls.yaml
Driving Model (WMI V12)
Can WMI V12 run on Comma 4 with these features?
Fully supported under tinygrad runner. Runs at native 20Hz (is20hz: true) with Generation 12 world model dynamics. Emits standard 33-point trajectory consumed identically by DEC and Vision Turn Speed. Hardware load on Comma 4 NPU remains under 60% with zero dropped frames. split_model_constants.py
modeld.py
Smart Cruise & Curve Slowdown
How do vision and map-based turn speeds operate?
Vision curve slowdown uses path predictions from the driving model; Map curve slowdown queries local OpenStreetMap geometry (OsmLocal) to preemptively brake before tight highway ramps or sharp turns. Slowdown sensitivity and target speed margins are adjustable in settings. Blended smoothly through longitudinal planner acceleration limits. Speeds offset by configurable margin (+5 mph). settings_ui.json
cruise.yaml
Stalk Gestures & MADS State
How do gear stalk controls manage lateral and longitudinal?
UP_1: Configurable via Settings $\rightarrow$ Vehicle $\rightarrow$ Stalk UP_1 Tap Action: MADS Toggle (Mode B, default), Cancel ACC (factory Rivian behavior), or Disengage All (simultaneous lateral & longitudinal).
UP_2: Full disengage of lateral and longitudinal.
Park: Disengages controls and triggers immediate Offroad mode.
Reverse: Disengages lateral control.
UP_2 MADS button press is inhibited in panda safety; full disengage latching and Park/Reverse transitions are enforced in car_specific.py. No steering actuation permitted outside Drive. carstate_ext.py
rivian.h
car_specific.py
rivian.py
Steering Limits & Overrides
What are the physical and panda safety limits for steering?
Dual-channel control (angle commands + cooperative torque). Steering angle clamped to 500°. Torque limited to 350 counts ($\le 9\text{ m/s}$) stepping down to 250 counts ($\ge 17\text{ m/s}$). Driver override sensitivity is driver-tunable via Settings $\rightarrow$ Vehicle $\rightarrow$ Driver Override Sensitivity (Light: 75 allowance / 0.75 Nm threshold; Standard: 100 allowance / 1.00 Nm threshold; Firm: 100 allowance / 1.30 Nm threshold, respecting panda safety limit of 100). Angle rate limit allows up to $3.5^\circ/\text{frame}$ ($350^\circ/\text{s}$) at low speeds for responsive 90° turns/roundabouts, while high-speed angle rate is mathematically bounded to $\approx 16^\circ/\text{s}$ ($\le 0.16^\circ/\text{frame}$) by lateral jerk vehicle model limits. Speed-dependent torque-to-angle handoff permits up to $60^\circ$ at low speeds ($0\text{ m/s}$), $45^\circ$ at $12.4\text{ mph}$, and $25^\circ$ at $\ge 28\text{ mph}$ (strictly capped by ISO lateral acceleration envelope, $16.7^\circ$ at $65\text{ mph}$). EPAS driver override detection instantly disengages with audio chime. Panda Safety Limits:
Max rate up: 3 / frame
Max rate down: 5 / frame
Max real-time delta: 125
Driver torque allowance: 100 max
rivian.h
carstate.py
ext_controller.py
values.py
rivian.py
Hardware & Harness Diagnostics
How do I verify the angle harness and longitudinal hardware?
Dedicated Settings $\rightarrow$ Vehicle $\rightarrow$ Rivian tab displays real-time diagnostic cards: Lateral Angle Harness (0x1310), Longitudinal Upgrade / XNOR XTREME (0x131a), Platform Generation (0x321), Front Radar (32 Tracks), and Corner Radar BSM (0x1350). Emits summary telemetry via RivianHarnessStatus. Live updates run at 1Hz in UI; controls customization is disabled during active drives (not_engaged gate) for on-road safety. rivian.py
carstate_ext.py
vehicle.yaml
Configuration Architecture
Where are settings managed, and are there conflicting toggles?
Streamlined control under Toggles $\rightarrow$ GaryPilot Longitudinal Control (disabled by default, strictly requiring hardware check 0x131a on bus 1) with safety confirmation modal. Dedicated Settings $\rightarrow$ Vehicle $\rightarrow$ Rivian tab hosts live Hardware & Harness Diagnostics and controls customization (UP_1 stalk action, speed click step, driver override sensitivity). Persistent parameters: AlphaLongitudinalEnabled (defaults to "0" / disabled; activates factory Rivian ACC). Hardware and control preferences stored via atomic VIRTUAL_PARAMS (RivianHarnessStatus, RivianStalkUp1Action, RivianSpeedClickStep, RivianSteerOverrideSensitivity). toggles.py
rivian.py
toggles.yaml
vehicle.yaml
params.py
Automated Safety Gate & Invariants
How are safety, code quality, and branch invariants verified?
Every push and pull request runs automated CI: 100% Panda safety line coverage, 26 SunnyLink/Rivian unit tests, automotive static analysis with MISRA C:2012 (268 active checkers, 0 violations), and tree-sitter mutation testing (3,422 mutants evaluated, 99.91% killed). Prebuilt branch invariants strictly protect compiled binaries and param schemas. Strict gate in fork-ci.yml. Conventional commit headers enforced up to 120 characters via .githooks/commit-msg. fork-ci.yml
safety_tests.sh
check_invariants.sh
test_misra.sh
mutation.py
Updates & Remote Management
Does Comma 4 auto-update, and can it be rebooted remotely?
Devices automatically pull updates from branch GaryPilot when parked/offroad on Wi-Fi. Can be rebooted remotely via SSH (sudo reboot), web dashboard, or on-device UI. SSH disabled by default for vehicle security (SshEnabled: false). Updates stage safely before prompting reboot. updated.py
hardwared.py

Installation

Supported hardware: comma 3X and comma four, in a Rivian R1T/R1S with the angle harness.

New Install or Clean Reinstall

  1. On the device: Settings → Software → Uninstall (uninstalls driving software; does not factory-reset AGNOS or Wi-Fi).

  2. The device reboots into the setup screen. Choose Custom Software and enter either:

    • Full URL:
      https://installer.comma.ai/caleb-collar/GaryPilot
      
    • Shorthand:
      caleb-collar/GaryPilot
      

    [!IMPORTANT] The branch name GaryPilot is case-sensitive in git. Ensure both G and P are capitalized.

  3. On first boot the panda is reflashed with this branch's firmware automatically.

Switching from an Existing Fork or Prior Branch

If your Comma was already running a previous branch or another fork pointing to caleb-collar/openpilot:

  • Via On-Device UI (Fastest):
    1. Open Settings → Software → Select a branch.
    2. Select GaryPilot.
    3. Tap Check for Updates (or wait for the download to finish).
    4. Tap Reboot when prompted.
  • Via SSH:
    ssh comma@<device-ip>
    cd /data/openpilot
    git remote set-url origin https://github.com/caleb-collar/openpilot.git
    git fetch origin GaryPilot
    git checkout -B GaryPilot origin/GaryPilot
    git submodule sync
    git submodule update --init --recursive
    touch prebuilt
    sudo rm -rf /data/safe_staging/*
    sudo reboot

Rollback: repeat the steps with xnor-tech/rx-dev (https://installer.comma.ai/xnor-tech/rx-dev). The panda firmware is restored automatically.

Important

Installed devices auto-update from GaryPilot. Only verified changes are promoted to that branch.

Repository Layout & Remotes

This branch is rooted on xnor's prebuilt rx-dev tree. Libraries are vendored rather than submodules (opendbc_repo/, panda/, msgq_repo/, …), and compiled aarch64 binaries are committed so the device skips the build.

Remote Repository Purpose
origin caleb-collar/openpilot This fork
upstream xnor-tech/openpilot Base (rx-dev). Push disabled
adventure AdventurePilotDev/openpilot Feature reference (stg-a). Push disabled

Key Rivian code:

  • opendbc_repo/opendbc/car/rivian/: car state, controller, xnor angle smoothing (ext_controller.py)
  • opendbc_repo/opendbc/sunnypilot/car/rivian/: stalk parsing, MADS car controller
  • opendbc_repo/opendbc/safety/modes/rivian.h: panda safety mode
  • openpilot/sunnypilot/selfdrive/car/car_specific.py, openpilot/sunnypilot/mads/: MADS event handling

Development

git config core.hooksPath .githooks   # Conventional Commits hook
  • Commits: Conventional Commits, enforced locally and in CI. See CONTRIBUTING.md.
  • Checks: fork/ holds the sudo-free safety gate (tests, 100% coverage, MISRA, mutation), a reproducible panda firmware build and verify step, and the prebuilt-branch invariant checks. CI runs the same scripts.
  • Changelog: Keep a Changelog in FORK_CHANGELOG.md. The root CHANGELOG.md is upstream sunnypilot's. The device parses it for release notes, so leave it untouched.
  • Plan, constraints, verification matrix, upstream resync workflow: INTEGRATION_PLAN.md.

Credits

User Data

By default, openpilot/sunnypilot uploads driving data to comma servers. You can access your data through comma connect. You are free to disable data collection.

openpilot logs the road-facing camera, CAN, GPS, IMU, magnetometer, thermal sensors, crashes, and operating system logs. The driver-facing camera and microphone are only logged if you explicitly opt in in settings.

By using this software, you understand that use of this software or its related services will generate certain types of user data, which may be logged and stored at the sole discretion of comma. By accepting this agreement, you grant an irrevocable, perpetual, worldwide right to comma for the use of this data.

Licensing

This fork is released under the MIT License, like sunnypilot and openpilot, from which it derives. The original openpilot license notice, including comma.ai's indemnification and alpha software disclaimer, is reproduced below as required:

openpilot is released under the MIT license. Some parts of the software are released under other licenses as specified.

Any user of this software shall indemnify and hold harmless Comma.ai, Inc. and its directors, officers, employees, agents, stockholders, affiliates, subcontractors and customers from and against all allegations, claims, actions, suits, demands, damages, liabilities, obligations, losses, settlements, judgments, costs and expenses (including without limitation attorneys' fees and costs) which arise out of, relate to or result from any use of this software by user.

THIS IS ALPHA QUALITY SOFTWARE FOR RESEARCH PURPOSES ONLY. THIS IS NOT A PRODUCT. YOU ARE RESPONSIBLE FOR COMPLYING WITH LOCAL LAWS AND REGULATIONS. NO WARRANTY EXPRESSED OR IMPLIED.

For full license terms, see the LICENSE and LICENSE.md files.

Trademark & Legal Disclaimers

  • Rivian®, R1T®, and R1S® are registered trademarks of their respective owners, RIVIAN AUTOMOTIVE, LLC and RIVIAN AUTOMOTIVE, INC.
  • Rivian is a registered trademark of its respective owner. This project is independent and has no official affiliation with the manufacturer.
  • No Endorsement or Affiliation: This project is an independent, community-driven open-source research fork. It is not affiliated with, endorsed by, sponsored by, or certified by Rivian Automotive, LLC, Rivian Automotive, Inc., or any of their affiliates.
  • No License or Credit Taken: We do not claim any ownership, rights, or license to Rivian's trademarks, trade dress, or logos, nor do we take credit for or license Rivian's logo or intellectual property. Any references to Rivian vehicle makes or models are used strictly for vehicle identification, technical compatibility, and nominative fair use.
  • Exclusion of Visual Assets: As stated in the LICENSE and LICENSE.md files, the MIT license applies solely to source code files. Visual assets and UI themes are excluded from this license.

About

Fork for combining xnor angle features with adventurepilot rivian features.

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages