Skip to content

Commit

Permalink
Fixed iteration over liveTracks in radar visualization by ensuring th…
Browse files Browse the repository at this point in the history
…e data structure is iterable and made the background black
  • Loading branch information
Willebrew committed Oct 8, 2024
1 parent 196fb0a commit 2bf1b1e
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions tools/replay/lib/rp_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
(230, "vibrantpink", (255, 36, 170)),
(240, "orange", (255, 146, 0)),
(255, "white", (255, 255, 255)),
(110, "carColor", (255,0,127))]
(110, "carColor", (255,0,127)),
(0, "background", (0, 0, 0)),]


class UIParams:
Expand Down Expand Up @@ -69,25 +70,24 @@ def plot_lead(rs, lid_overlay):


def maybe_update_radar_points(lt, lid_overlay):
ar_pts = []
if lt is not None:
if lt is not None and hasattr(lt, 'trackList'):
ar_pts = {}
for track in lt:
for track in lt.trackList:
ar_pts[track.trackId] = [track.dRel, track.yRel, track.vRel, track.aRel, track.oncoming, track.stationary]
for ids, pt in ar_pts.items():
# negative here since radar is left positive
px, py = to_topdown_pt(pt[0], -pt[1])
if px != -1:
if pt[-1]:
color = rerunColorPalette[4][0]
elif pt[-2]:
color = rerunColorPalette[3][0]
else:
color = rerunColorPalette[5][0]
if int(ids) == 1:
lid_overlay[px - 2:px + 2, py - 10:py + 10] = rerunColorPalette[1][0]
else:
lid_overlay[px - 2:px + 2, py - 2:py + 2] = color
for ids, pt in ar_pts.items():
# negative here since radar is left positive
px, py = to_topdown_pt(pt[0], -pt[1])
if px != -1:
if pt[-1]:
color = rerunColorPalette[4][0]
elif pt[-2]:
color = rerunColorPalette[3][0]
else:
color = rerunColorPalette[5][0]
if int(ids) == 1:
lid_overlay[px - 2:px + 2, py - 10:py + 10] = rerunColorPalette[1][0]
else:
lid_overlay[px - 2:px + 2, py - 2:py + 2] = color


def get_blank_lid_overlay(UP):
Expand Down

0 comments on commit 2bf1b1e

Please sign in to comment.