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 #include "cartographer/mapping/range_data_inserter_interface.h" 00018 00019 #include "cartographer/mapping/2d/probability_grid_range_data_inserter_2d.h" 00020 #include "cartographer/mapping/2d/tsdf_range_data_inserter_2d.h" 00021 00022 namespace cartographer { 00023 namespace mapping { 00024 00025 proto::RangeDataInserterOptions CreateRangeDataInserterOptions( 00026 common::LuaParameterDictionary* const parameter_dictionary) { 00027 proto::RangeDataInserterOptions options; 00028 const std::string range_data_inserter_type_string = 00029 parameter_dictionary->GetString("range_data_inserter_type"); 00030 proto::RangeDataInserterOptions_RangeDataInserterType 00031 range_data_inserter_type; 00032 CHECK(proto::RangeDataInserterOptions_RangeDataInserterType_Parse( 00033 range_data_inserter_type_string, &range_data_inserter_type)) 00034 << "Unknown RangeDataInserterOptions_RangeDataInserterType kind: " 00035 << range_data_inserter_type_string; 00036 options.set_range_data_inserter_type(range_data_inserter_type); 00037 *options.mutable_probability_grid_range_data_inserter_options_2d() = 00038 CreateProbabilityGridRangeDataInserterOptions2D( 00039 parameter_dictionary 00040 ->GetDictionary("probability_grid_range_data_inserter") 00041 .get()); 00042 *options.mutable_tsdf_range_data_inserter_options_2d() = 00043 CreateTSDFRangeDataInserterOptions2D( 00044 parameter_dictionary->GetDictionary("tsdf_range_data_inserter") 00045 .get()); 00046 return options; 00047 } 00048 } // namespace mapping 00049 } // namespace cartographer