SVO代码调试

SVO  https://github.com/uzh-rpg/rpg_svo  Paper: http://rpg.ifi.uzh.ch/docs/ICRA14_Forster.pdf

虽然是14年就出来的了,时间久远,但是是半直接法的代表作之一,代码逻辑清晰,可读性强,因此值得研究.

废话不多说,下面说明编译运行过程https://github.com/uzh-rpg/rpg_svo/wiki

(1)ROS安装

我用的是ubuntu14.04 的ros版本,安装方式之前的博客有介绍,就不多说了

(2)Sophus

cd SVO
git clone https://github.com/strasdat/Sophus.git
cd Sophus
mkdir build
cd build
cmake ..
make -j4
sudo make install

(3)Fast - Corner Detector

cd SVO
git clone https://github.com/uzh-rpg/fast.git
cd fast
mkdir build
cd build
cmake ..
make -j4

(4)G2O安装

cd SVO
wget https://github.com/RainerKuemmerle/g2o/archive/20160424_git.tar.gz -O g2o-20160424_git.tar.gz
tar xvzf g2o-20160424_git.tar.gz
cd g2o-20160424_git
mkdir build
cd build
cmake ..
make -j4
sudo make install

(5)源码下载编译 

cd SVO
mkdir -p catkin_ws/src
cd catkin_ws/src
git clone https://github.com/uzh-rpg/rpg_vikit.git
cd catkin_ws/src
git clone https://github.com/uzh-rpg/rpg_svo.git
cd ..
catkin_make

如果使用G2O 编译出现g2o::BlockSolver_6_3 * solver_ptr 之类的问题,可以这样解决

// g2o::BlockSolver_6_3 * solver_ptr = new g2o::BlockSolver_6_3(linearSolver);
// g2o::OptimizationAlgorithmLevenberg * solver = new g2o::OptimizationAlgorithmLevenberg(solver_ptr);
替换为:
g2o::BlockSolver_6_3* solver_ptr = new g2o::BlockSolver_6_3( std::unique_ptr<g2o::BlockSolver_6_3::LinearSolverType>(linearSolver) );
g2o::OptimizationAlgorithmLevenberg* solver = new g2o::OptimizationAlgorithmLevenberg(std::unique_ptr<g2o::BlockSolver_6_3>(solver_ptr) );

如果还是出错,那么可能是之前安装过G2O,使得版本有问题,那么就先不用G2O吧,原因后面再找,先编译通过再说,在rpg_svo/svo中:

SET(HAVE_G2O FALSE) 

添加环境变量

sudo gedit ~/.bashrc
在尾部添加:
source ~/SVO/catkin_ws/devel/setup.bash
然后:
source ~/.bashrc

(6)运行https://github.com/uzh-rpg/rpg_svo/wiki/Run-SVO-with-ROS

打开三个终端,注意最后一个数据集的路径
roslaunch svo_ros test_rig3.launch
rosrun rviz rviz -d /home/hahaha/SVO/catkin_ws/src/rpg_svo/svo_ros/rviz_config.rviz
rosbag play ./data/airground_rig_s3_2013-03-18_21-38-48.bag

(7)结果,还可以啦,嘿嘿!

猜你喜欢

转载自blog.csdn.net/qq_38589460/article/details/82873405