From e4de82f90636a551a2490ccda1abc30a9b7f30b1 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Sat, 18 Dec 2021 13:37:29 +0800 Subject: [PATCH] ui: remove variable world_objects_visible, use rcv_frame (#23264) --- selfdrive/ui/qt/onroad.cc | 2 +- selfdrive/ui/ui.cc | 3 --- selfdrive/ui/ui.h | 5 +++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index e9f9bbfa09752d..98ee279450439d 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -349,7 +349,7 @@ void NvgWindow::paintGL() { CameraViewWidget::paintGL(); UIState *s = uiState(); - if (s->scene.world_objects_visible) { + if (s->worldObjectsVisible()) { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing); painter.setPen(Qt::NoPen); diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index a8453889cbaa0b..8f82250fae1a7e 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -118,7 +118,6 @@ static void update_state(UIState *s) { update_leads(s, sm["radarState"].getRadarState(), line); } if (sm.updated("liveCalibration")) { - scene.world_objects_visible = true; auto rpy_list = sm["liveCalibration"].getLiveCalibration().getRpyCalib(); Eigen::Vector3d rpy; rpy << rpy_list[0], rpy_list[1], rpy_list[2]; @@ -211,8 +210,6 @@ static void update_status(UIState *s) { s->scene.end_to_end = Params().getBool("EndToEndToggle"); s->wide_camera = Hardware::TICI() ? Params().getBool("EnableWideCamera") : false; } - // Invisible until we receive a calibration message. - s->scene.world_objects_visible = false; } started_prev = s->scene.started; } diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 7c16e4ae6f4f2b..329da8a881e883 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -82,8 +82,6 @@ typedef struct { typedef struct UIScene { mat3 view_from_calib; - bool world_objects_visible; - cereal::PandaState::PandaType pandaType; // modelV2 @@ -106,6 +104,9 @@ class UIState : public QObject { public: UIState(QObject* parent = 0); + inline bool worldObjectsVisible() const { + return sm->rcv_frame("liveCalibration") > scene.started_frame; + }; int fb_w = 0, fb_h = 0;