Skip to content

Volvo/fix spa cruise freq - #7

Closed
cschmittiey wants to merge 230 commits into
paper5590:master-cmafrom
cschmittiey:volvo/fix-spa-cruise-freq
Closed

cschmittiey wants to merge 230 commits into
paper5590:master-cmafrom
cschmittiey:volvo/fix-spa-cruise-freq

Conversation

@cschmittiey

Copy link
Copy Markdown

No description provided.

lukasloetkolben and others added 30 commits December 17, 2025 10:39
correct radar interface

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
)

- Remove redundant address checks in rivian_get_counter, toyota_get_quality_flag_valid, and {psa,rivian}_get_checksum as these functions are securely guarded by the safety whitelist.
* Add CarInterface.DRIVABLE_GEARS gears attribute

* lil less
* less ignore

* one more

* one more

* lil more
…maai#2996)

hyundai: document SCC_CONTROL signal preservation for ACC cancel

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* build_env

* default

* conditional

* need it there

* try that

* fix

* rm those
* install mull on macOS

* runs

* run in ci

* more readable

* fail early

* who doesn't have curl

* fix that?

* uv sourcing

* unset that

* mit

* cleanup
* board/ is dead

* add that back
* Chrysler: fix safety build on clang

* misra
* safety: single libsafety.so

* llvm
cleanup SecOC doc generation
* VW PQ: Update HCA Status to use Mode 2 (Status 7)

* VW PQ: update PQ safety test to use HCA status 7

---------

Co-authored-by: Jason Young <46612682+jyoung8607@users.noreply.github.com>
* Add Lexus LS 2018 platform configuration

* Add fingerprints for Lexus LS ECUs

* Add LEXUS_LS to torque substitute

* Update steer ratio for Lexus LS 2018 configuration

* LS steer ratio back to 13.0

* Update steer ratio for Lexus LS 2018 based on live params

* Add test route for Lexus LS

* Update LS car docs to exclude LSS+ A package

* Fix formatting in Lexus LS 2018 documentation
* whitelist Toyota hybrids for standstill resume behaviour

* fixed logic for hybrid check

* one check

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
Revert "safety: single libsafety.so (commaai#3013)"

This reverts commit f812bf7.
commaci-public and others added 8 commits April 13, 2026 09:14
Co-authored-by: Vehicle Researcher <user@comma.ai>
Scaffolds opendbc/safety/tests/test_volvo.py with TestVolvoCMA
(safetyParam=0) and TestVolvoSPA (safetyParam=VOLVO_FLAG_SPA) sharing
the generic CarSafetyTest harness plus a Volvo-specific
test_gas_threshold_self_consistent regression guard.

Without this, the CMA-vs-SPA gas-threshold scale mismatch that appeared
on a real Polestar 2 drive (ECM_1.ACCELERATOR_PEDAL_POS is raw 0-255
on CMA but DBC-scaled percent on SPA) was only detectable via
test_models.py on recorded routes. Now a laptop-only pytest run catches
it.

Also adds the Volvo sibling-exception in common.py
test_tx_hook_on_wrong_safety_mode, matching the existing Subaru/Toyota
pattern: CMA and SPA share TX_MSGS (static in volvo_init), so a TX from
one while running tests for the other is expected.

38 pass, 31 skipped locally.
ECM_1.ACCELERATOR_PEDAL_POS on SPA is DBC-scaled to percent
(factor 0.00390625, idle ~0%), but the existing check applied CMA's
raw-count threshold (> 21) to both platforms. On a Polestar 2
(b7d9bddaf834065c/00000025--29eeffa499) this produced 545 frames
of gasPressed disagreement per test_panda_safety_carstate run —
openpilot's percent-scaled value never climbed above 21, so the
pedal effectively read as released regardless of driver input.

Branch on self.is_spa to use > 1.0% for SPA and keep the original
raw > 21 for CMA. Values match volvo.h and are regression-guarded
by test_volvo.py::test_gas_threshold_self_consistent.
Adds VOLVO_XC40_RECHARGE, VOLVO_S60_RECHARGE, and POLESTAR_2
to non_tested_cars so the test suite skips them with SkipTest
instead of raising "missing test route" errors.
The carcontroller passed actuators.steeringAngleDeg straight to the EPS
with no measurement clamp and no rate limit, leaving a TODO in place.

Under a sustained driver override the model's planner sees the car
drifting off-line and desiredCurvature grows unbounded — observed
+6.5° desired vs -5° actual on Polestar 2 (11° gap). On release, the
EPS slams toward that stale command and overshoots ~20°.

Stock Volvo Pilot Assist keeps commanded-vs-actual inside ~2° even
under 10+ count torque holds for 5+ seconds (measured across 9
PA-engaged segments on a reference dashcam route).

Fix:
- ANGLE_ERROR = 3.0° clamp against CS.out.steeringAngleDeg (analog
  of Ford's CURVATURE_ERROR). 3° leaves ~20% headroom over stock's
  observed worst case.
- Wire apply_std_steer_angle_limits with the already-defined but
  unused ANGLE_LIMITS rate curves.
- Both run before the live-testing override so test configs still
  bypass them.

Sim of the observed override scenario: gap converges from -4.8° to
+0.1° over 100ms instead of overshooting.

See cschmittiey/openpilot#1 (rate limits), #2 (steeringPressed
gating), #3 (VM jerk limits) for follow-ups.
Volvo: clamp commanded angle to actual ± ANGLE_ERROR + rate limit
The SPA_BUS1_CRUISE_CONTROL (0x349) safety rx_check declared 10 Hz, but
the actual message rate is 5 Hz. The lagging threshold is
MAX(timestep * 10, 1s), so at 10 Hz it was 1s — tight enough that normal
driving with occasional ~1.6s gaps triggered false lagging. At 5 Hz the
threshold becomes 2s, matching the real message cadence.

Validated on POLESTAR_2 route b7d9bddaf834065c/00000025--29eeffa499
segments 1-30 (210/210 tests pass). Segments 0 and 31 still fail due to
log-boundary artifacts (ELM boot period, end-of-drive relay closure),
not the safety config.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@cschmittiey

Copy link
Copy Markdown
Author

oops sorry, please ignore

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for contributing to opendbc! In order for us to review your PR as quickly as possible, check the following:

  • Convert your PR to a draft unless it's ready to review
  • Read the contributing docs
  • Before marking as "ready for review", ensure:
    • the goal is clearly stated in the description
    • all the tests are passing
    • include a route or your device' dongle ID if relevant

@cschmittiey
cschmittiey deleted the volvo/fix-spa-cruise-freq branch April 22, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.