DEC: refactor mode conditions with Experimental Mode

This commit is contained in:
Jason Wen
2026-02-04 00:15:08 -05:00
parent 959ebd22d8
commit f309be9038
2 changed files with 5 additions and 9 deletions
@@ -160,7 +160,7 @@ class LongitudinalPlanner(LongitudinalPlannerSP):
output_a_target_e2e = sm['modelV2'].action.desiredAcceleration
output_should_stop_e2e = sm['modelV2'].action.shouldStop
if sm['selfdriveState'].experimentalMode:
if self.is_e2e(sm):
output_a_target = min(output_a_target_e2e, output_a_target_mpc)
self.output_should_stop = output_should_stop_e2e or output_should_stop_mpc
if output_a_target < output_a_target_mpc:
@@ -36,16 +36,12 @@ class LongitudinalPlannerSP:
self.output_v_target = 0.
self.output_a_target = 0.
@property
def mlsim(self) -> bool:
# If we don't have a generation set, we assume it's default model. Which as of today are mlsim.
return bool(self.generation is None or self.generation >= 11)
def get_mpc_mode(self) -> str | None:
def is_e2e(self, sm: messaging.SubMaster) -> bool:
experimental_mode = sm['selfdriveState'].experimentalMode
if not self.dec.active():
return None
return experimental_mode
return self.dec.mode()
return experimental_mode and self.dec.mode() == "blended"
def update_targets(self, sm: messaging.SubMaster, v_ego: float, a_ego: float, v_cruise: float) -> tuple[float, float]:
CS = sm['carState']