How bharathkukka/ros2-depth-anything-v3-trt works
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: tensorrt_depth_anything.cpp TensorRT Depth · depth_anything_v3_node.cpp Synchronized Node · main.cpp ROS Node Entry · preprocess_gpu.cu GPU Preprocessing
Components 16
ROS 2 I/O
- Launch Configuration
depth_anything_v3/launch/depth_anything_v3.launch.py - ROS Node Entry
depth_anything_v3/src/main.cpp - Synchronized Node
depth_anything_v3/src/depth_anything_v3_node/depth_anything_v3_node.cpp - ROS Output Topics
depth_anything_v3/src/depth_anything_v3_node/depth_anything_v3_node.cpp
Depth Inference
- TensorRT Depth
depth_anything_v3/src/tensorrt_depth_anything/tensorrt_depth_anything.cpp - TensorRT Runtime
depth_anything_v3/src/tensorrt_common/tensorrt_common.cpp - GPU Preprocessing
depth_anything_v3/src/tensorrt_depth_anything/preprocess_gpu.cu - GPU Postprocessing
depth_anything_v3/src/tensorrt_depth_anything/postprocess_gpu.cu - Depth And Cloud
depth_anything_v3/src/tensorrt_depth_anything/tensorrt_depth_anything.cpp
Model Preparation
- ONNX Export
onnx/export.py - Model Files
depth_anything_v3/models - Engine Generator
depth_anything_v3/src/generate_engines.cpp
CUDA Support
- CUDA Memory Helpers
depth_anything_v3/include/cuda_utils/cuda_unique_ptr.hpp - CUDA Error Checking
depth_anything_v3/include/cuda_utils/cuda_check_error.hpp
Other components
- Camera Topics
- ROS Consumers
Connections 17
- Camera Topics → Synchronized Node: sends frames and calibration
README.md - Launch Configuration → ROS Node Entry: starts node
depth_anything_v3/launch/depth_anything_v3.launch.py - ROS Node Entry → Synchronized Node: constructs and spins
depth_anything_v3/src/main.cpp - Synchronized Node → TensorRT Depth: runs inference
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
README.md - TensorRT Depth → TensorRT Runtime: sets up and executes engine
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
README.md - TensorRT Depth → Depth And Cloud: builds point cloud
depth_anything_v3/src/tensorrt_depth_anything/tensorrt_depth_anything.cpp - Synchronized Node → ROS Output Topics: publishes results
depth_anything_v3/src/depth_anything_v3_node/depth_anything_v3_node.cpp - ROS Output Topics → ROS Consumers: publishes depth and cloud
README.md - ONNX Export → Model Files: exports ONNX model
README.md - Model Files → Engine Generator: provides ONNX inputs
depth_anything_v3/src/generate_engines.cpp - Engine Generator → TensorRT Runtime: builds TensorRT engines
depth_anything_v3/src/generate_engines.cpp - TensorRT Depth → CUDA Memory Helpers: allocates GPU buffers
depth_anything_v3/src/tensorrt_depth_anything/tensorrt_depth_anything.cpp - CUDA Memory Helpers → CUDA Error Checking: checks CUDA calls
depth_anything_v3/include/cuda_utils/cuda_unique_ptr.hpp