Ubuntu16.04 ros kinetic 使用奥比中光深度相机安装并运行rgbd-slam v2

本文记录一下在Ubuntu16.04 ros kinetic 下使用奥比中光深度相机进行测试rgbd-slam v2的一些过程。
如果你参考的是其他人的博客(大部分),大都是去git clone 作者的源码,然后下载编译eigen、g2o、pcl、、、、,然后发现各种错误,然后又各种修改,,然后又各种错误、、、、、、、、
当然,成功也是会成功的。只不过,,,,,,,作者给我们写了一个安装文件,直接安装就行了。对,就这么简单。。。。。。。。

1、准备工作

Ubuntu16.04+ros-kinetic
这个的安装去网上搜,我就不写了。注意一点,因为我们是需要接传感器的,所以别在虚拟机里面做这一套,要么双系统,要么Ubuntu系统。
奥比中光驱动安装以及bug解决,可以参考他人的博客,也可以参考我的。https://blog.csdn.net/Numberors/article/details/105637209

2、在ros中安装rgbd-slam v2

前面我说过了,作者给我们写了个安装文件,不需要我们再一步一步去安装那么麻烦了,作者的GitHub链接:
https://github.com/felixendres/rgbdslam_v2

你会发现有一个文件名字是:install.sh
你把他下载下来,然后在你下载的路径处打开终端,输入:

bash install.sh

然后终端提示你敲回车之类的,等待自动安装与编译完成(这个过程最好确认你的网络保持健康状态)。结束后会在这个目录下生成一个“Code”文件夹,这就是orb-slam2的整个工程。

3、数据集测试

下载数据集测试,网址:
https://vision.in.tum.de/data/datasets/rgbd-dataset/download#freiburg1_xyz
下载.bag后缀的文件。
如果网络不好的话,我把其上传在网盘里了:
链接:https://pan.baidu.com/s/1mb4FeVEI35qy5k-3sTsXlQ
提取码:xbht
接下来去到rgbd-slam v2里面找到launch文件,需要修改一些地方,我直接贴出来,也可以把我给的当作你的数据集测试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="/camera/rgb/image_color"/> 
    <param name="config/topic_image_depth"             value="/camera/depth/image"/>
    <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/max_keypoints"                 value="600"/><!-- Extract no more than this many keypoints -->
    <param name="config/max_matches"                   value="300"/><!-- Keep the best n matches (important for ORB to set lower than max_keypoints) -->
    <param name="config/min_sampled_candidates"        value="4"/><!-- Frame-to-frame comparisons to random frames (big loop closures) -->
    <param name="config/predecessor_candidates"        value="4"/><!-- Frame-to-frame comparisons to sequential frames-->
    <param name="config/neighbor_candidates"           value="4"/><!-- Frame-to-frame comparisons to graph neighbor frames-->
    <param name="config/ransac_iterations"             value="100"/>
    <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/cloud_display_type"            value="POINTS"/><!-- Show pointclouds as points (as opposed to TRIANGLE_STRIP) -->
    <param name="config/pose_relative_to"              value="largest_loop"/><!-- 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/backend_solver"                value="pcg"/><!-- pcg is faster and good for continuous online optimization, cholmod and csparse are better for offline optimization (without good initial guess)-->
    <param name="config/optimizer_skip_step"           value="1"/><!-- optimize only every n-th frame -->
  </node>
</launch>
    

先启动rgbd的launch文件,再启动相机的launch文件,再rosbag play ****.bag就可以看到数据集的测试效果。
在rgbd-slam2的界面顶部菜单栏,可以点击save,保存为point_cloud,默认的保存地址是code/rgbdslam_catkin_ws/devel/lib/rgbdslam路径下。
接着,在该路劲下输入:rosrun pcl_ros pcd_to_pointcloud quicksave.pcd
终端输入:rviz
然后在rviz中选择fixed frame为base_link,add中选择point_cloud2,topic中选择/cloud_pcd,
然后就可以显示你刚刚跑出的点云。

4、奥比中光摄像头来进行测试

在rgbdslam的launch文件夹下新添一个launch文件,内容如下:

<!-- This file shows the most important parameters in their default settings,
     to make them easily available for beginners.
     The openni driver has to be started seperately, e.g. with "roslaunch openni_launch openni.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="/camera/rgb/image_raw"/> 
 <param name="config/topic_image_depth"             value="/camera/depth/image"/> 
 <param name="config/camera_info_topic"             value="/camera/depth/camera_info"/>

<remap from="/camera/depth/camera_info" to="/camera/depth/camera_info"/>
<remap from="/camera/rgb/camera_info" to="/camera_info"/>

<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"           vawlue="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>

启动顺序还是,rgbdslam的launch文件,然后相机的launch文件,即可看到结果。

你可能感兴趣的:(Ubuntu16.04 ros kinetic 使用奥比中光深度相机安装并运行rgbd-slam v2)