diff --git a/selfdrive/ui/qt/onroad/annotated_camera.cc b/selfdrive/ui/qt/onroad/annotated_camera.cc index 416a562cc..73448070a 100644 --- a/selfdrive/ui/qt/onroad/annotated_camera.cc +++ b/selfdrive/ui/qt/onroad/annotated_camera.cc @@ -24,6 +24,11 @@ AnnotatedCameraWidget::AnnotatedCameraWidget(VisionStreamType type, QWidget* par main_layout->addWidget(map_settings_btn, 0, Qt::AlignBottom | Qt::AlignRight); dm_img = loadPixmap("../assets/img_driver_face.png", {img_size + 5, img_size + 5}); + + #ifdef DP + rainbow_path = new RainbowPath; + #endif + } void AnnotatedCameraWidget::updateState(const UIState &s) { @@ -76,6 +81,10 @@ void AnnotatedCameraWidget::updateState(const UIState &s) { map_settings_btn->setVisible(!hideBottomIcons); main_layout->setAlignment(map_settings_btn, (rightHandDM ? Qt::AlignLeft : Qt::AlignRight) | Qt::AlignBottom); } + + #ifdef DP + rainbow_path->update_states(s); + #endif } void AnnotatedCameraWidget::drawHud(QPainter &p) { @@ -233,7 +242,14 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { // paint path QLinearGradient bg(0, height(), 0, 0); + #ifdef DP + if (rainbow_path->is_enabled()) { + rainbow_path->paint(bg); + } + else if (sm["controlsState"].getControlsState().getExperimentalMode()) { + #else if (sm["controlsState"].getControlsState().getExperimentalMode()) { + #endif // The first half of track_vertices are the points for the right side of the path // and the indices match the positions of accel from uiPlan const auto &acceleration = sm["uiPlan"].getUiPlan().getAccel(); diff --git a/selfdrive/ui/qt/onroad/annotated_camera.h b/selfdrive/ui/qt/onroad/annotated_camera.h index 0be4adfff..ad15f536f 100644 --- a/selfdrive/ui/qt/onroad/annotated_camera.h +++ b/selfdrive/ui/qt/onroad/annotated_camera.h @@ -40,6 +40,10 @@ private: int skip_frame_count = 0; bool wide_cam_requested = false; + #ifdef DP + RainbowPath *rainbow_path; + #endif + protected: void paintGL() override; void initializeGL() override;