3 #include <SimoxUtility/color/Color.h>
14 #include <range/v3/range/conversion.hpp>
15 #include <range/v3/view/reverse.hpp>
32 const ShortestPathFasterAlgorithm spfa(obstacleDistancesCostmap,
33 ShortestPathFasterAlgorithm::Parameters());
35 ShortestPathFasterAlgorithm::Result result = spfa.spfa(
conv::to2D(global_P_robot));
39 obstacleDistancesCostmap.
params(),
46 const std::size_t cX = roomCostmap.
getGrid().rows();
47 const std::size_t cY = roomCostmap.
getGrid().cols();
52 #pragma omp parallel for schedule(static)
53 for (
unsigned int x = 0; x < cX; x++)
55 for (
unsigned int y = 0; y < cY; y++)
64 const bool isInside = room.
isInside(pos3d);
67 roomCostmap.
getMutableGrid()(x, y) *=
static_cast<float>(isInside);
78 const auto plan = spfa.plan(
conv::to2D(global_P_robot),
79 conv::to2D(closestReachablePositionOnRoomBoundary));
83 auto layer = arviz->
layer(
"RoomNavigationTargetCreator");
86 layer.add(
viz::Sphere(
"closestReachablePositionOnRoomBoundary")
87 .position(closestReachablePositionOnRoomBoundary)
89 .color(simox::Color::blue()));
99 namespace r = ::ranges;
100 namespace rv = ::ranges::views;
102 const auto reversedPlan =
rv::reverse(plan.path) | r::to_vector;
104 const auto goalPos =
conv::to2D(closestReachablePositionOnRoomBoundary);
106 for (
const auto& pos : reversedPlan)
114 ARMARX_INFO <<
"There is something wrong with the path!";
118 if (arviz !=
nullptr)
120 auto layer = arviz->
layer(
"RoomNavigationTargetCreator_target");
130 return {.global_P_roomEntry = closestReachablePositionOnRoomBoundary,
131 .global_P_robot = posInFrontOfRoom};