# ai-winter/ros_motion_planning architecture

> Architecture diagram of the GitHub repository ai-winter/ros_motion_planning, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ai-winter/ros_motion_planning
- Repository: https://github.com/ai-winter/ros_motion_planning

## Overview

##### Main Components
- Core Motion Planning Algorithms: This is the “heart” of the system where you have both global and local planning modules. In the file tree, these are primarily found under “src/core”:
– Global planners: Under “src/core/path_planner” (e.g., A*, Dijkstra, JPS, D*, LPA*, etc.). They define how paths are planned on grids or via sampling-based strategies.
– Local controllers: Under “src/core/controller” (with subdirectories for PID, DWA, APF, LQR, MPC, RPP etc.) which focus on trajectory tracking, dynamic window approach, and other control strategies.
– Common utilities and curve generation: Under “src/core/common” that contains foundational geometric utilities (e.g., Bezier, cubic splines, BSpline, Dubins, Reeds-Shepp curves) used in trajectory optimization.

- Simulation and Environment Modules: Under “src/sim_env” you find configuration files, launch scripts, maps, meshes, models, and URDF files. These components are used to simulate the robot’s operating environment (e.g., Gazebo worlds, RViz configurations).

- Plugins and Extensions: May include dynamic configuration for RViz, XML configuration generators, Gazebo plugins (e.g., for pedestrian simulation, costmap plugins), and RViz plugins (the “src/plugins” directory). These extend the primary functionality to visualization and real-world simulation integration.

- User Configuration: The “src/user_config” folder holds YAML files that drive runtime behavior (parameters for robots, planners, obstacles, and maps). This is critical because the launch files are auto-generated based on these configurations.

- Build and Deployment Tools: The “scripts” directory (with build.sh, main.sh, killpro.sh) provides the entry points for compiling and running the system. There are also Docker files and a 3rd-party dependency setup (via conan scripts) to support consistent deployment.

##### Clarifying Relationships and Data Flow
- Inter-module Interaction: Show the flow from cost maps and sensor data coming into simulation modules to the “core” algorithms that compute planned paths based on both global (graph-based planning, sampling methods) and local (dynamic control and obstacle avoidance) strategies.
- Configuration Flow: Illustrate how the user configuration files (and dynamically generated launch files) enable runtime parameterization. This links the “user_config” components to both the simulation environment and the core planner nodes.

##### Architectural Patterns and Design Principles
- Modular and Plugin-Based Design: The project is split into clear modules (planning, simulation, plugins) that interact via well-defined ROS interfaces.
- Separation of Concerns: Global vs. local planning is clearly segmented, as are environment simulation components and user interface/configuration components.
- Reusability and Extensibility: The multiple subdirectories for algorithms (each with its own package.xml and CMakeLists.txt) demonstrate that each planner or controller is a plug-and-play component. This separation allows for new planners/controllers to be added without disrupting the overall system.
- ROS Integration: Emphasize full ROS integration with nodes, topics, and services, along with launch file generation from configuration YAMLs.

##### Relevant Technologies and Libraries
- ROS Noetic on Ubuntu 20.04.
- C++ (with CMake build system) as the primary language for most core components.
- Conan for dependency management.
- Docker for environment consistency.
- Doxygen for documentation generation.
- GraphViz (likely used with Doxygen) for visualization of code architecture.

##### Detailed Elements
- Annotations indicating architectural patterns (e.g., “Plugin Architecture”, “Modular ROS Nodes”, “Configuration Driven Launch”).
- Reference to technology stacks (e.g., “C++/ROS Nodes”, “Python Scripts for Launch and Auto-generation”, “Dockerized Environment”).

Final Instruction:

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        UC["User Configuration (YAML)"]:::config
        BD["Build & Deployment Tools"]:::infra
    end

    %% ROS Communication Layer
    subgraph "ROS Communication Layer"
        RB["ROS Bus (Nodes & Topics)"]:::ros
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        GP["Global Planners – Graph-based & Sampling-based"]:::core
        LC["Local Controllers – PID, DWA, APF, LQR, MPC, RPP"]:::core
        CG["Common Utilities & Curve Generation"]:::core
    end

    %% Presentation/Interface Layer
    subgraph "Presentation/Interface Layer"
        SE["Simulation Environment"]:::sim
        PL["Plugins (RViz, Gazebo, Map)"]:::plugin
    end

    %% Connections
    UC -->|"ConfigurationDriven"| BD
    BD -->|"LaunchFiles"| RB
    SE -->|"SensorData"| RB
    RB -->|"PlanRequest"| GP
    RB -->|"PlanRequest"| LC
    RB -->|"PlanRequest"| CG
    GP -->|"PlannedPath"| RB
    LC -->|"TrajectoryCommands"| RB
    CG -->|"Curves"| RB
    RB -->|"Visualization"| PL
    SE -->|"SimOutput"| PL

    %% Click Events
    click GP "https://github.com/ai-winter/ros_motion_planning/tree/master/src/core/path_planner/path_planner"
    click LC "https://github.com/ai-winter/ros_motion_planning/tree/master/src/core/controller"
    click CG "https://github.com/ai-winter/ros_motion_planning/tree/master/src/core/common"
    click SE "https://github.com/ai-winter/ros_motion_planning/tree/master/src/sim_env"
    click PL "https://github.com/ai-winter/ros_motion_planning/tree/master/src/plugins"
    click UC "https://github.com/ai-winter/ros_motion_planning/tree/master/src/user_config"
    click BD "https://github.com/ai-winter/ros_motion_planning/tree/master/scripts"

    %% Styles
    classDef core fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef sim fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef config fill:#A9DFBF,stroke:#229954,stroke-width:2px;
    classDef plugin fill:#F5B7B1,stroke:#CB4335,stroke-width:2px;
    classDef infra fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
    classDef ros fill:#ABEBC6,stroke:#17A589,stroke-width:2px;
```
