From 0e6e81fc53327ebec4bd32e1c43e4feffcb35534 Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:19:30 -0700 Subject: [PATCH] Full sized map Added toggle to expand the map across the entire onroad UI screen. --- common/params.cc | 2 ++ .../ui/qt/offroad/visual_settings.cc | 5 ++++ .../frogpilot/ui/qt/offroad/visual_settings.h | 2 +- selfdrive/ui/qt/offroad/settings.cc | 2 ++ selfdrive/ui/qt/onroad.cc | 30 ++++++++++++------- selfdrive/ui/qt/onroad.h | 1 + selfdrive/ui/ui.cc | 2 ++ selfdrive/ui/ui.h | 2 ++ 8 files changed, 35 insertions(+), 11 deletions(-) diff --git a/common/params.cc b/common/params.cc index 15697f7c7..d0ea870cc 100644 --- a/common/params.cc +++ b/common/params.cc @@ -221,6 +221,7 @@ std::unordered_map keys = { {"AlwaysOnLateralMain", PERSISTENT}, {"ApiCache_DriveStats", PERSISTENT}, {"AutomaticUpdates", PERSISTENT}, + {"BigMap", PERSISTENT}, {"BlindSpotPath", PERSISTENT}, {"CameraFPS", PERSISTENT}, {"CameraView", PERSISTENT}, @@ -273,6 +274,7 @@ std::unordered_map keys = { {"FrogPilotTogglesUpdated", PERSISTENT}, {"FrogsGoMoo", PERSISTENT}, {"FrogsGoMooTune", PERSISTENT}, + {"FullMap", PERSISTENT}, {"GoatScream", PERSISTENT}, {"HideAOLStatusBar", PERSISTENT}, {"HideCEMStatusBar", PERSISTENT}, diff --git a/selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc b/selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc index cbb9d8fdc..150cd6ebf 100644 --- a/selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc +++ b/selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc @@ -38,6 +38,7 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot {"UnlimitedLength", tr("'Unlimited' Road UI Length"), tr("Extend the display of the path, lane lines, and road edges out as far as the model can see."), ""}, {"QOLVisuals", tr("Quality of Life"), tr("Miscellaneous quality of life changes to improve your overall openpilot experience."), "../frogpilot/assets/toggle_icons/quality_of_life.png"}, + {"BigMap", tr("Big Map"), tr("Increase the size of the map in the onroad UI."), ""}, {"CameraView", tr("Camera View"), tr("Choose your preferred camera view for the onroad UI. This is purely a visual change and doesn't impact how openpilot drives."), ""}, {"DriverCamera", tr("Driver Camera On Reverse"), tr("Show the driver camera feed when in reverse."), ""}, }; @@ -166,6 +167,10 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot std::vector cameraOptions{tr("Auto"), tr("Driver"), tr("Standard"), tr("Wide")}; FrogPilotButtonParamControl *preferredCamera = new FrogPilotButtonParamControl(param, title, desc, icon, cameraOptions); toggle = preferredCamera; + } else if (param == "BigMap") { + std::vector mapToggles{"FullMap"}; + std::vector mapToggleNames{tr("Full Map")}; + toggle = new FrogPilotParamToggleControl(param, title, desc, icon, mapToggles, mapToggleNames); } else { toggle = new ParamControl(param, title, desc, icon, this); diff --git a/selfdrive/frogpilot/ui/qt/offroad/visual_settings.h b/selfdrive/frogpilot/ui/qt/offroad/visual_settings.h index 8c7a9c93d..c0ad37fdd 100644 --- a/selfdrive/frogpilot/ui/qt/offroad/visual_settings.h +++ b/selfdrive/frogpilot/ui/qt/offroad/visual_settings.h @@ -28,7 +28,7 @@ private: std::set customOnroadUIKeys = {"CustomPaths", "DeveloperUI", "FPSCounter", "LeadInfo"}; std::set customThemeKeys = {"CustomColors", "CustomIcons", "CustomSignals", "CustomSounds"}; std::set modelUIKeys = {"DynamicPathWidth", "HideLeadMarker", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "RoadEdgesWidth", "UnlimitedLength"}; - std::set qolKeys = {"CameraView", "DriverCamera"}; + std::set qolKeys = {"BigMap", "CameraView", "DriverCamera", "FullMap"}; std::set screenKeys = {}; std::map toggles; diff --git a/selfdrive/ui/qt/offroad/settings.cc b/selfdrive/ui/qt/offroad/settings.cc index 07312eef8..6339cfe82 100644 --- a/selfdrive/ui/qt/offroad/settings.cc +++ b/selfdrive/ui/qt/offroad/settings.cc @@ -160,6 +160,8 @@ void TogglesPanel::updateToggles() { disengage_on_accelerator_toggle->setVisible(!params.getBool("AlwaysOnLateral")); auto driver_camera_toggle = toggles["RecordFront"]; driver_camera_toggle->setVisible(!(params.getBool("DeviceManagement") && params.getBool("NoLogging") && params.getBool("NoUploads"))); + auto nav_settings_left_toggle = toggles["NavSettingLeftSide"]; + nav_settings_left_toggle->setVisible(!params.getBool("FullMap")); auto experimental_mode_toggle = toggles["ExperimentalMode"]; auto op_long_toggle = toggles["ExperimentalLongitudinalEnabled"]; diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 8f2fead31..34ffa46f9 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -84,7 +84,7 @@ void OnroadWindow::updateState(const UIState &s) { Alert alert = Alert::get(*(s.sm), s.scene.started_frame); alerts->updateAlert(alert); - if (s.scene.map_on_left) { + if (s.scene.map_on_left || scene.full_map) { split->setDirection(QBoxLayout::LeftToRight); } else { split->setDirection(QBoxLayout::RightToLeft); @@ -128,6 +128,11 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) { bool sidebarVisible = geometry().x() > 0; bool show_map = uiState()->scene.navigate_on_openpilot ? sidebarVisible : !sidebarVisible; map->setVisible(show_map && !map->isVisible()); + if (scene.big_map) { + map->setFixedWidth(width()); + } else { + map->setFixedWidth(topWidget(this)->width() / 2 - UI_BORDER_SIZE); + } } #endif // propagation event to parent(HomeWindow) @@ -366,7 +371,9 @@ void ExperimentalButton::updateState(const UIState &s, bool leadInfo) { void ExperimentalButton::paintEvent(QPaintEvent *event) { QPainter p(this); QPixmap img = experimental_mode ? experimental_img : engage_img; - drawIcon(p, QPoint(btn_size / 2, btn_size / 2 + y_offset), img, QColor(0, 0, 0, 166), (isDown() || !engageable) ? 0.6 : 1.0); + if (!(scene.map_open && scene.big_map)) { + drawIcon(p, QPoint(btn_size / 2, btn_size / 2 + y_offset), img, QColor(0, 0, 0, 166), (isDown() || !engageable) ? 0.6 : 1.0); + } } @@ -438,7 +445,7 @@ void AnnotatedCameraWidget::updateState(const UIState &s) { has_eu_speed_limit = (nav_alive && speed_limit_sign == cereal::NavInstruction::SpeedLimitSign::VIENNA); is_metric = s.scene.is_metric; speedUnit = s.scene.is_metric ? tr("km/h") : tr("mph"); - hideBottomIcons = (cs.getAlertSize() != cereal::ControlsState::AlertSize::NONE || customSignals != 0 && (turnSignalLeft || turnSignalRight)); + hideBottomIcons = (cs.getAlertSize() != cereal::ControlsState::AlertSize::NONE || customSignals != 0 && (turnSignalLeft || turnSignalRight) || bigMapOpen); status = s.status; // update engageability/experimental mode button @@ -550,10 +557,12 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) { } // current speed - p.setFont(InterFont(176, QFont::Bold)); - drawText(p, rect().center().x(), 210, speedStr); - p.setFont(InterFont(66)); - drawText(p, rect().center().x(), 290, speedUnit, 200); + if (!bigMapOpen) { + p.setFont(InterFont(176, QFont::Bold)); + drawText(p, rect().center().x(), 210, speedStr); + p.setFont(InterFont(66)); + drawText(p, rect().center().x(), 290, speedUnit, 200); + } p.restore(); @@ -1031,6 +1040,7 @@ void AnnotatedCameraWidget::updateFrogPilotWidgets() { obstacleDistanceStock = scene.obstacle_distance_stock; mapOpen = scene.map_open; + bigMapOpen = mapOpen && scene.big_map; turnSignalLeft = scene.turn_signal_left; turnSignalRight = scene.turn_signal_right; @@ -1067,11 +1077,11 @@ void AnnotatedCameraWidget::updateFrogPilotWidgets() { } void AnnotatedCameraWidget::paintFrogPilotWidgets(QPainter &p) { - if (showAlwaysOnLateralStatusBar || showConditionalExperimentalStatusBar) { + if ((showAlwaysOnLateralStatusBar || showConditionalExperimentalStatusBar) && !bigMapOpen) { drawStatusBar(p); } - if (customSignals != 0 && (turnSignalLeft || turnSignalRight)) { + if (customSignals != 0 && (turnSignalLeft || turnSignalRight) && !bigMapOpen) { if (!animationTimer->isActive()) { animationTimer->start(totalFrames * 11); // 440 milliseconds per loop; syncs up perfectly with my 2019 Lexus ES 350 turn signal clicks } @@ -1080,7 +1090,7 @@ void AnnotatedCameraWidget::paintFrogPilotWidgets(QPainter &p) { animationTimer->stop(); } - if (leadInfo) { + if (leadInfo && !bigMapOpen) { drawLeadInfo(p); } diff --git a/selfdrive/ui/qt/onroad.h b/selfdrive/ui/qt/onroad.h index c7ec7d68d..9c50f77d7 100644 --- a/selfdrive/ui/qt/onroad.h +++ b/selfdrive/ui/qt/onroad.h @@ -124,6 +124,7 @@ private: QHBoxLayout *bottom_layout; bool alwaysOnLateralActive; + bool bigMapOpen; bool blindSpotLeft; bool blindSpotRight; bool experimentalMode; diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index f89f85a00..867151412 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -332,6 +332,8 @@ void ui_update_frogpilot_params(UIState *s) { bool quality_of_life_controls = params.getBool("QOLControls"); bool quality_of_life_visuals = params.getBool("QOLVisuals"); + scene.big_map = quality_of_life_visuals && params.getBool("BigMap"); + scene.full_map = scene.big_map && params.getBool("FullMap"); scene.camera_view = quality_of_life_visuals ? params.getInt("CameraView") : 0; scene.driver_camera = quality_of_life_visuals && params.getBool("DriverCamera"); } diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index eb3389e96..90f6e22fb 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -175,6 +175,7 @@ typedef struct UIScene { bool adjacent_path; bool adjacent_path_metrics; bool always_on_lateral_active; + bool big_map; bool blind_spot_left; bool blind_spot_path; bool blind_spot_right; @@ -185,6 +186,7 @@ typedef struct UIScene { bool experimental_mode; bool experimental_mode_via_screen; bool fps_counter; + bool full_map; bool has_auto_tune; bool hide_lead_marker; bool lead_info;