ui.py: white text on graphs (#19636)

* Improve readability and add automatic size detection

* Fix global variables

* Revert angle scale

* Revert enabled and brake colors

* Fix used colors
old-commit-hash: 5ce479cc56
commatwo_master
Philipp Braun 4 years ago committed by GitHub
parent 8e706e29d6
commit d572cd31cb
  1. 4
      tools/replay/lib/ui_helpers.py
  2. 15
      tools/replay/ui.py

@ -162,6 +162,10 @@ def init_plots(arr, name_to_arr_idx, plot_xlims, plot_ylims, plot_names, plot_co
plot_select.append(i)
axs[i].set_title(", ".join("%s (%s)" % (nm, cl)
for (nm, cl) in zip(pl_list, plot_colors[i])), fontsize=10)
axs[i].tick_params(axis="x", colors="white")
axs[i].tick_params(axis="y", colors="white")
axs[i].title.set_color("white")
if i < len(plot_ylims) - 1:
axs[i].set_xticks([])

@ -17,8 +17,7 @@ from selfdrive.config import UIParams as UP
from selfdrive.controls.lib.vehicle_model import VehicleModel
import cereal.messaging as messaging
from tools.replay.lib.ui_helpers import (_BB_TO_FULL_FRAME, _FULL_FRAME_SIZE, _INTRINSICS,
BLACK, BLUE, GREEN,
YELLOW, RED,
BLACK, BLUE, GREEN, YELLOW, RED,
CalibrationTransformsForWarpMatrix,
draw_lead_car, draw_lead_on, draw_mpc,
extract_model_data,
@ -30,8 +29,6 @@ from tools.replay.lib.ui_helpers import (_BB_TO_FULL_FRAME, _FULL_FRAME_SIZE, _I
os.environ['BASEDIR'] = BASEDIR
ANGLE_SCALE = 5.0
HOR = os.getenv("HORIZONTAL") is not None
def ui_thread(addr, frame_address):
# TODO: Detect car from replay and use that to select carparams
@ -45,7 +42,13 @@ def ui_thread(addr, frame_address):
pygame.font.init()
assert pygame_modules_have_loaded()
if HOR:
disp_info = pygame.display.Info()
max_height = disp_info.current_h
hor_mode = os.getenv("HORIZONTAL") is not None
hor_mode = True if max_height < 960+300 else hor_mode
if hor_mode:
size = (640+384+640, 960)
write_x = 5
write_y = 680
@ -220,7 +223,7 @@ def ui_thread(addr, frame_address):
pygame.draw.polygon(screen, BLUE, tuple(map(tuple, cpw)), 1)
pygame.draw.circle(screen, BLUE, list(map(int, map(round, vanishing_pointw[0]))), 2)
if HOR:
if hor_mode:
screen.blit(draw_plots(plot_arr), (640+384, 0))
else:
screen.blit(draw_plots(plot_arr), (0, 600))

Loading…
Cancel
Save