$ show ika-rwth-aachen/ros2-depth-anything-v3-trt
A ROS 2 node that performs real-time metric depth estimation and point cloud generation using Depth Anything V3 accelerated with TensorRT. The system subscribes to camera image and camera info topics, synchronizes them via approximate time, runs GPU-accelerated preprocessing and inference, then publishes a 32-bit float depth image and a colorized or monochrome point cloud. The pipeline includes GPU-side bicubic upscaling, focal-length-based metric scaling, sky detection with percentile-based fill, and optional debug visualization with FPS overlay. The repository provides a complete build system (ament_cmake, CUDA, TensorRT), a standalone engine generation tool, a Docker image, and an ONNX export script for the underlying PyTorch model. It is designed for autonomous driving and robotics perception applications requiring high frame rates (claimed 50 FPS on Quadro RTX 6000). The architecture is a monolithic ROS 2 component with a clean separation between the node, the TensorRT wrapper, and the GPU kernels.
The LLM identified 3 files worth highlighting for reuse:
A set of three header-only utility files (cuda_check_error.hpp, cuda_unique_ptr.hpp, stream_unique_ptr.hpp) that provide RAII wrappers for CUDA device memory, pinned host memory, and CUDA streams. They use std::unique_ptr with custom deleters and a macro for error checking. These are clean, generic, and directly reusable in any CUDA project without modification.
A generic TensorRT engine building and inference class (TrtCommon) that supports ONNX to engine conversion, engine loading, dynamic batch sizes, INT8 calibration, per-layer profiling, and DLA execution. The code is well-structured with RAII patterns (TrtUniquePtr) and conditional ROS logging that can be disabled via a compile-time flag. It can be extracted as a standalone library for any TensorRT-based project.
A Python script to export Depth Anything V3 PyTorch checkpoints to ONNX format. It wraps the official API, handles device placement, validates input dimensions, runs ONNX checker, and includes a demo inference routine that prints depth statistics. The script is well-documented and parameterized, making it reusable for exporting other Depth Anything V3 variants or similar multi-output models with minor adjustments.