高斯体绘制遇上ROS2
Gaussian Splatting Meets ROS2

原始链接: https://github.com/shadygm/ROSplat

Shady Gmira 的 ROSplat 是首个在线 ROS2 可视化工具,它利用高斯散射 (Gaussian splatting) 技术高效渲染包含数百万个高斯函数的复杂 3D 场景。它利用自定义的 ROS2 消息 (SingleGaussian, GaussianArray) 来传输高斯函数的属性,例如位置、旋转、缩放、不透明度和球谐函数。 ROSplat 通过 GPU 加速的排序和渲染提供实时可视化。它设计用于 Ubuntu 24.04 LTS 和 ROS2 Jazzy,需要 NVIDIA GPU 才能获得最佳性能。安装选项包括使用 `pip` 单独安装软件包(cuPy、PyTorch 用于 GPU 排序),或使用提供的 `requirements.txt` 或 `requirements-no-gpu.txt` 文件。还提供 Docker 设置以简化依赖项管理,但这需要将主机 CUDA 版本与 Dockerfile 匹配。 在启动可视化工具之前,使用 `colcon` 构建自定义高斯消息至关重要。该项目受到了 graphdeco-inria 的实现和 limacv 的 GaussianSplattingViewer 的启发,并热烈欢迎贡献和反馈。

Hacker News 的讨论主题是“ROSplat”,这是一个将高斯 splatting (GS) 与机器人操作系统 ROS2 集成的项目。其目标是方便通过 ROS 消息在网络上流式传输和可视化机器人应用程序(如 SLAM)生成的高斯 splat。 虽然 ROS 会带来一定的开销,但该项目优先考虑与现有机器人生态系统的轻松集成和实时数据共享。ROSplat 本身并不是一种更快的渲染方法;它使用 OpenGL 进行渲染,ROS 主要负责消息传递。 讨论涉及到在机器人技术中实时生成高斯 splat 的潜力。虽然目前的方法可能资源密集型,但正在取得进展。用户还讨论了其在 VR/XR、定位和遥操作中的潜在应用,以及基于 GS 进展的进一步项目。

原文

The Online ROS2-Based Gaussian Splatting-Enabled Visualizer

Shady Gmira

Project Image Demo Animation

ROSplat is the first online ROS2-based visualizer that leverages Gaussian splatting to render complex 3D scenes. It is designed to efficiently visualize millions of gaussians by using custom ROS2 messages and GPU-accelerated sorting and rendering techniques. ROSplat also supports data loading from PLY files and integrates with ROS2 tools such as bag recording.

  • Real-Time Visualization: Render millions of Gaussian “splats” in real time.
  • ROS2 Integration: Built on ROS2 for online data exchange of Gaussians, Images, and IMU data.
  • Custom Gaussian Messages: Uses custom message types (SingleGaussian and GaussianArray) to encapsulate properties such as position, rotation, scale, opacity, and spherical harmonics.
  • GPU-Accelerated Sorting & Rendering: Offloads sorting and rendering tasks to the GPU.

This project was developed and tested on Ubuntu 24.04 LTS using ROS2 Jazzy. Please note: Performance degrades significantly without an NVIDIA graphics card.

  • Mandatory: ROS2 (tested on ROS2 Jazzy)
  • Optional (for GPU-based Sorting):
    • cupy (ensure compatibility with your CUDA version)
    • torch (if using PyTorch for GPU sorting)

To install the optional GPU-based libraries individually:

pip install cupy-cuda12x  # Install Cupy (replace 12x with your CUDA version)
pip install torch         # Install PyTorch

The program will automatically prioritize sorting methods in the following order: 1) Torch → 2) Cupy → 3) CPU

To install all dependencies at once:

pip install -r requirements.txt        # For GPU acceleration
pip install -r requirements-no-gpu.txt  # Without GPU acceleration

Alternatively, you can set up the project using Docker. A setup script is available under the docker directory.

Before running Docker, ensure you have installed:

sudo apt-get install -y nvidia-container-toolkit

This enables GPU communication between the host and the container. If you come accross any other issues, follow the instructions under the following link

Then, to build and run the Docker container:

cd docker
./run_docker.sh -h    # Display help and usage instructions
./run_docker.sh -bu   # Build the Docker image and launch the container with docker-compose

Important: Ensure the host machine's CUDA version matches the version specified in the Dockerfile. If you are using a CUDA version other than 12.6, update the Dockerfile accordingly.

Building the Gaussian Messages

ROSplat defines two custom ROS2 messages to handle Gaussian data, located in the gaussian_interface/msg folder.

Note: The Gaussian messages are based on the original Gaussian Splatting implementation by graphdeco-inria.
geometry_msgs/msg/Point xyz
geometry_msgs/msg/Quaternion rotation
float32 opacity
geometry_msgs/msg/Vector3 scale
float32[] spherical_harmonics
gaussian_interface/SingleGaussian[] gaussians

a) Build your workspace using colcon:

colcon build --packages-select gaussian_interface

b) Source your workspace:

Important: Depending on your shell, you might need to adjust these commands.

Once the Gaussian messages are built, you can launch the visualizer from the project's root directory:

Contributions and feedback are welcome!

I'm glad to have worked on such a challenging topic and grateful for the invaluable advice and support I received throughout this project.

Special thanks to Qihao Yuan and Kailai Li for their guidance and encouragement as well as the constructive feedback that helped shape this work.

This project was additionally influenced by limacv 's implementation of the GaussianSplattingViewer repository.

For questions or further information, please email: shady.gmira[at]gmail.com

联系我们 contact @ memedata.com