mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-01 14:16:48 +08:00
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: 412ed6a017
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user