odometry_state_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_ODOMETRY_STATE_TRACKER_H_
18 #define CARTOGRAPHER_MAPPING_ODOMETRY_STATE_TRACKER_H_
19 
20 #include <deque>
21 
24 
25 namespace cartographer {
26 namespace mapping {
27 
28 struct OdometryState {
32 
33  common::Time time = common::Time::min();
36 };
37 
38 // Keeps track of the odometry states by keeping sliding window over some
39 // number of them.
41  public:
42  using OdometryStates = std::deque<OdometryState>;
43 
44  explicit OdometryStateTracker(int window_size);
45 
46  const OdometryStates& odometry_states() const;
47 
48  // Adds a new 'odometry_state' and makes sure the maximum number of previous
49  // odometry states is not exceeded.
50  void AddOdometryState(const OdometryState& odometry_state);
51 
52  // Returns true if no elements are present in the odometry queue.
53  bool empty() const;
54 
55  // Retrieves the most recent OdometryState. Must not be called when empty.
56  const OdometryState& newest() const;
57 
58  private:
60  size_t window_size_;
61 };
62 
63 } // namespace mapping
64 } // namespace cartographer
65 
66 #endif // CARTOGRAPHER_MAPPING_ODOMETRY_STATE_TRACKER_H_
UniversalTimeScaleClock::time_point Time
Definition: time.h:44


cartographer
Author(s):
autogenerated on Wed Jun 5 2019 21:57:58