telemetry: add cruise engagement state for desync debugging

Added brakePressed to cruise group, prev_cruise_button and
prev_main_button to buttons group in carstate telemetry. New "engage"
group in controlsd logs state machine state, enabled/active flags, and
stock cruise state every frame for tracing engagement desync bugs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 06:17:42 +00:00
parent 77b2ecef20
commit d801177d2a
2 changed files with 14 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ from openpilot.system.version import get_short_branch
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_functions import CRUISING_SPEED, PROBABILITY, MovingAverageCalculator
from openpilot.selfdrive.frogpilot.controls.lib.model_manager import RADARLESS_MODELS
from openpilot.selfdrive.clearpilot.telemetry import tlog
from openpilot.selfdrive.frogpilot.controls.lib.speed_limit_controller import SpeedLimitController
SOFT_DISABLE_TIME = 3 # seconds
@@ -628,6 +629,16 @@ class Controls:
# Check if openpilot is engaged and actuators are enabled
self.enabled = self.state in ENABLED_STATES
self.active = self.state in ACTIVE_STATES
# CLEARPILOT: log engagement state for debugging cruise desync issues
tlog("engage", {
"state": self.state.name,
"enabled": self.enabled,
"active": self.active,
"cruise_enabled": CS.cruiseState.enabled,
"cruise_available": CS.cruiseState.available,
"brakePressed": CS.brakePressed,
})
if self.active:
self.current_alert_types.append(ET.WARNING)