transform_interpolation_buffer.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_TRANSFORM_TRANSFORM_INTERPOLATION_BUFFER_H_
18 #define CARTOGRAPHER_TRANSFORM_TRANSFORM_INTERPOLATION_BUFFER_H_
19 
20 #include <vector>
21 
23 #include "cartographer/mapping/proto/trajectory.pb.h"
26 
27 namespace cartographer {
28 namespace transform {
29 
30 // A time-ordered buffer of transforms that supports interpolated lookups.
32  public:
33  TransformInterpolationBuffer() = default;
35  const mapping::proto::Trajectory& trajectory);
36 
37  // Adds a new transform to the buffer and removes the oldest transform if the
38  // buffer size limit is exceeded.
39  void Push(common::Time time, const transform::Rigid3d& transform);
40 
41  // Returns true if an interpolated transfrom can be computed at 'time'.
42  bool Has(common::Time time) const;
43 
44  // Returns an interpolated transform at 'time'. CHECK()s that a transform at
45  // 'time' is available.
47 
48  // Returns the timestamp of the earliest transform in the buffer or 0 if the
49  // buffer is empty.
51 
52  // Returns the timestamp of the earliest transform in the buffer or 0 if the
53  // buffer is empty.
54  common::Time latest_time() const;
55 
56  // Returns true if the buffer is empty.
57  bool empty() const;
58 
59  private:
60  std::vector<TimestampedTransform> timestamped_transforms_;
61 };
62 
63 } // namespace transform
64 } // namespace cartographer
65 
66 #endif // CARTOGRAPHER_TRANSFORM_TRANSFORM_INTERPOLATION_BUFFER_H_
void Push(common::Time time, const transform::Rigid3d &transform)
UniversalTimeScaleClock::time_point Time
Definition: time.h:44
static time_point time


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