Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FrameSemantics: fix NullVertex warnings #1458

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/FrameSemantics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ FindSourceVertex(const ScopedGraph<T> &_graph,
using DirectedEdge = typename ScopedGraph<T>::Edge;
using Vertex = typename ScopedGraph<T>::Vertex;
using VertexId = gz::math::graph::VertexId;
using VertexType = typename ScopedGraph<T>::VertexType;
using gz::math::graph::NullVertex;
using EdgesType = std::vector<DirectedEdge>;
using PairType = std::pair<const Vertex &, EdgesType>;
EdgesType edges;
Expand All @@ -86,7 +88,7 @@ FindSourceVertex(const ScopedGraph<T> &_graph,
_errors.push_back({ErrorCode::POSE_RELATIVE_TO_INVALID,
"Unable to resolve pose, invalid vertex[" + std::to_string(_id) + "] "
"in PoseRelativeToGraph."});
return PairType(Vertex::NullVertex, EdgesType());
return PairType(NullVertex<VertexType>(), EdgesType());
}

if (_id == _graph.ScopeVertexId())
Expand All @@ -106,7 +108,7 @@ FindSourceVertex(const ScopedGraph<T> &_graph,
_errors.push_back({ErrorCode::POSE_RELATIVE_TO_GRAPH_ERROR,
"PoseRelativeToGraph error: multiple incoming edges to "
"current vertex [" + vertex.get().Name() + "]."});
return PairType(Vertex::NullVertex, EdgesType());
return PairType(NullVertex<VertexType>(), EdgesType());
}
auto const &edge = incidentsTo.begin()->second;
vertex = _graph.Graph().VertexFromId(edge.get().Vertices().first);
Expand All @@ -116,7 +118,7 @@ FindSourceVertex(const ScopedGraph<T> &_graph,
_errors.push_back({ErrorCode::POSE_RELATIVE_TO_CYCLE,
"PoseRelativeToGraph cycle detected, already visited vertex [" +
vertex.get().Name() + "]."});
return PairType(Vertex::NullVertex, EdgesType());
return PairType(NullVertex<VertexType>(), EdgesType());
}
if (vertex.get().Id() == _graph.ScopeVertexId())
{
Expand All @@ -129,7 +131,7 @@ FindSourceVertex(const ScopedGraph<T> &_graph,
if (vertex.get().Id() != _graph.ScopeVertexId())
{
// Error, the root vertex is not the same as the the source
return PairType(Vertex::NullVertex, EdgesType());
return PairType(NullVertex<VertexType>(), EdgesType());
}

return PairType(vertex, edges);
Expand Down Expand Up @@ -157,6 +159,8 @@ FindSinkVertex(
using DirectedEdge = typename ScopedGraph<T>::Edge;
using Vertex = typename ScopedGraph<T>::Vertex;
using VertexId = gz::math::graph::VertexId;
using VertexType = typename ScopedGraph<T>::VertexType;
using gz::math::graph::NullVertex;
using EdgesType = std::vector<DirectedEdge>;
using PairType = std::pair<const Vertex &, EdgesType>;
EdgesType edges;
Expand All @@ -166,7 +170,7 @@ FindSinkVertex(
_errors.push_back({ErrorCode::FRAME_ATTACHED_TO_INVALID,
"Invalid vertex[" + std::to_string(_id) + "] "
"in FrameAttachedToGraph."});
return PairType(Vertex::NullVertex, EdgesType());
return PairType(NullVertex<VertexType>(), EdgesType());
}

std::set<VertexId> visited;
Expand All @@ -180,7 +184,7 @@ FindSinkVertex(
_errors.push_back({ErrorCode::FRAME_ATTACHED_TO_GRAPH_ERROR,
"FrameAttachedToGraph error: multiple outgoing edges from "
"current vertex [" + vertex.get().Name() + "]."});
return PairType(Vertex::NullVertex, EdgesType());
return PairType(NullVertex<VertexType>(), EdgesType());
}
auto const &edge = incidentsFrom.begin()->second;
vertex = _graph.Graph().VertexFromId(edge.get().Vertices().second);
Expand All @@ -190,7 +194,7 @@ FindSinkVertex(
_errors.push_back({ErrorCode::FRAME_ATTACHED_TO_CYCLE,
"FrameAttachedToGraph cycle detected, already visited vertex [" +
vertex.get().Name() + "]."});
return PairType(Vertex::NullVertex, EdgesType());
return PairType(NullVertex<VertexType>(), EdgesType());
}
visited.insert(vertex.get().Id());
incidentsFrom = _graph.Graph().IncidentsFrom(vertex);
Expand Down
Loading