00001 /* 00002 * SlidingWindowIterator.hpp 00003 * 00004 * Created on: Aug 17, 2017 00005 * Author: Péter Fankhauser 00006 * Institute: ETH Zurich, Robotic Systems Lab 00007 */ 00008 00009 #pragma once 00010 00011 #include "grid_map_core/GridMap.hpp" 00012 00013 #include "grid_map_core/iterators/GridMapIterator.hpp" 00014 00015 #include <Eigen/Core> 00016 00017 namespace grid_map { 00018 00024 class SlidingWindowIterator : public GridMapIterator 00025 { 00026 public: 00027 00028 enum class EdgeHandling { 00029 INSIDE, // Only visit indices that are surrounded by a full window. 00030 CROP, // Crop data matrix with missing cells at edges. 00031 EMPTY, // Fill in missing edges with empty cells (NAN-value). 00032 MEAN // Fill in missing edges with MEAN of valid values. 00033 }; 00034 00042 SlidingWindowIterator(const GridMap& gridMap, const std::string& layer, 00043 const EdgeHandling& edgeHandling = EdgeHandling::CROP, 00044 const size_t windowSize = 3); 00045 00050 SlidingWindowIterator(const SlidingWindowIterator* other); 00051 00057 void setWindowLength(const GridMap& gridMap, const double windowLength); 00058 00063 SlidingWindowIterator& operator ++(); 00064 00069 const Matrix getData() const; 00070 00071 private: 00073 void setup(const GridMap& gridMap); 00074 00076 bool dataInsideMap() const; 00077 00079 const EdgeHandling edgeHandling_; 00080 00082 const Matrix& data_; 00083 00085 size_t windowSize_; 00086 00088 size_t windowMargin_; 00089 00090 public: 00091 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00092 }; 00093 00094 } /* namespace */