Skip to content

Commit

Permalink
rerun: fix rp_visualization TypeError (#33749)
Browse files Browse the repository at this point in the history
* Fixed iteration over liveTracks in radar visualization by ensuring the data structure is iterable and made the background black

* Requested changes, moved conditional to function call

* Simplified conditional, renamed method
  • Loading branch information
Willebrew authored Oct 8, 2024
1 parent d72b598 commit 8a8d8c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 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 @@ -68,7 +69,7 @@ def plot_lead(rs, lid_overlay):
lid_overlay[px_left:px_right, py] = rerunColorPalette[0][0]


def maybe_update_radar_points(lt, lid_overlay):
def update_radar_points(lt, lid_overlay):
ar_pts = []
if lt is not None:
ar_pts = {}
Expand Down
5 changes: 3 additions & 2 deletions tools/replay/rp_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from openpilot.common.basedir import BASEDIR
from openpilot.tools.replay.lib.rp_helpers import (UP, rerunColorPalette,
get_blank_lid_overlay,
maybe_update_radar_points, plot_lead,
update_radar_points, plot_lead,
plot_model)
from msgq.visionipc import VisionIpcClient, VisionStreamType

Expand All @@ -33,7 +33,8 @@ def visualize(addr):
if sm.recv_frame['radarState']:
plot_lead(sm['radarState'], lid_overlay)
liveTracksTime = sm.logMonoTime['liveTracks']
maybe_update_radar_points(sm['liveTracks'], lid_overlay)
if sm.updated['liveTracks']:
update_radar_points(sm['liveTracks'], lid_overlay)
rr.set_time_nanos("TIMELINE", liveTracksTime)
rr.log("tracks", rr.SegmentationImage(np.flip(np.rot90(lid_overlay, k=-1), axis=1)))

Expand Down

0 comments on commit 8a8d8c2

Please sign in to comment.