Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "grid_map_filters/DeletionFilter.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 DeletionFilter<T>::DeletionFilter()
00020 {
00021 }
00022
00023 template<typename T>
00024 DeletionFilter<T>::~DeletionFilter()
00025 {
00026 }
00027
00028 template<typename T>
00029 bool DeletionFilter<T>::configure()
00030 {
00031
00032 if (!FilterBase<T>::getParam(std::string("layers"), layers_)) {
00033 ROS_ERROR("DeletionFilter did not find parameter 'layers'.");
00034 return false;
00035 }
00036
00037 return true;
00038 }
00039
00040 template<typename T>
00041 bool DeletionFilter<T>::update(const T& mapIn, T& mapOut)
00042 {
00043 mapOut = mapIn;
00044
00045 for (const auto& layer : layers_) {
00046
00047 if (!mapOut.exists(layer)) {
00048 ROS_ERROR("Check your deletion layers! Type %s does not exist.",
00049 layer.c_str());
00050 continue;
00051 }
00052
00053 if (!mapOut.erase(layer)) {
00054 ROS_ERROR("Could not remove type %s.", layer.c_str());
00055 }
00056 }
00057
00058 return true;
00059 }
00060
00061 }
00062
00063 PLUGINLIB_EXPORT_CLASS(grid_map::DeletionFilter<grid_map::GridMap>, filters::FilterBase<grid_map::GridMap>)