From ec900d0389f56bb213654a32461bf113e51d38be Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 25 Jul 2023 01:28:17 -0700 Subject: [PATCH] navd: don't use empty last step banner instructions (#29034) * fix empty banner instructions when arriving at destination * bug fixes * hide distance on arrival * stash * simpler * can also do this, but i don't like modifying the response * clean up * rm * revert * rm * flip this order * move up * need to flip order * Revert "need to flip order" This reverts commit ba961b8e6aa5d9490ab0dc661866cff9c72db91d. * Revert "move up" This reverts commit f1a4d8ae883080d52547fdaf9472457050e40669. * Update selfdrive/navd/navd.py old-commit-hash: 412ed6a017acef84e42395299042717d7120544b --- selfdrive/navd/navd.py | 7 ++++++- selfdrive/ui/qt/maps/map_instructions.cc | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/selfdrive/navd/navd.py b/selfdrive/navd/navd.py index 29a390bad..a2fc725be 100755 --- a/selfdrive/navd/navd.py +++ b/selfdrive/navd/navd.py @@ -219,9 +219,14 @@ class RouteEngine: along_geometry = distance_along_geometry(geometry, self.last_position) distance_to_maneuver_along_geometry = step['distance'] - along_geometry + # Banner instructions are for the following maneuver step, don't use empty last step + banner_step = step + if not len(banner_step['bannerInstructions']) and self.step_idx == len(self.route) - 1: + banner_step = self.route[max(self.step_idx - 1, 0)] + # Current instruction msg.navInstruction.maneuverDistance = distance_to_maneuver_along_geometry - parse_banner_instructions(msg.navInstruction, step['bannerInstructions'], distance_to_maneuver_along_geometry) + parse_banner_instructions(msg.navInstruction, banner_step['bannerInstructions'], distance_to_maneuver_along_geometry) # Compute total remaining time and distance remaining = 1.0 - along_geometry / max(step['distance'], 1) diff --git a/selfdrive/ui/qt/maps/map_instructions.cc b/selfdrive/ui/qt/maps/map_instructions.cc index fc7f80690..9009ab139 100644 --- a/selfdrive/ui/qt/maps/map_instructions.cc +++ b/selfdrive/ui/qt/maps/map_instructions.cc @@ -102,6 +102,9 @@ void MapInstructions::updateInstructions(cereal::NavInstruction::Reader instruct icon_01->setVisible(true); } + // Hide distance after arrival + distance->setVisible(type != "arrive" || instruction.getManeuverDistance() > 0); + // Show lanes auto lanes = instruction.getLanes(); for (int i = 0; i < lanes.size(); ++i) {