# bharathkukka/ros2-depth-anything-v3-trt architecture

> Architecture diagram of the GitHub repository bharathkukka/ros2-depth-anything-v3-trt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bharathkukka/ros2-depth-anything-v3-trt
- Repository: https://github.com/bharathkukka/ros2-depth-anything-v3-trt

## Overview

This ROS 2 application synchronizes camera images with calibration data, runs TensorRT depth inference, and publishes metric depth and a point cloud; optional debug visualization is also supported. The runtime divides into ROS orchestration, GPU/TensorRT inference, and output generation. Model export and engine generation are separate preparation workflows. The README documents capabilities not fully visible in the sampled source; those branches are shown only where the tree and documentation support them.

Main entry points: [`depth_anything_v3/src/tensorrt_depth_anything/tensorrt_depth_anything.cpp`](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/tensorrt_depth_anything/tensorrt_depth_anything.cpp) (TensorRT Depth), [`depth_anything_v3/src/depth_anything_v3_node/depth_anything_v3_node.cpp`](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/depth_anything_v3_node/depth_anything_v3_node.cpp) (Synchronized Node), [`depth_anything_v3/src/main.cpp`](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/main.cpp) (ROS Node Entry), [`depth_anything_v3/src/tensorrt_depth_anything/preprocess_gpu.cu`](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/tensorrt_depth_anything/preprocess_gpu.cu) (GPU Preprocessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ros["ROS 2 I/O"]
  node_launch["Launch Configuration"]
  node_entry["ROS Node Entry<br/>[main.cpp]"]
  node_node["Synchronized Node"]
  node_publishers["ROS Output Topics"]
end

subgraph group_inference["Depth Inference"]
  node_trt["TensorRT Depth"]
  node_trtcommon["TensorRT Runtime"]
  node_preprocess["GPU Preprocessing<br/>[preprocess_gpu.cu]"]
  node_postprocess["GPU Postprocessing<br/>[postprocess_gpu.cu]"]
  node_outputs["Depth And Cloud"]
end

subgraph group_preparation["Model Preparation"]
  node_exporter["ONNX Export<br/>[export.py]"]
  node_models["Model Files"]
  node_enginegen["Engine Generator"]
end

subgraph group_support["CUDA Support"]
  node_cuda["CUDA Memory Helpers"]
  node_cudaerrors["CUDA Error Checking"]
end

node_camera(("Camera Topics"))
node_consumers(("ROS Consumers"))

node_camera -->|"sends frames and calibration"| node_node
node_launch -->|"starts node"| node_entry
node_entry -->|"constructs and spins"| node_node
node_node -->|"runs inference"| node_trt
node_trt -->|"preprocesses images"| node_preprocess
node_preprocess -->|"provides input tensors"| node_trt
node_trt -->|"sets up and executes engine"| node_trtcommon
node_trt -->|"postprocesses outputs"| node_postprocess
node_postprocess -->|"produces depth data"| node_outputs
node_trt -->|"builds point cloud"| node_outputs
node_node -->|"publishes results"| node_publishers
node_publishers -->|"publishes depth and cloud"| node_consumers
node_exporter -->|"exports ONNX model"| node_models
node_models -->|"provides ONNX inputs"| node_enginegen
node_enginegen -->|"builds TensorRT engines"| node_trtcommon
node_trt -->|"allocates GPU buffers"| node_cuda
node_cuda -->|"checks CUDA calls"| node_cudaerrors

click node_launch "https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/launch/depth_anything_v3.launch.py"
click node_entry "https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/main.cpp"
click node_node "https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/depth_anything_v3_node/depth_anything_v3_node.cpp"
click node_trt "https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/tensorrt_depth_anything/tensorrt_depth_anything.cpp"
click node_trtcommon "https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/tensorrt_common/tensorrt_common.cpp"
click node_preprocess "https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/tensorrt_depth_anything/preprocess_gpu.cu"
click node_postprocess "https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/tensorrt_depth_anything/postprocess_gpu.cu"
click node_outputs "https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/tensorrt_depth_anything/tensorrt_depth_anything.cpp"
click node_publishers "https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/depth_anything_v3_node/depth_anything_v3_node.cpp"
click node_exporter "https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/onnx/export.py"
click node_models "https://github.com/bharathkukka/ros2-depth-anything-v3-trt/tree/main/depth_anything_v3/models"
click node_enginegen "https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/generate_engines.cpp"
click node_cuda "https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/include/cuda_utils/cuda_unique_ptr.hpp"
click node_cudaerrors "https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/include/cuda_utils/cuda_check_error.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_launch,node_entry,node_node,node_publishers toneBlue
class node_trt,node_trtcommon,node_preprocess,node_postprocess,node_outputs toneAmber
class node_exporter,node_models,node_enginegen toneMint
class node_cuda,node_cudaerrors toneRose
class node_camera,node_consumers toneIndigo
```

## Components

### ROS 2 I/O

- [Launch Configuration](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/launch/depth_anything_v3.launch.py): `depth_anything_v3/launch/depth_anything_v3.launch.py`
- [ROS Node Entry](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/main.cpp): `depth_anything_v3/src/main.cpp`
- [Synchronized Node](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/depth_anything_v3_node/depth_anything_v3_node.cpp): `depth_anything_v3/src/depth_anything_v3_node/depth_anything_v3_node.cpp`
- [ROS Output Topics](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/depth_anything_v3_node/depth_anything_v3_node.cpp): `depth_anything_v3/src/depth_anything_v3_node/depth_anything_v3_node.cpp`

### Depth Inference

- [TensorRT Depth](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/tensorrt_depth_anything/tensorrt_depth_anything.cpp): `depth_anything_v3/src/tensorrt_depth_anything/tensorrt_depth_anything.cpp`
- [TensorRT Runtime](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/tensorrt_common/tensorrt_common.cpp): `depth_anything_v3/src/tensorrt_common/tensorrt_common.cpp`
- [GPU Preprocessing](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/tensorrt_depth_anything/preprocess_gpu.cu): `depth_anything_v3/src/tensorrt_depth_anything/preprocess_gpu.cu`
- [GPU Postprocessing](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/tensorrt_depth_anything/postprocess_gpu.cu): `depth_anything_v3/src/tensorrt_depth_anything/postprocess_gpu.cu`
- [Depth And Cloud](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/tensorrt_depth_anything/tensorrt_depth_anything.cpp): `depth_anything_v3/src/tensorrt_depth_anything/tensorrt_depth_anything.cpp`

### Model Preparation

- [ONNX Export](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/onnx/export.py): `onnx/export.py`
- [Model Files](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/tree/main/depth_anything_v3/models): `depth_anything_v3/models`
- [Engine Generator](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/src/generate_engines.cpp): `depth_anything_v3/src/generate_engines.cpp`

### CUDA Support

- [CUDA Memory Helpers](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/include/cuda_utils/cuda_unique_ptr.hpp): `depth_anything_v3/include/cuda_utils/cuda_unique_ptr.hpp`
- [CUDA Error Checking](https://github.com/bharathkukka/ros2-depth-anything-v3-trt/blob/main/depth_anything_v3/include/cuda_utils/cuda_check_error.hpp): `depth_anything_v3/include/cuda_utils/cuda_check_error.hpp`

### Other components

- **Camera Topics**
- **ROS Consumers**

## Connections

- Camera Topics → Synchronized Node: sends frames and calibration (evidence: `README.md`)
- Launch Configuration → ROS Node Entry: starts node (evidence: `depth_anything_v3/launch/depth_anything_v3.launch.py`)
- ROS Node Entry → Synchronized Node: constructs and spins (evidence: `depth_anything_v3/src/main.cpp`)
- Synchronized Node → TensorRT Depth: runs inference (evidence: `depth_anything_v3/src/depth_anything_v3_node/depth_anything_v3_node.cpp`)
- TensorRT Depth → GPU Preprocessing: preprocesses images
- GPU Preprocessing → TensorRT Depth: provides input tensors (evidence: `README.md`)
- TensorRT Depth → TensorRT Runtime: sets up and executes engine (evidence: `depth_anything_v3/src/tensorrt_depth_anything/tensorrt_depth_anything.cpp`)
- TensorRT Depth → GPU Postprocessing: postprocesses outputs
- GPU Postprocessing → Depth And Cloud: produces depth data (evidence: `README.md`)
- TensorRT Depth → Depth And Cloud: builds point cloud (evidence: `depth_anything_v3/src/tensorrt_depth_anything/tensorrt_depth_anything.cpp`)
- Synchronized Node → ROS Output Topics: publishes results (evidence: `depth_anything_v3/src/depth_anything_v3_node/depth_anything_v3_node.cpp`)
- ROS Output Topics → ROS Consumers: publishes depth and cloud (evidence: `README.md`)
- ONNX Export → Model Files: exports ONNX model (evidence: `README.md`)
- Model Files → Engine Generator: provides ONNX inputs (evidence: `depth_anything_v3/src/generate_engines.cpp`)
- Engine Generator → TensorRT Runtime: builds TensorRT engines (evidence: `depth_anything_v3/src/generate_engines.cpp`)
- TensorRT Depth → CUDA Memory Helpers: allocates GPU buffers (evidence: `depth_anything_v3/src/tensorrt_depth_anything/tensorrt_depth_anything.cpp`)
- CUDA Memory Helpers → CUDA Error Checking: checks CUDA calls (evidence: `depth_anything_v3/include/cuda_utils/cuda_unique_ptr.hpp`)
