Add potential-field local-minimum escape (navigation/40)#16
Merged
Conversation
Artificial potential fields (Khatib, 1986) are the one-line local planner and the repo had no example of their one famous failure: the local minimum. This adds it together with the classic recovery. An obstacle sits on the straight line from start to goal, so plain gradient descent walks the robot into the stagnation point in front of it and stalls. The world detects the lack of *net* progress (the robot oscillates in place around the minimum) and reports a `local_minimum` failure; the agent reacts the way real potential-field planners do — it switches to boundary following, sliding tangent to the repulsive gradient around the obstacle until the goal-ward path reopens, then resumes descent and reaches the goal. `--no-escape` keeps plain descent and it stalls until timeout. escape: local_minimum x1 -> 14 tangential steps -> goal (51 steps) no escape: local_minimum x18 + timeout, stuck 6.0 from the goal - self-contained PotentialFieldWorld (Khatib attractive/repulsive forces within an influence radius, net-progress stall detection) + a PotentialFieldAgent with boundary-following escape, and a References section - two smoke tests: escape detects the minimum, boundary-follows, and reaches the goal with no collision; plain descent stalls, fires local_minimum repeatedly, and times out while the escape reaches the goal on the same scene - examples index + navigation README section; example 42->43, tests 118->120 Verified headless (escape reaches in 51 steps, plain stalls at distance 6.0) and the matplotlib render path under Agg. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
A new example,
examples/navigation/40_potential_field_escape.py: an artificial potential field local planner (Khatib, 1986) that hits its one famous failure — the local minimum — and recovers with the classic boundary-following escape. The repo had reactive avoidance, MPC, and a CBF safety filter, but not the textbook potential-field trap.The lesson
Pull the robot down the gradient of an attractive potential toward the goal plus a repulsive potential away from obstacles, and step along the net force. An obstacle sits squarely on the straight line from start to goal, so plain descent walks into the stagnation point in front of it and stalls. The world detects the lack of net progress (the robot oscillates in place around the minimum) and reports a
local_minimumfailure; the agent reacts the way real planners do — it slides tangent to the repulsive gradient around the obstacle until the goal-ward path reopens, then resumes descent.The contrast is built into the same file via
--no-escape:Contents
PotentialFieldWorld(Khatib attractive/repulsive forces within an influence radius; net-progress stall detection so oscillation-in-place counts as the trap) and aPotentialFieldAgentwhoselocal_minimumreaction is a fixed-length tangential boundary-follow committed to the goal-ward side.local_minimumrepeatedly, and times out while the escape reaches the goal on the same scene.examples/README.mdrow + a fullexamples/navigation/README.mdsection; example count 42→43 and test count 118→120 inREADME.md/docs/status.md.Verification
133 passed); matplotlib render path confirmed underAgg.References
🤖 Generated with Claude Code