#include <RBDyn/RBDyn/MultiBodyGraph.h>
Classes | |
struct | Arc |
struct | Node |
Public Member Functions | |
MultiBodyGraph (const std::string rootName="Root") | |
MultiBodyGraph (const MultiBodyGraph &mbg) | |
~MultiBodyGraph () | |
MultiBodyGraph & | operator= (const MultiBodyGraph &mbg) |
void | clear () |
void | addBody (const Body &B) |
void | addJoint (const Joint &J) |
void | linkBodies (const std::string &b1Name, const sva::PTransformd &tB1, const std::string &b2Name, const sva::PTransformd &tB2, const std::string &jointName, bool isB1toB2=true) |
const std::shared_ptr< Node > | nodeByName (const std::string &name) const |
const std::shared_ptr< Joint > | jointByName (const std::string &name) const |
std::size_t | nrNodes () const |
std::size_t | nrJoints () const |
MultiBody | makeMultiBody (const std::string &rootBodyName, bool isFixed, const sva::PTransformd &X_0_j0=sva::PTransformd::Identity(), const sva::PTransformd &X_b0_j0=sva::PTransformd::Identity()) const |
MultiBody | makeMultiBody (const std::string &rootBodyName, Joint::Type rootJointType, const sva::PTransformd &X_0_j0=sva::PTransformd::Identity(), const sva::PTransformd &X_b0_j0=sva::PTransformd::Identity()) const |
MultiBody | makeMultiBody (const std::string &rootBodyName, Joint::Type rootJointType, const Eigen::Vector3d &axis, const sva::PTransformd &X_0_j0=sva::PTransformd::Identity(), const sva::PTransformd &X_b0_j0=sva::PTransformd::Identity()) const |
void | removeJoint (const std::string &rootBodyName, const std::string &jointName) |
void | removeJoints (const std::string &rootBodyName, const std::vector< std::string > &joints) |
void | mergeSubBodies (const std::string &rootBodyName, const std::string &jointName, const std::map< std::string, std::vector< double >> &jointPosByName) |
std::map< std::string, sva::PTransformd > | bodiesBaseTransform (const std::string &rootBodyName, const sva::PTransformd &X_b0_j0=sva::PTransformd::Identity()) |
std::map< std::string, std::vector< std::string > > | successorJoints (const std::string &rootBodyName) |
std::map< std::string, std::string > | predecessorJoint (const std::string &rootBodyName) |
Static Public Member Functions | |
static MultiBodyGraph | fixJoints (const MultiBodyGraph &other, const std::vector< std::string > &jointsToFix, bool fixAllJoints=false) |
Protected Attributes | |
std::string | rootJointName_ |
std::vector< std::shared_ptr< Node > > | nodes_ |
std::vector< std::shared_ptr< Joint > > | joints_ |
std::map< std::string, std::shared_ptr< Node > > | bodyNameToNode_ |
std::map< std::string, std::shared_ptr< Joint > > | jointNameToJoint_ |
Graph representation of the robot. Provide a undirected graph representation of the robot that allow to create a kinematic tree from any body as root. The graph must be cycle free (closed loop is not supported).
rbd::MultiBodyGraph::MultiBodyGraph | ( | const std::string | rootName = "Root" | ) |
rbd::MultiBodyGraph::MultiBodyGraph | ( | const MultiBodyGraph & | mbg | ) |
rbd::MultiBodyGraph::~MultiBodyGraph | ( | ) |
void rbd::MultiBodyGraph::addBody | ( | const Body & | B | ) |
Add a node to the graph.
B | Body to add, his body name must be unique. |
std::domain_error | if the body name already exists |
void rbd::MultiBodyGraph::addJoint | ( | const Joint & | J | ) |
Add a joint.
J | Joint to add, his joint name must be unique. |
std::domain_error | if the joint name already exists |
std::map<std::string, sva::PTransformd> rbd::MultiBodyGraph::bodiesBaseTransform | ( | const std::string & | rootBodyName, |
const sva::PTransformd & | X_b0_j0 = sva::PTransformd::Identity() |
||
) |
Compute the transformation to apply on each bodies to find their original base.
rootBodyName | Name of graph root. |
X_b0_j0 | Transformation from the root body to the root joint. |
std::out_of_range. |
void rbd::MultiBodyGraph::clear | ( | ) |
|
static |
Return a copy of a graph with the specified joints fixed.
other | Graph to be copied. |
jointsToFix | Names of the joints to be fixed. |
fixAllJoints | If true, all joints are fixed. The value of jointsToFix is disregarded. |
const std::shared_ptr<Joint> rbd::MultiBodyGraph::jointByName | ( | const std::string & | name | ) | const |
name | Name of the joint. |
std::out_of_range | If name don't exist. |
void rbd::MultiBodyGraph::linkBodies | ( | const std::string & | b1Name, |
const sva::PTransformd & | tB1, | ||
const std::string & | b2Name, | ||
const sva::PTransformd & | tB2, | ||
const std::string & | jointName, | ||
bool | isB1toB2 = true |
||
) |
Create an arc to the graph.
b1Name | Body 1 name. |
tB1 | Transformation from body 1 to joint in body 1 coordinate. |
b2Name | Body 2 name. |
tB2 | Transformation from body 2 to joint in body 2 coordinate. |
jointName | Joint between the two body name. |
isB1toB2 | If true use the joint forward value as body 1 to body 2 forward value of the joint and the inverse value for body 2 to body 1 joint. If false the behavior is inversed. |
std::out_of_range | If b1Name or b2Name or jointName don't exist. |
MultiBody rbd::MultiBodyGraph::makeMultiBody | ( | const std::string & | rootBodyName, |
bool | isFixed, | ||
const sva::PTransformd & | X_0_j0 = sva::PTransformd::Identity() , |
||
const sva::PTransformd & | X_b0_j0 = sva::PTransformd::Identity() |
||
) | const |
Create a MultiBody from the graph.
rootBodyName | Name of the root body. |
isFixed | True if the root is fixed, false if the root is free. |
X_0_j0 | Transformation to the root joint. |
X_b0_j0 | Transformation from the root body to the root joint. |
std::out_of_range | If rootBodyId don't exist. |
MultiBody rbd::MultiBodyGraph::makeMultiBody | ( | const std::string & | rootBodyName, |
Joint::Type | rootJointType, | ||
const Eigen::Vector3d & | axis, | ||
const sva::PTransformd & | X_0_j0 = sva::PTransformd::Identity() , |
||
const sva::PTransformd & | X_b0_j0 = sva::PTransformd::Identity() |
||
) | const |
Create a MultiBody from the graph.
rootBodyName | Name of the root body. |
rootJointType | MultiBody root joint type. |
axis | MultiBody root joint axis. |
X_0_j0 | Transformation to the root joint. |
X_b0_j0 | Transformation from the root body to the root joint. |
std::out_of_range | If rootBodyId don't exist. |
MultiBody rbd::MultiBodyGraph::makeMultiBody | ( | const std::string & | rootBodyName, |
Joint::Type | rootJointType, | ||
const sva::PTransformd & | X_0_j0 = sva::PTransformd::Identity() , |
||
const sva::PTransformd & | X_b0_j0 = sva::PTransformd::Identity() |
||
) | const |
void rbd::MultiBodyGraph::mergeSubBodies | ( | const std::string & | rootBodyName, |
const std::string & | jointName, | ||
const std::map< std::string, std::vector< double >> & | jointPosByName | ||
) |
Merge jointName child bodies in jointName parent body (merge inertia matrix)
rootBodyName | Name of graph root. |
jointName | Merge all node after jointName in jointName parent node. |
jointPosByName | Joint configuration by joint name. |
std::out_of_range,std::domain_error. |
const std::shared_ptr<Node> rbd::MultiBodyGraph::nodeByName | ( | const std::string & | name | ) | const |
name | Name of the node. |
std::out_of_range | if id don't exist. |
std::size_t rbd::MultiBodyGraph::nrJoints | ( | ) | const |
std::size_t rbd::MultiBodyGraph::nrNodes | ( | ) | const |
MultiBodyGraph& rbd::MultiBodyGraph::operator= | ( | const MultiBodyGraph & | mbg | ) |
std::map<std::string, std::string> rbd::MultiBodyGraph::predecessorJoint | ( | const std::string & | rootBodyName | ) |
Return the dictionary of predecessor joint name by body name.
rootBodyName | Name of graph root. |
std::out_of_range. |
void rbd::MultiBodyGraph::removeJoint | ( | const std::string & | rootBodyName, |
const std::string & | jointName | ||
) |
Remove a joint (and successor joints and bodies) from the graph.
rootBodyName | Name of graph root. |
jointName | Name of joint to remove. |
std::out_of_range | If rootBodyName doesn't exist. |
void rbd::MultiBodyGraph::removeJoints | ( | const std::string & | rootBodyName, |
const std::vector< std::string > & | joints | ||
) |
Remove joints (and successor joints and bodies) from the graph. Do nothing for each joint name that doesn't exist.
rootBodyName | Name of the graph root. |
joints | List of joints names to remove. |
std::out_of_range | If rootBodyName doesn't exist. |
std::map<std::string, std::vector<std::string> > rbd::MultiBodyGraph::successorJoints | ( | const std::string & | rootBodyName | ) |
Return the dictionary of successor joints name by body name.
rootBodyName | Name of graph root. |
std::out_of_range. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |