VIO第二讲 allen方差工具
1.先安装ceres依赖库,如果在学十四讲的时候装了就不用管这一步
git clone https://github.com/ceres-solver/ceres-solver
cd ceres
mkdir build
cd build
cmake ..
make
sudo make install
如果遇到了ceres的安装问题,见前面的博客https://blog.csdn.net/qq_28901541/article/details/89605525
2.下载code_utils
cd ~/catkin_ws/src
git clone https://github.com/gaowenliang/code_utils
cd ~/catkin_ws
catkin_make
这里会报一个路径错误,github的issue里面提供了解决办法
code_utils-master/src/sumpixel_test.cpp:2:24: fatal error: backward.hpp: 没有那个文件或目录 compilation terminated
解决办法:
这个sumpixel_test.hpp 里可以直接换成:
#include "code_utils/backward.hpp"
或者在CMakeLists.txt中加入包含路径:
include_directories( "include/code_utils")
然后重新
catkin_make`
3 下载编译imu_utils
cd ~/catkin_ws/src
git clone https://github.com/gaowenliang/imu_utils
cd ~/catkin_ws
catkin_make
4 下载vio_data_simulation-ros_version
cd ~/catkin_ws/src
git clone https://github.com/HeYijia/vio_data_simulation/tree/ros_version
在vio_data_simulation/src/gener_alldata.cpp中修改生成的imu.bag的文件路径
将bag.open("/home/hyj/all_ros_ws/vio_sim_data_ws/src/data/imu.bag", rosbag::bagmode::Write);中的路径替换成自己的
进行编译
cd ~/catkin_ws
catkin_make
此处可能会提示cv-bridge.h找不到,自己到github去下一个cv-bridge进行安装
环境变量
source ./devel/setup.bash
这儿可能用source devel/setup.bash依然会报找不到功能报的错误,所以加上./
自此生成了一个节点,可以生成一个imu.bag的包
运行
roscore
cd ~/catkin_ws/devel/lib/vio_data_simulation
rosrun vio_data_simulation vio_data_simulation_node
运行完之后生成了imu.bag的包(模拟imu的采集数据)
写一个launch文件
写一个launch文件imu.launch放在imu_utils/launch文件夹中
内容如下
<launch><node pkg="imu_utils" type="imu_an" name="imu_an" output="screen"><param name="imu_topic" type="string" value= "/imu"/><param name="imu_name" type="string" value= "imutest"/><param name="data_save_path" type="string" value= "$(find imu_utils)/data/"/><param name="max_time_min" type="int" value= "120"/><param name="max_cluster" type="int" value= "100"/></node>
</launch>
再运行
rosbag play -r 200 imu.bag
roslaunch imu_utils imu.launch
生成的数据在imu_utils/data文件夹下,总共有16个txt文件
再用matlab去画这些方差图,程序在imu_utils/scripts下
如果ubuntu没装matlab,可以把这程序和txt文件放到windows下的matlab去运行
draw_allan.m的运行后的结果如下,注意改里头的路径和文件名字
中值积分代码
其实有个小bug没考虑到,读者可以自己加上:
判断i+1帧数据是不是最后一帧数据,如果是,就break,否则继续