ros2_depthanythingv2 is a ROS 2 package that converts monocular RGB images into depth maps and generates colored 3D point clouds. It leverages DepthAnythingV2 models for depth estimation and publishes the resulting point clouds as ROS 2 messages, suitable for navigation, mapping, and perception tasks.
- ROS 2 (tested on Humble)
- Ubuntu 22.04
- Subscribes to RGB image and camera info topics
- Runs DepthAnythingV2 model to estimate depth from images
- Projects depth and color into a 3D point cloud using camera intrinsics or FOV equation
- Publishes
sensor_msgs/PointCloud2messages - Optionally saves point clouds as PLY files for offline analysis
To start the node with default parameters:
ros2 launch ros2_depthanythingv2 depth_to_pointcloud.launch.pyYou can customize parameters such as image topic, model size, downsampling factor, and more via launch arguments.
image_transport: Image transport type (e.g., raw, compressed)model_size: Model variant to use (Base, Small, Large)downsample: Downsampling factor for point cloud densityprojection_method: Use camera_info or FOV equation for projectionfovx_deg: Horizontal field of view (if using FOV projection)max_depth: Maximum depth value for scalinguse_sim_time: Use simulation time (for simulation)
-
Subscribed
/image_rawor/image_compressed(sensor_msgs/Imageorsensor_msgs/CompressedImage): Input RGB image/camera_info(sensor_msgs/CameraInfo): Camera calibration
-
Published
/pointcloud(sensor_msgs/PointCloud2): Output colored point cloud
ros2 launch ros2_depthanythingv2 depth_to_pointcloud.launch.py image_transport:=compressed model_size:=Base downsample:=3This package is originally designed for use with the Nav2 STVL (Spatio-Temporal Voxel Layer) plugin to mimic a depth camera. By converting monocular RGB images into depth maps and projecting them into colored 3D point clouds, it enables robots without dedicated depth sensors to provide point cloud data for navigation, obstacle avoidance, and mapping tasks in Nav2.
Typical workflow:
- Launch this package to publish a point cloud from your monocular camera.
- Configure the Nav2 STVL plugin (or other point cloud consumers) to subscribe to the
/pointcloudtopic published by this node. - Tune parameters such as
downsample,max_depth, andprojection_methodfor your environment and performance needs.
This approach allows you to leverage advanced depth estimation models to enhance robot perception using only a standard RGB camera.
Special thanks to the authors and contributors of the following open source projects, which made this package possible:
This project is licensed under the Apache License 2.0.