Jason Wen ddf63701e8 Speed Limit: Resolver (#1256)
* init

* some fixes

* move

* more

* old navd helpers

* bring back cereal

* fix linting

* more

* add to cereal first

* sp events

* lint

* implement in long plan

* fixme-sp

* refactor state machine

* wrong state

* start refactor controller

* some type hints

* init these

* enable debug print

* ui? ui!

* print them out

* fix spinner import

* fix path

* let's use gps chips directly for now

* service missing

* publish events

* no nav for now

* need to sub

* no car state speed yet

* missed event

* Car: `CarStateSP`

* fix tests

* bring back car state speed limit

* fix

* use old controller for now

* fix

* fix source

* type hints

* none for now

* formatting

* more

* create directory if does not exist

* mypy my bt

* policy param catch exceptions

* handle all params with exceptions

* more

* single method

* define types in init

* rename

* simpler op enabled check

* more mypy stuff

* rename

* no need for brake pressed

* don't reset if gas pressed

* type hint all

* type hint all

* back to upstream

* in another pr

* no longer need data type

* qlog

* slc in another pr

* use horizontal accuracy

* use horizontal accuracy

* set core affinity for all realtime processes

* unused

* sort

* unused

* type hint and slight cleanup

* from old implementation

* use directly

* combine pm

* slight more cleanup

* type hints

* even more type hint

* Revert "slc in another pr"

This reverts commit 3a6987e6

* Revert "in another pr"

This reverts commit a29bccff12.

* rebump

* no need to check alive

* use it directly

* fix test

* refactor

* use gps data directly

* quote...?

* lint

* fix tests

* use CC.longActive

* user confirm in another PR

* rename

* fix import

* params fix

* no more

* fix

* drop new state machine for now

* more fixes

* internalize output

* unused

* rearrange

* auto draft

* rename

* this

* no

* no need

* use existing

* wrong cruise speed

* fix

* not used for now

* Revert "not used for now"

This reverts commit f0083d6241.

* some

* use frames instead

* split speed limit resolver out of slc

* no need to pass sm

* fix params

* test init

* use frame instead of time

* track session

* some tests

* too limiting

* bump

* always reset state

* end session if long_active but slc inactive at any given time

* off

* no warning in this PR

* no speed factor engage type yet

* wide open

* no

* introduce disabled, no longer transitions at inactive

* fix tests

* no more tempinactive

* clean

* rename

* offset default > off

* new tests, fixes controller

* more tests

* not really needed yet

* lint

* fix

* some more tests

* wrap

* more

* more

* use vCruiseCluster for set speed

* init better

* finish it up

* no

* typo

* one method state machine

* refactor preactive timeout check

* refactor new session check

* directly return statuses

* comments

* v_target

* refactor speed limit resolver

* turn off debug

* more resolver refactor

* no longer needed

* lint

* more lint

* fix

* move around

* fix events

* update event

* already happens while in enabled

* add carstateSP

* less

* Speed Limit Control -> Speed Limit Assist

* in another PR

* more rename

* overriding state

* fix

* make sure to return the correct type

* just slr in this one

* more

* update

* redundant

* fix

* fix

* lint

* fix

* fix

* match toggle

* fix priority checks

* fix combined source for picking 0 limit

* no need to wrap

* add speed limit offset to resolver

* add speed limit offset

* make sure it displays distance when higher

* Revert "make sure it displays distance when higher"

This reverts commit 15c6834d4e.

* some rename

* translations

* unused for now

* more

* lint

---------

Co-authored-by: nayan <nayan8teen@gmail.com>
Co-authored-by: DevTekVE <devtekve@gmail.com>
2025-09-19 18:32:20 -04:00
2025-09-19 18:32:20 -04:00
2025-09-19 18:32:20 -04:00
2024-12-16 19:47:29 -05:00
2025-09-19 18:32:20 -04:00
2025-09-19 18:32:20 -04:00
2021-01-05 12:50:23 -08:00
2025-05-14 14:34:11 +01:00
2024-12-08 22:03:47 +01:00
2025-06-19 12:36:38 -07:00
2025-08-27 19:04:16 -07:00
2025-03-10 09:43:46 -07:00
2025-09-07 14:21:14 -07:00
2020-01-17 10:22:00 -08:00
2024-11-15 08:11:51 +01:00
2025-08-28 08:19:39 -07:00
2024-06-09 17:44:34 -07:00
2024-07-31 23:17:40 -07:00
2020-05-14 15:36:56 -07:00
2025-09-11 10:48:32 -07:00
2022-08-13 23:28:44 -07:00
2025-09-09 10:56:07 -07:00

🌞 What is sunnypilot?

sunnypilot is a fork of comma.ai's openpilot, an open source driver assistance system. sunnypilot offers the user a unique driving experience for over 300+ supported car makes and models with modified behaviors of driving assist engagements. sunnypilot complies with comma.ai's safety rules as accurately as possible.

💭 Join our Discord

Join the official sunnypilot Discord server to stay up to date with all the latest features and be a part of shaping the future of sunnypilot!

Documentation

https://docs.sunnypilot.ai/ is your one stop shop for everything from features to installation to FAQ about the sunnypilot

🚘 Running on a dedicated device in a car

  • A supported device to run this software
  • This software
  • One of the 300+ supported cars. We support Honda, Toyota, Hyundai, Nissan, Kia, Chrysler, Lexus, Acura, Audi, VW, Ford and more. If your car is not supported but has adaptive cruise control and lane-keeping assist, it's likely able to run sunnypilot.
  • A car harness to connect to your car

Detailed instructions for how to mount the device in a car.

Installation

Please refer to Recommended Branches to find your preferred/supported branch. This guide will assume you want to install the latest staging-c3-new branch.

If you want to use our newest branches (our rewrite)

Tip

You can see the rewrite state on our rewrite project board, and to install the new branches, you can use the following links

  • sunnypilot not installed or you installed a version before 0.8.17?

    1. Factory reset/uninstall the previous software if you have another software/fork installed.
    2. After factory reset/uninstall and upon reboot, select Custom Software when given the option.
    3. Input the installation URL per Recommended Branches. Example: https://staging-c3-new.sunnypilot.ai.
    4. Complete the rest of the installation following the onscreen instructions.
  • sunnypilot already installed and you installed a version after 0.8.17?

    1. On the comma three, go to Settings ▶️ Software.
    2. At the Download option, press CHECK. This will fetch the list of latest branches from sunnypilot.
    3. At the Target Branch option, press SELECT to open the Target Branch selector.
    4. Scroll to select the desired branch per Recommended Branches (see below). Example: staging-c3-new
Branch Installation URL
staging-c3-new https://staging-c3-new.sunnypilot.ai
dev-c3-new https://dev-c3-new.sunnypilot.ai
custom-branch https://install.sunnypilot.ai/{branch_name}
release-c3-new Not yet available.

Tip

You can use sunnypilot/targetbranch as an install URL. Example: 'sunnypilot/staging-c3-new'.

Note

Do you require further assistance with software installation? Join the sunnypilot Discord server and message us in the #installation-help channel.

Older legacy branches

[IMPORTANT] It is recommended to re-flash AGNOS if you intend to downgrade from the new branches. You can still restore the latest sunnylink backup made on the old branches.

Branch Installation URL
release-c3 https://release-c3.sunnypilot.ai
staging-c3 https://staging-c3.sunnypilot.ai
dev-c3 https://dev-c3.sunnypilot.ai

🎆 Pull Requests

We welcome both pull requests and issues on GitHub. Bug fixes are encouraged.

Pull requests should be against the most current master branch.

📊 User Data

By default, sunnypilot uploads the driving data to comma servers. You can also access your data through comma connect.

sunnypilot is open source software. The user is free to disable data collection if they wish to do so.

sunnypilot 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

sunnypilot is released under the MIT License. This repository includes original work as well as significant portions of code derived from openpilot by comma.ai, which is also released under the MIT license with additional disclaimers.

The original openpilot license notice, including comma.ais 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, please see the LICENSE file.

💰 Support sunnypilot

If you find any of the features useful, consider becoming a sponsor on GitHub to support future feature development and improvements.

By becoming a sponsor, you will gain access to exclusive content, early access to new features, and the opportunity to directly influence the project's development.

GitHub Sponsor

Become a Sponsor

PayPal

PayPal this

Your continuous love and support are greatly appreciated! Enjoy 🥰

- Jason, Founder of sunnypilot

Languages
Python 70.6%
C++ 21.7%
C 2.2%
Cap'n Proto 1.9%
Shell 1.6%
Other 1.9%