mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-19 00:43:54 +08:00
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
This commit is contained in:
@@ -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)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user