# rosneuro/rosneuro_acquisition architecture

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

- Interactive diagram: https://gitdiagram.com/rosneuro/rosneuro_acquisition
- Repository: https://github.com/rosneuro/rosneuro_acquisition

## Overview

##### Project Type and Purpose
- The project is a ROS (Robot Operating System) package (written in C++ with CMake and package.xml) that provides a generic interface for device data acquisition.
- It is designed to acquire data from external hardware (or simulated sources) and publish it as “NeuroFrame” messages. It supports dynamic loading of various device plugins (e.g., for EEG devices or LSL streams).
- The package itself contains the acquisition node that manages device plugins, accepts configuration parameters (framerate, plugin type, etc.), and interacts with ROS topics and services.

##### Analysis of the File Structure
- Top-level Files:
- CMakeLists.txt and package.xml: Define the build, dependencies, and ROS package configuration.
- README.md: Provides an in-depth description of how to use the acquisition node, parameters, published topics, and how to create plugins.
- A .gitignore file for version control.
- Directories:
- /rosneuro_acquisition: Contains header files (Acquisition.hpp, Device.hpp) which define the public API and abstract interface for plugins.
- src: Contains the implementations (Acquisition.cpp, Device.cpp) – core logic for data acquisition.
- launch: Contains launch files to start the acquisition node (e.g., acquisition.launch).
- test: Includes unit tests (e.g., TestAcquisition.cpp, TestConfiguration.cpp, TestDevice.cpp) for validating core functionality.
- example: Contains example usage and a sample plugin (example_plugin.cpp) plus a runner (run.cpp) that can demonstrate how to load a plugin.
- This structure implies a clear separation between the interface, implementation, testing, and examples, which is very helpful when mapping out the architectural components.

##### Information from the README
- It provides details on the expected interactions: the acquisition node publishes to /neurodata and offers services (start, stop, quit, get_info) to control the device.
- The acquisition node adapts its behavior (through parameters like “framerate” and “plugin” type) to handle different device drivers like “rosneuro::EGDDevice” or “rosneuro::LSLDevice”.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Acquisition Node System"
        ACQ("Acquisition Node"):::core
        PL("Plugin Loader"):::core
        ACQ -->|"contains"| PL
    end

    ED("External Devices"):::external
    CP("Concrete Plugin Example"):::plugin
    DPI("Device Plugin Interface"):::interface
    RC("ROS Communication Layer"):::ros
    TC("Testing Components"):::test

    ED -->|"providesData"| CP
    CP -->|"implements"| DPI
    PL -->|"loads"| CP
    ACQ -->|"publishesMessages"| RC
    TC -->|"validates"| ACQ

    click ACQ "https://github.com/rosneuro/rosneuro_acquisition/blob/master/src/Acquisition.cpp"
    click ACQ "https://github.com/rosneuro/rosneuro_acquisition/blob/master/include/rosneuro_acquisition/Acquisition.hpp"
    click PL "https://github.com/rosneuro/rosneuro_acquisition/blob/master/src/Acquisition.cpp"
    click PL "https://github.com/rosneuro/rosneuro_acquisition/blob/master/launch/acquisition.launch"
    click DPI "https://github.com/rosneuro/rosneuro_acquisition/blob/master/include/rosneuro_acquisition/Device.hpp"
    click CP "https://github.com/rosneuro/rosneuro_acquisition/blob/master/example/example_plugin.cpp"
    click CP "https://github.com/rosneuro/rosneuro_acquisition/blob/master/example/run.cpp"
    click RC "https://github.com/rosneuro/rosneuro_acquisition/blob/master/launch/acquisition.launch"
    click TC "https://github.com/rosneuro/rosneuro_acquisition/blob/master/test/TestAcquisition.cpp"
    click TC "https://github.com/rosneuro/rosneuro_acquisition/blob/master/test/TestConfiguration.cpp"
    click TC "https://github.com/rosneuro/rosneuro_acquisition/blob/master/test/TestDevice.cpp"

    classDef core fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef interface fill:#99ccff,stroke:#333,stroke-width:2px;
    classDef plugin fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef ros fill:#ff99cc,stroke:#333,stroke-width:2px;
    classDef external fill:#ccffff,stroke:#333,stroke-width:2px;
    classDef test fill:#ffe680,stroke:#333,stroke-width:2px;
```
