33#include <RobotAPI/libraries/armem_locations/aron/Location.aron.generated.h>
38#include <armarx/navigation/core/aron/Graph.aron.generated.h>
41#include <SemanticObjectRelations/RelationGraph/RelationGraph.h>
42#include <SemanticObjectRelations/Shapes/Shape.h>
55 return aron.locationID.entityName;
63 return aron.locationID.providerSegmentName;
71 return not(
aron.locationID.providerSegmentName.empty() and
72 aron.locationID.entityName.empty());
78 return _pose.has_value();
100 << _pose->agent <<
"'.";
103 << _pose->frame <<
"'.";
104 return Pose(_pose->toEigen());
108 Graph::strEdge(ConstEdge edge)
const
110 std::stringstream ss;
111 ss << semrel::RelationGraph<VertexAttribs, EdgeAttribs, GraphAttribs>::strEdge(edge);
113 ss <<
" cost " << edge.attrib().cost()
114 <<
", type: " <<
static_cast<int>(edge.attrib().strategy) <<
" , has traj "
115 << edge.attrib().trajectory.has_value();
135 std::vector<core::GraphPath>
138 std::set<core::Graph::VertexDescriptor> visited)
140 using namespace core;
143 if (visited.count(vertex.descriptor()) > 0)
148 visited.insert(vertex.descriptor());
150 std::vector<GraphPath> paths;
152 paths.push_back({vertex});
161 for (
const auto edge : vertex.inEdges())
163 std::vector<GraphPath> pathsToSource =
findPathsTo(edge.source(),
graph, visited);
164 for (
auto path : pathsToSource)
168 ARMARX_CHECK(std::find(path.begin(), path.end(), vertex) == path.end());
171 path.push_back(vertex);
173 paths.push_back(path);
181 std::vector<core::GraphPath>
184 std::set<Graph::VertexDescriptor> visited;
192 for (
auto vertex : bo.vertices())
194 auto& v = dto.vertices.emplace_back(vertex.attrib().aron);
195 v.vertexID =
static_cast<std::int64_t
>(vertex.objectID());
199 for (
auto edge : bo.edges())
201 auto& e = dto.edges.emplace_back(edge.attrib().aron);
202 e.sourceVertexID =
static_cast<std::int64_t
>(edge.sourceObjectID());
203 e.targetVertexID =
static_cast<std::int64_t
>(edge.targetObjectID());
208 core::Graph::ConstVertex
211 auto vertices =
graph.vertices();
212 const auto vertexIt =
213 std::find_if(vertices.begin(),
215 [&vertexName](
const core::Graph::ConstVertex& vertex) ->
bool
216 { return vertex.attrib().getLocationName() == vertexName; });
219 <<
"No vertex found with id " <<
QUOTED(vertexName);
226 auto vertices =
graph.vertices();
227 return std::any_of(vertices.begin(),
229 [&vertexName](
const core::Graph::ConstVertex& vertex) ->
bool
230 { return vertex.attrib().getLocationName() == vertexName; });
236 auto graphIt = std::find_if(graphs.begin(),
239 { return hasVertex(vertexName, graph); });
242 <<
"No subgraph found for vertex " <<
QUOTED(vertexName);
250 for (
const arondto::Vertex& vertex : dto.vertices)
252 auto v = bo.addVertex(semrel::ShapeID(vertex.vertexID));
253 v.attrib().aron = vertex;
257 for (
const arondto::Edge& edge : dto.edges)
259 auto e = bo.addEdge(semrel::ShapeID(edge.sourceVertexID),
260 semrel::ShapeID(edge.targetVertexID));
261 e.attrib().aron = edge;
269 navigation::location::arondto::Location dto;
270 dto.fromAron(locationData);
274 vertex.attrib().setPose(pose);
#define ARMARX_CHECK_EMPTY(c)
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
#define ARMARX_CHECK_EQUAL(lhs, rhs)
This macro evaluates whether lhs is equal (==) rhs and if it turns out to be false it will throw an E...
std::string const GlobalFrame
Variable of the global coordinate system.
std::shared_ptr< Dict > DictPtr
This file is part of ArmarX.
Graph::ConstVertex getVertexByName(const std::string &vertexName, const Graph &graph)
std::vector< Graph > Graphs
bool hasVertex(const std::string &vertexName, const Graph &graph)
std::vector< GraphPath > findPathsTo(Graph::ConstVertex vertex, const Graph &graph)
void resolveLocation(Graph::Vertex &vertex, const aron::data::DictPtr &locationData)
void toAron(arondto::GlobalTrajectoryPoint &dto, const GlobalTrajectoryPoint &bo)
void fromAron(const arondto::GlobalTrajectoryPoint &dto, GlobalTrajectoryPoint &bo)
const core::Graph & getSubgraph(const std::string &vertexName, const Graphs &graphs)
std::vector< core::GraphPath > findPathsTo(core::Graph::ConstVertex vertex, const core::Graph &graph, std::set< core::Graph::VertexDescriptor > visited)
This file is part of ArmarX.
This file is part of ArmarX.
void fromAron(const arondto::PackagePath &dto, PackageFileLocation &bo)
Pose requireGlobal() const
std::string getFullName() const
bool hasLocationName() const
std::string getProviderName() const
armarx::navigation::core::arondto::Vertex aron
FramedPose getPose() const
std::string getLocationName() const
void setPose(const FramedPose &pose)