collated_trajectory_builder.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_INTERNAL_COLLATED_TRAJECTORY_BUILDER_H_
18 #define CARTOGRAPHER_MAPPING_INTERNAL_COLLATED_TRAJECTORY_BUILDER_H_
19 
20 #include <chrono>
21 #include <map>
22 #include <memory>
23 #include <set>
24 #include <string>
25 
33 
34 namespace cartographer {
35 namespace mapping {
36 
37 // Collates sensor data using a sensor::CollatorInterface, then passes it on to
38 // a mapping::TrajectoryBuilderInterface which is common for 2D and 3D.
40  public:
42 
44  sensor::CollatorInterface* sensor_collator, int trajectory_id,
45  const std::set<SensorId>& expected_sensor_ids,
46  std::unique_ptr<TrajectoryBuilderInterface> wrapped_trajectory_builder);
47  ~CollatedTrajectoryBuilder() override;
48 
51  delete;
52 
54  const std::string& sensor_id,
55  const sensor::TimedPointCloudData& timed_point_cloud_data) override {
56  AddData(sensor::MakeDispatchable(sensor_id, timed_point_cloud_data));
57  }
58 
59  void AddSensorData(const std::string& sensor_id,
60  const sensor::ImuData& imu_data) override {
61  AddData(sensor::MakeDispatchable(sensor_id, imu_data));
62  }
63 
64  void AddSensorData(const std::string& sensor_id,
65  const sensor::OdometryData& odometry_data) override {
66  AddData(sensor::MakeDispatchable(sensor_id, odometry_data));
67  }
68 
70  const std::string& sensor_id,
71  const sensor::FixedFramePoseData& fixed_frame_pose_data) override {
72  AddData(sensor::MakeDispatchable(sensor_id, fixed_frame_pose_data));
73  }
74 
75  void AddSensorData(const std::string& sensor_id,
76  const sensor::LandmarkData& landmark_data) override {
77  AddData(sensor::MakeDispatchable(sensor_id, landmark_data));
78  }
79 
80  void AddLocalSlamResultData(std::unique_ptr<mapping::LocalSlamResultData>
81  local_slam_result_data) override {
82  AddData(std::move(local_slam_result_data));
83  }
84 
85  private:
86  void AddData(std::unique_ptr<sensor::Data> data);
87 
88  void HandleCollatedSensorData(const std::string& sensor_id,
89  std::unique_ptr<sensor::Data> data);
90 
92  const int trajectory_id_;
93  std::unique_ptr<TrajectoryBuilderInterface> wrapped_trajectory_builder_;
94 
95  // Time at which we last logged the rates of incoming sensor data.
96  std::chrono::steady_clock::time_point last_logging_time_;
97  std::map<std::string, common::RateTimer<>> rate_timers_;
98 };
99 
100 } // namespace mapping
101 } // namespace cartographer
102 
103 #endif // CARTOGRAPHER_MAPPING_INTERNAL_COLLATED_TRAJECTORY_BUILDER_H_
CollatedTrajectoryBuilder & operator=(const CollatedTrajectoryBuilder &)=delete
void AddSensorData(const std::string &sensor_id, const sensor::OdometryData &odometry_data) override
void AddData(std::unique_ptr< sensor::Data > data)
std::unique_ptr< TrajectoryBuilderInterface > wrapped_trajectory_builder_
void HandleCollatedSensorData(const std::string &sensor_id, std::unique_ptr< sensor::Data > data)
void AddSensorData(const std::string &sensor_id, const sensor::ImuData &imu_data) override
CollatedTrajectoryBuilder(sensor::CollatorInterface *sensor_collator, int trajectory_id, const std::set< SensorId > &expected_sensor_ids, std::unique_ptr< TrajectoryBuilderInterface > wrapped_trajectory_builder)
void AddSensorData(const std::string &sensor_id, const sensor::FixedFramePoseData &fixed_frame_pose_data) override
std::map< std::string, common::RateTimer<> > rate_timers_
void AddSensorData(const std::string &sensor_id, const sensor::LandmarkData &landmark_data) override
void AddSensorData(const std::string &sensor_id, const sensor::TimedPointCloudData &timed_point_cloud_data) override
std::unique_ptr< Dispatchable< DataType > > MakeDispatchable(const std::string &sensor_id, const DataType &data)
Definition: dispatchable.h:44
void AddLocalSlamResultData(std::unique_ptr< mapping::LocalSlamResultData > local_slam_result_data) override
::cartographer::mapping::TrajectoryBuilderInterface::SensorId SensorId
std::chrono::steady_clock::time_point last_logging_time_


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