Jason Wen dc0fd4ca96 Longitudinal: Speed Limit Assist (SLA) (#833)
* 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 a29bccff12b9ed9d64efe7a5722bf614214002c4.

* 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 f0083d6241380e84ed259c402941fa2c78e03fdf.

* 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

* sync with latest

* housekeeping

* use v cruise cluster instead

* fix var

* show it in UI!

* actually show it

* update event texts

* todo

* no override for now

* wrong timer!

* add vtarget and atarget

* fix

* handle no speed limit events

* fix size

* unused

* skip preActive if init max speed was already reached

* display last known speed limit and its state with SLA

* pending event

* much shorter disable guard

* update events

* convert max init for metric

* fix even if unused atm

* just use it

* red for all

* not disabled

* rename

* 10s pre active

* kumar wants it higher, blame him

* fix

* pcm long only

* some fixes

* rename

* use consolidate method to evaluate set speed status

* init non pcm cruise

* tests

* disable non pcm long state machine for now

* lint

* lint

* let the non PCM party begins

* fix event

* update event

* use speed limit final last

* only do direction checks if preActive

* use resolver

* use it directly

* no longer applies

* do it globally

* non pcm long: adapting or pending unused

* use button events instead of raw vals

* need to initialize

* move

* what?

* what #2???

* cst!

* circular

* slight fixes for tests

* change up checks for user confirm

* get buttonEvents at 100 hz and process for 20 hz consumption

* get v cruise cluster from outer loop

* Revert "get v cruise cluster from outer loop"

This reverts commit be8068e8ab9b52c7e8e1b3f29e89f994b3e911df.

* Revert "get buttonEvents at 100 hz and process for 20 hz consumption"

This reverts commit a739d4d4379080fceffda8d7d080c0260519f144.

* don't need

* do not allow target speed confirm if inactive

* do not allow preActive if no valid speed limit

* gimme them arrow pls

* less

* descriptive direction

* fix event

* update cs in 100 hz

* Revert "don't need"

This reverts commit 1eec763be795e1269f2046f8fe65781b3abedd0a.

* missed

* wrong

* stop

* throw them to helpers class

* property

* hold speed behavior changes

* abstract it

* use converted to check last set speed change

* Revert "do not allow target speed confirm if inactive"

This reverts commit 9840e74e

* pre active too short

* slight fixes

* fix tests

* linty lint

* speed limit changed hold timer for non pcm long

* should be 0

* less loopy

* some gates

* special sauce for sla

---------

Co-authored-by: nayan <nayan8teen@gmail.com>
Co-authored-by: DevTekVE <devtekve@gmail.com>
2025-09-30 13:13:45 -04:00
2024-12-16 19:47:29 -05: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
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
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

Description
No description provided
Readme MIT 3.5 GiB
Languages
Python 58.3%
C 20.4%
C++ 18.3%
Shell 0.7%
Cuda 0.6%
Other 1.6%