Drake
drake::parsers Namespace Reference

Namespaces

 sdf
 
 urdf
 

Classes

struct  FloatingJointConstants
 Defines constants used by AddFloatingJoint(). More...
 

Typedefs

typedef std::map< std::string, intModelInstanceIdTable
 Defines a data type that maps model names to their instance IDs within the RigidBodyTree. More...
 
using PackageMap = drake::multibody::parsing::PackageMap
 

Functions

void AddModelInstancesToTable (const drake::parsers::ModelInstanceIdTable &source_table, drake::parsers::ModelInstanceIdTable *dest_table)
 Adds the model instances in source_table to dest_table. More...
 
int AddFloatingJoint (const FloatingBaseType floating_base_type, const vector< int > &body_indices, const std::shared_ptr< RigidBodyFrame< double >> weld_to_frame, const PoseMap *pose_map, RigidBodyTree< double > *tree)
 
CompliantMaterial ParseCollisionCompliance (XMLElement *node)
 
void ParseCollisionFilterGroup (RigidBodyTree< double > *tree, XMLElement *node, int model_instance_id)
 
int AddFloatingJoint (multibody::joints::FloatingBaseType floating_base_type, const std::vector< int > &body_indices, const std::shared_ptr< RigidBodyFrame< double >> weld_to_frame, const PoseMap *pose_map, RigidBodyTree< double > *tree)
 Adds a floating joint to each body specified by body_indices that does not already have a parent. More...
 
systems::CompliantMaterial ParseCollisionCompliance (tinyxml2::XMLElement *node)
 Instantiates a CompliantMaterial instance from an XMLNode. More...
 
void ParseCollisionFilterGroup (RigidBodyTree< double > *tree, tinyxml2::XMLElement *node, int model_instance_id)
 Parses the Drake collision filter group specification. More...
 

Typedef Documentation

typedef std::map<std::string, int> ModelInstanceIdTable

Defines a data type that maps model names to their instance IDs within the RigidBodyTree.

The model names are defined in a single URDF or SDF file and are thus guaranteed to be unique within an instance of this data type. The instance IDs are determined by by the RigidBodyTree and are unique among all model instances within the tree. This data type is used to inform applications of the IDs that were assigned to model instances as they were added to a RigidBodyTree while parsing a URDF or SDF description.

The model names within this data type are specified by the URDF and SDF. They are not the same as "model instance names" since multiple instances of the same model may be added to the same RigidBodyTree. Model instance names can be decided by the application based on the information contained within this data type. It is recommended, but not required, that applications separately create mappings from model instance IDs to meaningful model instance names. This is because an instance ID, as an integer, does not convey much information about the model instance.

Function Documentation

int drake::parsers::AddFloatingJoint ( const FloatingBaseType  floating_base_type,
const vector< int > &  body_indices,
const std::shared_ptr< RigidBodyFrame< double >>  weld_to_frame,
const PoseMap pose_map,
RigidBodyTree< double > *  tree 
)
int drake::parsers::AddFloatingJoint ( multibody::joints::FloatingBaseType  floating_base_type,
const std::vector< int > &  body_indices,
const std::shared_ptr< RigidBodyFrame< double >>  weld_to_frame,
const PoseMap pose_map,
RigidBodyTree< double > *  tree 
)

Adds a floating joint to each body specified by body_indices that does not already have a parent.

This method is only intended to be called by parsers since parsers add bodies to the RigidBodyTree en masse. The logic in this method is necessary to identify which of the rigid bodies specified by body_indices get floating joints.

When manually adding a model instance to the RigidBodyTree, i.e., directly using the C++ API rather than via a parser, this method should not be necessary since floating joints can be directly added by calling RigidBody::setJoint().

Parameters
[in]floating_base_typeThe floating joint's type.
[in]body_indicesA list of body indexes to check. A floating joint is added to any body in this list that does not have a parent joint.
[in]weld_to_frameThe frame to which the floating joint should attach the parent-less non-world bodies. This parameter may be nullptr, in which case the body is welded to the world with zero offset.
[in]pose_mapA mapping where the key is the body's name and the value is the transform from the frame of the body to the frame of the model to which the body belongs. This parameter will may be nullptr, in which case an identity transform is used.
[out]treeThe RigidBodyTree to which to add the floating joints.
Returns
The number of floating joint added to this rigid body tree.
Exceptions
Astd::runtime_error if the floating_base_type is unrecognized or zero floating joints were added to the model.
void drake::parsers::AddModelInstancesToTable ( const drake::parsers::ModelInstanceIdTable source_table,
drake::parsers::ModelInstanceIdTable dest_table 
)

Adds the model instances in source_table to dest_table.

Throws a std::runtime_error if there is a collision in the model names.

systems::CompliantMaterial drake::parsers::ParseCollisionCompliance ( tinyxml2::XMLElement *  node)

Instantiates a CompliantMaterial instance from an XMLNode.

It ignores unrecognized elements, but throws an exception if a recognized element's contents cannot be converted to a double. Omitted property elements remain tied to the default parameter value. If either friction coefficient is defined, both must be defined. Furthermore, the coefficient for static friction must be greater than or equal to the dynamic friction and both must be non-negative.

Looks for the following tags in URDF and SDF:

1 ...
2 <collision ...>
3  <geometry...>
4  </geometry>
5 
6  <drake_compliance>
7  <youngs_modulus>##</youngs_modulus>
8  <dissipation>##</dissipation>
9  <static_friction>##</static_friction>
10  <dynamic_friction>##</dynamic_friction>
11  </drake_compliance>
12 
13 </collision>
14 ...
Parameters
[in]nodeThe parent node which ostensibly contains a declaration of drake compliance.
CompliantMaterial drake::parsers::ParseCollisionCompliance ( XMLElement *  node)
void drake::parsers::ParseCollisionFilterGroup ( RigidBodyTree< double > *  tree,
tinyxml2::XMLElement *  node,
int  model_instance_id 
)

Parses the Drake collision filter group specification.

Attempts to add collision filter groups (with their member lists and ignore lists) to the tree specification. Inconsistent definitions will lead to thrown exceptions.

See this discussion for details on the XML specification.

Parameters
treeThe rigid body tree containing the bodies to which the filters will be applied.
nodeThe XML node containing the filter details.
model_instance_idThe id of the current model instance.
void drake::parsers::ParseCollisionFilterGroup ( RigidBodyTree< double > *  tree,
XMLElement *  node,
int  model_instance_id 
)