# arghyachatterjee/waypoint-based-2d-navigation-in-ros architecture

> Architecture diagram of the GitHub repository arghyachatterjee/waypoint-based-2d-navigation-in-ros, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arghyachatterjee/waypoint-based-2d-navigation-in-ros
- Repository: https://github.com/arghyachatterjee/waypoint-based-2d-navigation-in-ros

## Overview

##### Project Type and Purpose
- Type: A ROS‐based robotics navigation package (Python node) that buffers and sequentially issues waypoint goals to the navigation stack.
- Purpose:
– Accept a list of 2D waypoints (predefined or loaded from file).
– Publish goals to the `move_base` action server one by one.
– Optionally record the robot’s path to disk.
– Expose ROS parameters for wait duration and distance tolerance.

##### File Structure
- Top-level:
– CMakeLists.txt, package.xml, setup.py: ROS build/config files.
– launch/follow_waypoints.launch: Launches your node and any required parameters.
– nodes/follow_waypoints: (possibly legacy or alternate launch script wrapper).
– src/follow_waypoints/follow_waypoints.py: Main Python node implementing waypoint sequencing.
– saved_path/pose.csv & pose.txt: Files where recorded waypoint sequences are stored.
– readme_images: Screenshots for documentation.
- Architectural hints:
– A single core node (“follow_waypoints”) interacting with ROS Master, Parameter Server, Action Server, Topics, and the local filesystem.

##### README for Additional Insights
- Runtime invocation:
rosrun follow_waypoints follow_waypoints.py
- ROS parameters:
– `wait_duration` (float)
– `waypoint_distance_tolerance` (float)
- Topics/Actions used:
– Publishes to `move_base` action server
– Subscribes to robot pose (e.g., `/amcl_pose` or `/odom`)
– Listens for `/start_journey` topic (std_msgs/Empty)
- Features: buffering goals, saving/loading paths.

##### Main Components
a. ROS Master & Parameter Server
b. `follow_waypoints` Node (Action Client & Publisher/Subscriber)
c. Navigation Stack (e.g., `move_base` Action Server, local & global costmaps)
d. Robot Base Controller (diff_drive_controller, hardware drivers)
e. Rviz (Visualization)
f. File System (saved_path/*.csv, *.txt)
g. User Interface (CLI or remapping for parameters/topics)

##### Relationships & Interactions
- `follow_waypoints` ↔ ROS Master
– Registers as node, reads parameters (`wait_duration`, `waypoint_distance_tolerance`), advertises topics and action client.
- `follow_waypoints` –> `move_base` (actionlib client sends PoseStamped goals)
- `move_base` –> Robot Base (trajectory commands)
- Robot Base –> Odometry topic (e.g., `/odom`), `follow_waypoints` subscribes to monitor distance to each waypoint.
- `follow_waypoints` –> File System (writes/reads saved_path/pose.csv)
- User –> ROS Parameter Server (sets parameters)
- User –> `/start_journey` topic (std_msgs/Empty) to trigger replay of saved path
- `follow_waypoints` –> Rviz (publishes visualization markers or relies on move_base display)

##### Architectural Patterns & Principles
- Publisher/Subscriber for telemetry and control triggers.
- Actionlib Client/Server for goal sequencing and preemption.
- Parameter Server for tunable behaviors.
- Modularization: Single responsibility node, delegating path planning & control to the navigation stack.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% ROS Infrastructure
    Master["ROS Master &\nParameter Server"]:::core
    %% Custom Node
    FW["follow_waypoints Node"]:::custom
    %% Launch
    Launch["Launch:\nfollow_waypoints.launch"]:::custom
    Wrapper["Legacy Wrapper:\nnodes/follow_waypoints"]:::custom
    %% Navigation Stack
    subgraph "Navigation Stack" 
        MB["move_base Action Server"]:::external
        PC["Planners & Costmaps"]:::external
    end
    %% Robot Base
    RB["Robot Base Controller"]:::external
    %% Visualization
    RV["Rviz"]:::external
    %% File System Storage
    FS["Saved Paths\n(pose.csv, pose.txt)"]:::storage
    %% User Interface
    UI["User Interface:\nCLI/Params/Topics"]:::user

    %% Data Flows & Interactions
    UI -->|"sets parameters"| Master
    UI -->|"/start_journey"| FW
    Master -->|"reads wait_duration,\nwaypoint_distance_tolerance"| FW
    FW -->|"move_base/goal (actionlib)"| MB
    MB -->|"trajectory commands"| RB
    RB -->|"/odom /amcl_pose"| FW
    FW -->|"write/read"| FS
    FW -->|"visualization markers"| RV
    FW -->|"node registration & lookup"| Master

    %% Click Events
    click FW "https://github.com/arghyachatterjee/waypoint-based-2d-navigation-in-ros/blob/main/src/follow_waypoints/follow_waypoints.py"
    click Launch "https://github.com/arghyachatterjee/waypoint-based-2d-navigation-in-ros/blob/main/launch/follow_waypoints.launch"
    click Wrapper "https://github.com/arghyachatterjee/waypoint-based-2d-navigation-in-ros/tree/main/nodes/follow_waypoints"
    click FS "https://github.com/arghyachatterjee/waypoint-based-2d-navigation-in-ros/blob/main/saved_path/pose.csv"
    click FS "https://github.com/arghyachatterjee/waypoint-based-2d-navigation-in-ros/blob/main/saved_path/pose.txt"
    click pxml "https://github.com/arghyachatterjee/waypoint-based-2d-navigation-in-ros/blob/main/package.xml"
    click cmake "https://github.com/arghyachatterjee/waypoint-based-2d-navigation-in-ros/blob/main/CMakeLists.txt"
    click setup "https://github.com/arghyachatterjee/waypoint-based-2d-navigation-in-ros/blob/main/setup.py"
    click readme "https://github.com/arghyachatterjee/waypoint-based-2d-navigation-in-ros/blob/main/README.md"
    click images "https://github.com/arghyachatterjee/waypoint-based-2d-navigation-in-ros/tree/main/readme_images/"

    %% Metadata Components (hidden nodes for clicks)
    pxml["package.xml"]:::meta
    cmake["CMakeLists.txt"]:::meta
    setup["setup.py"]:::meta
    readme["README.md"]:::meta
    images["readme_images/"]:::meta

    %% Styling
    classDef custom fill:#D0E8FF,stroke:#0366D6,stroke-width:2px;
    classDef core fill:#E6FFDD,stroke:#28A745,stroke-width:2px;
    classDef external fill:#FFE5B4,stroke:#D97706,stroke-width:2px;
    classDef storage fill:#F0F0F0,stroke:#6B7280,stroke-width:2px,stroke-dasharray: 5 5;
    classDef user fill:#F5E1FF,stroke:#8B5CF6,stroke-width:2px;
    classDef meta fill:#ffffff,stroke:#ffffff,visibility:hidden;
```
