|
| 1 | +# 🚀 Dynamic Window Approach (DWA) Path Planning Simulation |
| 2 | + |
| 3 | +A fully visualized implementation of the **Dynamic Window Approach (DWA)** in Python using Pygame. Simulate and visualize obstacle avoidance and goal-reaching for mobile robots in 2D space — perfect for robotics beginners, path planning researchers, and AI robotics students! |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 🧠 What is DWA? |
| 8 | + |
| 9 | +Dynamic Window Approach is a real-time collision avoidance algorithm for mobile robots. It evaluates a set of feasible trajectories based on the robot's dynamic constraints, obstacle proximity, and goal direction. |
| 10 | + |
| 11 | +This project: |
| 12 | + |
| 13 | +- Predicts multiple future trajectories |
| 14 | +- Scores each based on distance to goal, speed, and safety |
| 15 | +- Selects the best trajectory and visualizes it |
| 16 | +- Runs smoothly in a Pygame window with live user interaction! |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## 🖼️ Features |
| 21 | + |
| 22 | +- 📍 Real-time path planning to a user-defined goal |
| 23 | +- ⚠️ Dynamic obstacle addition with right-click |
| 24 | +- 🧭 Visualized prediction trajectories |
| 25 | +- 🚗 Simulated robot with circular collision model |
| 26 | +- 🧪 Easy to tweak robot config for experiments |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## 🕹️ Demo |
| 31 | + |
| 32 | +### Controls: |
| 33 | + |
| 34 | +- **Left-click** to set a new goal |
| 35 | +- **Right-click** to add a new obstacle |
| 36 | +- Window will auto-close once robot reaches goal |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +## 🛠️ Requirements |
| 43 | + |
| 44 | +- Python 3.7+ |
| 45 | +- Pygame |
| 46 | +- NumPy |
| 47 | + |
| 48 | +```bash |
| 49 | +pip install pygame numpy |
| 50 | +``` |
| 51 | + |
| 52 | +## 📦 Run the Simulation |
| 53 | + |
| 54 | +```bash |
| 55 | + |
| 56 | +python DWA.py |
| 57 | + |
| 58 | +``` |
| 59 | + |
| 60 | +## Customize Parameters |
| 61 | + |
| 62 | +Easily adjust robot dynamics and cost weights in the Config class: |
| 63 | + |
| 64 | +```bash |
| 65 | + |
| 66 | +self.max_speed = 1.0 |
| 67 | +self.max_accel = 0.2 |
| 68 | +self.to_goal_cost_gain = 0.1 |
| 69 | +self.obstacle_cost_gain = 0.5 |
| 70 | +... |
| 71 | + |
| 72 | +``` |
| 73 | + |
| 74 | +## 🤖 Why Use This? |
| 75 | + |
| 76 | +- ✅ Learn path planning through visualization |
| 77 | +- ✅ Great teaching material for robotics classes |
| 78 | +- ✅ Easy to hack and extend (e.g., LIDAR input, map loading) |
| 79 | +- ✅ No ROS or external frameworks required |
| 80 | + |
| 81 | +## 🌟 Star this repo |
| 82 | + |
| 83 | +If you found this useful or interesting, give it a ⭐ to support more open robotics projects! |
0 commit comments