Verify End to End Planner Boundaries

This commit is contained in:
firestar5683
2026-11-28 10:53:57 -06:00
parent 15997d73ea
commit fb7c88aa40
3 changed files with 9 additions and 4 deletions
@@ -559,10 +559,11 @@ class LongitudinalPlanner:
personality = sm['selfdriveState'].personality
relaxed = personality == log.LongitudinalPersonality.relaxed
boost_blocked = (
not e2e_active or reset_state or self.fcw or not self.allow_throttle or self.force_stop_plan.forcing or
not e2e_active or not profile_eligible or reset_state or self.fcw or not self.allow_throttle or self.force_stop_plan.forcing or
output_should_stop_mpc or output_should_stop_e2e or cruise_should_stop or self.mpc.solution_status != 0 or
curve.effective_mps is not None or traffic_mode is not False or sm['controlsState'].forceDecel or
not all(getattr(sm, health).get(service, False)
not cs.canValid or cs.canTimeout or cs.gasPressed or cs.brakePressed or
not all(getattr(sm, health, {}).get(service, False)
for health in ('alive', 'valid', 'freq_ok') for service in ('modelV2', 'carState', 'radarState'))
)
encouraged_model = self.encouragement.update(
@@ -270,6 +270,7 @@ class TestModelLeadTrajectory(unittest.TestCase):
sm['modelV2'].timestampEof = later + BOOT_OFFSET - 20_000_000
for lead in sm['modelV2'].leadsV3:
lead.x = [float(value + 100.) for value in lead.x]
lead.a = [-5.] * len(lead.a)
selected = []
real_process = planner.mpc.process_lead
def record(lead, model_lead=None, *, model_v_ego=None, selected=selected, real_process=real_process):
@@ -340,9 +340,12 @@ class TestOnroadAxes(unittest.TestCase):
def test_end_to_end_border_changes_when_slowing(self):
# These manual ExperimentalMode projections use the explicitly selected stock family.
self.ui.params.put('ConditionalModeConfig', json.loads(encode_preferences(SavedPreferences(mode=ModeChoice.STOCK))), block=True)
combined = replace(self.state(True, True), experimental_enabled=True)
self.ui.sm['selfdriveState'].experimentalMode = True
combined = self.state(True, True)
self.assertEqual(rgba(axis_status_color(combined)), (22, 127, 64, 255))
slowing = replace(combined, e2e_slowdown="Lead vehicle")
self.ui.sm.put('longitudinalPlan', NS(aTarget=-0.5, hasLead=True, shouldStop=False, longitudinalPlanSource='lead0'))
slowing = self.state(True, True)
self.assertEqual(slowing.e2e_slowdown, 'Lead vehicle')
self.assertEqual(rgba(axis_status_color(slowing)), (218, 111, 37, 255))
self.assertEqual(rgba(axis_status_color(replace(combined, longitudinal_active=False))), (10, 186, 181, 255))
self.assertEqual(rgba(axis_status_color(replace(combined, lateral_active=False))), (255, 105, 180, 255))