前言
imu_utils是一个用于分析IMU性能的ROS工具包。
参考资料
- Allan Variance: Noise Analysis for Gyroscopes
- vectornav gyroscope
- An introduction to inertial navigation
安装
首先,安装依赖:
sudo apt-get install libdw-dev
作者在README.md中的编译步骤为:
- download required code_utils;
- put the ROS package imu_utils and code_utils into your workspace, usually named catkin_ws;
- cd to your workspace, build with catkin_make;
但是,如果这样操作,会编译出错。查了一下,需要先编译code_utils
,然后再编译imu_utils
,不能同时编译,应该是依赖问题。
正确的编译步骤:
mkdir -p imu-calibration/src
cd imu-calibration/src
git clone https://github.com/gaowenliang/code_utils.git
cd ..
catkin_make
cd imu-calibration/src
git clone https://github.com/gaowenliang/imu_utils.git
cd ..
catkin_make
可能出现的Error
当然,还有可能遇到一些错误。
错误1:找不到Eigen
我们一般通过以下命令安装Eigen:
sudo apt-get install libeigen3-dev
这样Eigen就默认安装在/usr/include/eigen3
,需要在/home/jlg/imu-calibration/src/code_utils/CMakeLists.txt
中注释掉find_package(Eigen3 REQUIRED)
,然后添加:
include_directories(/usr/include/eigen3)
错误2:找不到backward.hpp
atal error: backward.hpp: No such file or directory
把文件code_utils/srcsumpixel_test.cpp
中的#include "backward.hpp"
改成#include "code_utils/backward.hpp"
即可。
错误3:std::ofstream
未定义
/home/***/imu-calibration/src/imu_utils/src/imu_an.cpp:69:19: error: aggregate ‘std::ofstream out_t’ has incomplete type and cannot be defined
打开文件imu_utils/src/imu_an.cpp
,添加:
#include <fstream>
运行
1.采集IMU数据
在 IMU 静止时收集数据,持续两小时。
2.播放数据
rosbag play -r 200 imu_A3.bag
作者提供了5个IMU数据集,可以先测试一下。
3.启动节点
roslaunch imu_utils A3.launch
注意launch文件:
<launch>
<node pkg="imu_utils" type="imu_an" name="imu_an" output="screen">
<param name="imu_topic" type="string" value= "/djiros/imu"/>
<param name="imu_name" type="string" value= "A3"/>
<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>
要根据自己的IMU,修改imu_topic
和imu_name
。
4.样例
我使用的imu_16448.bag
,结果保存在imu_utils/data/16448_imu_param.yaml
,对于其他 txt 文件,可以用imu_utils/scripts
中的Matlab脚本绘图。
%YAML:1.0
type: IMU
name: “16448”
Gyr:
unit: rad/s
avg-axis:
gyr_n: 2.5540703819967830e-03
gyr_w: 7.3979547257109791e-05
x-axis:
gyr_n: 2.5732073264841159e-03
gyr_w: 7.9169715719978401e-05
y-axis:
gyr_n: 2.5490825380843534e-03
gyr_w: 6.8388779942953886e-05
z-axis:
gyr_n: 2.5399212814218798e-03
gyr_w: 7.4380146108397072e-05
Acc:
unit: " m/s^2"
avg-axis:
acc_n: 2.7851422418165215e-02
acc_w: 1.2053367145964710e-03
x-axis:
acc_n: 2.6671201438493906e-02
acc_w: 9.3260697511083528e-04
y-axis:
acc_n: 3.2016249942269592e-02
acc_w: 1.8349143250976515e-03
z-axis:
acc_n: 2.4866815873732146e-02
acc_w: 8.4848884358092636e-04