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