rerun: fix rp_visualization TypeError (#33749)

* 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
pull/33756/head
Will 7 months ago committed by GitHub
parent d72b59832c
commit 8a8d8c2272
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      tools/replay/lib/rp_helpers.py
  2. 5
      tools/replay/rp_visualization.py

@ -8,7 +8,8 @@ rerunColorPalette = [(96, "red", (255, 0, 0)),
(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:
@ -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 = {}

@ -8,7 +8,7 @@ import cereal.messaging as messaging
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
@ -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)))

Loading…
Cancel
Save