ubuntu16.04编译安装imu_tk
imu_tk代码地址
https://bitbucket.org/alberto_pretto/imu_tk
安装依赖项
sudo apt-get install build-essential cmake libeigen3-dev libqt4-dev libqt4-opengl-dev freeglut3-dev gnuplot
安装ceres-solver
https://www.cnblogs.com/feifanrensheng/p/8630149.html
编译安装imu_tk
cd imu_tk
mkdir build
cd build
cmake ..
make
遇到的问题
下面是用cmake编译你的程序可能会遇到的问题
(1)找不到xi和xmu库
CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: GLUT_Xi_LIBRARY (ADVANCED) linked by target "WindowsTest" in directory /home/me/devl/c++/game/2DGame/src GLUT_Xmu_LIBRARY (ADVANCED) linked by target "WindowsTest" in directory /home/me/devl/c++/game/2DGame/src
https://blog.csdn.net/whu_zcj/article/details/49737243
解决方法
sudo apt-get install libxmu-dev libxi-dev
(2)找不到boost库
sudo apt-get install libboost-dev
编译成功
-- Found GLUT: /usr/lib/x86_64-linux-gnu/libglut.so imu_tk;ceres;/usr/lib/x86_64-linux-gnu/libQtOpenGL.so;/usr/lib/x86_64-linux-gnu/libQtGui.so;/usr/lib/x86_64-linux-gnu/libQtCore.so;/usr/lib/x86_64-linux-gnu/libGLU.so;/usr/lib/x86_64-linux-gnu/libGL.so;/usr/lib/x86_64-linux-gnu/libglut.so;/usr/lib/x86_64-linux-gnu/libXmu.so;/usr/lib/x86_64-linux-gnu/libXi.so -- Configuring done -- Generating done -- Build files have been written to: /home/zn/alberto_pretto-imu_tk-7780270fb9a2/build
make 报错
usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options. #error This file requires compiler and library support \
当使用CMAKE编译工程时,出现这个错误,解决办法:
在工程主目录的CMakeLists.txt中添加如下,可以编译成功:
SET( CMAKE_CXX_FLAGS "-std=c++11 -O3")
编译成功
Test the library with the test_imu_calib app (binary in /bin, source code in src/test_imu_calib.cpp): test_imu_calib performs an IMU calibration given the data included in bin/test_data/:
./test_imu_calib test_data/xsens_acc.mat test_data/xsens_gyro.mat
结果
Accelerometers calibration: Better calibration obtained using threshold multiplier 6 with residual 0.120131 Misalignment Matrix 1 -0.0033593 -0.00890639 0 1 -0.0213341 -0 0 1 Scale Matrix 0.00241278 0 0 0 0.00242712 0 0 0 0.00241168 Bias Vector 33124.2 33275.2 32364.4 Accelerometers calibration: inverse scale factors: 414.459 412.01 414.649 Press Enter to continue
Gyroscopes calibration: residual 0.00150696 Misalignment Matrix 1 0.00593634 0.00111101 0.00808812 1 -0.0535569 0.0253067 -0.0025513 1 Scale Matrix 0.000209295 0 0 0 0.000209899 0 0 0 0.000209483 Bias Vector 32777.1 32459.8 32511.8 Gyroscopes calibration: inverse scale factors: 4777.96 4764.21 4773.66
测试数据的时间间隔是0.01秒,也就是以100hz采集imu的数据。