controlsd: fix park short-circuit lac_log type mismatch crashing controlsd

The park short-circuit added in cea422b created lac_log as
LateralDebugState. publish_logs assigns lac_log to
controlsState.lateralControlState.<subtype> based on
CP.lateralTuning.which() — for torque-tuned cars (Hyundai Tucson here)
that's torqueState, expecting LateralTorqueState. The mismatch threw
a capnp KjException ("Value type mismatch") on the first state_control
cycle in park, killing controlsd. Manager respawned it, it crashed
again on the next park cycle, repeat — controlsState was never reliably
published, so the UI never saw the started/onroad transition and didn't
flip to the camera view.

Fix: call self.LaC.update(False, ...) which internally early-returns
when active is False (cheap) but produces the correct lac_log subtype
for whichever controller this car uses (LateralTorqueState for torque,
LateralPIDState for pid, LateralAngleState for angle). Pass through
the same sm reads the regular path uses; they're cached so the cost is
negligible.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-26 12:43:08 -05:00
parent 5d76576a15
commit 37e095eab7
+6 -1
View File
@@ -681,7 +681,12 @@ class Controls:
self.LoC.reset(v_pid=CS.vEgo) self.LoC.reset(v_pid=CS.vEgo)
self.frogpilot_variables.no_lat_lane_change = False self.frogpilot_variables.no_lat_lane_change = False
self.FPCC.noLatLaneChange = False self.FPCC.noLatLaneChange = False
lac_log = log.ControlsState.LateralDebugState.new_message() # Call LaC.update with active=False so we get the right lac_log subtype
# for this car's lateralTuning (torque vs pid vs angle). Internally it
# early-returns when active is False — cheap.
lp = self.sm['liveParameters']
_, _, lac_log = self.LaC.update(False, CS, self.VM, lp, self.steer_limited, 0.0,
self.sm['liveLocationKalman'], model_data=self.sm['modelV2'])
return CC, lac_log return CC, lac_log
# Update VehicleModel # Update VehicleModel