# robotics-upo/ars548_ros architecture

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

- Interactive diagram: https://gitdiagram.com/robotics-upo/ars548_ros
- Repository: https://github.com/robotics-upo/ars548_ros

## Overview

##### Project type and purpose
- This is a ROS 2 driver package (ars548_driver) plus a companion messages package (ars548_messages).

##### Top-level file-structure analysis
- Root workspace contains two ROS 2 packages:
- ars548_driver
– include/ars548_driver: headers for driver class, filter interface & example, message data structures.
– src: node implementations (driver node, filter node, setup node).
– launch: two launch XMLs (driver+RViz, driver+filter+RViz).
– rviz: configuration files for visualizing radar data.
– scripts: network‐config and parameter‐setup shell scripts.
– Docker folder (Dockerfile + instructions).
– CMakeLists.txt & package.xml define build, dependencies (rclcpp, sensor_msgs, tf2_ros, pcl).
- ars548_messages
– msg: custom ROS 2 .msg definitions for radar data structures (Object, Detection, Status, lists, config messages).
– CMakeLists.txt & package.xml declare message dependencies.

##### Key architectural patterns & components
- ROS 2 node‐based microservices:
- Driver node: UDP client → decode → publish raw data messages.
- Filter node (optional): subscribe ObjectList → apply user filter → republish filtered PointCloud2.
- Radar setup node: CLI tool to read/write radar parameters.
- static_transform_publisher: transform frames for RViz.
- RViz2 node: subscribe to topics and render 3D view.
- Custom message definitions separate transport layer from application logic.
- Launch files compose multiple nodes into a single system.
- Docker container encapsulates runtime dependencies when ROS2 not installed.

##### Main components
- Hardware: ARS_548 radar (Ethernet)
- Networking: UDP over VLAN interface
- ROS 2 runtime / DDS middleware
- Nodes:
- ars548_driver_node
- ars548_filter_node (example filter)
- radar_setup CLI
- static_transform_publisher
- rviz2
- Topics:
- /status (Status.msg)
- /objects (ObjectList.msg)
- /detections (DetectionList.msg)
- /pointcloud (PointCloud2)
- /pose_array (PoseArray)
- /filtered_pointcloud (PointCloud2)
- Configuration artifacts: launch XMLs, RViz config, scripts, environment variables, parameters.

##### Relationships and data flow
- Radar hardware → Ethernet (UDP) → Driver node
- Driver node decodes UDP → publishes raw messages on ROS 2 topics
- Filter node subscribes raw ObjectList → applies filter → publishes filtered PointCloud2
- static_transform_publisher broadcasts TF transforms for frame alignment
- rviz2 subscribes PointCloud2 + PoseArray + TF tree → renders visualization
- radar_setup CLI reads/writes radar via driver’s API

##### Important design principles
- Clear separation of concerns: hardware interface, data decoding, filtering, visualization
- Extensibility: filter interface abstract base class allows custom filters
- Reusability: messages package decoupled from driver logic
- ROS 2 best practices: use of launch files, parameterization, TF for frames

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Hardware
    RadarHardware["ARS_548 Radar"]:::hardware

    %% Docker boundary
    subgraph "Docker Container" 
        style DockerContainer stroke:#666,stroke-width:2px,fill:#f9f9f9
        subgraph "ROS 2 Runtime"
            style ROSRuntime stroke:#555,stroke-width:2px,fill:#eef

            %% Nodes
            DriverNode["ars548_driver_node"]:::node
            FilterNode["ars548_filter_node"]:::node
            SetupCLI["radar_setup CLI"]:::node
            StaticTF["static_transform_publisher"]:::node
            RViz["rviz2"]:::external

            %% Topics (as cylinders)
            StatusTopic[(/status\nStatus.msg)]:::topic
            ObjectsTopic[(/objects\nObjectList.msg)]:::topic
            DetectionsTopic[(/detections\nDetectionList.msg)]:::topic
            PC2Topic[(/pointcloud\nPointCloud2)]:::topic
            PoseArrayTopic[(/pose_array\nPoseArray)]:::topic
            FiltPC2[(/filtered_pointcloud\nPointCloud2)]:::topic

        end
    end

    %% Config and scripts
    Configurer["configurer.sh"]:::config
    SetupMax["setup_max_dist.sh"]:::config
    LaunchDriver["ars548_launch.xml"]:::config
    LaunchFilter["filter_launch.xml"]:::config
    RVizConfig["RadarVisualization.rviz"]:::config
    RVizFilterConfig["filter.rviz"]:::config
    Dockerfile["Dockerfile"]:::config

    %% Message package dependency
    MsgPkg["ars548_messages"]:::messages

    %% Dependency configs
    CMakeDriver["CMakeLists.txt\npackage.xml\n(ars548_driver)"]:::config
    CMakeMsgs["CMakeLists.txt\npackage.xml\n(ars548_messages)"]:::config

    %% Relationships
    RadarHardware -->|UDP packets| DriverNode
    DriverNode -->|publishes| StatusTopic
    DriverNode -->|publishes| ObjectsTopic
    DriverNode -->|publishes| DetectionsTopic
    DriverNode -->|publishes| PC2Topic
    DriverNode -->|publishes| PoseArrayTopic

    ObjectsTopic -->|subscribes| FilterNode
    FilterNode -->|publishes| FiltPC2

    PC2Topic -->|subscribes| RViz
    PoseArrayTopic -->|subscribes| RViz
    FiltPC2 -->|subscribes| RViz
    StaticTF -->|broadcasts| RViz

    SetupCLI -.->|API calls| DriverNode

    %% Config orchestration
    LaunchDriver --> DriverNode
    LaunchDriver --> StaticTF
    LaunchDriver --> RViz
    LaunchFilter --> DriverNode
    LaunchFilter --> FilterNode
    LaunchFilter --> StaticTF
    LaunchFilter --> RViz

    Configurer --> LaunchDriver
    SetupMax --> LaunchDriver

    Dockerfile -->|build| DockerContainer

    MsgPkg -->|defines messages| DriverNode
    MsgPkg -->|defines messages| FilterNode

    CMakeDriver --> DriverNode
    CMakeDriver --> Configurer
    CMakeMsgs --> MsgPkg

    %% Click Events
    click DriverNode "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_driver/src/ars548_driver_node.cpp"
    click FilterNode "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_driver/src/ars548_filter_node.cpp"
    click SetupCLI "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_driver/src/radar_setup.cpp"
    click DriverClass "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_driver/include/ars548_driver/ars548_driver.hpp"
    click FilterInterface "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_driver/include/ars548_driver/ars548_filter_interface.hpp"
    click FilterExample "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_driver/include/ars548_driver/ars548_filter_example.hpp"
    click DataStructs "https://github.com/robotics-upo/ars548_ros/tree/master/ars548_driver/include/ars548_driver/ars548_data"
    click Byteswap "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_driver/include/ars548_driver/util/byteswap.hpp"
    click RoughEqual "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_driver/include/ars548_driver/util/rough_equal.hpp"
    click LaunchDriver "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_driver/launch/ars548_launch.xml"
    click LaunchFilter "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_driver/launch/filter_launch.xml"
    click RVizConfig "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_driver/rviz/RadarVisualization.rviz"
    click RVizFilterConfig "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_driver/rviz/filter.rviz"
    click Configurer "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_driver/scripts/configurer.sh"
    click SetupMax "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_driver/scripts/setup_max_dist.sh"
    click Dockerfile "https://github.com/robotics-upo/ars548_ros/tree/master/ars548_driver/docker/Dockerfile"
    click CMakeDriver "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_driver/CMakeLists.txt"
    click CMakeDriver "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_driver/package.xml"
    click CMakeMsgs "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_messages/CMakeLists.txt"
    click CMakeMsgs "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_messages/package.xml"
    click MsgPkg "https://github.com/robotics-upo/ars548_ros/tree/master/ars548_messages"
    click AccLat "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_messages/msg/AccelerationLateralCoG.msg"
    click AccLong "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_messages/msg/AccelerationLongitudinalCoG.msg"
    click CharSpeed "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_messages/msg/CharacteristicSpeed.msg"
    click Detection "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_messages/msg/Detection.msg"
    click DetectionList "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_messages/msg/DetectionList.msg"
    click DriveDir "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_messages/msg/DrivingDirection.msg"
    click ObjectMsg "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_messages/msg/Object.msg"
    click ObjectList "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_messages/msg/ObjectList.msg"
    click SensorConfig "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_messages/msg/SensorConfiguration.msg"
    click StatusMsg "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_messages/msg/Status.msg"
    click SteeringAngle "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_messages/msg/SteeringAngleFrontAxle.msg"
    click Velocity "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_messages/msg/VelocityVehicle.msg"
    click YawRate "https://github.com/robotics-upo/ars548_ros/blob/master/ars548_messages/msg/YawRate.msg"

    %% Styles
    classDef hardware fill:#ccc,stroke:#333,stroke-width:1px
    classDef node fill:#8f8,stroke:#266,stroke-width:1px
    classDef topic fill:#ff8,stroke:#aa4,stroke-width:1px,shape: cylinder
    classDef config fill:#88f,stroke:#446,stroke-width:1px,shape: document
    classDef external fill:#f88,stroke:#a33,stroke-width:1px
    classDef messages fill:#faa,stroke:#a22,stroke-width:1px
    class RadarHardware hardware
    class DriverNode,FilterNode,SetupCLI,StaticTF node
    class StatusTopic,ObjectsTopic,DetectionsTopic,PC2Topic,PoseArrayTopic,FiltPC2 topic
    class Configurer,SetupMax,LaunchDriver,LaunchFilter,RVizConfig,RVizFilterConfig,Dockerfile,CMakeDriver,CMakeMsgs config
    class RViz external
    class MsgPkg messages
```
