diff --git a/selfdrive/navd/navd.py b/selfdrive/navd/navd.py index 29a390bad3..a2fc725be4 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 fc7f80690a..9009ab1390 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) {