Intel realsense D435 驱动并嵌入ROS使用

Ubuntu 16.04  Installation

Ubuntu Build Dependencies

安装过程中会用到wget, git, add-apt-repository 等命令,有可能会被防火墙阻拦,所以建议不要使用公司的网(我就出现了这个问题,公司的网有的命令怎么都连不上,开了手机热点,就解决了。)

1、前期准备

更新 Ubuntu:

  • Update Ubuntu distribution, including getting the latest stable kernel:
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade

如果需要查看内核版本,运行如下命令:

uname -r

2、下载最新的librealsense SDK包:

下载地址如下:https://github.com/IntelRealSense/librealsense/tags ,解压之后,移动到系统的home根目录下。

3、Prepare Linux Backend and the Dev. Environment:

        注意事项:安装时,不要将相机连在电脑上。

3.1 切换目录到 librealsense 的根目录下,然后安装必要的packages

cd ~/librealsense
sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev 

3.2 安装对应版本的包:

Ubuntu 16:

sudo apt-get install libglfw3-dev

3.3 安装 librealsense原文件目录下的许可脚本

sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/ 
sudo udevadm control --reload-rules && udevadm trigger

3.4 构建并应用修补的内核模块


Ubuntu 14/16/18 with LTS kernel script will download, patch and build realsense-affected kernel modules (drivers).
Then it will attempt to insert the patched module instead of the active one. If failed the original uvc modules will be restored.

./scripts/patch-realsense-ubuntu-lts.sh

注意事项:有可能会出现错误:Failed to unload module videobuf2_core,解决方法如下:

https://github.com/IntelRealSense/librealsense/issues/2846

sudo modprobe -r uvcvideo
sudo modprobe -r videobuf2_core (imho it unwinds automatically once you release uvcvideo)
sudo modprobe -r videodev

and reapply the patch. 还不行的话就重启。

3.5 TM1-specific(可选的):

In order to accomplish this add the driver's name hid_sensor_custom to /etc/modules file, eg:

echo 'hid_sensor_custom' | sudo tee -a /etc/modules

4、Building librealsense2 SDK

4.1、运行如下命令:

cd ~/librealsense
mkdir build && cd build
cmake ../
cmake ../ -DBUILD_EXAMPLES=true

4.2、重编译并安装 librealsense binaries:

sudo make uninstall && make clean && make && sudo make install

4.3、Install IDE (Optional): We use QtCreator as an IDE for Linux development on Ubuntu * Follow the link for QtCreator5 installation

4.4 运行如下命令验证:

realsense-viewer

大概率是运行不成功的,需要更新firmware,见下文。

5、更新DFU(Device Firmware Update)firmware

这个是教程下载链接,第8-9页: 

https://www.intel.com/content/dam/support/us/en/documents/emerging-technologies/intel-realsense-technology/Linux-RealSense-D400-DFU-Guide.pdf

摘抄如下:

1)添加 Intel server 到 list of repositories:

echo 'deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo xenial main' | sudo tee /etc/apt/sources.list.d/realsense-public.list

2)注册the servers public key:

sudo apt-key adv --keyserver keys.gnupg.net --recv-key 6F3EFCDE

3)刷新资源库安装包列表:

sudo apt-get update

4)安装the intel-realsense-dfu(有星号)包,链接手机热点才安装成功:

sudo apt-get install intel-realsense-dfu*

5)下载最新的D400系列的firmware .bin 文件 (Signed Binary),其中.bin文件下载地址:

https://downloadcenter.intel.com/download/28237/Latest-Firmware-for-Intel-RealSense-D400-Product-Family?v=t

6)将相机连接上电脑,USB3.0接口,输入lsusb,查询对应 “Intel Corp”的bus号和device号:

lsusb

7)升级D400系列的相机固件: 

intel-realsense-dfu –b 002 –d 002 –f –i /home/intel/downloads/Signed_Image_UVC_5_9_2_0.bin

(This command specifies bus #, device #, -f flag to force upgrade, and –i flag for complete system path to downloaded FW.bin file,后面的链接是.bin文件的存放路径)
8)验证firmware:Check firmware with command:

intel-realsense-dfu –p

9)运行如下命令验证:

realsense-viewer

如果还不显示图像,可以重启电脑试一下。

6、ROS包安装

1)Clone the latest Intel® RealSense™ ROS from here into 'catkin_ws/src/',然后编译:

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

2)关于怎么在ROS中调用相机,请看下面链接中的内容

https://github.com/intel-ros/realsense

猜你喜欢

转载自blog.csdn.net/sinat_23853639/article/details/88044019