# bdaiinstitute/spot_ros2 architecture

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

- Interactive diagram: https://gitdiagram.com/bdaiinstitute/spot_ros2
- Repository: https://github.com/bdaiinstitute/spot_ros2

## Overview

##### Main Components Identification

The system should be divided into these major components:
- Spot Robot Hardware Interface
- ROS 2 Driver Core
- Controllers Layer
- Message/Service Interfaces
- Utilities and Tools

##### Component Relationships

- Data flow (→): Show how sensor data, commands, and state information flow
- Dependencies (⇢): Indicate package dependencies
- Control flow (⇒): Show command execution paths

##### Specific Implementation Details

a) Key Nodes:
- Image Publisher Node
- State Publisher Node
- Kinematic Node
- Controller Nodes

b) Important Services:
- Robot Command Service
- Image Services
- State Services

c) Critical Actions:
- Navigation
- Manipulation
- Robot Commands

##### Data Flow Paths

Main data flows:

##### Integration Points

Integration with:
- Boston Dynamics SDK
- ROS 2 Control Framework
- External Tools (like RViz)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Hardware
        SpotRobot[Spot Robot Hardware]
        SDK[Boston Dynamics SDK]
        HWInterface["Hardware Interface"]:::hardware
    end

    subgraph DriverCore
        StateManagement["State Management"]:::core
        ImageProcessing["Image Processing"]:::core
        KinematicControl["Kinematic Control"]:::core
        RobotCommand["Robot Command Interface"]:::core
        TimeSync["Time Synchronization"]:::core
    end

    subgraph Controllers
        ControllersPkg["Controllers Package"]:::controller
        ROS2Control["ROS2 Control Integration"]:::controller
        ForwardState["Forward State Controller"]:::controller
    end

    subgraph Interfaces
        SpotMsgs["Custom Messages/Services"]:::interface
        ROSMsgs["ROS 2 Standard Messages"]:::interface
        ImagePub["Image Publishers"]:::interface
        StatePub["State Publishers"]:::interface
    end

    subgraph Applications
        Examples["Examples"]:::app
        UserApps["User Applications"]:::app
        RobotDesc["Robot Description"]:::app
    end

    subgraph CoreAPIs
        SpotAPI["Spot API"]:::api
        KinematicAPI["Kinematic API"]:::api
        ImageClient["Image Client"]:::api
    end

    %% Relationships
    SpotRobot --> SDK
    SDK --> HWInterface
    HWInterface --> StateManagement
    HWInterface --> ImageProcessing
    HWInterface --> KinematicControl

    StateManagement --> StatePub
    ImageProcessing --> ImagePub
    KinematicControl --> RobotCommand

    StatePub --> SpotMsgs
    ImagePub --> ROSMsgs
    RobotCommand --> ControllersPkg

    ControllersPkg --> ROS2Control
    ControllersPkg --> ForwardState

    SpotAPI --> RobotCommand
    KinematicAPI --> KinematicControl
    ImageClient --> ImageProcessing

    SpotMsgs --> Examples
    ROSMsgs --> UserApps
    
    %% Click Events
    click HWInterface "https://github.com/bdaiinstitute/spot_ros2/blob/main/spot_hardware_interface/include/spot_hardware_interface/spot_hardware_interface.hpp"
    click ROS2Control "https://github.com/bdaiinstitute/spot_ros2/tree/main/spot_ros2_control/"
    click StateManagement "https://github.com/bdaiinstitute/spot_ros2/tree/main/spot_driver/include/spot_driver/robot_state/"
    click ImageProcessing "https://github.com/bdaiinstitute/spot_ros2/tree/main/spot_driver/include/spot_driver/images/"
    click KinematicControl "https://github.com/bdaiinstitute/spot_ros2/tree/main/spot_driver/include/spot_driver/kinematic/"
    click RobotCommand "https://github.com/bdaiinstitute/spot_ros2/blob/main/spot_driver/include/spot_driver/api/default_spot_api.hpp"
    click TimeSync "https://github.com/bdaiinstitute/spot_ros2/blob/main/spot_driver/include/spot_driver/api/default_time_sync_api.hpp"
    click ControllersPkg "https://github.com/bdaiinstitute/spot_ros2/tree/main/spot_controllers/"
    click ForwardState "https://github.com/bdaiinstitute/spot_ros2/blob/main/spot_controllers/include/spot_controllers/forward_state_controller.hpp"
    click SpotMsgs "https://github.com/bdaiinstitute/spot_ros2/tree/main/spot_msgs/"
    click ImagePub "https://github.com/bdaiinstitute/spot_ros2/blob/main/spot_driver/src/images/spot_image_publisher.cpp"
    click StatePub "https://github.com/bdaiinstitute/spot_ros2/blob/main/spot_driver/src/robot_state/state_publisher.cpp"
    click Examples "https://github.com/bdaiinstitute/spot_ros2/tree/main/spot_examples/spot_examples/"
    click RobotDesc "https://github.com/bdaiinstitute/spot_ros2/tree/main/spot_description/"
    click SpotAPI "https://github.com/bdaiinstitute/spot_ros2/blob/main/spot_driver/include/spot_driver/api/spot_api.hpp"
    click KinematicAPI "https://github.com/bdaiinstitute/spot_ros2/blob/main/spot_driver/include/spot_driver/api/kinematic_api.hpp"
    click ImageClient "https://github.com/bdaiinstitute/spot_ros2/blob/main/spot_driver/include/spot_driver/api/default_image_client.hpp"

    %% Styles
    classDef hardware fill:#90EE90
    classDef core fill:#87CEEB
    classDef controller fill:#FFA500
    classDef interface fill:#FFD700
    classDef app fill:#DDA0DD
    classDef api fill:#20B2AA
```
