Allow observed detours to join advisory route segments

This commit is contained in:
DCCONSTRUCTIONS
2026-10-09 18:43:54 +03:00
parent b4dab01f2a
commit 70e47fc83b
3 changed files with 53 additions and 4 deletions
@@ -424,10 +424,13 @@ class RoutedMission(WaypointMission):
return None
adjacent = segments[self.segment_index : self.segment_index + 2]
if adjacent[0].get("guidance_only"):
along, lateral = projection(pose[:2], adjacent[0]["start_xy"], adjacent[0]["end_xy"])
along, _ = projection(pose[:2], adjacent[0]["start_xy"], adjacent[0]["end_xy"])
length = math.dist(adjacent[0]["start_xy"], adjacent[0]["end_xy"])
# A soft line must not allow instant graph progress at a distance.
if length - along > 1.5 or lateral > max(2., adjacent[0]["half_width_m"]):
# 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
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.