最近因为做融合定位,需要对IMU进行标定所以了解了下标定的程序。但是网上的教程基本上都或多或少有点问题没法,在我自己把坑趟完后,做个总结给后来者一个方便。
sudo apt-get install libdw-dev
如果说没有安装过那直接去搜索ceres的安装方法全局安装即可,若是自定义装那么对于cmakelist.txt ,则需要注意加入
#由于我ceres版本较高所以需要C++17
set(CMAKE_CXX_FLAGS "-std=c++17")
set(THIRD_PATH_HOME_PATH /usr/local/third_party)#定义你的路径
#find_package(Ceres REQUIRED)#注释掉
include_directories(
${THIRD_PATH_HOME_PATH}/x64/include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
)#加入头文件
target_link_libraries(pnp ${Boost_LIBRARIES} ${OpenCV_LIBS} ${THIRD_PATH_HOME_PATH}/x64/lib/ceres)#加入lib
创建一个文件夹catkin_ws,内部创建子文件夹src,用来作为编译源码
cd src
git clone https://github.com/gaowenliang/code_utils
cd ..
catkin_make #编译这个空间
编译完成后进行下一步,若有错误找到cmakelist.txt 的31行做如下修改
include_directories("include" "include/code_utils")
完成上一步后,将这个文件夹放入src中,如果所有库都是全局安装的那应该不需要怎么进行修改,如果报错
make[2]: *** [imu_utils-master/CMakeFiles/imu_an.dir/build.make:181:/media/sunmc/My Passport/catkin_ws/devel/lib/imu_utils/imu_an] 错误 1
make[1]: *** [CMakeFiles/Makefile2:462:imu_utils-master/CMakeFiles/imu_an.dir/all] 错误 2
make: *** [Makefile:141:all] 错误 2
Invoking "make -j16 -l16" failed
那么需要在cmakelist.txt中做如下处理
set(BOOST_LINK_LIBS "-lboost_system -lboost_signals")#加入34行左右
target_link_libraries(imu_an ${BOOST_LINK_LIBS})#加入这个在57行左右
如果自定义了ceres位置等则需要如下修改,同时如果有以上报错也需要进行上述修改
set(CMAKE_CXX_FLAGS "-std=c++17")#6行
set(THIRD_PATH_HOME_PATH /usr/local/third_party)#9行
#find_package(Ceres REQUIRED)#注释掉ceres
include_directories(
${THIRD_PATH_HOME_PATH}/x64/include/
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
)#28行
link_directories(
${THIRD_PATH_HOME_PATH}/x64/lib/boost
${THIRD_PATH_HOME_PATH}/x64/lib/protobuf
${THIRD_PATH_HOME_PATH}/x64/lib/glog
${THIRD_PATH_HOME_PATH}/x64/lib/gflags
${THIRD_PATH_HOME_PATH}/x64/lib/ceres
)#35行
target_link_libraries(imu_an ${catkin_LIBRARIES} ${OpenCV_LIBS} gflags glog protobuf ${BOOST_LINK_LIBS} ceres)#57行
然后进行编译
cd src
git clone https://github.com/gaowenliang/imu_utils
cd ..
catkin_make #编译imu_utils
编译完成后即可使用。
1、让IMU保持静止两个小时,保存IMU数据;
2、将IMU数据按照对应的格式打包成IMU.bag;
3、然后根据自己的需求对src/imu_utils-master/launch文件进行修改(可直接用文件下的):主要包括名字、时长之类的; 比如:A3.launch
4、rosbag play -r 200 imu-.bag (200倍速度发布)
source ./devel/setup.bash
roslaunch imu_utils A3.launch
5、最后标定结果文件保存在src/imu_utils-master/data/ 找到对应的 yaml文件
标定结果格式为三轴的bias和随机游走
%YAML:1.0
---
type: IMU
name: "16448"
Gyr:
unit: " rad/s"
avg-axis:
gyr_n: 5.4087209662838391e-03
gyr_w: 2.8014911724116295e-04
x-axis:
gyr_n: 9.8285305850927306e-04
gyr_w: 2.9311234179739457e-05
y-axis:
gyr_n: 1.8599032135948482e-03
gyr_w: 5.8209513808253253e-05
z-axis:
gyr_n: 1.3383406626747394e-02
gyr_w: 7.5292660373549607e-04
Acc:
unit: " m/s^2"
avg-axis:
acc_n: 6.1067058739634868e-02
acc_w: 1.3090835326163882e-03
x-axis:
acc_n: 7.7670032495112368e-02
acc_w: 2.1647622724341922e-03
y-axis:
acc_n: 3.8066062843794456e-02
acc_w: 8.9909838235641690e-04
z-axis:
acc_n: 6.7465080879997780e-02
acc_w: 8.6338994305855507e-04
参考:imu_utils IMU内参标定工具 imu_utils安装教程 imu_utils使用教程_Baymax_在路上的博客-CSDN博客_imu_utils
使用imu_utils进行IMU的误差标定以及IMU姿态解算_非晚非晚的博客-CSDN博客_imu_utils
c++ - Undefined reference to 'boost::system::generic_category()'? - Stack Overflow