ArduPilot / ArduPilot/ardupilot

AC_Avoid: stop-at-polygon fence is incorrect for acute angles

Open
#4,429 6 comments 0 reactions 0 assignees View on GitHub
Copter
Dominant language
C++
Stars
15.9k
Forks
21.4k
Avg merge
3d 17h
Merged PRs (30d)
119

Description

#### Issue details

If the polygon fence contains interior angles that are less than 90 degrees, it is possible to escape the fence. The bug is in AC_Avoid::adjust_velocity_poly(). This function iterates over all edges, repeatedly adjusting the velocity to be safe for the current edge. The problem occurs in the following scenario:
- The velocity is unsafe for the first edge in an acute angle, causing an adjustment.
- The adjusted velocity is unsafe for the second edge in the acute angle, causing a second adjustment.
- The adjustment after the second edge is unsafe for the first edge, but the first edge is not considered again.

Contributor guide

Open the contributing guide

Research direction

Start by inspecting AC_Avoid::adjust_velocity_poly() and trace how velocity adjustments are applied across polygon edges. Reproduce the acute-angle sequence described in the issue, then verify that the final velocity remains safe for every edge, including earlier edges after later adjustments.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
robotics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.