Skip to content

Path Planning: Particle Swarm Optimization#62

Open
guilyx wants to merge 7 commits intoShisatoYano:mainfrom
guilyx:feat/particle-swarm-optimization
Open

Path Planning: Particle Swarm Optimization#62
guilyx wants to merge 7 commits intoShisatoYano:mainfrom
guilyx:feat/particle-swarm-optimization

Conversation

@guilyx
Copy link
Contributor

@guilyx guilyx commented Feb 9, 2026

Summary

Rework PSO path planner from a global path-optimizer to a swarm-navigation approach matching the classic Kennedy & Eberhart formulation:

  • Each particle is a 2D agent that physically navigates from start toward the goal (previously each particle encoded an entire candidate path as a flat waypoint vector)
  • Fitness = Euclidean distance to goal + soft obstacle proximity penalty (previously path length + collision penalty per segment)
  • Collision handling via velocity deflection (bounce-back at −0.3×) instead of abstract segment checks
  • The global-best particle's trail of positions forms the planned path (previously decoded from optimised waypoint vectors)
  • Early termination when global best reaches goal within tolerance
  • Tuned for convergence: max_vel=3.0, c1=1.8, c2=2.0, spawn_radius=8.0, inertia decay 0.9→0.4
  • Search GIF now shows particles swarming through the map with fading trails (blue=free, red=blocked), global-best trail in green, at 8 fps for clear step-by-step visibility

Test plan

  • test_pso_path_planning.py passes (planner finds path, simulation completes)

- Blue particles for collision-free paths, red for colliding
- Dashed connectors showing start→wp1 and wp_last→goal
- Fitness counter and free/colliding counts in title
- Global best drawn with prominent green line and white-edged markers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant