range_data_collator.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2018 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_MAPPING_INTERNAL_RANGE_DATA_COLLATOR_H_
00018 #define CARTOGRAPHER_MAPPING_INTERNAL_RANGE_DATA_COLLATOR_H_
00019 
00020 #include <memory>
00021 
00022 #include "absl/memory/memory.h"
00023 #include "cartographer/sensor/timed_point_cloud_data.h"
00024 
00025 namespace cartographer {
00026 namespace mapping {
00027 
00028 // Synchronizes TimedPointCloudData from different sensors. Input needs only be
00029 // monotonous in 'TimedPointCloudData::time', output is monotonous in per-point
00030 // timing. Up to one message per sensor is buffered, so a delay of the period of
00031 // the slowest sensor may be introduced, which can be alleviated by passing
00032 // subdivisions.
00033 class RangeDataCollator {
00034  public:
00035   explicit RangeDataCollator(
00036       const std::vector<std::string>& expected_range_sensor_ids)
00037       : expected_sensor_ids_(expected_range_sensor_ids.begin(),
00038                              expected_range_sensor_ids.end()) {}
00039 
00040   sensor::TimedPointCloudOriginData AddRangeData(
00041       const std::string& sensor_id,
00042       const sensor::TimedPointCloudData& timed_point_cloud_data);
00043 
00044  private:
00045   sensor::TimedPointCloudOriginData CropAndMerge();
00046 
00047   const std::set<std::string> expected_sensor_ids_;
00048   // Store at most one message for each sensor.
00049   std::map<std::string, sensor::TimedPointCloudData> id_to_pending_data_;
00050   common::Time current_start_ = common::Time::min();
00051   common::Time current_end_ = common::Time::min();
00052 };
00053 
00054 }  // namespace mapping
00055 }  // namespace cartographer
00056 
00057 #endif  // CARTOGRAPHER_MAPPING_INTERNAL_RANGE_DATA_COLLATOR_H_


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