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 
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
armarx::armem::vision::OccupancyGrid
Definition: types.h:36
armarx::OccupancyGridHelper::knownCells
BinaryArray knownCells() const
Definition: OccupancyGridHelper.cpp:14
armarx::OccupancyGridHelper::freespace
BinaryArray freespace() const
Definition: OccupancyGridHelper.cpp:20
armarx::detail::OccupancyGridHelperParams
Definition: OccupancyGridHelper.h:16
armarx::OccupancyGridHelper::obstacles
BinaryArray obstacles() const
Definition: OccupancyGridHelper.cpp:34
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:27