From e560b083765f6dbfb64d284dd08565889c056dcb Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Sat, 11 May 2024 15:17:37 -0700 Subject: [PATCH] FrogPilot features - Display model path in map Co-Authored-By: pencilpusher <83676301+jakethesnake420@users.noreply.github.com> --- selfdrive/ui/qt/maps/map.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/selfdrive/ui/qt/maps/map.cc b/selfdrive/ui/qt/maps/map.cc index 6e05cc8..66b442f 100644 --- a/selfdrive/ui/qt/maps/map.cc +++ b/selfdrive/ui/qt/maps/map.cc @@ -196,6 +196,18 @@ void MapWindow::updateState(const UIState &s) { } } + // Credit to jakethesnake420 + if (loaded_once && (sm.rcv_frame("uiPlan") != model_rcv_frame)) { + auto locationd_location = sm["liveLocationKalman"].getLiveLocationKalman(); + auto model_path = model_to_collection(locationd_location.getCalibratedOrientationECEF(), locationd_location.getPositionECEF(), sm["uiPlan"].getUiPlan().getPosition()); + QMapLibre::Feature model_path_feature(QMapLibre::Feature::LineStringType, model_path, {}, {}); + QVariantMap modelV2Path; + modelV2Path["type"] = "geojson"; + modelV2Path["data"] = QVariant::fromValue(model_path_feature); + m_map->updateSource("modelPathSource", modelV2Path); + model_rcv_frame = sm.rcv_frame("uiPlan"); + } + if (sm.updated("navRoute") && sm["navRoute"].getNavRoute().getCoordinates().size()) { auto nav_dest = coordinate_from_param("NavDestination"); bool allow_open = std::exchange(last_valid_nav_dest, nav_dest) != nav_dest &&