Struct ModelGraph

Struct Documentation

struct ModelGraph

Represents multibody model as a bidirectional graph.

This is an intermediate step before creating a model, that allows more flexibility as to which body will be the root…

Public Types

typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, ModelGraphVertex, ModelGraphEdge> Graph
typedef boost::graph_traits<Graph>::vertex_descriptor VertexDesc
typedef boost::graph_traits<Graph>::edge_descriptor EdgeDesc

Public Functions

ModelGraph() = default
void addFrame(const std::string &vertex_name, const FrameVariant &frame)

Add a new vertex to the graph.

Parameters:
  • vertex_name[in] Name of the vertex

  • frame[in] which type of frame will be added to the model (op_frame, sensor, body)

void addBody(const std::string &vertex_name, const Inertia &inert)

Add a new body to the graph.

Parameters:
  • vertex_name[in] Name of the vertex

  • inert[in] inertia of the body

GeometryBuilder geometryBuilder()
void addGeometry(const std::string &vertex_name, const Geometry &geom)
void addGeometries(const std::string &vertex_name, const std::vector<Geometry> &geoms)
void addJoint(const std::string &joint_name, const JointVariant &joint, const std::string &source_body, const SE3 &source_to_joint, const std::string &target_body, const SE3 &joint_to_target)

Add edges (joint) to the graph. Since it’s a bidirectional graph, edge and its reverse are added to the graph.

Note

Since it’s a bidirectional graph, two edges are added to the graph. Joints and transformation are inverted, to create reverse edge.

Parameters:
  • joint_name[in] Name of the edge

  • joint[in] Type of the joint

  • source_body[in] Vertex that is supporting the edge

  • source_to_joint[in] Transformation from supporting vertex to edge

  • target_body[in] Vertex that is supported by edge

  • joint_to_target[in] Transformation from edge to supported vertex

void addJoint(const EdgeParameters &params)

Add edges (joint) to the graph. Since it’s a bidirectional graph, edge and its reverse are added to the graph.

Note

Since it’s a bidirectional graph, two edges are added to the graph. Joints and transformation are inverted, to create reverse edge.

Parameters:

params[in] Structure that holds all of the joint parameters

EdgeBuilder edgeBuilder()

Create an EdgeBuilde. This will allow to use EdgeBuilder interface to have a more flexible edge configuration.

void appendGraph(const ModelGraph &g)

add all the vertex and edges from a graph to this one. Attention : it does not add an edge between the two, so it will be like having two graph coexisting in this structure.

Parameters:

g – graph that will be added

Public Members

Graph graph

Boost graph structure that holds the graph structure.

std::unordered_map<std::string, VertexDesc> name_to_vertex

Name of the vertexes in the graph. Useful for graph parcours.