imu_tracker.h
Go to the documentation of this file.
1 /*
2  * Copyright 2016 The Cartographer Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef CARTOGRAPHER_MAPPING_IMU_TRACKER_H_
18 #define CARTOGRAPHER_MAPPING_IMU_TRACKER_H_
19 
20 #include "Eigen/Geometry"
22 
23 namespace cartographer {
24 namespace mapping {
25 
26 // Keeps track of the orientation using angular velocities and linear
27 // accelerations from an IMU. Because averaged linear acceleration (assuming
28 // slow movement) is a direct measurement of gravity, roll/pitch does not drift,
29 // though yaw does.
30 class ImuTracker {
31  public:
32  ImuTracker(double imu_gravity_time_constant, common::Time time);
33 
34  // Advances to the given 'time' and updates the orientation to reflect this.
35  void Advance(common::Time time);
36 
37  // Updates from an IMU reading (in the IMU frame).
39  const Eigen::Vector3d& imu_linear_acceleration);
41  const Eigen::Vector3d& imu_angular_velocity);
42 
43  // Query the current time.
44  common::Time time() const { return time_; }
45 
46  // Query the current orientation estimate.
47  Eigen::Quaterniond orientation() const { return orientation_; }
48 
49  private:
53  Eigen::Quaterniond orientation_;
54  Eigen::Vector3d gravity_vector_;
55  Eigen::Vector3d imu_angular_velocity_;
56 };
57 
58 } // namespace mapping
59 } // namespace cartographer
60 
61 #endif // CARTOGRAPHER_MAPPING_IMU_TRACKER_H_
Eigen::Vector3d imu_angular_velocity_
Definition: imu_tracker.h:55
UniversalTimeScaleClock::time_point Time
Definition: time.h:44
common::Time last_linear_acceleration_time_
Definition: imu_tracker.h:52
ImuTracker(double imu_gravity_time_constant, common::Time time)
Definition: imu_tracker.cc:29
void AddImuLinearAccelerationObservation(const Eigen::Vector3d &imu_linear_acceleration)
Definition: imu_tracker.cc:49
common::Time time() const
Definition: imu_tracker.h:44
Eigen::Quaterniond orientation() const
Definition: imu_tracker.h:47
void AddImuAngularVelocityObservation(const Eigen::Vector3d &imu_angular_velocity)
Definition: imu_tracker.cc:70
Eigen::Quaterniond orientation_
Definition: imu_tracker.h:53
void Advance(common::Time time)
Definition: imu_tracker.cc:38


cartographer
Author(s): The Cartographer Authors
autogenerated on Mon Feb 28 2022 22:00:58