首页 > 代码库 > ORB-SLAM2 with Kinect V1

ORB-SLAM2 with Kinect V1

因为手上只有kinect V1 没有V2,而网上关于ORB-SLAM2的实现都是基于Kinect2,最著名的是高博进行实现的 http://www.cnblogs.com/gaoxiang12/p/5161223.html。通过查阅部分资料,用Kinect1实现了ORB-SLAM2,这里总结一下具体步骤。

1.我的系统:

    Ubuntu14.04, ROS indigo,Lenovo Z485, Kinect V1.

 

2. 依赖项安装,参照ORB-SLAM2的Prerequisites (dependencies) 部分

    2.1 Boost

   sudo apt-get install libboost-all-dev

 2.2 ROS  安装的是indigo (http://wiki.ros.org/indigo/Installation/Ubuntu)

 2.3 OpenCV 安装的是OpenCV2.4.11

2.4 g2o
sudo apt-get install libblas-dev
sudo apt-get install liblapack-dev
sudo apt-get install libeigen3-dev
 2.5 DBoW2 (included in Thirdparty)  在ORB-SLAM2的Thirdparty文件夹里面,无需安装。


3. 安装ORB-SLAM2 参照ORB-SLAM2的Installation部分
3.1 下载 git clone https://github.com/raulmur/ORB_SLAM.git (可以直接放在home下,然后解压)
3.2 修改.bashrc,加入
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH_TO_PARENT_OF_ORB_SLAM (红色字体是需要修改的内容,改为ROS文件夹下的ORB-SLAM2路径)
gedit .bashrc
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/zfy/ORB-SLAM2/Examples/ROS (根据需要,红色字体改为对应的路径)
3.3 编译g2o, cd到Thirdparty/g2o/,然后执行:

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
  3.4 编译DBoW2, cd到Thirdparty/DBoW2/,然后执行:           
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make

 4. 安装Kinect V1 驱动

    sudo apt-get install libfreenect-dev
    sudo apt-get install ros-indigo-freenect-launch

 可以通过 roslaunch freenect_launch freenect.launch 验证kinect驱动是否安装成功;
rostopic list查看ORB-SLAM2需要的两个topic: /camera/rgb/image_raw /camera/depth_registered/image_raw


5. 配置launch文件
在解压后的ORB-SLAM2的根目录下新建文件kinect_orbslam2.launch , 其内容为(根据需要,红色字体改为对应的路径,其他的无需修改)
<launch> 
  <param name="orb_use_viewer" value="http://www.mamicode.com/false"/> 
  <node pkg="ORB_SLAM2" type="RGBD" name="ORB_SLAM2" 
        args="/home/zfy/ORB_SLAM2/Vocabulary/ORBvoc.txt 
         /home/zfy/ORB_SLAM2/Examples/RGB-D/TUM1.yaml" cwd="node" output="screen"/> 

  <include file="$(find freenect_launch)/launch/freenect.launch"> 
    <!-- use device registration --> 
    <arg name="depth_registration" value="http://www.mamicode.com/true" /> 
    <arg name="rgb_processing" value="http://www.mamicode.com/true" /> 
    <arg name="ir_processing" value="http://www.mamicode.com/false" /> 
    <arg name="depth_processing" value="http://www.mamicode.com/false" /> 
    <arg name="depth_registered_processing" value="http://www.mamicode.com/true" /> 
    <arg name="disparity_processing" value="http://www.mamicode.com/false" /> 
    <arg name="disparity_registered_processing" value="http://www.mamicode.com/false" /> 
    <arg name="sw_registered_processing" value="http://www.mamicode.com/false" /> 
    <arg name="hw_registered_processing" value="http://www.mamicode.com/true" /> 
  </include> 
</launch> 

6. 运行ORB-SLAM2
cd ORB-SLAM2
./build.sh
roslaunch kinect_orbslam2.launch

结果如下图:
技术分享
 

ORB-SLAM2 with Kinect V1