# open-rmf/rmf_demos architecture

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

- Interactive diagram: https://gitdiagram.com/open-rmf/rmf_demos
- Repository: https://github.com/open-rmf/rmf_demos

## Overview

Based on our analysis of the file tree and the README content, the project is a demonstration repository for the Open Robotics Middleware Framework (Open-RMF). Its purpose is to showcase how heterogeneous robot fleets can be coordinated through demos in different worlds (Hotel, Office, Airport Terminal, Clinic, Campus, Manufacturing & Logistics) using RMF’s scheduling, task allocation, and conflict resolution capabilities. It covers multiple integration aspects, from simulation launch files (both for Gazebo and Ignition), task dispatching, fleet adapters, and even bridges for external communication (like MQTT for RobotManager).

##### Main components and how they relate
- Demo Launch Environments: Multiple demo “worlds” (Hotel, Office, Airport Terminal, Clinic, Campus, Manufacturing & Logistics) that each have their own ROS 2 launch files and configuration directories.
- Simulation and Visualization: Integration with simulation tools (Gazebo, Ignition) and visualization components (RViz configuration files, schedule visualizer).
- Task Dispatching and Management: The rmf_demos_tasks directory includes numerous scripts for dispatching various task types (loop, clean, delivery, patrol, etc.). In addition, the README describes a bidding/dispatcher mechanism.
- Fleet Adapters and Bridges: rmf_demos_fleet_adapter and rmf_demos_bridges (which includes MQTT bridge and socketio bridge) are responsible for interfacing RMF with external simulated (or real) robot fleets.
- Maps and Assets: The rmf_demos_maps and rmf_demos_assets directories contain the environmental data and 3D models for robots and building structures used during the demonstrations.
- Web Integration: Although the primary demos are ROS launch-based, the README covers instructions to start a backend API server and a dashboard (rmf-web) via Docker – representing a web-based control/monitoring layer.
- Security and Advanced Features: Some demos integrate ROS 2 DDS-Security (for example, secure office world) and specialized features like lift watchdog, emergency alarms, and docking sequences.

##### Architectural patterns/design principles
- Layered Architecture: Clearly separate simulation/launch, task/mission management, fleet communication, and integration with external web monitors.
- Modular Deployment: Each “world” or demo is mostly independent, with its own configuration and launch files. Similarly, fleet adapters and bridges are standalone modules.

##### Relevant technologies and frameworks
- ROS 2 as the primary middleware, integrating with Gazebo (and Ignition via rmf_demos_gz).
- Docker for deployment of the backend API server and dashboard (rmf-web).
- MQTT and Socket.IO (in rmf_demos_bridges) for real-time communication to external systems.
- CMake (CMakeLists.txt files in several directories) and package.xml files for ROS package management.
- YAML configuration files across demos, which are essential for specifying robot behavior, building configurations, and potentially even the mapping information.

- Clear labels for all major components: Simulation Launcher, Task Dispatcher, Fleet Adapters, Bridges, Maps/Assets, and Web API/Dashboard.
- Annotations that show dependencies such as which modules require ROS 2, Docker, or Gazebo. Also include configuration layers (like YAML configuration files) that influence robot behavior in each demo.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User (CLI/Web UI)"]:::user
    Web_API["Web API/Dashboard (rmf-web)"]:::web
    TaskDispatcher["Task Dispatcher (rmf_demos_tasks)"]:::task
    FleetAdapters["Fleet Adapters (rmf_demos_fleet_adapter)"]:::fleet
    Bridges["Bridges (rmf_demos_bridges)"]:::bridge

    subgraph "Demo Launch Environments"
        Configurations["Configurations (rmf_demos/config)"]:::launch
        ROS_Launch["ROS Launch (rmf_demos/launch)"]:::launch
        Ignition_Launch["Ignition Launch (rmf_demos_gz/launch)"]:::launch
    end

    subgraph "Simulation & Visualization"
        RViz["RViz Config (rmf_demos/launch/include)"]:::sim
        Ignition_Vis["Ignition Visualization (rmf_demos_gz/launch/include)"]:::sim
    end

    subgraph "Environment Details"
        Maps["Maps (rmf_demos_maps)"]:::map
        Assets["Assets (rmf_demos_assets)"]:::map
    end

    DDS_Security["DDS-Security (rmf_demos/sros2)"]:::security

    %% Data & Control Flow Connections
    User -->|"dispatch"| TaskDispatcher
    User -->|"access"| Web_API
    Web_API -->|"trigger"| TaskDispatcher
    TaskDispatcher -->|"dispatch"| FleetAdapters
    TaskDispatcher -->|"bridgeCall"| Bridges
    FleetAdapters -->|"startSim"| ROS_Launch
    FleetAdapters -->|"startSim"| Ignition_Launch
    ROS_Launch -->|"visualize"| RViz
    Ignition_Launch -->|"visualize"| Ignition_Vis
    Maps -->|"provideData"| Configurations
    Assets -->|"provideData"| Configurations
    DDS_Security -->|"secure"| Configurations
    Configurations -->|"configure"| ROS_Launch
    Configurations -->|"configure"| Ignition_Launch

    %% Click Events
    click Configurations "https://github.com/open-rmf/rmf_demos/tree/main/rmf_demos/config"
    click ROS_Launch "https://github.com/open-rmf/rmf_demos/tree/main/rmf_demos/launch"
    click Ignition_Launch "https://github.com/open-rmf/rmf_demos/tree/main/rmf_demos_gz/launch"
    click RViz "https://github.com/open-rmf/rmf_demos/tree/main/rmf_demos/launch/include"
    click Ignition_Vis "https://github.com/open-rmf/rmf_demos/tree/main/rmf_demos_gz/launch/include"
    click TaskDispatcher "https://github.com/open-rmf/rmf_demos/tree/main/rmf_demos_tasks"
    click FleetAdapters "https://github.com/open-rmf/rmf_demos/tree/main/rmf_demos_fleet_adapter"
    click Bridges "https://github.com/open-rmf/rmf_demos/tree/main/rmf_demos_bridges"
    click Maps "https://github.com/open-rmf/rmf_demos/tree/main/rmf_demos_maps"
    click Assets "https://github.com/open-rmf/rmf_demos/tree/main/rmf_demos_assets"
    click DDS_Security "https://github.com/open-rmf/rmf_demos/tree/main/rmf_demos/sros2"

    %% Style Definitions
    classDef user fill:#ffe6e6,stroke:#333,stroke-width:2px;
    classDef web fill:#d1e0e0,stroke:#333,stroke-width:2px;
    classDef task fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef fleet fill:#ff9999,stroke:#333,stroke-width:2px;
    classDef bridge fill:#ff6666,stroke:#333,stroke-width:2px;
    classDef launch fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef sim fill:#99ccff,stroke:#333,stroke-width:2px;
    classDef map fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef security fill:#d1c4e9,stroke:#333,stroke-width:2px;
```
