AC_Avoidance: Use closest fence point if Dijkstra starts outside fence #31827
+51
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #31399
Bug Description
If a Rover (or Copter) using OADijkstra starts slightly outside an inclusion fence (e.g., due to GPS drift or loitering near the edge),
calc_shortest_pathfails.update_visgraphreturnstruebut generates 0 nodes because all paths to internal nodes intersect the fence.DIJKSTRA_ERROR_OUT_OF_MEMORY(or general failure) and the vehicle cannot RTL or navigate back.The Fix
This PR implements a "Recovery Mode" inside
calc_shortest_path:_source_visgraphis empty after the initial update._inclusion_polygon_ptsto find the geometrically closest point on the fence boundary.update_visgraphfrom this safe spot (which guarantees valid connections).Verification
Vector2f::closest_pointfor robust geometry handling.