Advance passed advisory route joints from observed body progress
This commit is contained in:
@@ -361,6 +361,25 @@ class RoutedMission(WaypointMission):
|
||||
# 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 can_query_route_transition(self, pose):
|
||||
"""Ask about the current body, never require visiting a passed map hint.
|
||||
|
||||
Near a joint we retain the existing approach window. Once longitudinal
|
||||
progress passes an advisory joint, lateral displacement from that hint
|
||||
cannot pin the itinerary to the old edge. Only one adjacent transition
|
||||
may then be confirmed by a fresh positive whole-body observation.
|
||||
"""
|
||||
if not self.advisory_joint():
|
||||
return math.dist(pose[:2], self.arrival_target()) <= 3.5
|
||||
segment = self.leg["segments"][self.segment_index]
|
||||
axis = np.asarray(segment["end_xy"]) - segment["start_xy"]
|
||||
remaining = float(
|
||||
(np.asarray(segment["end_xy"]) - pose[:2]) @ axis / np.linalg.norm(axis)
|
||||
)
|
||||
return remaining <= 0 or (
|
||||
remaining <= 1.5 and math.dist(pose[:2], segment["end_xy"]) <= 3.5
|
||||
)
|
||||
|
||||
def arrival_target(self):
|
||||
segments = self.leg["segments"]
|
||||
return segments[self.segment_index]["end_xy"] if segments else self.leg["goal_xy"]
|
||||
@@ -423,7 +442,7 @@ class RoutedMission(WaypointMission):
|
||||
def confirm_corridor_transition(self, pose, seconds, body):
|
||||
"""Join adjacent corridors without treating a graph vertex as a task goal.
|
||||
|
||||
A current positive whole-body assessment and containment in BOTH
|
||||
A current positive whole-body assessment and permission in BOTH
|
||||
corridors are required. This changes intent only; the adapter fences
|
||||
the old command, and every subsequent turn still needs swept admission.
|
||||
Explicit mission goals and return-to-anchor obligations retain arrival.
|
||||
@@ -465,15 +484,8 @@ class RoutedMission(WaypointMission):
|
||||
):
|
||||
return None
|
||||
adjacent = segments[self.segment_index : self.segment_index + 2]
|
||||
if adjacent[0].get("guidance_only"):
|
||||
along, _ = projection(pose[:2], adjacent[0]["start_xy"], adjacent[0]["end_xy"])
|
||||
length = math.dist(adjacent[0]["start_xy"], adjacent[0]["end_xy"])
|
||||
# Use the same local observation radius as the native support
|
||||
# query. An advisory line's width is not a travel boundary: a
|
||||
# positively observed detour may join the next segment off-centre.
|
||||
# Progress and proximity still prevent remote/skipped joints.
|
||||
if length - along > 1.5 or math.dist(pose[:2], adjacent[0]["end_xy"]) > 3.5:
|
||||
return None
|
||||
if not self.can_query_route_transition(pose):
|
||||
return None
|
||||
directions = [np.asarray(s["end_xy"]) - s["start_xy"] for s in adjacent]
|
||||
# A reversal is a visit and return, not a corner that can be cut.
|
||||
if np.dot(*directions) <= -0.95 * np.linalg.norm(directions[0]) * np.linalg.norm(
|
||||
|
||||
Reference in New Issue
Block a user