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 ba961b8e6a.

* Revert "move up"

This reverts commit f1a4d8ae88.

* Update selfdrive/navd/navd.py
pull/29032/head^2
Shane Smiskol 2 years ago committed by GitHub
parent f0ae0c34cd
commit 412ed6a017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      selfdrive/navd/navd.py
  2. 3
      selfdrive/ui/qt/maps/map_instructions.cc

@ -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)

@ -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) {

Loading…
Cancel
Save