17 #ifndef CARTOGRAPHER_MAPPING_INTERNAL_3D_IMU_INTEGRATION_H_ 18 #define CARTOGRAPHER_MAPPING_INTERNAL_3D_IMU_INTEGRATION_H_ 24 #include "Eigen/Geometry" 28 #include "glog/logging.h" 39 template <
typename T,
typename RangeType,
typename IteratorType>
41 const RangeType& imu_data,
42 const Eigen::Transform<T, 3, Eigen::Affine>&
43 linear_acceleration_calibration,
44 const Eigen::Transform<T, 3, Eigen::Affine>& angular_velocity_calibration,
46 IteratorType*
const it) {
47 CHECK_LE(start_time, end_time);
48 CHECK(*it != imu_data.end());
49 CHECK_LE((*it)->time, start_time);
50 if (std::next(*it) != imu_data.end()) {
51 CHECK_GT(std::next(*it)->time, start_time);
57 Eigen::Quaterniond::Identity().cast<T>()};
58 while (current_time < end_time) {
60 if (std::next(*it) != imu_data.end()) {
61 next_imu_data = std::next(*it)->time;
63 common::Time next_time = std::min(next_imu_data, end_time);
66 const Eigen::Matrix<T, 3, 1> delta_angle =
67 (angular_velocity_calibration *
68 (*it)->angular_velocity.template cast<T>()) *
73 ((linear_acceleration_calibration *
74 (*it)->linear_acceleration.template cast<T>()) *
76 current_time = next_time;
77 if (current_time == next_imu_data) {
85 template <
typename RangeType,
typename IteratorType>
89 IteratorType*
const it) {
90 return IntegrateImu<double, RangeType, IteratorType>(
91 imu_data, Eigen::Affine3d::Identity(), Eigen::Affine3d::Identity(),
92 start_time, end_time, it);
98 #endif // CARTOGRAPHER_MAPPING_INTERNAL_3D_IMU_INTEGRATION_H_ Eigen::Quaternion< T > delta_rotation
UniversalTimeScaleClock::time_point Time
IntegrateImuResult< T > IntegrateImu(const RangeType &imu_data, const Eigen::Transform< T, 3, Eigen::Affine > &linear_acceleration_calibration, const Eigen::Transform< T, 3, Eigen::Affine > &angular_velocity_calibration, const common::Time start_time, const common::Time end_time, IteratorType *const it)
double ToSeconds(const Duration duration)
Eigen::Matrix< T, 3, 1 > delta_velocity