How zhm-real/pathplanning works
Project Type and Purpose
• This is an open-source Python library of path-planning algorithms for robotics.
File-Structure Analysis
• Top-level directories:
• Sampling_based_Planning – 2D and 3D Rapidly-exploring Random Tree (RRT) variants and related planners
• Search_based_Planning – 2D and 3D graph‐search algorithms (A*, Dijkstra, D*, BFS, DFS, etc.)
• Support code in each planner folder: env.py (environment model), queue/queue3D.py (data structures), plotting/plot_util3D.py (visualization helpers), utils.py (misc).
• GIF subdirectories collect output animations for each algorithm.
• No external services—everything runs locally in Python.
Key Insights from README
• Purpose: demonstrate and animate classical path-planning algorithms.
• Animations are generated via matplotlib (implied) and saved as GIFs under “gif” subfolders.
• No web/UI layer; this is a library/tool for research and teaching.
Main Components
• User Interface (CLI or Notebook)
• Accepts problem definition: map/environment + start/goal
• Core PathPlanning Library
a. Search-based Module
– Search_2D
– Search_3D
b. Sampling-based Module
– rrt_2D
– rrt_3D
c. Curve Generation Module
– CurvesGenerator package
• Shared Utilities
• env.py (2D/3D)
• queue / queue3D
• utils / utils3D
• plotting / plot_util3D
• Output Generator
• GIF writer (matplotlib + imageio)
Component Relationships and Data Flow
1. User invokes a planner via CLI or notebook.
2. Planner module imports env.py to load/map the environment.
3. Planner uses queue and utils to grow a graph/tree, guided by heuristic functions.
4. Planner returns a raw path (waypoints).
5. CurveGeneration module takes waypoints → computes continuous spline or Dubins path.
7. GIF writer assembles frames into animation under the “gif” folder.
Architectural Patterns and Principles
• Package-based modularity: each algorithm family lives in its own package.
• Shared‐service modules: env, queue, utils, plotting are singletons imported by all planners.
• Separation of concerns: path computation (planner), smoothing (CurvesGenerator), and visualization (plotting + GIF writer).
• Extensibility points: adding a new planner means dropping a new .py in the appropriate package and conforming to the env/queue API.
Summary
• Packages as separate components.
• Processing flow from problem definition to final GIF animation.