cleanup unused radar fields (#38346)

* cleanup unused radar fields

* bump opendbc

* this is nice for debugging

* bring that back too

* bring these back

* more revert
This commit is contained in:
Adeeb Shihadeh
2026-07-15 11:52:31 -07:00
committed by GitHub
parent eee13472ce
commit ec72ee096d
6 changed files with 18 additions and 28 deletions
+12 -12
View File
@@ -704,8 +704,7 @@ struct UsbState {
}
struct RadarState @0x9a185389d6fdd05f {
mdMonoTime @6 :UInt64;
carStateMonoTime @11 :UInt64;
mdMonoTime @6 :UInt64; # for debugging
radarErrors @13 :Car.RadarData.Error;
leadOne @3 :LeadData;
@@ -715,21 +714,21 @@ struct RadarState @0x9a185389d6fdd05f {
dRel @0 :Float32;
yRel @1 :Float32;
vRel @2 :Float32;
aRel @3 :Float32;
vLead @4 :Float32;
dPath @6 :Float32;
vLat @7 :Float32;
vLeadK @8 :Float32;
aLeadK @9 :Float32;
fcw @10 :Bool;
vLeadK @8 :Float32; # kalman-filtered lead speed
aLeadK @9 :Float32; # kalman-filtered lead accel
present @11 :Bool;
aLeadTau @12 :Float32;
modelProb @13 :Float32;
radar @14 :Bool;
radarTrackId @15 :Int32 = -1;
radar @14 :Bool; # true if lead is radar-matched (vs vision-only)
radarTrackId @15 :Int32 = -1; # for debugging
deprecated :group {
aRel @3 :Float32;
aLead @5 :Float32;
dPath @6 :Float32;
vLat @7 :Float32;
fcw @10 :Bool;
}
}
@@ -742,6 +741,7 @@ struct RadarState @0x9a185389d6fdd05f {
calPerc @9 :Int8;
canMonoTimes @10 :List(UInt64);
cumLagMs @5 :Float32;
carStateMonoTime @11 :UInt64;
radarErrors @12 :List(Car.RadarData.ErrorDEPRECATED);
}
}
@@ -1041,7 +1041,6 @@ struct ModelDataV2 {
roadEdgeStds @14 :List(Float32);
# predicted lead cars
leads @11 :List(LeadDataV2);
leadsV3 @18 :List(LeadDataV3);
meta @12 :MetaData;
@@ -1051,8 +1050,9 @@ struct ModelDataV2 {
action @26: Action;
lateralPlannerSolutionDEPRECATED @25: Deprecated.LateralPlannerSolution;
leadsDEPRECATED @11 :List(LeadDataV2DEPRECATED);
struct LeadDataV2 {
struct LeadDataV2DEPRECATED {
prob @0 :Float32; # probability that car is your lead at time t
t @1 :Float32;
+3 -11
View File
@@ -23,7 +23,6 @@ SPEED, ACCEL = 0, 1 # Kalman filter states enum
# stationary qualification parameters
V_EGO_STATIONARY = 4. # no stationary object flag below this speed
RADAR_TO_CENTER = 2.7 # (deprecated) RADAR is ~ 2.7m ahead from center of car
RADAR_TO_CAMERA = 1.52 # RADAR is ~ 1.5m ahead from center of mesh frame
@@ -59,13 +58,12 @@ class Track:
self.K_K = kalman_params.K
self.kf = KF1D([[v_lead], [0.0]], self.K_A, self.K_C, self.K_K)
def update(self, d_rel: float, y_rel: float, v_rel: float, v_lead: float, measured: float):
def update(self, d_rel: float, y_rel: float, v_rel: float, v_lead: float):
# relative values, copy
self.dRel = d_rel # LONG_DIST
self.yRel = y_rel # -LAT_DIST
self.vRel = v_rel # REL_SPEED
self.vLead = v_lead
self.measured = measured # measured or estimate
# computed velocity and accelerations
if self.cnt > 0:
@@ -92,7 +90,6 @@ class Track:
"aLeadK": float(self.aLeadK),
"aLeadTau": float(self.aLeadTau.x),
"present": True,
"fcw": self.is_potential_fcw(model_prob),
"modelProb": model_prob,
"radar": True,
"radarTrackId": self.identifier,
@@ -103,9 +100,6 @@ class Track:
# Radar points closer than 0.75, are almost always glitches on toyota radars
return abs(self.yRel) < 1.0 and (v_ego < V_EGO_STATIONARY) and (0.75 < self.dRel < 25)
def is_potential_fcw(self, model_prob: float):
return model_prob > .9
def __str__(self):
ret = f"x: {self.dRel:4.1f} y: {self.yRel:4.1f} v: {self.vRel:4.1f} a: {self.aLeadK:4.1f}"
return ret
@@ -149,7 +143,6 @@ def get_RadarState_from_vision(lead_msg: capnp._DynamicStructReader, v_ego: floa
"vLeadK": float(v_ego + lead_v_rel_pred),
"aLeadK": float(lead_msg.a[0]),
"aLeadTau": 0.3,
"fcw": False,
"modelProb": float(lead_prob),
"present": True,
"radar": False,
@@ -209,7 +202,7 @@ class RadarD:
self.v_ego_hist.append(self.v_ego)
self.last_v_ego_frame = sm.recv_frame['carState']
ar_pts = {pt.trackId: [pt.dRel, pt.yRel, pt.vRel, pt.measured] for pt in rr.points}
ar_pts = {pt.trackId: [pt.dRel, pt.yRel, pt.vRel] for pt in rr.points}
# *** remove missing points from meta data ***
for ids in list(self.tracks.keys()):
@@ -226,14 +219,13 @@ class RadarD:
# create the track if it doesn't exist or it's a new track
if ids not in self.tracks:
self.tracks[ids] = Track(ids, v_lead, self.kalman_params)
self.tracks[ids].update(rpt[0], rpt[1], rpt[2], v_lead, rpt[3])
self.tracks[ids].update(rpt[0], rpt[1], rpt[2], v_lead)
# *** publish radarState ***
self.radar_state_valid = sm.all_checks()
self.radar_state = log.RadarState.new_message()
self.radar_state.mdMonoTime = sm.logMonoTime['modelV2']
self.radar_state.radarErrors = rr.errors
self.radar_state.carStateMonoTime = sm.logMonoTime['carState']
if len(sm['modelV2'].velocity.x):
model_v_ego = sm['modelV2'].velocity.x[0]
@@ -89,7 +89,6 @@ class Plant:
lead.dRel = float(d_rel)
lead.yRel = 0.0
lead.vRel = float(v_rel)
lead.aRel = float(a_lead - self.acceleration)
lead.vLead = float(v_lead)
lead.vLeadK = float(v_lead)
lead.aLeadK = float(a_lead)
@@ -97,6 +96,7 @@ class Plant:
lead.aLeadTau = float(_LEAD_ACCEL_TAU)
lead.present = status
lead.modelProb = float(prob_lead)
lead.radar = True
if not self.only_lead2:
radar.radarState.leadOne = lead
radar.radarState.leadTwo = lead
@@ -175,8 +175,6 @@ def migrate_liveTracks(msgs):
pt.dRel = track.dRel
pt.yRel = track.yRel
pt.vRel = track.vRel
pt.aRel = track.aRel
pt.measured = True
pts.append(pt)
new_msg.liveTracks.points = pts
+1 -1
View File
@@ -201,7 +201,7 @@ def maybe_update_radar_points(lt, lid_overlay):
if lt is not None:
ar_pts = {}
for track in lt:
ar_pts[track.trackId] = [track.dRel, track.yRel, track.vRel, track.aRel]
ar_pts[track.trackId] = [track.dRel, track.yRel, track.vRel]
for pt in ar_pts.values():
# negative here since radar is left positive
px, py = to_topdown_pt(pt[0], -pt[1])