From 45b53cf66ac564326a78e024eb974f742c2ca69b Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Tue, 14 Jul 2026 18:54:07 -0700 Subject: [PATCH] Rename LeadData.status to LeadData.present (#38339) * rename LeadData.status to LeadData.present * rename LeadData.status to LeadData.present * resolve longitudinal MPC merge conflict --- openpilot/cereal/log.capnp | 2 +- .../controls/lib/longitudinal_mpc_lib/long_mpc.py | 2 +- openpilot/selfdrive/controls/lib/longitudinal_planner.py | 2 +- openpilot/selfdrive/controls/radard.py | 8 ++++---- openpilot/selfdrive/test/longitudinal_maneuvers/plant.py | 2 +- openpilot/selfdrive/ui/mici/onroad/model_renderer.py | 4 ++-- openpilot/selfdrive/ui/onroad/model_renderer.py | 4 ++-- openpilot/tools/replay/lib/ui_helpers.py | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/openpilot/cereal/log.capnp b/openpilot/cereal/log.capnp index 296cba3b25..c7923bd373 100644 --- a/openpilot/cereal/log.capnp +++ b/openpilot/cereal/log.capnp @@ -722,7 +722,7 @@ struct RadarState @0x9a185389d6fdd05f { vLeadK @8 :Float32; aLeadK @9 :Float32; fcw @10 :Bool; - status @11 :Bool; + present @11 :Bool; aLeadTau @12 :Float32; modelProb @13 :Float32; radar @14 :Bool; diff --git a/openpilot/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py b/openpilot/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py index 99d0c7ae68..de1ba0c278 100755 --- a/openpilot/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py +++ b/openpilot/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py @@ -288,7 +288,7 @@ class LongitudinalMpc: def process_lead(self, lead): v_ego = self.x0[1] - if lead is not None and lead.status: + if lead is not None and lead.present: x_lead = lead.dRel v_lead = lead.vLead a_lead = lead.aLeadK diff --git a/openpilot/selfdrive/controls/lib/longitudinal_planner.py b/openpilot/selfdrive/controls/lib/longitudinal_planner.py index f413903aa0..cf5a4b13a8 100755 --- a/openpilot/selfdrive/controls/lib/longitudinal_planner.py +++ b/openpilot/selfdrive/controls/lib/longitudinal_planner.py @@ -161,7 +161,7 @@ class LongitudinalPlanner: longitudinalPlan.accels = self.a_desired_trajectory.tolist() longitudinalPlan.jerks = self.j_desired_trajectory.tolist() - longitudinalPlan.hasLead = sm['radarState'].leadOne.status + longitudinalPlan.hasLead = sm['radarState'].leadOne.present longitudinalPlan.longitudinalPlanSource = self.mpc.source longitudinalPlan.fcw = self.fcw diff --git a/openpilot/selfdrive/controls/radard.py b/openpilot/selfdrive/controls/radard.py index 94400f3357..1474b31cf1 100755 --- a/openpilot/selfdrive/controls/radard.py +++ b/openpilot/selfdrive/controls/radard.py @@ -91,7 +91,7 @@ class Track: "vLeadK": float(self.vLeadK), "aLeadK": float(self.aLeadK), "aLeadTau": float(self.aLeadTau.x), - "status": True, + "present": True, "fcw": self.is_potential_fcw(model_prob), "modelProb": model_prob, "radar": True, @@ -151,7 +151,7 @@ def get_RadarState_from_vision(lead_msg: capnp._DynamicStructReader, v_ego: floa "aLeadTau": 0.3, "fcw": False, "modelProb": float(lead_prob), - "status": True, + "present": True, "radar": False, "radarTrackId": -1, } @@ -165,7 +165,7 @@ def get_lead(v_ego: float, ready: bool, tracks: dict[int, Track], lead_msg: capn else: track = None - lead_dict = {'status': False} + lead_dict = {'present': False} if track is not None: lead_dict = track.get_RadarState(lead_prob) elif (track is None) and ready and (lead_prob > .5): @@ -177,7 +177,7 @@ def get_lead(v_ego: float, ready: bool, tracks: dict[int, Track], lead_msg: capn closest_track = min(low_speed_tracks, key=lambda c: c.dRel) # Only choose new track if it is actually closer than the previous one - if (not lead_dict['status']) or (closest_track.dRel < lead_dict['dRel']): + if (not lead_dict['present']) or (closest_track.dRel < lead_dict['dRel']): lead_dict = closest_track.get_RadarState() return lead_dict diff --git a/openpilot/selfdrive/test/longitudinal_maneuvers/plant.py b/openpilot/selfdrive/test/longitudinal_maneuvers/plant.py index fbffde911a..733c1ab2fd 100755 --- a/openpilot/selfdrive/test/longitudinal_maneuvers/plant.py +++ b/openpilot/selfdrive/test/longitudinal_maneuvers/plant.py @@ -95,7 +95,7 @@ class Plant: lead.aLeadK = float(a_lead) # TODO use real radard logic for this lead.aLeadTau = float(_LEAD_ACCEL_TAU) - lead.status = status + lead.present = status lead.modelProb = float(prob_lead) if not self.only_lead2: radar.radarState.leadOne = lead diff --git a/openpilot/selfdrive/ui/mici/onroad/model_renderer.py b/openpilot/selfdrive/ui/mici/onroad/model_renderer.py index 0442aa2b65..adf9814364 100644 --- a/openpilot/selfdrive/ui/mici/onroad/model_renderer.py +++ b/openpilot/selfdrive/ui/mici/onroad/model_renderer.py @@ -166,7 +166,7 @@ class ModelRenderer(Widget): leads = [radar_state.leadOne, radar_state.leadTwo] for i, lead_data in enumerate(leads): - if lead_data and lead_data.status: + if lead_data and lead_data.present: d_rel, y_rel, v_rel = lead_data.dRel, lead_data.yRel, lead_data.vRel idx = self._get_path_length_idx(path_x_array, d_rel) @@ -195,7 +195,7 @@ class ModelRenderer(Widget): road_edge.projected_points = self._map_line_to_polygon(road_edge.raw_points, line_width_factor, 0.0, max_idx) # Update path using raw points - if lead and lead.status: + if lead and lead.present: lead_d = lead.dRel * 2.0 max_distance = np.clip(lead_d - min(lead_d * 0.35, 10.0), 0.0, max_distance) diff --git a/openpilot/selfdrive/ui/onroad/model_renderer.py b/openpilot/selfdrive/ui/onroad/model_renderer.py index e21ca4f271..50ff3b1c53 100644 --- a/openpilot/selfdrive/ui/onroad/model_renderer.py +++ b/openpilot/selfdrive/ui/onroad/model_renderer.py @@ -150,7 +150,7 @@ class ModelRenderer(Widget): leads = [radar_state.leadOne, radar_state.leadTwo] for i, lead_data in enumerate(leads): - if lead_data and lead_data.status: + if lead_data and lead_data.present: d_rel, y_rel, v_rel = lead_data.dRel, lead_data.yRel, lead_data.vRel idx = self._get_path_length_idx(path_x_array, d_rel) @@ -176,7 +176,7 @@ class ModelRenderer(Widget): road_edge.projected_points = self._map_line_to_polygon(road_edge.raw_points, 0.025, 0.0, max_idx, max_distance) # Update path using raw points - if lead and lead.status: + if lead and lead.present: lead_d = lead.dRel * 2.0 max_distance = np.clip(lead_d - min(lead_d * 0.35, 10.0), 0.0, max_distance) diff --git a/openpilot/tools/replay/lib/ui_helpers.py b/openpilot/tools/replay/lib/ui_helpers.py index 039dd4f235..b5fdd18025 100644 --- a/openpilot/tools/replay/lib/ui_helpers.py +++ b/openpilot/tools/replay/lib/ui_helpers.py @@ -187,7 +187,7 @@ def plot_model(m, img, calibration, top_down): def plot_lead(rs, top_down): for lead in [rs.leadOne, rs.leadTwo]: - if not lead.status: + if not lead.present: continue x = lead.dRel