# icube-robotics/ethercat_driver_ros2 architecture

> Architecture diagram of the GitHub repository icube-robotics/ethercat_driver_ros2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/icube-robotics/ethercat_driver_ros2
- Repository: https://github.com/icube-robotics/ethercat_driver_ros2

## Overview

This repository provides a ROS 2 control hardware interface for configuring EtherCAT modules and exchanging cyclic process data through the IgH EtherCAT Master. The principal workflow parses robot configuration, loads slave plugins, configures and activates the bus, then transfers state and command values through PDO channels. Separate capabilities include generic and CiA 402 slave plugins, asynchronous SDO services, and transfer-based safety configuration. The graph uses README claims and tree-visible subsystem paths; unsampled implementation details are not expanded.

Main entry points: [`ethercat_driver/src/ethercat_bus_manager.cpp`](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_driver/src/ethercat_bus_manager.cpp) (Bus Manager), [`ethercat_driver/src/ethercat_driver.cpp`](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_driver/src/ethercat_driver.cpp) (Hardware Interface), [`ethercat_interface/src/ec_master.cpp`](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_interface/src/ec_master.cpp) (EtherCAT Master), [`ethercat_interface/include/ethercat_interface/ec_slave.hpp`](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_interface/include/ethercat_interface/ec_slave.hpp) (Slave Interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_driver["ROS 2 Driver"]
  node_hardware["Hardware Interface"]
  node_parser["URDF Parser"]
  node_bus["Bus Manager"]
end

subgraph group_interface["EtherCAT Interface"]
  node_master["EtherCAT Master<br/>[ec_master.cpp]"]
  node_slave["Slave Interface<br/>[ec_slave.hpp]"]
  node_pdo["PDO Channels"]
  node_singlepdo["Single PDO"]
  node_grouppdo["Grouped PDO"]
  node_sdo["SDO Manager<br/>[ec_sdo_manager.hpp]"]
end

subgraph group_plugins["Slave Plugins"]
  node_ecslave["Generic Slave"]
  node_cia402["CiA 402 Drive"]
end

subgraph group_services["SDO And Safety"]
  node_async["Async Master"]
  node_sdo_service["SDO Service"]
  node_sdo_msgs["SDO Messages<br/>[GetSdo.srv]"]
  node_transfer["Safety Transfers"]
end

node_operator(("Robot Integrator"))
node_roscontrol["ros2_control"]
node_urdfconfig["Robot Configuration"]
node_igh["IgH Master"]
node_network(("EtherCAT Network"))

node_operator -->|"configures"| node_urdfconfig
node_urdfconfig -->|"configures"| node_hardware
node_roscontrol -->|"loads"| node_hardware
node_hardware -->|"parses URDF"| node_parser
node_hardware -->|"manages bus"| node_bus
node_bus -->|"loads plugin"| node_ecslave
node_bus -->|"loads plugin"| node_cia402
node_bus -->|"configures"| node_master
node_master -->|"registers slaves"| node_slave
node_slave -->|"manages PDOs"| node_pdo
node_pdo -->|"specializes"| node_singlepdo
node_pdo -->|"specializes"| node_grouppdo
node_hardware -->|"cycles read/write"| node_bus
node_bus -->|"reads/writes process data"| node_master
node_master -->|"uses master API"| node_igh
node_igh -->|"communicates"| node_network
node_bus -->|"configures SDOs"| node_sdo
node_async -->|"serves requests"| node_sdo_service
node_sdo_service -->|"uses definitions"| node_sdo_msgs
node_transfer -.->|"configures safety transfers"| node_bus
node_ecslave -->|"implements"| node_slave
node_cia402 -->|"implements"| node_slave

click node_urdfconfig "https://github.com/icube-robotics/ethercat_driver_ros2/tree/jazzy/ethercat_driver/examples/configurations"
click node_hardware "https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_driver/src/ethercat_driver.cpp"
click node_parser "https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_driver/src/ethercat_ros2_control_xml_parser.cpp"
click node_bus "https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_driver/src/ethercat_bus_manager.cpp"
click node_master "https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_interface/src/ec_master.cpp"
click node_slave "https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_interface/include/ethercat_interface/ec_slave.hpp"
click node_pdo "https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_interface/src/ec_pdo_channel_manager.cpp"
click node_singlepdo "https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_interface/src/ec_pdo_single_interface_channel_manager.cpp"
click node_grouppdo "https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_interface/src/ec_pdo_group_interface_channel_manager.cpp"
click node_ecslave "https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_generic_plugins/ethercat_generic_slave/src/generic_ec_slave.cpp"
click node_cia402 "https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_generic_plugins/ethercat_generic_cia402_drive/src/generic_ec_cia402_drive.cpp"
click node_sdo "https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_interface/include/ethercat_interface/ec_sdo_manager.hpp"
click node_async "https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_manager/include/ethercat_manager/ec_master_async.hpp"
click node_sdo_service "https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_manager/src/ethercat_sdo_srv_server.cpp"
click node_sdo_msgs "https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_msgs/srv/GetSdo.srv"
click node_transfer "https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_driver/include/ethercat_driver/ethercat_bus_manager.hpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_hardware,node_parser,node_bus toneBlue
class node_master,node_slave,node_pdo,node_singlepdo,node_grouppdo,node_sdo toneAmber
class node_ecslave,node_cia402 toneMint
class node_async,node_sdo_service,node_sdo_msgs,node_transfer toneRose
class node_operator,node_roscontrol,node_igh,node_network toneIndigo
class node_urdfconfig toneTeal
```

## Components

### ROS 2 Driver

- [Hardware Interface](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_driver/src/ethercat_driver.cpp): `ethercat_driver/src/ethercat_driver.cpp`
- [URDF Parser](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_driver/src/ethercat_ros2_control_xml_parser.cpp): `ethercat_driver/src/ethercat_ros2_control_xml_parser.cpp`
- [Bus Manager](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_driver/src/ethercat_bus_manager.cpp): `ethercat_driver/src/ethercat_bus_manager.cpp`

### EtherCAT Interface

- [EtherCAT Master](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_interface/src/ec_master.cpp): `ethercat_interface/src/ec_master.cpp`
- [Slave Interface](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_interface/include/ethercat_interface/ec_slave.hpp): `ethercat_interface/include/ethercat_interface/ec_slave.hpp`
- [PDO Channels](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_interface/src/ec_pdo_channel_manager.cpp): `ethercat_interface/src/ec_pdo_channel_manager.cpp`
- [Single PDO](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_interface/src/ec_pdo_single_interface_channel_manager.cpp): `ethercat_interface/src/ec_pdo_single_interface_channel_manager.cpp`
- [Grouped PDO](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_interface/src/ec_pdo_group_interface_channel_manager.cpp): `ethercat_interface/src/ec_pdo_group_interface_channel_manager.cpp`
- [SDO Manager](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_interface/include/ethercat_interface/ec_sdo_manager.hpp): `ethercat_interface/include/ethercat_interface/ec_sdo_manager.hpp`

### Slave Plugins

- [Generic Slave](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_generic_plugins/ethercat_generic_slave/src/generic_ec_slave.cpp): `ethercat_generic_plugins/ethercat_generic_slave/src/generic_ec_slave.cpp`
- [CiA 402 Drive](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_generic_plugins/ethercat_generic_cia402_drive/src/generic_ec_cia402_drive.cpp): `ethercat_generic_plugins/ethercat_generic_cia402_drive/src/generic_ec_cia402_drive.cpp`

### SDO And Safety

- [Async Master](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_manager/include/ethercat_manager/ec_master_async.hpp): `ethercat_manager/include/ethercat_manager/ec_master_async.hpp`
- [SDO Service](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_manager/src/ethercat_sdo_srv_server.cpp): `ethercat_manager/src/ethercat_sdo_srv_server.cpp`
- [SDO Messages](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_msgs/srv/GetSdo.srv): `ethercat_msgs/srv/GetSdo.srv`
- [Safety Transfers](https://github.com/icube-robotics/ethercat_driver_ros2/blob/jazzy/ethercat_driver/include/ethercat_driver/ethercat_bus_manager.hpp): `ethercat_driver/include/ethercat_driver/ethercat_bus_manager.hpp`

### Other components

- **Robot Integrator**
- **ros2_control**
- [Robot Configuration](https://github.com/icube-robotics/ethercat_driver_ros2/tree/jazzy/ethercat_driver/examples/configurations): `ethercat_driver/examples/configurations`
- **IgH Master**
- **EtherCAT Network**

## Connections

- Robot Integrator → Robot Configuration: configures
- Robot Configuration → Hardware Interface: configures
- ros2_control → Hardware Interface: loads
- Hardware Interface → URDF Parser: parses URDF
- Hardware Interface → Bus Manager: manages bus
- Bus Manager → Generic Slave: loads plugin
- Bus Manager → CiA 402 Drive: loads plugin
- Bus Manager → EtherCAT Master: configures
- EtherCAT Master → Slave Interface: registers slaves
- Slave Interface → PDO Channels: manages PDOs
- PDO Channels → Single PDO: specializes
- PDO Channels → Grouped PDO: specializes
- Hardware Interface → Bus Manager: cycles read/write
- Bus Manager → EtherCAT Master: reads/writes process data
- EtherCAT Master → IgH Master: uses master API
- IgH Master → EtherCAT Network: communicates
- Bus Manager → SDO Manager: configures SDOs
- Async Master → SDO Service: serves requests
- SDO Service → SDO Messages: uses definitions
- Safety Transfers → Bus Manager: configures safety transfers
- Generic Slave → Slave Interface: implements
- CiA 402 Drive → Slave Interface: implements
