transform_interpolation_buffer.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2016 The Cartographer Authors
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef CARTOGRAPHER_TRANSFORM_TRANSFORM_INTERPOLATION_BUFFER_H_
00018 #define CARTOGRAPHER_TRANSFORM_TRANSFORM_INTERPOLATION_BUFFER_H_
00019 
00020 #include <vector>
00021 
00022 #include "cartographer/common/time.h"
00023 #include "cartographer/mapping/proto/trajectory.pb.h"
00024 #include "cartographer/transform/rigid_transform.h"
00025 #include "cartographer/transform/timestamped_transform.h"
00026 
00027 namespace cartographer {
00028 namespace transform {
00029 
00030 // A time-ordered buffer of transforms that supports interpolated lookups.
00031 class TransformInterpolationBuffer {
00032  public:
00033   TransformInterpolationBuffer() = default;
00034   explicit TransformInterpolationBuffer(
00035       const mapping::proto::Trajectory& trajectory);
00036 
00037   // Adds a new transform to the buffer and removes the oldest transform if the
00038   // buffer size limit is exceeded.
00039   void Push(common::Time time, const transform::Rigid3d& transform);
00040 
00041   // Returns true if an interpolated transfrom can be computed at 'time'.
00042   bool Has(common::Time time) const;
00043 
00044   // Returns an interpolated transform at 'time'. CHECK()s that a transform at
00045   // 'time' is available.
00046   transform::Rigid3d Lookup(common::Time time) const;
00047 
00048   // Returns the timestamp of the earliest transform in the buffer or 0 if the
00049   // buffer is empty.
00050   common::Time earliest_time() const;
00051 
00052   // Returns the timestamp of the earliest transform in the buffer or 0 if the
00053   // buffer is empty.
00054   common::Time latest_time() const;
00055 
00056   // Returns true if the buffer is empty.
00057   bool empty() const;
00058 
00059  private:
00060   std::vector<TimestampedTransform> timestamped_transforms_;
00061 };
00062 
00063 }  // namespace transform
00064 }  // namespace cartographer
00065 
00066 #endif  // CARTOGRAPHER_TRANSFORM_TRANSFORM_INTERPOLATION_BUFFER_H_


cartographer
Author(s): The Cartographer Authors
autogenerated on Thu May 9 2019 02:27:36