ekf_cal  0.4.0
A Kalman filter-based sensor calibration package
imu.hpp
1 // Copyright 2022 Jacob Hartzer
2 //
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program. If not, see <https://www.gnu.org/licenses/>.
15 
16 #ifndef SENSORS__IMU_HPP_
17 #define SENSORS__IMU_HPP_
18 
19 #include <eigen3/Eigen/Eigen>
20 
21 #include <memory>
22 #include <string>
23 
24 #include "ekf/update/imu_updater.hpp"
25 #include "sensors/imu_message.hpp"
26 #include "sensors/sensor.hpp"
27 
32 class IMU : public Sensor
33 {
34 public:
38  typedef struct Parameters : public Sensor::Parameters
39  {
40  bool is_extrinsic{false};
41  bool is_intrinsic{false};
42  Eigen::Vector3d pos_i_in_b {0, 0, 0};
43  Eigen::Quaterniond ang_i_to_b {1, 0, 0, 0};
44  Eigen::Vector3d acc_bias {0, 0, 0};
45  Eigen::Vector3d omg_bias {0, 0, 0};
46  double pos_stability {1e-9};
47  double ang_stability {1e-9};
48  double acc_bias_stability {1e-9};
49  double omg_bias_stability {1e-9};
51  double noise_scale_factor{1.0};
53  Eigen::VectorXd variance {{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};
55 
60  explicit IMU(IMU::Parameters params);
61 
66  void Callback(std::shared_ptr<ImuMessage> imu_message);
67 
68 private:
69  bool m_is_extrinsic;
70  bool m_is_intrinsic;
71  std::shared_ptr<EKF> m_ekf;
72  ImuUpdater m_imu_updater;
73 };
74 
75 #endif // SENSORS__IMU_HPP_
IMU Sensor Class.
Definition: imu.hpp:33
void Callback(std::shared_ptr< ImuMessage > imu_message)
Callback method for IMU measurements.
Definition: imu.cpp:62
IMU::Parameters Parameters
IMU initialization parameters structure.
IMU(IMU::Parameters params)
IMU class constructor.
Definition: imu.cpp:30
EKF Updater Class for IMU Sensors.
Definition: imu_updater.hpp:32
Pure base sensor class.
Definition: sensor.hpp:32
IMU initialization parameters structure.
Definition: imu.hpp:39
Eigen::Vector3d omg_bias
Gyroscope bias vector.
Definition: imu.hpp:45
double ang_stability
Angular stability.
Definition: imu.hpp:47
Eigen::Vector3d pos_i_in_b
Position offset vector.
Definition: imu.hpp:42
double motion_detection_threshold
Motion detection chi-Squared threshold.
Definition: imu.hpp:50
double pos_stability
Position stability.
Definition: imu.hpp:46
Eigen::Quaterniond ang_i_to_b
Angular offset quaternion.
Definition: imu.hpp:43
bool is_extrinsic
Extrinsic calibration.
Definition: imu.hpp:40
double noise_scale_factor
Stationary noise scale factor.
Definition: imu.hpp:51
double omg_bias_stability
Gyroscope bias stability.
Definition: imu.hpp:49
Eigen::Vector3d acc_bias
Accelerometer bias vector.
Definition: imu.hpp:44
bool is_intrinsic
Intrinsic calibration.
Definition: imu.hpp:41
Eigen::VectorXd variance
Initial state variance.
Definition: imu.hpp:53
double acc_bias_stability
Accelerometer bias stability.
Definition: imu.hpp:48
Sensor parameter structure.
Definition: sensor.hpp:38