27 ROS_ERROR(
"Unable to find nonground_layer parameter.");
33 ROS_ERROR(
"Unable to find inflation radius parameter.");
57 int cellSideLen = _mapOut.
getSize()(0);
61 double distToRim = sideLen / 2;
65 double posXMax = pos.x() + distToRim;
66 double posXMin = pos.x() - distToRim;
67 double posYMax = pos.y() + distToRim;
68 double posYMin = pos.y() - distToRim;
78 if (layer(index(0), index(1)) != 100)
92 int xCells = (int)floor((posXMax - cellPos.x()) / resolution);
93 int yCells = (int)floor((posYMax - cellPos.y()) / resolution);
103 if (xCells > numCellsForInflation)
106 rowStartIdx = index.x() - numCellsForInflation;
111 rowStartIdx = index.x() - xCells;
115 if (yCells > numCellsForInflation)
118 colStartIdx = index.y() - numCellsForInflation;
123 colStartIdx = index.y() - yCells;
134 xCells = (int)floor((cellPos.x() - posXMin) / resolution);
135 yCells = (int)floor((cellPos.y() - posYMin) / resolution);
137 if (xCells > numCellsForInflation)
143 blockXSize = (index.x() - rowStartIdx) + numCellsForInflation + 1;
147 blockXSize = (index.x() - rowStartIdx) + xCells + 1;
150 if (yCells > numCellsForInflation)
152 blockYSize = (index.y() - colStartIdx) + numCellsForInflation + 1;
156 blockYSize = (index.y() - colStartIdx) + yCells + 1;
168 rowStartIdx = cellSideLen + rowStartIdx;
173 colStartIdx = cellSideLen + colStartIdx;
195 if (rowStartIdx + blockXSize > cellSideLen && colStartIdx + blockYSize > cellSideLen)
197 int rowsBeforeWrap = cellSideLen - rowStartIdx;
198 int rowsAfterWrap = blockXSize - rowsBeforeWrap;
200 int colsBeforeWrap = cellSideLen - colStartIdx;
201 int colsAfterWrap = blockYSize - colsBeforeWrap;
204 inflateLayer.block(rowStartIdx, 0, rowsBeforeWrap, colsAfterWrap).array() = 30;
207 inflateLayer.block(rowStartIdx, colStartIdx, rowsBeforeWrap, colsBeforeWrap).array() = 30;
210 inflateLayer.block(0, colStartIdx, rowsAfterWrap, colsBeforeWrap).array() = 30;
213 inflateLayer.block(0, 0, rowsAfterWrap, colsAfterWrap).array() = 30;
215 else if (rowStartIdx + blockXSize > cellSideLen)
217 int rowsBeforeWrap = cellSideLen - rowStartIdx;
218 int rowsAfterWrap = blockXSize - rowsBeforeWrap;
221 inflateLayer.block(rowStartIdx, colStartIdx, rowsBeforeWrap, blockYSize).array() = 30;
224 inflateLayer.block(0, colStartIdx, rowsAfterWrap, blockYSize).array() = 30;
226 else if (colStartIdx + blockYSize > cellSideLen)
228 int colsBeforeWrap = cellSideLen - colStartIdx;
229 int colsAfterWrap = blockYSize - colsBeforeWrap;
232 inflateLayer.block(rowStartIdx, colStartIdx, blockXSize, colsBeforeWrap).array() = 30;
235 inflateLayer.block(rowStartIdx, 0, blockXSize, colsAfterWrap).array() = 30;
240 inflateLayer.block(rowStartIdx, colStartIdx, blockXSize, blockYSize).array() = 30;
249 if (layer(index(0), index(1)) == 100)
251 inflateLayer(index(0), index(1)) = 100;
const Length & getLength() const
PLUGINLIB_EXPORT_CLASS(mitre_fast_layered_map::Inflation, filters::FilterBase< grid_map::GridMap >)
bool getPosition(const Index &index, Position &position) const
double inflationSideLen_m_
Determines length of side of square to inflate around an obstacle.
virtual bool update(const grid_map::GridMap &_mapIn, grid_map::GridMap &_mapOut)
bool getParam(const std::string &name, std::string &value)
bool exists(const std::string &layer) const
double getResolution() const
std::string layer_
Layer of grid map to perform outlier removal on.
Filters that operate on a grid map instance.
const Size & getSize() const