25 #include <Ice/LocalException.h>
27 #include <SimoxUtility/color/Color.h>
28 #include <SimoxUtility/color/GlasbeyLUT.h>
29 #include <SimoxUtility/color/cmaps/colormaps.h>
43 #include <armarx/navigation/core/aron/Graph.aron.generated.h>
44 #include <armarx/navigation/core/aron/Location.aron.generated.h>
46 #include <armarx/navigation/human/aron/Human.aron.generated.h>
48 #include <armarx/navigation/rooms/aron/Room.aron.generated.h>
61 locSegment(locSegment),
62 graphSegment(graphSegment),
63 costmapSegment(costmapSegment),
64 humanSegment(humanSegment),
65 roomsSegment(roomsSegment),
66 visu(
std::make_unique<graph::GraphVisu>())
76 const std::vector<ObjectInfo>& info,
79 using namespace armem::server;
81 std::map<armem::MemoryID, location::arondto::Location> locations;
90 locations[entity.id()].fromAron(instance->data());
95 for (
auto& [
id, location] : locations)
98 fromAron(location.framedPose, framedPose);
101 if (res.pose.has_value())
103 visu->vertex->draw(layer,
id.
str(), res.pose.value());
110 const std::vector<ObjectInfo>& info,
111 std::vector<viz::Layer>& layers,
114 using namespace armem::server;
116 std::map<armem::MemoryID, core::Graph> graphs;
121 [&](
const wm::Entity& entity)
128 navigation::core::arondto::Graph aron;
129 aron.fromAron(instance->data());
130 fromAron(aron, graph);
137 for (
auto& [
id, graph] : graphs)
143 visu->draw(layer, graph, {objects, info});
156 const std::vector<ObjectInfo> info;
163 std::vector<viz::Layer>& layers,
176 const std::vector<ObjectInfo> info = objectFinder.findAllObjects();
180 catch (::Ice::NotRegisteredException e)
182 ARMARX_VERBOSE <<
"Failed to retrieve objects from ObjectMemory: " << e.what();
191 const std::vector<ObjectInfo> info;
197 std::vector<viz::Layer>& layers,
209 const std::vector<ObjectInfo> info = objectFinder.findAllObjects();
213 catch (::Ice::NotRegisteredException e)
215 ARMARX_VERBOSE <<
"Failed to retrieve objects from ObjectMemory: " << e.what();
227 const Eigen::Translation3f human_T_mmm(Eigen::Vector3f{0, 0, 1000});
230 for (
const auto& human : humans)
244 mmm.file(
"RobotAPI",
"RobotAPI/robots/MMM/mmm.xml");
251 if (human.linearVelocity != Eigen::Vector2f::Zero())
254 vel3d.translation().head<2>() += human.linearVelocity * 2;
256 .fromTo(human3d.translation(), vel3d.translation())
273 std::map<std::string, std::vector<std::pair<std::string, algorithms::Costmap>>>
274 namedProviderCostmaps;
279 using namespace armem::server;
286 navigation::algorithms::Costmap costmap =
287 algorithms::fromAron(*instance);
289 namedProviderCostmaps[instance->id().providerSegmentName].emplace_back(
290 instance->id().entityName, std::move(costmap));
295 for (
const auto& [providerName, namedCostmaps] : namedProviderCostmaps)
298 for (
const auto& [name, costmap] : namedCostmaps)
308 using namespace armem::server;
310 std::map<armem::MemoryID, rooms::Room>
rooms;
322 navigation::rooms::arondto::Room aron;
323 aron.fromAron(instance->data());
324 fromAron(aron, room);
332 for (
auto& [
id, room] :
rooms)
337 const auto color = simox::color::GlasbeyLUT::at(i++);
339 drawRoom(layer, room, color);
351 for (
const auto& point : room.
polygon)
360 polygon.color(color.with_alpha(50));
361 polygon.lineColor(simox::Color::black());
362 polygon.lineWidth(0);
372 const bool visuTransparent,
380 std::map<std::string, navigation::human::Humans> namedProviderHumans;
386 using namespace armem::server;
391 namedProviderHumans[entity.
id().providerSegmentName];
393 [&namedProviderHumans, ×tamp, &maxAge](
397 timestamp - instance.
metadata().referencedTime;
399 if (dtToNow < maxAge and dtToNow.
isPositive())
401 const auto dto = navigation::human::arondto::Human::FromAron(
404 navigation::human::Human human;
405 fromAron(dto, human);
407 namedProviderHumans[instance.id().providerSegmentName]
408 .emplace_back(std::move(human));
414 for (
const auto& [providerName, humans] : namedProviderHumans)
417 visualize(humans, layer, visuTransparent);