5 #include <SimoxUtility/color/Color.h>
19 #include <range/v3/range/conversion.hpp>
20 #include <range/v3/view/reverse.hpp>
37 const ShortestPathFasterAlgorithm spfa(obstacleDistancesCostmap,
40 ShortestPathFasterAlgorithm::Result result = spfa.spfa(
conv::to2D(global_P_robot));
44 obstacleDistancesCostmap, result.distances, result.reachable);
48 const std::size_t cX = roomCostmap.
getGrid().rows();
49 const std::size_t cY = roomCostmap.
getGrid().cols();
54 #pragma omp parallel for schedule(static)
55 for (
unsigned int x = 0;
x < cX;
x++)
57 for (
unsigned int y = 0; y < cY; y++)
66 const bool isInside = room.
isInside(pos3d);
80 const auto plan = spfa.plan(
conv::to2D(global_P_robot),
81 conv::to2D(closestReachablePositionOnRoomBoundary));
85 auto layer = arviz->
layer(
"RoomNavigationTargetCreator");
88 layer.add(
viz::Sphere(
"closestReachablePositionOnRoomBoundary")
89 .position(closestReachablePositionOnRoomBoundary)
91 .color(simox::Color::blue()));
101 namespace r = ::ranges;
102 namespace rv = ::ranges::views;
104 const auto reversedPlan =
rv::reverse(plan.path) | r::to_vector;
106 const auto goalPos =
conv::to2D(closestReachablePositionOnRoomBoundary);
108 for (
const auto& pos : reversedPlan)
116 ARMARX_INFO <<
"There is something wrong with the path!";
120 if (arviz !=
nullptr)
122 auto layer = arviz->
layer(
"RoomNavigationTargetCreator_target");
132 return {.global_P_roomEntry = closestReachablePositionOnRoomBoundary,
133 .global_P_robot = posInFrontOfRoom};