详细的安装过程见我的另一篇博客Ubuntu18.04 —— 安装环境及运行Vins_mono(2022年)
git clone http://github.com/ethz-asl/kindr
cd kindr
mkdir build && cd build
cmake ..
sudo make install
由于ROVIO是在ROS下运行。因此需要先创建一个ros工程
mkdir -p ~/rovio_ws/src
cd ~/rovio_ws/src
catkin_init_workspace
cd ..
catkin_make
source devel/setup.bash //将对应的工作空间的路径加入环境变量ROS_PACKAGE_PATH中
echo $ROS_PACKAGE_PATH //查看当前环境变量
进入src目录下载rovio源码
并安装lightweight_filtering
cd ~/rovio_ws/src
git clone http://github.com/ethz-asl/rovio
cd rovio
git submodule update --init --recursive //下载子模块lightweight_filtering
cd ~/rovio_ws
catkin_make rovio --cmake-args -DCMAKE_BUILD_TYPE=Release -DMAKE_SCENE=ON
catkin_make
如果在运行的时候,提示找不到一个S开头的头文件,在rovio/Cmakelist 中最后加上 add_dependencies(rovio rovio_gencpp)
详细的安装过程见我的另一篇博客Ubuntu 18.04 ——— VIO算法评测工具EVO的安装与使用
Euroc数据集:数据集采用MH_01_easy.bag。
在rovio_ws工作空间下
打开terminal运行
source ./devel/setup.bash
roslaunch rovio rovio_node.launch
重新在你数据集的存放路径下
新打开一个terminal运行
rosbag play MH_01_easy.bag
或者修改rovio/launch/rovio_rosbag_node.launch中的的filename参数,将其改为实际rosbag的目录
<param name="rosbag_filename" value="your path/MH_01_easy.bag"/>
在工作空间rovio_ws下
打开新terminal运行
source ./devel/setup.bash
roslaunch rovio rovio_rosbag_node.launch
在Rovio_Node.hpp
中,定义一个ofstream类,然后在发送IMU位姿上面,将这八个数据(时间戳,p的xyz,q的xyzw)保存到自己设定路径下的.txt文件中。
首先在开头添加头文件
#include
#include
在第670行 imuOutputCT_.transformState(state,imuOutput_);后添加代码
std::ofstream out_pose("/你的保存路径/rovio_traj.txt",std::ios::app);//save pose
//std::ofstream out_pose("/home/sfann/output/rovio_traj.txt",std::ios::app);//本次保存的路径
out_pose << ros::Time(mpFilter_->safe_.t_) << " "
<< imuOutput_.WrWB()(0) << " "
<< imuOutput_.WrWB()(1) << " "
<< imuOutput_.WrWB()(2) << " "
<< imuOutput_.qBW().x() << " "
<< imuOutput_.qBW().y() << " "
<< imuOutput_.qBW().z() << " "
<< -imuOutput_.qBW().w()
<< std::endl;
cd ~/rovio_ws
catkin_make rovio --cmake-args -DCMAKE_BUILD_TYPE=Release -DMAKE_SCENE=ON
catkin_make
source ./devel/setup.bash
roslaunch rovio rovio_node.launch
rosbag play MH_01_easy.bag
bag播放完后,需要按ctrl+c退出,才能保存地图。
打开数据集中文件夹中的mav0/state_groundtruth_estimate0/文件夹
,会发现有一个文件:
data.csv
。这是一个euroc格式的文件,我们首先要把他转成tum格式
。输入以下命令:
evo_traj euroc data.csv --save_as_tum
把你的rovio轨迹文件和真实值
放在同一文件夹下 打开terminal输入
evo_traj tum --ref=data.tum rovio_traj.txt -va -s -p --plot_mode=xy
结果:
sfann@sfann-virtual-machine:~$ evo_traj tum --ref=/home/sfann/catkin_ws/MH_01_easy/mav0/state_groundtruth_estimate0/data.tum rovio_traj.csv -va -s -p --plot_mode=xy
--------------------------------------------------------------------------------
Loaded 3680 stamps and poses from: rovio_traj.csv
Loaded 36382 stamps and poses from: /home/sfann/catkin_ws/MH_01_easy/mav0/state_groundtruth_estimate0/data.tum
--------------------------------------------------------------------------------
Found 3638 of max. 3680 possible matching timestamps between...
reference
and: rovio_traj.csv
..with max. time diff.: 0.01 (s) and time offset: 0.0 (s).
--------------------------------------------------------------------------------
Aligning rovio_traj.csv to reference.
Aligning using Umeyama's method... (with scale correction)
Rotation of alignment:
[[ 0.96110465 0.27421674 -0.03290934]
[-0.27429325 0.96164345 0.00225517]
[ 0.03226546 0.00685936 0.9994558 ]]
Translation of alignment:
[ 4.75225979 -1.72884375 0.977417 ]
Scale correction: 0.978972578668
--------------------------------------------------------------------------------
name: rovio_traj
infos:
duration (s) 181.85000014305115
nr. of poses 3638
path length (m) 84.51317253
pos_end (m) [ 4.61313081 -2.68249177 0.45436378]
pos_start (m) [ 4.74818183 -1.70234231 0.68451628]
t_end (s) 1403636762.7135556
t_start (s) 1403636580.8635554
--------------------------------------------------------------------------------
name: data
infos:
duration (s) 181.90499997138977
nr. of poses 36382
path length (m) 80.6262118473
pos_end (m) [ 4.572531 -1.942023 0.61962 ]
pos_start (m) [ 4.688319 -1.786938 0.783338]
t_end (s) 1403636762.7435555
t_start (s) 1403636580.8385556