# livox-sdk/livox_ros_driver2 architecture

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

- Interactive diagram: https://gitdiagram.com/livox-sdk/livox_ros_driver2
- Repository: https://github.com/livox-sdk/livox_ros_driver2

## Overview

Livox ROS Driver 2 connects Livox LiDAR devices to ROS 1 or ROS 2 and publishes point-cloud and IMU data. The principal flow is launch/configuration into driver startup, LiDAR setup and packet handling, then ROS message publication; supported output formats and mixed-device scenarios are documented in the README. The excerpts show publisher and message-output behavior, while some startup and callback wiring is known only from the SOURCE INDEX, so uncertain runtime links are omitted.

Main entry points: [`src/livox_ros_driver2.cpp`](https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/livox_ros_driver2.cpp) (Driver entry), [`src/lds_lidar.cpp`](https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/lds_lidar.cpp) (LiDAR lifecycle), [`src/lddc.cpp`](https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/lddc.cpp) (ROS data converter), [`launch_ROS2`](https://github.com/livox-sdk/livox_ros_driver2/tree/master/launch_ROS2) (Launch examples)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Startup and configuration"]
  node_launch["Launch examples"]
  node_entry["Driver entry"]
  node_node["Driver node<br/>[driver_node.cpp]"]
  node_config["LiDAR config parser"]
end

subgraph group_devices["LiDAR acquisition"]
  node_lifecycle["LiDAR lifecycle<br/>[lds_lidar.cpp]"]
  node_callbacks["Device callbacks"]
  node_common_cb["Common callbacks"]
  node_lds["Data source base<br/>[lds.cpp]"]
end

subgraph group_processing["Packet processing"]
  node_pubhandler["Point cloud handler<br/>[pub_handler.cpp]"]
  node_queues["Packet queues"]
end

subgraph group_rosout["ROS publication"]
  node_lddc["ROS data converter<br/>[lddc.cpp]"]
  node_cloud["Point cloud topics"]
  node_imu["IMU topics"]
end

node_operator(("ROS operator"))
node_device(("Livox LiDAR"))
node_ros(("ROS runtime"))

node_operator -->|"selects"| node_launch
node_launch -.->|"starts"| node_entry
node_entry -->|"initializes"| node_node
node_entry -->|"initializes"| node_lifecycle
node_lifecycle -->|"parses"| node_config
node_lifecycle -.->|"registers"| node_callbacks
node_lifecycle -.->|"registers"| node_common_cb
node_device -.->|"sends events"| node_callbacks
node_device -.->|"sends packets"| node_pubhandler
node_pubhandler -.->|"processes packets"| node_queues
node_entry -->|"initializes"| node_lddc
node_lddc -->|"registers source"| node_lds
node_lddc -->|"publishes"| node_cloud
node_lddc -->|"publishes"| node_imu
node_cloud -->|"uses topics"| node_ros
node_imu -.->|"uses topics"| node_ros

click node_launch "https://github.com/livox-sdk/livox_ros_driver2/tree/master/launch_ROS2"
click node_entry "https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/livox_ros_driver2.cpp"
click node_node "https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/driver_node.cpp"
click node_config "https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/parse_cfg_file/parse_livox_lidar_cfg.cpp"
click node_lifecycle "https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/lds_lidar.cpp"
click node_callbacks "https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/call_back/livox_lidar_callback.cpp"
click node_common_cb "https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/call_back/lidar_common_callback.cpp"
click node_pubhandler "https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/comm/pub_handler.cpp"
click node_queues "https://github.com/livox-sdk/livox_ros_driver2/tree/master/src/comm"
click node_lds "https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/lds.cpp"
click node_lddc "https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/lddc.cpp"

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_launch,node_entry,node_node,node_config toneBlue
class node_lifecycle,node_callbacks,node_common_cb,node_lds toneAmber
class node_pubhandler,node_queues toneMint
class node_lddc,node_cloud,node_imu toneRose
class node_operator,node_device,node_ros toneIndigo
```

## Components

### Startup and configuration

- [Launch examples](https://github.com/livox-sdk/livox_ros_driver2/tree/master/launch_ROS2): `launch_ROS2`
- [Driver entry](https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/livox_ros_driver2.cpp): `src/livox_ros_driver2.cpp`
- [Driver node](https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/driver_node.cpp): `src/driver_node.cpp`
- [LiDAR config parser](https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/parse_cfg_file/parse_livox_lidar_cfg.cpp): `src/parse_cfg_file/parse_livox_lidar_cfg.cpp`

### LiDAR acquisition

- [LiDAR lifecycle](https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/lds_lidar.cpp): `src/lds_lidar.cpp`
- [Device callbacks](https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/call_back/livox_lidar_callback.cpp): `src/call_back/livox_lidar_callback.cpp`
- [Common callbacks](https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/call_back/lidar_common_callback.cpp): `src/call_back/lidar_common_callback.cpp`
- [Data source base](https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/lds.cpp): `src/lds.cpp`

### Packet processing

- [Point cloud handler](https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/comm/pub_handler.cpp): `src/comm/pub_handler.cpp`
- [Packet queues](https://github.com/livox-sdk/livox_ros_driver2/tree/master/src/comm): `src/comm`

### ROS publication

- [ROS data converter](https://github.com/livox-sdk/livox_ros_driver2/blob/master/src/lddc.cpp): `src/lddc.cpp`
- **Point cloud topics**
- **IMU topics**

### Other components

- **ROS operator**
- **Livox LiDAR**
- **ROS runtime**

## Connections

- ROS operator → Launch examples: selects
- Launch examples → Driver entry: starts
- Driver entry → Driver node: initializes (evidence: `src/livox_ros_driver2.cpp`)
- Driver entry → LiDAR lifecycle: initializes (evidence: `src/livox_ros_driver2.cpp`)
- LiDAR lifecycle → LiDAR config parser: parses (evidence: `src/lds_lidar.cpp`)
- LiDAR lifecycle → Device callbacks: registers
- LiDAR lifecycle → Common callbacks: registers
- Livox LiDAR → Device callbacks: sends events
- Livox LiDAR → Point cloud handler: sends packets
- Point cloud handler → Packet queues: processes packets (evidence: `src/comm/pub_handler.cpp`)
- Driver entry → ROS data converter: initializes (evidence: `src/livox_ros_driver2.cpp`)
- ROS data converter → Data source base: registers source (evidence: `src/lddc.cpp`)
- ROS data converter → Point cloud topics: publishes (evidence: `src/lddc.cpp`)
- ROS data converter → IMU topics: publishes (evidence: `src/lddc.cpp`)
- Point cloud topics → ROS runtime: uses topics
- IMU topics → ROS runtime: uses topics
