Rename LeadData.status to LeadData.present (#38339)

* rename LeadData.status to LeadData.present

* rename LeadData.status to LeadData.present

* resolve longitudinal MPC merge conflict
This commit is contained in:
Adeeb Shihadeh
2026-07-14 18:54:07 -07:00
committed by GitHub
parent cf8371c2c5
commit 45b53cf66a
8 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -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;
@@ -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
@@ -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
+4 -4
View File
@@ -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
@@ -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
@@ -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)
@@ -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)
+1 -1
View File
@@ -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