pose_extrapolator.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 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_POSE_EXTRAPOLATOR_H_
18 #define CARTOGRAPHER_MAPPING_POSE_EXTRAPOLATOR_H_
19 
20 #include <deque>
21 #include <memory>
22 
28 
29 namespace cartographer {
30 namespace mapping {
31 
32 // Keep poses for a certain duration to estimate linear and angular velocity.
33 // Uses the velocities to extrapolate motion. Uses IMU and/or odometry data if
34 // available to improve the extrapolation.
36  public:
37  explicit PoseExtrapolator(common::Duration pose_queue_duration,
38  double imu_gravity_time_constant);
39 
40  PoseExtrapolator(const PoseExtrapolator&) = delete;
42 
43  static std::unique_ptr<PoseExtrapolator> InitializeWithImu(
44  common::Duration pose_queue_duration, double imu_gravity_time_constant,
45  const sensor::ImuData& imu_data);
46 
47  // Returns the time of the last added pose or Time::min() if no pose was added
48  // yet.
51 
53  void AddImuData(const sensor::ImuData& imu_data);
54  void AddOdometryData(const sensor::OdometryData& odometry_data);
56 
57  // Gravity alignment estimate.
58  Eigen::Quaterniond EstimateGravityOrientation(common::Time time);
59 
60  private:
62  void TrimImuData();
63  void TrimOdometryData();
64  void AdvanceImuTracker(common::Time time, ImuTracker* imu_tracker) const;
65  Eigen::Quaterniond ExtrapolateRotation(common::Time time,
66  ImuTracker* imu_tracker) const;
67  Eigen::Vector3d ExtrapolateTranslation(common::Time time);
68 
70  struct TimedPose {
73  };
74  std::deque<TimedPose> timed_pose_queue_;
75  Eigen::Vector3d linear_velocity_from_poses_ = Eigen::Vector3d::Zero();
76  Eigen::Vector3d angular_velocity_from_poses_ = Eigen::Vector3d::Zero();
77 
78  const double gravity_time_constant_;
79  std::deque<sensor::ImuData> imu_data_;
80  std::unique_ptr<ImuTracker> imu_tracker_;
81  std::unique_ptr<ImuTracker> odometry_imu_tracker_;
82  std::unique_ptr<ImuTracker> extrapolation_imu_tracker_;
84 
85  std::deque<sensor::OdometryData> odometry_data_;
86  Eigen::Vector3d linear_velocity_from_odometry_ = Eigen::Vector3d::Zero();
87  Eigen::Vector3d angular_velocity_from_odometry_ = Eigen::Vector3d::Zero();
88 };
89 
90 } // namespace mapping
91 } // namespace cartographer
92 
93 #endif // CARTOGRAPHER_MAPPING_POSE_EXTRAPOLATOR_H_
std::unique_ptr< ImuTracker > extrapolation_imu_tracker_
static std::unique_ptr< PoseExtrapolator > InitializeWithImu(common::Duration pose_queue_duration, double imu_gravity_time_constant, const sensor::ImuData &imu_data)
UniversalTimeScaleClock::time_point Time
Definition: time.h:44
transform::Rigid3d ExtrapolatePose(common::Time time)
std::deque< sensor::ImuData > imu_data_
static time_point time
UniversalTimeScaleClock::duration Duration
Definition: time.h:43
PoseExtrapolator(common::Duration pose_queue_duration, double imu_gravity_time_constant)
void AddOdometryData(const sensor::OdometryData &odometry_data)
PoseExtrapolator & operator=(const PoseExtrapolator &)=delete
Eigen::Quaterniond ExtrapolateRotation(common::Time time, ImuTracker *imu_tracker) const
std::unique_ptr< ImuTracker > imu_tracker_
Eigen::Quaterniond EstimateGravityOrientation(common::Time time)
void AddPose(common::Time time, const transform::Rigid3d &pose)
void AddImuData(const sensor::ImuData &imu_data)
transform::Rigid3d pose
std::deque< sensor::OdometryData > odometry_data_
void AdvanceImuTracker(common::Time time, ImuTracker *imu_tracker) const
std::unique_ptr< ImuTracker > odometry_imu_tracker_
Eigen::Vector3d ExtrapolateTranslation(common::Time time)


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