Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync: commaai/opendbc:master into sunnypilot/opendbc:master-new #75

Merged
merged 59 commits into from
Mar 9, 2025

Conversation

devtekve
Copy link

@devtekve devtekve commented Mar 9, 2025

No description provided.

sunnyhaibin and others added 30 commits February 28, 2025 02:40
* reimplement

* use average wheel speed

* fix factor with eEgoRaw

* Revert "fix factor with eEgoRaw"

This reverts commit 35f3624.

* Revert "use average wheel speed"

This reverts commit ec4e9c1.

* revert to previous

* mutation again ugh

* mutation you got to be kidding me

* nice, this passes test models now

---------

Co-authored-by: Shane Smiskol <[email protected]>
* test test_angle_cmd_when_enabled above max angle and set them

* nissan is too high

* clean up

* more
* Hyundai CAN FD: Steering API updates

* comments

* comments

* keep it for now

* not used

* should use DBC spec

* consistent

---------

Co-authored-by: Shane Smiskol <[email protected]>
* struct to prevent forgetting something and make more organized

* use it

* move all over

* clean up

* rm
Revert "Hyundai CAN FD: ADAS steering API updates (commaai#1873)"

This reverts commit 2a75806.
* restart

* fix

* missing

* remove stuff we don't use

* huh

* fix

* fix fix fix

* we haven't seen LKAS with angle yet

* this is missing from the new message

* ...

* more explicit

* flip

* import
…#1890)

* Update replay_drive.py

* warn

* no true

* tqdm too
Use gcovr instead of gcov to support exclusion markers.

This also replaces lcov, since gcov has far fewer dependencies,
can be installed via uv (and looks better if anything).
* curvature safety: limit to ISO max

* .

* cmt

* implement in carcontroller

* MISRAAAAAA

* use ~average road roll

* stash

* clean up

* compiles

* fix safety replay for ford can fd

* always init

* stash

* fix replay

* fix that

* safety doesn't consider rate limits when clipping max curvature

consider: at the max curvature limit and user gas overrides heavily, max curvature limit might drop quicker than the safet rate limit will allow for

* don't limit for CAN

* do tests (need to clean up)

* stash

* rm

* clean up tests

* fix that

* smaller

* fix capnp error

* because we allow tolerance on the error limiting, we need the same type of tolerance on the max accel curvature to not block

* fix a test

* fix another

* consistent naming

* debugging

* debug

* remove

* stash

* clean up

* clean up

* minor

* and this

* space

* misra

* doesn't matter here

* safety mutation test fix

* misra false positive?

* rename

* ah good catch, these are equivalent

* comment

* clean up

* rename like safety

* fix

* simpler

* not needed
* debug

* remove debugging

* huh
* fixup

* test

* bye copilot

* rev

* fix

* fix

* test again

* revert

* need
* Only run tx hooks on msgs in safety_config.tx_msgs.

* 'fix' tests

* retrigger checks bc timeouts

* not hit

* formatting

* add back

---------

Co-authored-by: Shane Smiskol <[email protected]>
these are the same
* no tron (2010)

* switch to actual ACC message

* switch to camera

* add logging
…p fail (commaai#1919)

add checkout check to prevent opendbc bump fail
* add VDM fault signal

* fix
sshane and others added 25 commits March 5, 2025 14:51
* support support-type

* fix

* fix

* fix
* add candidate cancel command and test

* fixes

* this was correct

* try spacing out the messages

* try adas status to acm to cancel

* try a bunch of stuff

* send the entire range

* try faulted

* try two faults

* try faster

* 50hz

* Revert "50hz"

This reverts commit babcbdf.

* no fault on dash

* 50hz

* see if "unavailable" also works

* try sending just 1

* 100 Hz

* Revert "100 Hz"

This reverts commit 29ae625.

* Revert "try sending just 1"

This reverts commit 64908eb.

* revert other stuff - forgot counter!

* Revert "revert other stuff - forgot counter!"

This reverts commit 5ce09b7.

* try counter

* final thing

* 100 hz

* Revert "100 hz" (faults)

This reverts commit bea3977.

* nvm we can't do this since the state management to know when openpilot stops sending cancel is too complex

* Revert "nvm we can't do this since the state management to know when openpilot stops sending cancel is too complex"

This reverts commit 19fb385.

* forward through openpilot

* try these two

* let's also try this

* are we doing this right?

* temp fault?

* ?

* try oscillating?!

* that works?!

* maybe ACM needs to see VDM status rise before VDM can request cancel with a falling edge

* try to cancel immediately (1 frame of available)

* no counter

* cmts

* 3 frames

* comments

* clean up safety

* clean up

* cc clean up

* typo

* comments

* clean this up too

* and this too
* fix possible gear exception

* fix cruise state mismatch

* clean up
* Rivian: don't show set speed in UI

* carparam

* just use speed
…e test speed (commaai#1930)

* Replace @parameterized.expand with @pytest.mark.parametrize for faster test collection

This change reduces the opendbc/car/tests/ collection time to ~0.4s.

* clean up

---------

Co-authored-by: Shane Smiskol <[email protected]>
so far only tesla has been seen being able to set to 0
* Update interface.py

* Update fingerprints.py

* Revert "Update interface.py"

This reverts commit a2abbc0.
* Update fingerprints.py

* 2020 confirmed!

* should be fine

---------

Co-authored-by: Jason Young <[email protected]>
* parse vin

* Update opendbc/car/vin.py
* TODO: cant pass down due to circular imports

* revert

* screw it, we can split vin.py and vin_query.py later. this is nicer

* Revert "screw it, we can split vin.py and vin_query.py later. this is nicer"

This reverts commit 9ddab33.
* add match_fw_to_car_fuzzy

* remove comment

* fix dbc

* format

* don't remove...

* parse_vin function

* test caught bug

* safe string accessing

---------

Co-authored-by: Shane Smiskol <[email protected]>
* this is what we want

* rm old

* and now counter

* need this

* toyota

* subaru's good

* Tesla and Chrysler

* Ford

* do some find and replace

* do the rest

* clean up

* remove this

* rm

* not broken but bad

* this was wrong!
* set FWD_BUS_LOOKUP to most common

* this is always assumed to be a number, test models tests mismatches

* clean up

* and this
…aster-new

# Conflicts:
#	opendbc/car/hyundai/hyundaicanfd.py
#	opendbc/car/rivian/carcontroller.py
#	opendbc/safety/tests/common.py
#	opendbc/safety/tests/test_chrysler.py
#	opendbc/safety/tests/test_hyundai_canfd.py
* Fix get_params_for_docs call to use correct parameters

Updated the function call to match the required arguments by removing the redundant 'model' parameter. This ensures compatibility with the function definition and prevents potential errors.

* Add _tx_acc_state_msg method and standardize PT_BUS usage

Introduce the _tx_acc_state_msg method in Hyundai safety tests to handle ACC state messaging. Replace hardcoded bus values with the self.PT_BUS variable for consistency and maintainability across SCC_CONTROL messages.

* Add MADS heartbeat engaged state validation test

Introduce a new test function `test_heartbeat_engaged_mads_check` to verify the behavior of MADS heartbeat engagement logic under varying conditions. This ensures correct state transitions and validates robustness against mismatched heartbeat signals.

* Increase timeout for safety mutation tests to 60 minutes

Extended the timeout for the entire safety mutation tests workflow and its individual steps from 20 and 10 minutes respectively to 60 minutes. This change ensures that longer-running tests complete successfully without premature termination.
Copy link

sourcery-ai bot commented Mar 9, 2025

Reviewer's Guide by Sourcery

The pull request synchronizes changes from commaai/opendbc:master into sunnypilot/opendbc:master-new, focusing on safety checks, CAN message handling, and platform-specific configurations. Key changes include updates to safety checks, CAN message handling, and platform-specific configurations, particularly for Ford, Rivian, and Hyundai vehicles.

Sequence diagram for Rivian ACC cancel

sequenceDiagram
    participant User
    participant CarController
    participant VDM_AdasSts

    User->>CarController: Cancels ACC
    activate CarController
    CarController->>VDM_AdasSts: Sets VDM_AdasInterfaceStatus to 1 (available) for 5 frames, then 0 (unavailable)
    activate VDM_AdasSts
    VDM_AdasSts-->>CarController: Sends VDM_AdasSts message
    deactivate VDM_AdasSts
    loop for 5 frames
    CarController->>VDM_AdasSts: Sets VDM_AdasInterfaceStatus to 0
    activate VDM_AdasSts
    VDM_AdasSts-->>CarController: Sends VDM_AdasSts message
    deactivate VDM_AdasSts
    end
    deactivate CarController
Loading

Sequence diagram for Ford curvature limits

sequenceDiagram
    participant CarController
    participant EPS

    CarController->>CarController: Calculates desired curvature
    CarController->>CarController: Applies rate limits and curvature error limits
    CarController->>CarController: Checks if CANFD flag is set
    alt CANFD flag is set
        CarController->>CarController: Limits curvature based on max lateral acceleration
    end
    CarController->>EPS: Sends steering command with limited curvature
    EPS-->>CarController: Acknowledges steering command
Loading

Updated class diagram for AngleSteeringLimits

classDiagram
    class AngleSteeringLimits {
        float STEER_ANGLE_MAX
        tuple[list[float], list[float]] ANGLE_RATE_LIMIT_UP
        tuple[list[float], list[float]] ANGLE_RATE_LIMIT_DOWN
    }
Loading

Updated class diagram for RivianPlatformConfig

classDiagram
    class RivianPlatformConfig {
        DbcDict dbc_dict
        set[WMI] wmis
        set[ModelLine] lines
        set[ModelYear] years
    }
Loading

Updated class diagram for Vin

classDiagram
    class Vin {
        str vin
        str wmi
        str vds
        str vis
    }
Loading

File-Level Changes

Change Details Files
Enhancements to safety checks and CAN message handling.
  • Updated safety checks to include new parameters for checksum and counter handling.
  • Refactored CAN message handling to improve safety and reliability.
  • Introduced new safety configurations for Ford, Rivian, and Hyundai platforms.
opendbc/safety/safety/safety_ford.h
opendbc/safety/safety/safety_rivian.h
opendbc/safety/safety/safety_hyundai_canfd.h
opendbc/safety/safety/safety.h
Refactoring and improvements in platform-specific configurations.
  • Refactored Ford platform configurations to support CAN FD.
  • Updated Rivian platform configurations with new VIN handling and fuzzy matching.
  • Enhanced Hyundai platform configurations with new fingerprinting and safety checks.
opendbc/car/ford/values.py
opendbc/car/rivian/values.py
opendbc/car/hyundai/values.py
Improvements in testing and coverage for safety and platform-specific features.
  • Added new tests for Ford and Rivian safety features.
  • Improved test coverage for Hyundai CAN FD safety checks.
  • Refactored existing tests to align with new safety configurations.
opendbc/safety/tests/test_ford.py
opendbc/safety/tests/test_rivian.py
opendbc/safety/tests/test_hyundai_canfd.py
General code maintenance and cleanup.
  • Removed deprecated code and updated comments for clarity.
  • Refactored code for better readability and maintainability.
  • Updated documentation to reflect recent changes.
opendbc/car/docs.py
opendbc/car/car_helpers.py
opendbc/car/docs_definitions.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've reviewed this pull request using the Sourcery rules engine.

@devtekve devtekve merged commit 3cfc935 into master-new Mar 9, 2025
13 of 14 checks passed
@devtekve devtekve deleted the sync-20250309 branch March 9, 2025 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.