Choose local passage centres before route guidance
This commit is contained in:
@@ -325,8 +325,17 @@ class RoutedMission(WaypointMission):
|
||||
return True
|
||||
return super().heading_progress(pose, seconds)
|
||||
|
||||
def advisory_joint(self):
|
||||
segments = self.leg['segments']
|
||||
return bool(segments and self.segment_index < len(segments)-1
|
||||
and segments[self.segment_index].get('guidance_only')
|
||||
and not segments[self.segment_index].get('return_to_anchor'))
|
||||
|
||||
def can_query_arrival(self, pose):
|
||||
return not self.route_failure and self.remaining is not None
|
||||
# Intermediate advisory nodes select the next route leg; they are not
|
||||
# destinations for chassis placement. Only the current support receipt
|
||||
# may advance that cursor while free-space navigation owns the path.
|
||||
return not self.route_failure and self.remaining is not None and not self.advisory_joint()
|
||||
|
||||
def arrival_target(self):
|
||||
segments = self.leg["segments"]
|
||||
@@ -406,7 +415,7 @@ class RoutedMission(WaypointMission):
|
||||
or inclination(pose) >= 30
|
||||
or self.segment_index >= len(segments) - 1
|
||||
or segments[self.segment_index].get("return_to_anchor")
|
||||
or math.dist(pose[:2], self.arrival_target()) <= 0.4
|
||||
or (not self.advisory_joint() and math.dist(pose[:2], self.arrival_target()) <= 0.4)
|
||||
):
|
||||
return None
|
||||
expected = dict(
|
||||
@@ -473,7 +482,12 @@ class RoutedMission(WaypointMission):
|
||||
self.completed_length += math.dist(segment["start_xy"], segment["end_xy"])
|
||||
self.segment_index += 1
|
||||
self.last_transition_time = seconds
|
||||
self.anchor = self.goal = self.best_distance = self.recovery_goal = None
|
||||
# A route cursor transition changes the itinerary, not the observed
|
||||
# passage. Revalidate its existing local goal against the new segment
|
||||
# instead of manufacturing a fresh lateral target on every graph joint.
|
||||
if self.goal is not None and not self.goal_permitted(self.goal):
|
||||
self.goal = None
|
||||
self.anchor = self.best_distance = self.recovery_goal = None
|
||||
self.attempts = 0
|
||||
self.turn_started = self.turn_goal = self.turn_best_error = None
|
||||
self.state = "replanning"
|
||||
|
||||
Reference in New Issue
Block a user