OccupancyGridHelper.cpp
Go to the documentation of this file.
2
3#include "types.h"
4
5namespace armarx
6{
8 const Params& params) :
9 occupancyGrid(occupancyGrid), params(params)
10 {
11 }
12
15 {
16 return (occupancyGrid.grid > 0.F).cast<bool>();
17 }
18
21 {
22 // matrix1 = matrix1 .unaryExpr(std::ptr_fun(ReplaceNanWithValue<1>));
23 // return (occupancyGrid.grid ).cast<bool>();
24
25 const auto isFree = [&](OccupancyGrid::CellType p) -> float
26 { return static_cast<float>(p < params.freespaceThreshold and p > 0.F); };
27
28 // TODO(fabian.reister): which one to choose?
29 // return occupancyGrid.grid.unaryExpr(isFree).cast<bool>();
30 return occupancyGrid.grid.unaryViewExpr(isFree).cast<bool>();
31 }
32
35 {
36 const auto isOccupied = [&](OccupancyGrid::CellType p) -> float
37 { return static_cast<float>(p > params.occupiedThreshold); };
38
39 return occupancyGrid.grid.unaryViewExpr(isOccupied).cast<bool>();
40 }
41
42} // namespace armarx
OccupancyGridHelper(const OccupancyGrid &occupancyGrid, const Params &params=Params())
detail::OccupancyGridHelperParams Params
Eigen::Array< bool, Eigen::Dynamic, Eigen::Dynamic > BinaryArray
This file offers overloads of toIce() and fromIce() functions for STL container types.