Before installing imu_utils, you need to install the ceres and eigen libraries and code_utils first.
1. Install ceres
(1) Download the ceres source code. It is not recommended to download the latest version. This article downloads 1.14.0 (click Releases on the right to view historical versions)
https://github.com/ceres-solver/ceres-solver
(2) Unzip the compressed package, enter the directory in the terminal, then create a new build folder and enter the build process
tar -zxvf ceres-solver-1.14.0.tar.gz
cd ceres-solver-1.14.0/
mkdir build
cd build/
(3), install ceres dependencies
sudo apt-get install liblapack-dev libsuitesparse-dev libcxsparse3 libgflags-dev libgoogle-glog-dev libgtest-dev
(4) Compile and install
cmake ..
make
sudo make install
2. Install eigen
This article installs eigen3.3.7
(1). Download link:
https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz
(2) Unzip the compressed package, enter the directory in the terminal, then create a new build folder and enter the build process
sudo tar -xzvf eigen-3.3.7.tar.gz
cd eigen-3.3.7
mkdir build
cd build
(3) Compile and install
cmake ..
make
sudo make install
(4), move the header file
sudo cp -r /usr/local/include/eigen3/Eigen /usr/local/include
3. Install code_utils
(1), Install dependencies
sudo apt-get install libdw-dev
(2) Go to the src directory of your ros workspace
If you don’t know how to create a ros workspace, you can also refer to my blog:
How to create a ros workspace, create a ros function package, and create a ros node under ubuntu_ubuntu creates a workspace_╰︶ ̄ Mo Dongxian۩۩۩’s blog-CSDN blog https ://blog.csdn.net/qq_49959714/article/details/127028396
cd ~/catkin_ws/src
(3) Clone the code into the src directory of the workspace
git clone https://github.com/gaowenliang/code_utils.git
(4) Return to the workspace directory and execute compilation
cd ..
catkin_make
You may encounter some problems at this time:
Problem 1: backward.hpp not found
Solution: Copy the src/code_utils/include/backward.hpp file to src/code_utils/src
Question 2: There is no opencv2/core.hpp file or directory
Solution:
Open the error file and change #include <opencv2/core.hpp> to #include <opencv2/core/core.hpp>
4. Install imu_utils
cd ~/catkin_ws/src
git clone https://github.com/gaowenliang/imu_utils.git
cd ..
catkin_make
You may encounter some problems at this time:
Solution:
The first error is that there is no header file containing this data structure. Just open the file and add:
#include <fstream>
The second one is comparing two different data types. Just change them to the same:
for (unsigned int index = 0; index < gyro_ts_x.size( ); ++index )
Recompile:
catkin_make
5. IMU internal parameter calibration
(1), driver imu_utils
cd ~/catkin_ws
source devel/setup.bash
roslaunch imu_utils xsens.launch
(2) Play imu data (pay attention to check whether the topic of your imu data is consistent with the one in the launch file. If it is inconsistent, you need to modify the launch file)
rosbag play imu.bag
wait for imu data may always appear here
At this time, you need to modify the max_time_min value in the xsens_driver.launch file. This value should be changed to be less than your own bag duration.
If wait for imu data still appears, the imu internal parameter data should appear after the data is played.
The imu calibration internal parameters will be saved in the xsens_imu_param.yaml file in the imu_utils/data directory.