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_2D_LOCAL_SLAM_RESULT_2D_H_ 00018 #define CARTOGRAPHER_MAPPING_INTERNAL_2D_LOCAL_SLAM_RESULT_2D_H_ 00019 00020 #include "cartographer/mapping/internal/submap_controller.h" 00021 #include "cartographer/mapping/local_slam_result_data.h" 00022 #include "cartographer/mapping/trajectory_builder_interface.h" 00023 00024 namespace cartographer { 00025 namespace mapping { 00026 00027 class LocalSlamResult2D : public LocalSlamResultData { 00028 public: 00029 LocalSlamResult2D( 00030 const std::string& sensor_id, 00031 const mapping::proto::LocalSlamResultData local_slam_result_data, 00032 SubmapController<mapping::Submap2D>* submap_controller) 00033 : LocalSlamResultData(sensor_id, common::FromUniversal( 00034 local_slam_result_data.timestamp())), 00035 sensor_id_(sensor_id), 00036 local_slam_result_data_(local_slam_result_data), 00037 submap_controller_(submap_controller) {} 00038 00039 void AddToTrajectoryBuilder( 00040 TrajectoryBuilderInterface* const trajectory_builder) override; 00041 void AddToPoseGraph(int trajectory_id, PoseGraph* pose_graph) const override; 00042 00043 private: 00044 const std::string sensor_id_; 00045 const mapping::proto::LocalSlamResultData local_slam_result_data_; 00046 SubmapController<mapping::Submap2D>* submap_controller_; 00047 }; 00048 00049 } // namespace mapping 00050 } // namespace cartographer 00051 00052 #endif // CARTOGRAPHER_MAPPING_INTERNAL_2D_LOCAL_SLAM_RESULT_2D_H_