Drake

Data structure to store the topological information associated with an entire MultibodyTree. More...
#include <drake/multibody/multibody_tree/multibody_tree_topology.h>
Public Member Functions  
MultibodyTreeTopology ()  
Default constructor creates an empty, invalid topology. More...  
bool  operator== (const MultibodyTreeTopology &other) const 
Returns true if all members of this topology are exactly equal to the members of other . More...  
int  num_bodies () const 
Returns the number of bodies in the multibody tree. More...  
int  num_frames () const 
Returns the number of physical frames in the multibody tree. More...  
int  num_mobilizers () const 
Returns the number of mobilizers in the multibody tree. More...  
int  get_num_body_nodes () const 
Returns the number of tree nodes. This must equal the number of bodies. More...  
int  num_force_elements () const 
Returns the number of force elements in the topology. More...  
int  num_joint_actuators () const 
Returns the number of joint actuators in the topology. More...  
int  tree_height () const 
Returns the number of tree levels in the topology. More...  
const FrameTopology &  get_frame (FrameIndex index) const 
Returns a constant reference to the corresponding FrameTopology given the FrameIndex. More...  
const BodyTopology &  get_body (BodyIndex index) const 
Returns a constant reference to the corresponding BodyTopology given a BodyIndex. More...  
const MobilizerTopology &  get_mobilizer (MobilizerIndex index) const 
Returns a constant reference to the corresponding BodyTopology given a BodyIndex. More...  
const JointActuatorTopology &  get_joint_actuator (JointActuatorIndex index) const 
Returns a constant reference to the corresponding JointActuatorTopology given a JointActuatorIndex. More...  
const BodyNodeTopology &  get_body_node (BodyNodeIndex index) const 
Returns a constant reference to the corresponding BodyNodeTopology given a BodyNodeIndex. More...  
std::pair< BodyIndex, FrameIndex >  add_body () 
Creates and adds a new BodyTopology to this MultibodyTreeTopology. More...  
FrameIndex  add_frame (BodyIndex body_index) 
Creates and adds a new FrameTopology, associated with the given body_index, to this MultibodyTreeTopology. More...  
MobilizerIndex  add_mobilizer (FrameIndex in_frame, FrameIndex out_frame, int num_positions, int num_velocities) 
Creates and adds a new MobilizerTopology connecting the inboard and outboard multibody frames identified by indexes in_frame and out_frame , respectively. More...  
ForceElementIndex  add_force_element () 
Creates and adds a new ForceElementTopology, associated with the given force_index, to this MultibodyTreeTopology. More...  
JointActuatorIndex  add_joint_actuator (int num_dofs) 
Creates and adds a new JointActuatorTopology for a joint with num_dofs degrees of freedom. More...  
void  Finalize () 
This method must be called by MultibodyTree::Finalize() after all topological elements in the tree (corresponding to joints, bodies, force elements, constraints) were added and before any computations are performed. More...  
bool  is_valid () const 
Returns true if Finalize() was already called on this topology. More...  
int  num_positions () const 
Returns the total number of generalized positions in the model. More...  
int  num_velocities () const 
Returns the total number of generalized velocities in the model. More...  
int  num_states () const 
Returns the total size of the state vector in the model. More...  
int  num_actuated_dofs () const 
Returns the total number of actuated joint dofs in the model. More...  
void  GetKinematicPathToWorld (BodyNodeIndex from, std::vector< BodyNodeIndex > *path_to_world) const 
Given a node in this topology, specified by its BodyNodeIndex from , this method computes the kinematic path formed by all the nodes in the tree that connect from with the root (corresponding to the world). More...  
std::vector< std::set< BodyIndex > >  CreateListOfWeldedBodies () const 
This method partitions the tree topology into subgraphs such that two bodies are in the same subgraph if there is a path between them which includes only weldedmobilizer. More...  
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable  
MultibodyTreeTopology (const MultibodyTreeTopology &)=default  
MultibodyTreeTopology &  operator= (const MultibodyTreeTopology &)=default 
MultibodyTreeTopology (MultibodyTreeTopology &&)=default  
MultibodyTreeTopology &  operator= (MultibodyTreeTopology &&)=default 
Data structure to store the topological information associated with an entire MultibodyTree.

default 

default 

inline 
Default constructor creates an empty, invalid topology.
The minimum valid topology for a minimum valid MultibodyTree contains at least the BodyTopology for the world. The topology for the world body does not get added until MultibodyTree construction, which creates a world body and adds it to the tree.

inline 
Creates and adds a new BodyTopology to this MultibodyTreeTopology.
The BodyTopology will be assigned a new, unique BodyIndex and FrameIndex values.
std::logic_error  if Finalize() was already called on this topology. 

inline 
Creates and adds a new ForceElementTopology, associated with the given force_index, to this MultibodyTreeTopology.
std::logic_error  if Finalize() was already called on this topology. 

inline 
Creates and adds a new FrameTopology, associated with the given body_index, to this MultibodyTreeTopology.
std::logic_error  if Finalize() was already called on this topology. 

inline 
Creates and adds a new JointActuatorTopology for a joint with num_dofs
degrees of freedom.
[in]  num_dofs  The number of joint dofs actuated by this actuator. 
std::logic_error  if Finalize() was already called on this topology. 

inline 
Creates and adds a new MobilizerTopology connecting the inboard and outboard multibody frames identified by indexes in_frame
and out_frame
, respectively.
The created topology will correspond to that of a Mobilizer with num_positions
and num_velocities
.
std::runtime_error  if either in_frame or out_frame do not index frame topologies in this MultibodyTreeTopology. 
std::runtime_error  if in_frame == out_frame . 
std::runtime_error  if in_frame and out_frame already are connected by another mobilizer. More than one mobilizer between two frames is not allowed. 
std::logic_error  if Finalize() was already called on this topology. 

inline 
This method partitions the tree topology into subgraphs such that two bodies are in the same subgraph if there is a path between them which includes only weldedmobilizer.
Each subgraph of welded bodies is represented as a set of body indices. By definition, these subgraphs will be disconnected by any nonweld mobilizers that may be inboard or outboard of any given body. The first subgraph will have all of the bodies welded to the world; all subsequent subgraphs will be in no particular order. A few more notes:

inline 
This method must be called by MultibodyTree::Finalize() after all topological elements in the tree (corresponding to joints, bodies, force elements, constraints) were added and before any computations are performed.
It essentially compiles all the necessary "topological information", i.e. how bodies, joints and, any other elements connect with each other, and performs all the required preprocessing to perform computations at a later stage. This preprocessing includes:
If the finalize stage is successful, the this
topology is validated, meaning it is uptodate after this call. No more multibody tree elements can be added after a call to Finalize().
std::logic_error  If users attempt to call this method on an already finalized topology. 

inline 
Returns a constant reference to the corresponding BodyTopology given a BodyIndex.

inline 
Returns a constant reference to the corresponding BodyNodeTopology given a BodyNodeIndex.

inline 
Returns a constant reference to the corresponding FrameTopology given the FrameIndex.

inline 
Returns a constant reference to the corresponding JointActuatorTopology given a JointActuatorIndex.

inline 
Returns a constant reference to the corresponding BodyTopology given a BodyIndex.

inline 
Returns the number of tree nodes. This must equal the number of bodies.

inline 
Given a node in this
topology, specified by its BodyNodeIndex from
, this method computes the kinematic path formed by all the nodes in the tree that connect from
with the root (corresponding to the world).
[in]  from  A node in the tree topology to which the path to the root (world) is to be computed. 
[out]  path_to_world  A std::vector of body node indexes that on output will contain the path to the root of the tree. Forward iteration (from element 0 to element size()1) of path_to_world will traverse all nodes in the tree starting at the root along the path to from . That is, forward iteration starts with the root of the tree at path_to_world[0] and ends with from at path_to_world.back() . On input, path_to_world must be a valid pointer. On output this vector will be resized, only if needed, to store as many elements as the level (BodyNodeTopology::level) of body node from plus one (so that we can include the root node in the path). 

inline 
Returns true
if Finalize() was already called on this
topology.

inline 
Returns the total number of actuated joint dofs in the model.

inline 
Returns the number of bodies in the multibody tree.
This includes the "world" body and therefore the minimum number of bodies after MultibodyTree::Finalize() will always be one, not zero.

inline 
Returns the number of force elements in the topology.

inline 
Returns the number of physical frames in the multibody tree.

inline 
Returns the number of joint actuators in the topology.

inline 
Returns the number of mobilizers in the multibody tree.
Since the "world" body does not have a mobilizer, the number of mobilizers will always equal the number of bodies minus one.

inline 
Returns the total number of generalized positions in the model.

inline 
Returns the total size of the state vector in the model.

inline 
Returns the total number of generalized velocities in the model.

default 

default 

inline 
Returns true
if all members of this
topology are exactly equal to the members of other
.

inline 
Returns the number of tree levels in the topology.