From eae5fb2e7bbdbe76383f7a2c115ffa7312350849 Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Tue, 9 Feb 2021 11:38:30 +0100 Subject: [PATCH] ui.py: topdown fixes old-commit-hash: 5019d1d14392c0943c8aa96c62cc7808585c2a84 --- tools/replay/lib/ui_helpers.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/replay/lib/ui_helpers.py b/tools/replay/lib/ui_helpers.py index 9bb640679c..ae83af0696 100644 --- a/tools/replay/lib/ui_helpers.py +++ b/tools/replay/lib/ui_helpers.py @@ -9,6 +9,7 @@ import pygame # pylint: disable=import-error from common.transformations.camera import (eon_f_frame_size, eon_f_focal_length, tici_f_frame_size, tici_f_focal_length) from selfdrive.config import UIParams as UP +from selfdrive.config import RADAR_TO_CAMERA RED = (255, 0, 0) @@ -85,8 +86,8 @@ def to_lid_pt(y, x): def draw_path(path, color, img, calibration, top_down, lid_color=None, z_off=0): - x, y, z = np.asarray(path.x), np.asarray(path.y), np.asarray(path.z) - pts = calibration.car_space_to_bb(x, -y, -z + z_off) + x, y, z = np.asarray(path.x), -np.asarray(path.y), -np.asarray(path.z) + z_off + pts = calibration.car_space_to_bb(x, y, z) pts = np.round(pts).astype(int) # draw lidar path point on lidar @@ -194,9 +195,10 @@ def plot_model(m, img, calibration, top_down): x, y, _, _ = lead.xyva x_std, _, _, _ = lead.xyvaStd + x -= RADAR_TO_CAMERA - _, py_top = to_lid_pt(x + x_std, y) - px, py_bottom = to_lid_pt(x - x_std, y) + _, py_top = to_lid_pt(x + x_std, -y) + px, py_bottom = to_lid_pt(x - x_std, -y) top_down[1][int(round(px - 4)):int(round(px + 4)), py_top:py_bottom] = find_color(top_down[0], YELLOW) for path, prob, _ in zip(m.laneLines, m.laneLineProbs, m.laneLineStds):