Ubuntu16.04下使用ros-kinetic与Kinect v2深度相机跑通RGBD-SLAMv2

运行效果:https://www.bilibili.com/video/BV1Po4y1d75V/
由于一些原因需要跑一下视觉slam,跑通了RGBD-SLAMV2,ORB-SLAMV2,RTAB-MAP等开源算法,但在安装运行的过程中也遇到了一些问题,想把它记录下来希望对大家有所帮助。该文章为RGBD-SLAMV2的最新教程,设备为ubuntu16.04,ros-kinetic.以及kineticv2深度相机。
1.ros-kinetic安装
创客智造
2.RGBD-SLAMV2相关驱动安装过程可以借鉴如下链接
编译安装教程1
编译安装教程2
跑通kineticv2相机出现画面后就可以继续安装RGBD-SLAMV2了

3.安装问题与解决方式

在安装软件库与编译过程中如出现电脑卡顿而导致的编译错误,建议加装内存条后再次尝试。本人使用8G内存编译报错,升级16G后无卡顿和报错

  1. 建议新建工作空间并初始化环境变量
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
echo “source ~/catkin_ws/devel/setup.bash” >> ~/.bashrc
source ~/.bashrc
  1. 下载RGBD-SLAM_v2源码
cd ~/catkin_ws/src
git clone https://github.com/felixendres/rgbdslam_v2
  1. 安装g2o
sudo apt-get install cmake libeigen3-dev libsuitesparse-dev libqt4-dev qt4-qmake libqglviewer-dev qt5-qmake
git clone https://github.com/felixendres/g2o
cd g2o
mkdir build
cd build
cmake ..
make -j8
sudo make install
  1. 安装pcl
    下载pcl1.8 https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.0.tar.gz并完成解压
    编译安装
cd pcl-pcl-1.8.0 
mkdir build
cd build
cmake ..
make -j8
sudo make install
  1. 编译RGBDSLAM,修改catkin_ws/src/rgbdslam_v2/cmakelsits文件
    将79行pcl1.7改为pcl1.8
find_package(PCL 1.8 REQUIRED COMPONENTS common io)

在cmakelsits文件的开头或者末尾添加

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  1. 编译 siftgpu,这一步很重要,不进行编译在后续的编译中会存在报错
cd ~/catkin_ws/src/rgbdslam_v2/external/SiftGPU
sudo apt-get install libglew-dev
sudo apt-get install libdevil1c2 libdevil-dev
make

7删除特定文件后编译

请将catkin_ws/src/rgbdslam_v2/下cmake-modules文件中的文件删除干净后再进行catkin_make编译
删除

  1. 编译安装
cd ~/catkin_ws
catkin_make
  1. 建立rgbdslam_kinect2.launch文件
cd ~/catkin_ws/src/rgbdslam_v2/launch
touch rgbdslam_kinect2.launch
gedit rgbdslam_kinect2.launch
<launch> 
<node pkg="rgbdslam" type="rgbdslam" name="rgbdslam" cwd="node" required="true" output="screen"> 
 
<!-- Input data settings-->
 <param name="config/topic_image_mono"              value="/kinect2/qhd/image_color_rect"/> 
<param name="config/camera_info_topic"             value="/kinect2/qhd/camera_info"/>
 <param name="config/topic_image_depth"             value="/kinect2/qhd/image_depth_rect"/> 
<param name="config/topic_points"                  value=""/> <!--if empty, poincloud will be reconstructed from image and depth --> 
 
<!-- These are the default values of some important parameters --> 
<param name="config/feature_extractor_type"        value="ORB"/><!-- also available: SIFT, SIFTGPU, SURF, SURF128 (extended SURF), ORB. --> 
<param name="config/feature_detector_type"         value="ORB"/><!-- also available: SIFT, SURF, GFTT (good features to track), ORB. --> 
<param name="config/detector_grid_resolution"      value="3"/><!-- detect on a 3x3 grid (to spread ORB keypoints and parallelize SIFT and SURF) --> 
<param name="config/optimizer_skip_step"           value="15"/><!-- optimize only every n-th frame -->
 <param name="config/cloud_creation_skip_step"      value="2"/>
 
<!-- subsample the images' pixels (in both, width and height), when creating the cloud (and therefore reduce memory consumption) -->
 <param name="config/backend_solver"                value="csparse"/><!-- pcg is faster and good for continuous online optimization, cholmod and csparse are better for offline optimization (without good initial guess)--> <param name="config/pose_relative_to"              value="first"/><!-- optimize only a subset of the graph: "largest_loop" = Everything from the earliest matched frame to the current one. Use "first" to optimize the full graph, "inaffected" to optimize only the frames that were matched (not those inbetween for loops) --> 
<param name="config/maximum_depth"           value="2"/> <param name="config/subscriber_queue_size"         value="20"/> 
<param name="config/min_sampled_candidates"        value="30"/><!-- Frame-to-frame comparisons to random frames (big loop closures) -->
 <param name="config/predecessor_candidates"        value="20"/><!-- Frame-to-frame comparisons to sequential frames--> 
<param name="config/neighbor_candidates"           value="20"/><!-- Frame-to-frame comparisons to graph neighbor frames--> 
<param name="config/ransac_iterations"             value="140"/> 
<param name="config/g2o_transformation_refinement"           value="1"/> 
<param name="config/icp_method"           value="icp"/> <!-- icp, gicp ... --> <!--
<param name="config/max_rotation_degree"           value="20"/>
<param name="config/max_translation_meter"           value="0.5"/>
<param name="config/min_matches"           value="30"/>   
<param name="config/min_translation_meter"           value="0.05"/>
<param name="config/min_rotation_degree"           value="3"/>
<param name="config/g2o_transformation_refinement"           value="2"/>
<param name="config/min_rotation_degree"           value="10"/>
<param name="config/matcher_type"         value="SIFTGPU"/>
 --> 
</node> 
</launch>

4.启动SLAM

RGBD-SLAMV2启动指令
roslaunch rgbdslam rgbdslam_kinect2.launch
roslaunch kinect2_bridge kinect2_bridge.launch
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

_cv_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值