接下来我们来启动演示一下:
roslaunch mbot_gazebo mbot_laser_nav_gazebo.launch
roslaunch mbot_navigation hector_demo.launch
roslaunch mbot_teleop mbot_teleop.launch
效果如下:
但是这种方法如果机器人运动的速度过大的话就会使得建图出现偏差。建图过程中特征点比较多的话,建图效果会比较好。
Cartographer功能包:
这个功能包是2016年10月5日谷歌开源的基于图网络的优化方法,是一种二维或三维条件下的定位及建图功能,设计的目的是在计算资源有限的情况下,实时获取相对较高精度的2D地图,主要是基于激光雷达,后面会支持更多传感器和机器人平台,同时不断增加新的功能。
安装:
安装工具:
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build
创建一个名字为google_ws的文件夹作为我们的工作空间:
wstool init src wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall wstool update -t src
上面第二步可能会有网络问题,我们可以到src目录下面ctrl+h打开隐藏文件夹,修改里面第三个包的下载地址: https://github.com/ceres-solver/ceres-solver.git
下载功能包:
src/cartographer/scripts/install_proto3.sh
lsb_release -a
查看自己的ubuntu版本号:
rosdep update rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y --os=ubuntu:xenial
这里我之前由于没有加后面这个os报错如下,加了之后就没有了:
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
cartographer: No definition of [eigen] for OS version []
ceres-solver: No definition of [eigen] for OS version []
编译功能包:
catkin_make_isolated --install --use-ninja source install_isolated/setup.bash #当前终端有效
接下来我们可以演示一下效果:
下载 2D SLAM Demo:
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
启动 2D SLAM Demo:
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag
下载 3D SLAM Demo:
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/with_intensities/b3-2016-04-05-14-14-00.bag
启动 3D SLAM Demo:
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/b3-2016-04-05-14-14-00.bag
下载PR2 Demo:
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/pr2/2011-09-15-08-32-46.bag
启动PR2 :
roslaunch cartographer_ros demo_pr2.launch bag_filename:=~/Downloads/
2011-09-15-08-32-46.bag
ORB_SLAM功能包
基于特征点的实时单目SLAM系统,实时解算摄像机的移动轨迹,构建三维点云地图,不仅适用与手持设备获取的一组连续图像,也可以应用于汽车行驶过程中获取的连续图像。
安装:
安装工具&下载源码:
sudo apt-get install libboost-all-dev libblas-dev liblapack-dev
git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
安装eigen3.2
去官网下载:http://eigen.tuxfamily.org/index.php?title=Main_Page
解压源码包,并进入目录:
mkdir build
cd build
cmake ..
make
sudo make install
编译安装Pangolin
sudo apt-get install libglew-dev
sudo apt-get install libboost-dev libboost-thread-dev libboost-filesystem-dev
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build
cd build
cmake ..
cmake --build .
编译g2o:
cd ~/ORB_SLAM2/Thirdparty/g2o/
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
编译DBoW2:
cd ~/ORB_SLAM2/Thirdparty/DBoW2/
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
编译ORM_SLAM:
cd ~/ORB_SLAM2
chmod +x build.sh
./build.sh
在make -j4这一步的时候,如果你遇到了error: ‘usleep’ was not declared in this scope,这种问题的话,你需要找到出错的文件,添加头文件:
#include
Examples/Monocular/mono_euroc.cc Examples/Monocular/mono_kitti.cc Examples/Monocular/mono_tum.cc Examples/RGB-D/rgbd_tum.cc Examples/Stereo/stereo_euroc.cc Examples/Stereo/stereo_kitti.cc src/LocalMapping.cc src/LoopClosing.cc src/System.cc src/Tracking.cc src/Viewer.cc
爆炸,我之前装的是opencv3,装不上去,不想卸载,也不想装两个版本opencv,以后再说。
https://github.com/raulmur/ORB_SLAM2
我的微信公众号名称:深度学习与先进智能决策
微信公众号ID:MultiAgent1024
公众号介绍:主要研究强化学习、计算机视觉、深度学习、机器学习等相关内容,分享学习过程中的学习笔记和心得!期待您的关注,欢迎一起学习交流进步!