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_MAPPING_2D_RANGE_DATA_INSERTER_2D_PROBABILITY_GRID_H_ 00018 #define CARTOGRAPHER_MAPPING_2D_RANGE_DATA_INSERTER_2D_PROBABILITY_GRID_H_ 00019 00020 #include <utility> 00021 #include <vector> 00022 00023 #include "cartographer/common/lua_parameter_dictionary.h" 00024 #include "cartographer/common/port.h" 00025 #include "cartographer/mapping/2d/probability_grid.h" 00026 #include "cartographer/mapping/2d/xy_index.h" 00027 #include "cartographer/mapping/proto/2d/probability_grid_range_data_inserter_options_2d.pb.h" 00028 #include "cartographer/mapping/range_data_inserter_interface.h" 00029 #include "cartographer/sensor/point_cloud.h" 00030 #include "cartographer/sensor/range_data.h" 00031 00032 namespace cartographer { 00033 namespace mapping { 00034 00035 proto::ProbabilityGridRangeDataInserterOptions2D 00036 CreateProbabilityGridRangeDataInserterOptions2D( 00037 common::LuaParameterDictionary* parameter_dictionary); 00038 00039 class ProbabilityGridRangeDataInserter2D : public RangeDataInserterInterface { 00040 public: 00041 explicit ProbabilityGridRangeDataInserter2D( 00042 const proto::ProbabilityGridRangeDataInserterOptions2D& options); 00043 00044 ProbabilityGridRangeDataInserter2D( 00045 const ProbabilityGridRangeDataInserter2D&) = delete; 00046 ProbabilityGridRangeDataInserter2D& operator=( 00047 const ProbabilityGridRangeDataInserter2D&) = delete; 00048 00049 // Inserts 'range_data' into 'probability_grid'. 00050 virtual void Insert(const sensor::RangeData& range_data, 00051 GridInterface* grid) const override; 00052 00053 private: 00054 const proto::ProbabilityGridRangeDataInserterOptions2D options_; 00055 const std::vector<uint16> hit_table_; 00056 const std::vector<uint16> miss_table_; 00057 }; 00058 00059 } // namespace mapping 00060 } // namespace cartographer 00061 00062 #endif // CARTOGRAPHER_MAPPING_2D_RANGE_DATA_INSERTER_2D_PROBABILITY_GRID_H_