# safehold17/ros_motion_planning architecture

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

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

## Overview

##### Main Components
- Core Motion Planning Modules:
– Common Utilities and Infrastructure (geometry, math helpers, logging, etc.)
– Path Planners (global planning algorithms such as A*, JPS, D*, RRT, etc. found under src/core/path_planner)
– Controllers (local planners such as PID, LQR, DWA, APF, RPP, MPC; see src/core/controller)
– Curve Generation Components (Bezier, BSpline, Dubins, Reeds-Shepp, etc.)
- Simulation Environment:
– ROS simulation setup (src/sim_env with its config, launch, maps, models, URDF, and worlds directories)
– Robot and environment models, including URDFs and meshes for Turtlebot3 and nanocar.
- Plugins:
– RViz and dynamic configuration plugins (both dynamic_rviz_config and dynamic_xml_config)
– Gazebo plugins (e.g., pedestrian_sfm_plugin and pedestrian_visualizer_plugin)
– Map plugins (e.g., voronoi_layer) and other custom visualization tools.
- User and Build Infrastructure:
– Scripts (build.sh, main.sh, killpro.sh) for compilation, launching, and termination.
– Docker and third-party repository integration (docker folder, 3rd directory with Conan build files)
– User configuration files (src/user_config) for setting up parameters that drive the generation of launch files.
- Documentation and DevTools:
– Integration with doxygen (via Doxyfile) for generating API and interface documentation.
– Versioning and historical documentation (docs folder).

##### Relationships and Flows
- Data Flow:
– Users modify configuration files (in “user_config”) that dynamically generate ROS launch files (notably under sim_env/launch) for running the simulation along with the planning and control nodes.
– The “Core Motion Planning” components process sensor inputs (from ROS topics) and output planned paths and trajectory commands back into the ROS ecosystem.
- Interactions:
– Core modules (controllers, planners, curve generators) are independent but interact via common message formats (e.g., through ROS msg definitions found in plugins) and shared utility libraries.
– Plugins serve as adapters/connectors between underlying planning algorithms and visualization interfaces (RViz and Gazebo), thus extending the user’s ability to dynamically adjust parameters.
- Build & Deployment:
– The build scripts and Conan configurations in “3rd” ensure the proper setup of dependencies.
– Docker containers (in the docker folder) encapsulate the ROS Noetic environment required to run the application seamlessly.

##### Architectural Patterns and Design Principles
- Modular Design: Each major component (core planners, controllers, simulation, plugins) is neatly compartmentalized into separate directories. This encourages reusability and independent evolution.
- ROS Node Architecture: Visualization and simulation are running as ROS nodes, with clear publisher/subscriber relationships, parameter servers (via configuration files) and dynamic reconfiguration (via plugins).
- Plugin/Extension Based Architecture: The plugins directory shows a clear approach to extending and customizing the system (e.g., for RViz or Gazebo), making the system adaptable to different robotics applications.
- Configuration Driven: The use of “user_config” files and auto-generation of launch files illustrates a design that favors configuration over hard-coded parameters.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User & Build Infrastructure
    subgraph "User & Build Infrastructure"
        scripts["Scripts"]:::infra
        docker["Docker Containers"]:::infra
        thirdparty["3rd Party Dependencies"]:::infra
        userconfig["User Configuration"]:::infra
    end

    %% Core Motion Planning
    subgraph "Core Motion Planning"
        common["Common Utilities & Infrastructure"]:::core
        planners["Path Planners"]:::core
        curve["Curve Generation"]:::core
        subgraph "Controllers"
            pid["PID Controller"]:::core
            dwa["DWA Controller"]:::core
            lqr["LQR Controller"]:::core
            mpc["MPC Controller"]:::core
            apf["APF Controller"]:::core
            rpp["RPP Controller"]:::core
            static["Static Controller"]:::core
            orca["ORCA Controller"]:::core
        end
    end

    %% Simulation Environment
    subgraph "Simulation Environment"
        simsetup["ROS Simulation Setup & Models"]:::sim
        launch["Launch Files"]:::sim
    end

    %% Plugins
    subgraph "Plugins"
        subgraph "RViz & Dynamic Config"
            rviz["RViz Plugin"]:::plugin
            dynamicxml["Dynamic XML Config Plugin"]:::plugin
            additionalrviz["Additional RViz Plugins"]:::plugin
        end
        subgraph "Gazebo"
            pedestriansfm["Pedestrian SFM Plugin"]:::plugin
            pedestrianviz["Pedestrian Visualizer Plugin"]:::plugin
        end
        subgraph "Map"
            voronoi["Voronoi Layer"]:::plugin
        end
    end

    %% Documentation & DevTools
    subgraph "Documentation & DevTools"
        doxygen["Doxygen"]:::doc
        docs["Documentation"]:::doc
    end

    %% Data Flow & Interactions
    userconfig -->|"generate_launch"| launch
    scripts -->|"build"| common
    thirdparty -->|"manage_dependencies"| scripts
    docker -->|"deploy_ROS"| simsetup

    planners -->|"publish_path"| simsetup
    common -->|"publish_data"| rviz
    common -->|"publish_data"| pedestrianviz
    simsetup -->|"simulate_data"| additionalrviz

    %% Styling
    classDef core fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef sim fill:#A9DFBF,stroke:#196F3D,stroke-width:2px;
    classDef plugin fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef infra fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
    classDef doc fill:#CCD1D1,stroke:#566573,stroke-width:2px;

    %% Click Events
    click common "https://github.com/safehold17/ros_motion_planning/tree/master/src/core/common"
    click planners "https://github.com/safehold17/ros_motion_planning/tree/master/src/core/path_planner/path_planner"
    click curve "https://github.com/safehold17/ros_motion_planning/tree/master/src/core/common/include/common/geometry/curve"
    click pid "https://github.com/safehold17/ros_motion_planning/tree/master/src/core/controller/pid_controller"
    click dwa "https://github.com/safehold17/ros_motion_planning/tree/master/src/core/controller/dwa_controller"
    click lqr "https://github.com/safehold17/ros_motion_planning/tree/master/src/core/controller/lqr_controller"
    click mpc "https://github.com/safehold17/ros_motion_planning/tree/master/src/core/controller/mpc_controller"
    click apf "https://github.com/safehold17/ros_motion_planning/tree/master/src/core/controller/apf_controller"
    click rpp "https://github.com/safehold17/ros_motion_planning/tree/master/src/core/controller/rpp_controller"
    click static "https://github.com/safehold17/ros_motion_planning/tree/master/src/core/controller/static_controller"
    click orca "https://github.com/safehold17/ros_motion_planning/tree/master/src/core/controller/orca_controller"
    click simsetup "https://github.com/safehold17/ros_motion_planning/tree/master/src/sim_env"
    click rviz "https://github.com/safehold17/ros_motion_planning/tree/master/src/plugins/dynamic_rviz_config"
    click dynamicxml "https://github.com/safehold17/ros_motion_planning/tree/master/src/plugins/dynamic_xml_config"
    click pedestriansfm "https://github.com/safehold17/ros_motion_planning/tree/master/src/plugins/gazebo_plugins/pedestrian_sfm_plugin"
    click pedestrianviz "https://github.com/safehold17/ros_motion_planning/tree/master/src/plugins/gazebo_plugins/pedestrian_visualizer_plugin"
    click voronoi "https://github.com/safehold17/ros_motion_planning/tree/master/src/plugins/map_plugins/voronoi_layer"
    click additionalrviz "https://github.com/safehold17/ros_motion_planning/tree/master/src/plugins/rviz_plugins"
    click userconfig "https://github.com/safehold17/ros_motion_planning/tree/master/src/user_config"
    click scripts "https://github.com/safehold17/ros_motion_planning/tree/master/scripts"
    click docker "https://github.com/safehold17/ros_motion_planning/tree/master/docker"
    click thirdparty "https://github.com/safehold17/ros_motion_planning/tree/master/3rd"
    click doxygen "https://github.com/safehold17/ros_motion_planning/tree/master/Doxyfile"
    click docs "https://github.com/safehold17/ros_motion_planning/tree/master/docs"
```
