Skip to content

教程raw.githubusercontent.com6 天前

Intel RealSense D435/D455:ROS 2 驱动安装、启动与常用参数 ​

> 本文依据以下官方文档整理:raw.githubusercontent.com/IntelRealSense/realsense-ros/ros2-。命令与版本以文档当前版本为准。

前置条件 ​

  • RealSense(TM) Cameras
  • Ubuntu 24.04、Ubuntu 22.04 或 Ubuntu 20.04
  • ROS2 Kilted、ROS2 Jazzy、ROS2 Iron、ROS2 Humble 或 ROS2 Foxy
  • RealSense™ SDK 2.0
  • python3-rosdep、colcon

1. 1. 确认 ROS 2 与 Ubuntu 版本组合 ​

Ubuntu 24.04 可使用 ROS2 Kilted 或 ROS2 Jazzy;Ubuntu 22.04 可使用 ROS2 Iron 或 ROS2 Humble;Ubuntu 20.04 可使用 ROS2 Foxy。ROS1 Wrapper for RealSense™ cameras is not supported anymore。

2. 2. 安装 RealSense™ SDK 2.0 ​

文档要求 3 种 SDK 安装方式只选择一种,以避免 multiple versions installation and workspace conflicts。若从 ROS servers 安装 librealsense2,可使用以下命令;Foxy EOL distro is not supported by this option。

bash
sudo apt install ros-<ROS_DISTRO>-librealsense2*

Humble 示例:

bash
sudo apt install ros-humble-librealsense2*

3. 3. 安装 ROS Wrapper 二进制包 ​

ROS Wrapper for RealSense™ cameras 可从 ROS servers 安装;同样注意 Foxy EOL distro is not supported by this option。通用包名与 Humble 示例分别如下:

bash
sudo apt install ros-<ROS_DISTRO>-realsense2-*
bash
sudo apt install ros-humble-realsense2-*

4. 4. 或者从源码获取 ROS Wrapper ​

如果选择 Install from source,先创建 ROS2 workspace,再把 ros2-master 分支克隆到 ~/ros2_ws/src/。仓库位置已迁移到 realsenseai organization。

bash
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src/
bash
git clone https://github.com/realsenseai/realsense-ros.git -b ros2-master
cd ~/ros2_ws

5. 5. 安装依赖、编译并加载环境 ​

源码安装继续执行 rosdep 依赖安装、colcon build,并在终端中 source ROS 与工作空间环境。Foxy and earlier 使用文档注释中的 include-eol-distros 形式。

bash
sudo apt-get install python3-rosdep -y
sudo rosdep init # "sudo rosdep init --include-eol-distros" for Foxy and earlier
rosdep update # "sudo rosdep update --include-eol-distros" for Foxy and earlier
rosdep install -i --from-path src --rosdistro $ROS_DISTRO --skip-keys=librealsense2 -y
bash
colcon build
bash
ROS_DISTRO=<YOUR_SYSTEM_ROS_DISTRO>  # set your ROS_DISTRO: kilted, jazzy, iron, humble, foxy
source /opt/ros/$ROS_DISTRO/setup.bash
cd ~/ros2_ws
. install/local_setup.bash

6. 6. 启动相机节点并使用 ros2-master 参数 ​

ros2-master 中 video streams 使用 <module>.profile 替代 <stream>_width、<stream>_height、<stream>_fps。文档给出的新启动示例如下:

bash
ros2 launch realsense2_camera rs_launch.py depth_module.profile:=640x480x30

常用参数还包括 <stream>.enable、<filter_name>.enable、align_depth.enable、pointcloud.allow_no_texture_points、pointcloud.ordered_pc、pointcloud.stream_filter、pointcloud.stream_index_filter、unite_imu_method、enable_sync。

验证是否跑通 ​

完成安装和环境加载后,执行文档中的 ros2 launch realsense2_camera rs_launch.py depth_module.profile:=640x480x30;相机节点能够按该示例启动,并接受 depth_module.profile 参数,即可确认基础流程跑通。

文档里点名的注意事项 ​

  • RealSense GitHub repositories have been successfully migrated to the RealSenseAI organization;旧的 IntelRealSense 重定向不保证长期有效。
  • RealSense™ SDK 2.0 的 3 种安装方式只能选择一种,以避免 multiple versions installation and workspace conflicts。
  • ROS Wrapper 的 debian package from ROS servers 对 Foxy EOL distro is not supported。
  • ROS1 Wrapper for RealSense™ cameras is not supported anymore。
  • 启用 USE_LIFECYCLE_NODE=ON 时,Image Transport functionality (image_transport) is disabled;compressed image topics will not be available,Subscribers must use raw image topics。
  • ros2-master 中 stereo_module、l500_depth_sensor 被 depth_module 替代;filters 参数被移除,改用 <filter>.enable。

来源

本页事实对应的公开页面,以原文为准。

  1. raw.githubusercontent.com/IntelRealSense/realsense-ros/ros2-master/README.md访问 2026-10-22