Skip to content
Snippets Groups Projects

Feature/costmap integration

Merged Fabian Reister requested to merge feature/costmap-integration into master
All threads resolved!
6 files
+ 185
19
Compare changes
  • Side-by-side
  • Inline
Files
6
@@ -62,5 +62,38 @@ namespace armarx::navigation::algorithms
return grid(v.index.x(), v.index.y()) == 0.F;
}
bool
Costmap::add(const Costmap& other)
{
const auto startIdx = toVertex(other.sceneBounds.min);
// merge other grid into this one => use max costs
// TODO if one of both matrices has mask, it has to be considered.
ARMARX_TRACE;
grid.block(startIdx.index.x(), startIdx.index.y(), other.grid.rows(), other.grid.cols()) =
grid.block(startIdx.index.x(), startIdx.index.y(), other.grid.rows(), other.grid.cols())
.cwiseMax(other.grid);
if(other.mask.has_value())
{
if(not mask.has_value())
{
mask = Mask(grid.rows(), grid.cols());
mask->setOnes();
}
// union of masks
ARMARX_TRACE;
mask = mask->cwiseMin(other.mask->value());
// apply mask to grid => all invalid points will be 0
ARMARX_TRACE;
grid = grid.cwiseProduct(mask->cast<float>());
}
return true;
}
} // namespace armarx::navigation::algorithms
Loading