ros_map_writing_points_processor.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_ROS_CARTOGRAPHER_ROS_ROS_MAP_WRITING_POINTS_PROCESSOR_H
00018 #define CARTOGRAPHER_ROS_CARTOGRAPHER_ROS_ROS_MAP_WRITING_POINTS_PROCESSOR_H
00019 
00020 #include "cartographer/common/lua_parameter_dictionary.h"
00021 #include "cartographer/io/file_writer.h"
00022 #include "cartographer/io/points_processor.h"
00023 #include "cartographer/mapping/2d/probability_grid.h"
00024 #include "cartographer/mapping/2d/probability_grid_range_data_inserter_2d.h"
00025 #include "cartographer/mapping/proto/2d/probability_grid_range_data_inserter_options_2d.pb.h"
00026 #include "cartographer/mapping/value_conversion_tables.h"
00027 
00028 namespace cartographer_ros {
00029 
00030 // Very similar to Cartographer's ProbabilityGridPointsProcessor, but writes
00031 // out a PGM and YAML suitable for ROS map server to consume.
00032 class RosMapWritingPointsProcessor
00033     : public ::cartographer::io::PointsProcessor {
00034  public:
00035   constexpr static const char* kConfigurationFileActionName = "write_ros_map";
00036   RosMapWritingPointsProcessor(
00037       double resolution,
00038       const ::cartographer::mapping::proto::
00039           ProbabilityGridRangeDataInserterOptions2D&
00040               range_data_inserter_options,
00041       ::cartographer::io::FileWriterFactory file_writer_factory,
00042       const std::string& filestem, PointsProcessor* next);
00043   RosMapWritingPointsProcessor(const RosMapWritingPointsProcessor&) = delete;
00044   RosMapWritingPointsProcessor& operator=(const RosMapWritingPointsProcessor&) =
00045       delete;
00046 
00047   static std::unique_ptr<RosMapWritingPointsProcessor> FromDictionary(
00048       ::cartographer::io::FileWriterFactory file_writer_factory,
00049       ::cartographer::common::LuaParameterDictionary* dictionary,
00050       PointsProcessor* next);
00051 
00052   ~RosMapWritingPointsProcessor() override {}
00053 
00054   void Process(std::unique_ptr<::cartographer::io::PointsBatch> batch) override;
00055   FlushResult Flush() override;
00056 
00057  private:
00058   const std::string filestem_;
00059   PointsProcessor* const next_;
00060   ::cartographer::io::FileWriterFactory file_writer_factory_;
00061   ::cartographer::mapping::ProbabilityGridRangeDataInserter2D
00062       range_data_inserter_;
00063   ::cartographer::mapping::ValueConversionTables conversion_tables_;
00064   ::cartographer::mapping::ProbabilityGrid probability_grid_;
00065 };
00066 
00067 }  // namespace cartographer_ros
00068 
00069 #endif  // CARTOGRAPHER_ROS_CARTOGRAPHER_ROS_ROS_MAP_WRITING_POINTS_PROCESSOR_H


cartographer_ros
Author(s): The Cartographer Authors
autogenerated on Wed Jul 10 2019 04:10:28