Ubuntu 22.04 ROS2环境下Realsense 相机的使用教程
realsense使用过程中总是有这样那样的问题,虽然有官方说明文档,但更新不及时且内容不全面,这里对本人使用过程中遇到的问题进行总结。
环境:Linux jpx-virtual-machine 6.8.0-52-generic #53~22.04.1-Ubuntu
realsense 版本: LibRealSense v2.55.1
D435:Device FW version: 5.15.1
librealsense SDK 安装
sudo mkdir -p /etc/apt/keyrings
curl -sSf https://librealsense.intel.com/Debian/librealsense.pgp | sudo tee /etc/apt/keyrings/librealsense.pgp > /dev/null
# Make sure apt HTTPS support is installed: sudo apt-get install apt-transport-https
# Add the server to the list of repositories:
echo "deb [signed-by=/etc/apt/keyrings/librealsense.pgp] https://librealsense.intel.com/Debian/apt-repo `lsb_release -cs` main" | \
sudo tee /etc/apt/sources.list.d/librealsense.list
sudo apt-get update
# Install the libraries (see section below if upgrading packages):
sudo apt-get install librealsense2-dkms
sudo apt-get install librealsense2-utils
# The above two lines will deploy librealsense2 udev rules, build and activate kernel modules, runtime library and executable demos and tools.
# Optionally install the developer and debug packages:
sudo apt-get install librealsense2-dev
sudo apt-get install librealsense2-dbg
# 测试是否安装成功
realsense-viewer
realsense ros2 安装 和 使用
# 源码安装realsense ros2
mkdir -p ./ros2_ws/src
cd ./ros2_ws/src
git clone https://github.com/IntelRealSense/realsense-ros.git -b ros2-master
cd ../
# 编译
sudo rosdep init
rosdep update
rosdep install -i --from-path src --rosdistro $ROS_DISTRO --skip-keys=librealsense2 -y
colcon build
# source environment
ROS_DISTRO=humble
# 写入以下内容到 ~/.bashrc
source /opt/ros/humble/setup.bash
source /path/to/ros2_ws/install/setup.bash
realsense 参数查看和修改
对于这个问题,不同版本的SDK有着不同的解决方法
关闭结构光IR light
对于这个问题,不同版本的SDK有着不同的解决方法。
对于当前环境 [6.8.0-52-generic v2.55.1]
:
# 首先确定要修改的节点名称
ros2 node list
# 然后查看要修改的节点名称的参数
ros2 param get /camera/camera depth_module.emitter_enabled
# 如果参数为1 说明结构光打开;设置为0 可以关闭结构光
ros2 param set /camera/camera depth_module.emitter_enabled 0
对于旧版本环境 [5.15.]
:
# 进入realsense-ros中的realsense2_camera文件夹中
cd /opt/ros/humble/share/realsense2_camera/launch
# 修改launch文件
sudo vim rs_launch.py
# 修改内容如下
# 在configable_parameters 中添加下面一行
{'name': 'depth_module.emitter_enable', 'default': '0', 'description': 'IR light'},
其它问题汇总
其它问题