Ubuntu 16.04安装realsense D435i SDK以及realsense-ros
先直接上一个报错信息,折腾了半天才解决
在使用catkin_make编译realsense-ros时,报错
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 4 packages in topological order:
-- ~~ - realsense_camera_msgs (plain cmake)
-- ~~ - ddynamic_reconfigure
-- ~~ - realsense2_camera (plain cmake)
-- ~~ - realsense2_node (plain cmake)
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkin_workspace.cmake:95 (message):
This workspace contains non-catkin packages in it, and catkin cannot build
a non-homogeneous workspace without isolation. Try the
'catkin_make_isolated' command instead.
Call Stack (most recent call first):
CMakeLists.txt:67 (catkin_workspace)
-- Configuring incomplete, errors occurred!
解决方案
在下载完realsense-ros源码后,不要运行以下两行指令
cd realsense-ros/realsense2_camera
git checkout `git tag | sort -V | grep -P "^\d+\.\d+\.\d+" | tail -1`
直接进行后续的指令,问题解决。
下面就是正常安装realsense D435i SDK以及realsense-ros的步骤
1. 安装librealsense
- 下载源码(指定2.24.0版本,为了与realsense-ros版本匹配)
git clone -b v2.24.0 https://github.com/IntelRealSense/librealsense.git
- 安装依赖(拔掉realsense连接)
sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
sudo apt-get install libglfw3-dev
- 安装realsense所需的内核模块
cd librealsense
./scripts/setup_udev_rules.sh
./scripts/patch-realsense-ubuntu-lts.sh
#这一条命令执行会比较慢,我是配置了Ubuntu终端*因此速度快一些
- 编译安装
mkdir build && cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=true
sudo make uninstall && make clean && make -j8 && sudo make install
- 测试
#打开终端输入以下指令
realsense-viewer
到此librealsense安装完成
2. 安装realsense-ros
- 创建ros工作空间
mkdir -p ~/realsense_ws/src && cd ~/realsense_ws/src
- 下载源码并检查依赖(指定2.2.7版本,与librealsense版本匹配)
git clone -b 2.2.7 https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/realsense2_camera
git checkout `git tag | sort -V | grep -P "^\d+\.\d+\.\d+" | tail -1`
sudo apt-get install ros-kinetic-ddynamic-reconfigure
- 编译
cd ~/realsense_ws
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
echo "source ~/realsense_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
- 测试
roslaunch realsense2_camera rs_camera.launch
rostopic list
#查看话题列表
rviz
#打开rviz订阅几个节点就可以看到效果
到此realsense-ros安装完成,所有关于realsense的驱动都已经安装完了
上一篇: 跑通hdl_graph_slam开源算法
下一篇: 第一讲作业 预备知识