00001 /* 00002 * DuplicationFilter.cpp 00003 * 00004 * Created on: Aug 18, 2017 00005 * Author: Peter Fankhauser 00006 * Institute: ETH Zurich, Robotic Systems Lab 00007 */ 00008 00009 #include "grid_map_filters/DuplicationFilter.hpp" 00010 00011 #include <grid_map_core/GridMap.hpp> 00012 #include <pluginlib/class_list_macros.h> 00013 00014 using namespace filters; 00015 00016 namespace grid_map { 00017 00018 template<typename T> 00019 DuplicationFilter<T>::DuplicationFilter() 00020 { 00021 } 00022 00023 template<typename T> 00024 DuplicationFilter<T>::~DuplicationFilter() 00025 { 00026 } 00027 00028 template<typename T> 00029 bool DuplicationFilter<T>::configure() 00030 { 00031 if (!FilterBase<T>::getParam(std::string("input_layer"), inputLayer_)) { 00032 ROS_ERROR("DuplicationFilter did not find parameter 'input_layer'."); 00033 return false; 00034 } 00035 00036 if (!FilterBase<T>::getParam(std::string("output_layer"), outputLayer_)) { 00037 ROS_ERROR("DuplicationFilter did not find parameter 'output_layer'."); 00038 return false; 00039 } 00040 00041 return true; 00042 } 00043 00044 template<typename T> 00045 bool DuplicationFilter<T>::update(const T& mapIn, T& mapOut) 00046 { 00047 mapOut = mapIn; 00048 mapOut.add(outputLayer_, mapIn[inputLayer_]); 00049 return true; 00050 } 00051 00052 } /* namespace */ 00053 00054 PLUGINLIB_EXPORT_CLASS(grid_map::DuplicationFilter<grid_map::GridMap>, filters::FilterBase<grid_map::GridMap>)