Ubuntu16.04安装intel RealSense D435i驱动并在ROS中使用

参考:

  1. https://blog.csdn.net/qq_43265072/article/details/106437287
  2. https://blog.csdn.net/zhangfenger/article/details/84998082
  3. https://blog.csdn.net/sinat_23853639/article/details/88044019?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.channel_param

以下步骤基本是官方教程的翻译,更多细节请移步官方教程

一、系统配置:

  1. 系统环境:Ubuntu16.04
  2. 内核版本:4.15.0-112-generic
    D435i 驱动支持的内核有: supported kernel version (4.[4,8,10,13,15,16]]),可通过:uname -r 查看内核版本

二、驱动安装:

以下采用source code方式进行安装
!!!注意:驱动安装过程中不要连接相机!!!

  1. Make Ubuntu Up-to-date::
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
  1. Download/Clone librealsense github repository:
git clone https://github.com/IntelRealSense/librealsense.git
  1. Prepare Linux Backend and the Dev. Environment:
sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
sudo apt-get install libglfw3-dev
  1. 进入 librealsense 根目录,运行 Intel Realsense permissions script :
./scripts/setup_udev_rules.sh
  1. Build and apply patched kernel modules for:
./scripts/patch-realsense-ubuntu-lts.sh

这里可能会遇到一些问题:
(1)g++需要升级,按照提示依次运行以下命令即可:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -y
sudo apt-get install g++-7 -y

(2)Applying the patched module … modprobe: ERROR: could not insert ‘videodev’: Required key not available
Failed to insert the patched module. Operation is aborted, the original module is restored
Verify that the current kernel version is aligned to the patched module version
在这里插入图片描述
出现此问题的原因是,Ubuntu Kernel 使用 EFI_SECURE_BOOT_SIG_ENFORCE 内核配置,这样会阻止内核载入第三方模块。解决方法如下:

  • 在终端输入:
sudo apt install mokutil
sudo mokutil --disable-validation
  • 执行后,终端会让你设置8-16位的密码(下一步要用,所以一定要记得设置的密码
  • 然后,重启电脑,会出现蓝屏,按下任意键进入选择界面 ,出现以下四个选项:
- Continue boot
- Change Secure Boot state
- Enroll key from disk
- Enroll hash from disk
  1. TM1-specific:
echo 'hid_sensor_custom' | sudo tee -a /etc/modules
  1. 编译librealsense2 SDK:
cd librealsense
mkdir build && cd build
cmake ..
# The default build is set to produce the core shared object and unit-tests binaries in Debug mode. Use -DCMAKE_BUILD_TYPE=Release to build with optimizations.

下面两个步骤可酌情跳过:

cmake ../ -DBUILD_EXAMPLES=true  # - Builds librealsense along with the demos and tutorials
cmake ../ -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=false # - For systems without OpenGL or X11 build only textual examples
  1. 重新编译和安装:
sudo make uninstall && make clean && make && sudo make install

说明:The shared object will be installed in /usr/local/lib, header files in /usr/local/include.
The binary demos, tutorials and test files will be copied into /usr/local/bin.

三、测试SDK:

连接相机,新开一个终端,输入:realsense-viewer 启动即可:
在这里插入图片描述
看到上图画面就说明连接啦!用户可以查看深度图、可视化点云、记录和回放视频,还可以配置摄像头设置、修改高级控件和后期处理等功能。

四、ROS包安装:

官方提供的RealSense ROS包安装有两种方式,一种是apt方式安装,另一种是源码安装。

1. apt安装:
  1. 安装 realsense2_camera and its dependents, including librealsense2 library:
sudo apt-get install ros-kinetic-realsense2-camera
  1. 安装 realsense2_description :
sudo apt-get install ros-kinetic-realsense2-description

It includes the 3D-models of the devices and is necessary for running launch files that include these models (i.e. roslaunch realsense2_camera rs_d435_camera_with_model.launch)

  1. start the camera node in ROS:
roslaunch realsense2_camera rs_camera.launch

显示如下界面:
在这里插入图片描述

  1. Start the camera node and make it publish the RGBD point cloud using aligned depth topic:
roslaunch realsense2_camera rs_camera.launch filters:=pointcloud
2. 源码安装:
  1. 安装最新版本的Intel® RealSense™ SDK 2.0:
sudo apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
sudo add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo xenial main" -u
sudo apt-get install librealsense2-dkms
sudo apt-get install librealsense2-utils
sudo apt-get install librealsense2-dev
sudo apt-get install librealsense2-dbg
modinfo uvcvideo | grep "version:"
sudo apt-get update
sudo apt-get upgrade
  1. 源码方式安装Intel® RealSense™ ROS:
# Create a catkin workspace Ubuntu
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src/
# Clone the latest Intel® RealSense™ ROS from here into 'catkin_ws/src/'
git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/
git checkout `git tag | sort -V | grep -P "^\d+\.\d+\.\d+" | tail -1`
cd ..
# Make sure all dependent packages are installed. You can check .travis.yml file for reference.
# Specifically, make sure that the ros package ddynamic_reconfigure is installed.
catkin_init_workspace
cd ..
catkin_make clean
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
  1. Start the camera node:
roslaunch realsense2_camera rs_camera.launch
  1. Start the camera node and make it publish the RGBD point cloud using aligned depth topic:
roslaunch realsense2_camera rs_camera.launch filters:=pointcloud
  1. Start the camera node and make it publish the aligned depth stream to other available streams such as color or infra-red:
roslaunch realsense2_camera rs_camera.launch align_depth:=true
  1. Set Camera Controls Using Dynamic Reconfigure Params:
rosrun rqt_reconfigure rqt_reconfigure

在这里插入图片描述

  1. realsense2_description package:
    For viewing included models, a separate package is included. For example:
roslaunch realsense2_description view_d415_model.launch
  • 12
    点赞
  • 92
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值