一、安装Intel® RealSense™ SDK 2.0
Intel® RealSense™ SDK 2.0 的DKMS内核驱动包(librealsense2-dkms)支持Ubuntu LTS内核版本4.4、4.8、4.10、4.13、4.15、4.18、5.0、5.3、5.4。
1.1 查看自己的内核版本:
sudo cat /proc/version
如果非上述版本,需要手动安装和修补版本,请移步官网教程:https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md
本教程不适合你。
1.2 注册服务器公钥:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
如果公钥无法检索,检查并指定代理设置:
export http_proxy="http://<proxy>:<port>"
重新运行该命令。
1.3 将服务器添加到储存库列表
sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u
1.4 安装库
sudo apt-get install librealsense2-dkms
sudo apt-get install librealsense2-utils
上面两行代码将部署librealsense2 udevs规则,构建和激活内核模块、运行库和可执行演示和工具包。
1.5 可选择安装开发人员和调试包:
sudo apt-get install librealsense2-dev
sudo apt-get install librealsense2-dbg
1.6 验证内核是否已经更新:
modinfo uvcvideo | grep "version:"
version后面出现realsense表示更新成功。
1.7 启动realsense-viewer
插入D455相机,可能需要USB3.0及以上接口。启动realsense-viewer:
realsense-viewer
通过界面左侧的选项可以打开imu,双目和rgb相机模块,右上可切换2D、3D界面:
成功!退出realsense-viewer界面。
二、realsense-ros的安装与编译
2.1 创建工作空间
创建工作空间 ,这里~/Packages/RealsenseRos_ws可以自定义路径,但必须包含/src:
mkdir -p ~/Packages/RealsenseRos_ws/src
cd ~/Packages/RealsenseRos_ws/src
2.2 从github上下载realsense-ros并修改指针:
git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/
git checkout `git tag | sort -V | grep -P "^2.\d+\.\d+" | tail -1`
cd ..
2.3 安装ddynamic_reconfigure
初始化工作空间前,最好检查一下ddynamic_reconfigure是否安装。
执行如下命令(注意将melodic改为自己的ROS对应版本,修改“melodic”为"kinect"、"neotic"等等):
sudo apt-get install ros-melodic-ddynamic-reconfigure
否则会出现报错:提示没有ddynamic_reconfigure。
2.4 初始化工作空间
catkin_init_workspace
cd ..
catkin_make clean
2.5 安装源码
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
2.6 添加工作路径到bashrc文件
注意修改~/Packages/RealsenseRos_ws/为自己的路径。
echo "source ~/Packages/RealsenseRos_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
2.7 插上相机并启动相机
插上相机运行
roslaunch realsense2_camera rs_camera.launch
如果出现报错:[camera/realsense2_camera_manager-2]进程已经死亡。报错如下:
/opt/ros/melodic/lib/nodelet/nodelet: symbol lookup error: /home/khz/ROS/catkin_ws/devel/lib//librealsense2_camera.so: undefined symbol: _ZN2cv3MatC1EiiiRKNS_7Scalar_IdEE
[camera/realsense2_camera_manager-2] process has died [pid 4924, exit code 127, cmd /opt/ros/melodic/lib/nodelet/nodelet manager __name:=realsense2_camera_manager __log:=/home/khz/.ros/log/81b1e24a-8f95-11ec-8270-344b50000000/camera-realsense2_camera_manager-2.log].
log file: /home/khz/.ros/log/81b1e24a-8f95-11ec-8270-344b50000000/camera-realsense2_camera_manager-2*.log
[camera/realsense2_camera-3] process has finished cleanly
log file: /home/khz/.ros/log/81b1e24a-8f95-11ec-8270-344b50000000/camera-realsense2_camera-3*.log
如下图:
由于出现提示:未定义标识符undefined symbol: _ZN2cv3MatC1EiiiRKNS_7Scalar_IdEE。猜测是OpenCV库的问题。
解决方案:
首先看看自己有没有安装OpenCV,没有安装请先安装,安装过程略。
如果已经安装,打开realsense-ros的功能包文件夹下 realsense2_camera 文件夹下的 CmakeLists.txt文件,做出如下修改:
添加set(OpenCV_DIR /usr/local/share/OpenCV/)到find_package前(下图11行,注意检查自己OpenCV的路径),添加OpenCV REQUIRED到find_package里(下图26行,注意放在括号里)。
添加${OpenCV_LIBS}到目标链接库里(下图127行)
然后跳回2.5再次安装,完成后执行roslaunch realsense2_camera rs_camera.launch。看到如下图就是启动成功了(有Realsense Node Is Up就行,警告可以忽略)。
2.8 启动RGBD相机
如果是RGBD相机,需启用第二步验证:
roslaunch realsense2_camera rs_rgbd.launch
如果出现报错:
Resource not found: rgbd_launch
ROS path [0]=/opt/ros/melodic/share/ros
ROS path [1]=/home/andyvictory/Packages/RealsenseRos_ws/src
ROS path [2]=/opt/ros/melodic/share
The traceback for the exception was written to the log file
安装RGBD的launch(注意ROS版本):
sudo apt install ros-melodic-rgbd-launch
安装成功!
参考文章:
https://blog.csdn.net/qq_44305475/article/details/123686786?ops_request_misc=&request_id=&biz_id=102&utm_term=d455&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-2-123686786.nonecase&spm=1018.2226.3001.4187https://blog.csdn.net/qq_44305475/article/details/123686786?ops_request_misc=&request_id=&biz_id=102&utm_term=d455&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-2-123686786.nonecase&spm=1018.2226.3001.4187https://blog.csdn.net/robinvista/article/details/115732239?ops_request_misc=&request_id=&biz_id=102&utm_term=d455&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-3-115732239.nonecase&spm=1018.2226.3001.4187https://blog.csdn.net/robinvista/article/details/115732239?ops_request_misc=&request_id=&biz_id=102&utm_term=d455&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-3-115732239.nonecase&spm=1018.2226.3001.4187文章来源:https://www.toymoban.com/news/detail-819076.html
https://blog.csdn.net/qq_40186909/article/details/113104595?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522166312286216782391821994%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=166312286216782391821994&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_ecpm_v1~pc_rank_v39-2-113104595-null-null.142%5Ev47%5Epc_rank_34_2,201%5Ev3%5Econtrol_2&utm_term=realsense%20%E7%9A%84%20D%20%E7%9F%A9%E9%98%B5&spm=1018.2226.3001.4187https://blog.csdn.net/qq_40186909/article/details/113104595?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522166312286216782391821994%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=166312286216782391821994&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_ecpm_v1~pc_rank_v39-2-113104595-null-null.142%5Ev47%5Epc_rank_34_2,201%5Ev3%5Econtrol_2&utm_term=realsense%20%E7%9A%84%20D%20%E7%9F%A9%E9%98%B5&spm=1018.2226.3001.4187文章来源地址https://www.toymoban.com/news/detail-819076.html
到了这里,关于Intel Realsense D455深度相机的标定及使用(一)——安装librealsense SDK2.0以及realsense-ros的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!