docs: cruise control desync investigation notes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 02:19:31 -05:00
parent b85ce8176d
commit 73472e5fab

View File

@@ -0,0 +1,29 @@
# CAN-FD Issues to Investigate
## Cruise Control Desync on Hot Start
### Problem
When the car is already in cruise control mode before openpilot starts (or before controlsd initializes), pressing the cruise control button causes a desync:
1. Car has active cruise control when openpilot comes online
2. Driver presses cruise button — car interprets as "toggle off" (cruise was already on)
3. openpilot interprets it as "engage" (from its perspective, it hasn't seen a cruise enable transition)
4. Result: car disengages cruise, but openpilot thinks it just engaged lateral mode
### Proposed Fix
When controlsd first reads carState and discovers `cruiseState.enabled` is already true:
1. Set a flag `cruise_was_active_at_start = True`
2. While this flag is set, do NOT allow openpilot to transition to engaged state on button press
3. Only clear the flag after seeing `cruiseState.enabled` go to `False` at least once (a full stop of cruise, not just standstill/pause)
4. After the first full off cycle, normal engagement logic resumes
### Status
- Could not reproduce on 2026-04-14 — may require specific timing (openpilot restart while driving with cruise active)
- Need to capture telemetry data during reproduction to see exact signal sequence
- Key telemetry groups to watch: `cruise` (enabled, available, ACCMode, VSetDis), `buttons` (cruise_button)
### Relevant Code
- `selfdrive/controls/controlsd.py` — engagement state machine
- `selfdrive/car/hyundai/carstate.py` — CAN-FD cruise state parsing
- `selfdrive/car/interfaces.py` — pcm_enable / cruise state transitions