1.首先,安装ceres依赖项,然后下载编译安装ceres
git clone https://github.com/ceres-solver/ceres-solver
cd ceres
mkdir build
cd build
cmake ..
make
sudo make install
安装依赖项
sudo apt-get install libdw-dev
在编译之前我们先注意三个问题,避免入坑
(1)全局安装ceres库,code_imu依赖ceres。
(2)code_utils和imu_utils有先后顺序,不能放在一起编译,具体的操作是:
不要同时把imu_utils和code_utils一起放到src下进行编译。由于imu_utils 依赖 code_utils,所以先把code_utils放在工作空间的src下面,进行编译。
然后再将imu_utils放到src下面,再编译。否则会报如下错误:
Could not find a package configuration file provided by "code_utils" with
any of the following names:
code_utilsConfig.cmake
code_utils-config.cmake
Add the installation prefix of "code_utils" to CMAKE_PREFIX_PATH or set
"code_utils_DIR" to a directory containing one of the above files. If "code_utils" provides a separate development package
or SDK, be sure it has been installed.
下面开始进行编译!
2.下载code_utils并编译
cd ~/catkin_ws/src
git clone https://github.com/gaowenliang/code_utils
cd ~/catkin_ws
catkin_make
这里会报错:fatal error: backward.hpp: 没有那个文件或目录,修改办法: 在code_utils的CMakeLists.txt中加入包含路径:
include_directories( "include/code_utils") ,然后继续进行: catkin_make
3. 上一步骤编译成功以后,再把imu_utils放到工作空间的src下面,进行编译
cd ~/catkin_ws/src
git clone https://github.com/gaowenliang/imu_utils.git
cd ~/catkin_ws
catkin_make
4.录制imu.bag
让IMU静止不动两个小时,录制IMU的bag.
cd MYNT-EYE-D-SDK
source wrappers/ros/devel/setup.bash
roslaunch mynteye_wrapper_d display.launch
rosbag record /mynteye/imu/data_raw -O imu.bag
5. 标定IMU
rosbag play -r 200 imu_utils/imu.bag //(这里要写你录制的包的路径)
cd imu_ws
source ./devel/setup.bash
roslaunch imu_utils mynt_imu.launch
注意这里的launch文件,我用的是小觅相机,所以imu.launch的内容为:
<launch>
<node pkg="imu_utils" type="imu_an" name="imu_an" output="screen">
<param name="imu_topic" type="string" value= "/mynteye/imu/data_raw"/> #imu topic 名字
<param name="imu_name" type="string" value= "mynteye"/>
<param name="data_save_path" type="string" value= "$(find imu_utils)/data/"/>
<param name="max_time_min" type="int" value= "30"/> #标定时长,到时长才会停止
<param name="max_cluster" type="int" value= "100"/>
</node>
</launch>
6. 结果转换
最后结果输出到 imu_util/data/mynteye_imu_param.yaml
%YAML:1.0
---
type: IMU
name: mynteye
Gyr:
unit: " rad/s"
avg-axis:
gyr_n: 1.9480242194900136e-03
gyr_w: 2.2620050177053397e-05
x-axis:
gyr_n: 1.4943337644865377e-03
gyr_w: 1.6979123891120051e-05
y-axis:
gyr_n: 2.8556505698921365e-03
gyr_w: 3.8869840774243172e-05
z-axis:
gyr_n: 1.4940883240913672e-03
gyr_w: 1.2011185865796957e-05
Acc:
unit: " m/s^2"
avg-axis:
acc_n: 2.1870816125420644e-02
acc_w: 3.1961985711386886e-04
x-axis:
acc_n: 2.1689606568187404e-02
acc_w: 3.2513933860140864e-04
y-axis:
acc_n: 2.3148960398654196e-02
acc_w: 3.3709366869493846e-04
z-axis:
acc_n: 2.0773881409420332e-02
acc_w: 2.9662656404525953e-04
输出 imu.yaml, 为后续相机-IMU标定准备文件
rostopic: /mynteye/imu/data_raw
update_rate: 200.0 #Hz
accelerometer_noise_density: 2.1870816125420644e-02 #continous
accelerometer_random_walk: 3.1961985711386886e-04
gyroscope_noise_density: 1.9480242194900136e-03 #continous
gyroscope_random_walk: 2.2620050177053397e-05