Repository navigation
code cleanup on lca_3 counter and hands-on-wheel spoof - no functionality change - #9
Open
thomasfifer wants to merge 3 commits into
Open
thomasfifer wants to merge 3 commits into
thomasfifer wants to merge 3 commits into
Conversation
pattern matching doesn't work for all cars and ultimately just passes through the counter. while that appears to work in most cases, we should set the counter to a known value
figured out the pscm message a bit better for the dbc, update code to reflect changes and properly spoof hands on wheel
Owner
|
Oh, I missed this PR, sorry. Not sure when I'll have availability to review this, but at least now I know about it. About HANDS_ON_STEERING_WHEEL_A and _B: |
Author
thomasfifer
added a commit
to thomasfifer/StarPilot
that referenced
this pull request
Nov 16, 2026
Reverse-engineered the PSCM message's hands-on-wheel fields more precisely: replaces the old 2-byte HANDS_ON_STEERING_WHEEL_A/B guess with HANDS_ON_WHEEL_ALERT_FLAGS/TIMER (and the other newly-identified signals in that byte range) in opendbc/dbc/volvo_mid_1.dbc, and spoofs by setting the alert flags/timer directly instead of toggling pseudo-random A/B byte values by frame parity. Scoped to this codebase's existing lat_active-only condition (no VolvoSpoofPAHandsOnWheel/bit-128 toggle here, since that doesn't exist in this fork yet). Brought in from paper5590/opendbc#9, adapted for StarPilot's current carcontroller.py/volvocan.py. Verified by decoding the produced PSCM CAN message with a real CANParser against the updated DBC: ALERT_FLAGS=3/ALERT_TIMER=0 while steering, 0/0 otherwise.
thomasfifer
added a commit
to thomasfifer/StarPilot
that referenced
this pull request
Nov 16, 2026
Pattern matching doesn't work for all cars and ultimately just passes through the observed counter in the unsynced case. Replace it with a known, predictable incrementing counter (mod 4) like the other LCA_* counters already use, seeded from the first observed value. Brought in from paper5590/opendbc#9, adapted for StarPilot's current carcontroller.py. Verified by running CarController.update() and decoding the real LCA_3 CAN output: COUNTER_1 increments 1,2,3,0,1,2,3...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

LCA_3 counter:
my car wasn't matching the pattern and instead just passing through the counter. it didn't appear to have any issues with passthrough but it's still probably better to use our own counter. just a normal incrementor appears to work ok.
hands-on-wheel spoof:
broke apart HANDS_ON_STEERING_WHEEL_A and _B into multiple variables including a timer and flags. we now set the flag and timer when spoofing hands on wheel and pass through all other data for a "correct" implementation instead of just alternating between two bit patterns that appeared to work.