chrono::parsers::ChParserURDF Class Reference

Description

URDF input file parser.

#include <ChParserURDF.h>

Classes

class  CustomProcessor
 Class to be used as a callback interface for custom processing of the URDF XML string. More...
 

Public Types

enum  ActuationType { ActuationType::POSITION, ActuationType::SPEED, ActuationType::FORCE }
 Motor actuation types. More...
 
enum  MeshCollisionType { MeshCollisionType::TRIANGLE_MESH, MeshCollisionType::CONVEX_HULL, MeshCollisionType::NODE_CLOUD }
 Collision type for meshes. More...
 

Public Member Functions

 ChParserURDF (const std::string &filename)
 Construct a Chrono parser for the specified URDF file.
 
const std::string & GetFilename () const
 Get access to the URDF filename.
 
const std::string & GetXMLstring () const
 Get access to the raw XML string in the provided URDF file.
 
const std::string & GetModelName () const
 Get the URDF model name.
 
const urdf::ModelInterfaceSharedPtr & GetModelTree () const
 Get the URDF model tree.
 
void PrintModelBodyTree ()
 Print the body tree from parsed URDF file.
 
void PrintModelBodies ()
 Print the list of bodies from parsed URDF file.
 
void PrintModelJoints ()
 Print the list of joints from parsed URDF file.
 
void SetRootInitPose (const ChFrame<> &init_pose)
 Set the initial pose of the model (root link).
 
void SetJointActuationType (const std::string &joint_name, ActuationType actuation_type)
 Set the specified joint as actuated, using the specified actuation type. More...
 
void SetAllJointsActuationType (ActuationType actuation_type)
 Set all candidate joints in the URDF model as actuated, using the specified actuation type. More...
 
void SetBodyMeshCollisionType (const std::string &body_name, MeshCollisionType collision_type)
 Set the collision type for mesh collision (default: TRIMESH). More...
 
void SetAllBodiesMeshCollisinoType (MeshCollisionType collision_type)
 Set the collision type for all bodies with mesh collision shapes (default: TRIMESH).
 
void SetDefaultContactMaterial (const ChContactMaterialData &mat_data)
 Set default contact material properties. More...
 
void SetBodyContactMaterial (const std::string &body_name, const ChContactMaterialData &mat_data)
 Set contact material properties for the specified body. More...
 
void EnableCollisionVisualization ()
 Enable visualization of collision shapes (default: visualization shapes).
 
void PopulateSystem (ChSystem &sys)
 Create the Chrono model in the given system from the parsed URDF model.
 
std::shared_ptr< ChBodyAuxRefGetRootChBody () const
 Get the root body of the Chrono model. More...
 
std::shared_ptr< ChBodyGetChBody (const std::string &name) const
 Get the body with specified name in the Chrono model. More...
 
std::shared_ptr< ChLinkBaseGetChLink (const std::string &name) const
 Get the joint with specified name in the Chrono model. More...
 
std::shared_ptr< ChLinkMotorGetChMotor (const std::string &name) const
 Get the motor with specified name in the Chrono model. More...
 
void SetMotorFunction (const std::string &motor_name, const std::shared_ptr< ChFunction > function)
 Set the actuation function for the specified Chrono motor. More...
 
std::shared_ptr< tinyxml2::XMLDocument > CustomProcess (const std::string &key, std::shared_ptr< CustomProcessor > callback)
 Scan the URDF XML for all objects of the specified key and execute the Process() function of the provided callback object. More...
 

Member Enumeration Documentation

◆ ActuationType

Motor actuation types.

Enumerator
POSITION 

position (if linear motor) or angle (if rotation motor)

SPEED 

linear speed (if linear motor) or angular speed (if rotation motor)

FORCE 

force (if linear motor) or torque (if rotation motor)

◆ MeshCollisionType

Collision type for meshes.

Enumerator
TRIANGLE_MESH 

use the triangular mesh itself

CONVEX_HULL 

use the convex hull of the trimesh

NODE_CLOUD 

use spheres at mesh vertices

Member Function Documentation

◆ CustomProcess()

std::shared_ptr< tinyxml2::XMLDocument > chrono::parsers::ChParserURDF::CustomProcess ( const std::string &  key,
std::shared_ptr< CustomProcessor callback 
)

Scan the URDF XML for all objects of the specified key and execute the Process() function of the provided callback object.

Only direct children of the "robot" element in the input URDF are processed. The XML document may be augmented as the processed XML document is returned.

◆ GetChBody()

std::shared_ptr< ChBody > chrono::parsers::ChParserURDF::GetChBody ( const std::string &  name) const

Get the body with specified name in the Chrono model.

This function must be called after PopulateSystem.

◆ GetChLink()

std::shared_ptr< ChLinkBase > chrono::parsers::ChParserURDF::GetChLink ( const std::string &  name) const

Get the joint with specified name in the Chrono model.

This function must be called after PopulateSystem.

◆ GetChMotor()

std::shared_ptr< ChLinkMotor > chrono::parsers::ChParserURDF::GetChMotor ( const std::string &  name) const

Get the motor with specified name in the Chrono model.

This function must be called after PopulateSystem.

◆ GetRootChBody()

std::shared_ptr< ChBodyAuxRef > chrono::parsers::ChParserURDF::GetRootChBody ( ) const

Get the root body of the Chrono model.

This function must be called after PopulateSystem.

◆ SetAllJointsActuationType()

void chrono::parsers::ChParserURDF::SetAllJointsActuationType ( ActuationType  actuation_type)

Set all candidate joints in the URDF model as actuated, using the specified actuation type.

This function has no effect for joints other than Revolute, Continuous, or Prismatic.

◆ SetBodyContactMaterial()

void chrono::parsers::ChParserURDF::SetBodyContactMaterial ( const std::string &  body_name,
const ChContactMaterialData mat_data 
)

Set contact material properties for the specified body.

Bodies for which this function is not explictly called are constructed with the default contact material.

◆ SetBodyMeshCollisionType()

void chrono::parsers::ChParserURDF::SetBodyMeshCollisionType ( const std::string &  body_name,
MeshCollisionType  collision_type 
)

Set the collision type for mesh collision (default: TRIMESH).

This is interpreted only if the specified body has a mesh collision shape.

◆ SetDefaultContactMaterial()

void chrono::parsers::ChParserURDF::SetDefaultContactMaterial ( const ChContactMaterialData mat_data)

Set default contact material properties.

All bodies for which SetBodyContactMaterial was not explicitly called will be constructed with this contact material for all their collision shapes.

◆ SetJointActuationType()

void chrono::parsers::ChParserURDF::SetJointActuationType ( const std::string &  joint_name,
ActuationType  actuation_type 
)

Set the specified joint as actuated, using the specified actuation type.

By default, all URDF joints are translated into Chrono kinematic joints. Joints marked as actuated will be translated to Chrono motors (with same kinematics as the corresponding passive joint). This function has no effect for joints other than Revolute, Continuous, or Prismatic.

◆ SetMotorFunction()

void chrono::parsers::ChParserURDF::SetMotorFunction ( const std::string &  motor_name,
const std::shared_ptr< ChFunction function 
)

Set the actuation function for the specified Chrono motor.

The return value of this function has different meaning, depending on the type of motor, and can represent a position, angle, linear speed, angular speed, force, or torque. No action is taken if a joint with the specified does not exist or if it was not marked as actuated. This function must be called after PopulateSystem.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_parsers/ChParserURDF.h
  • /builds/uwsbel/chrono/src/chrono_parsers/ChParserURDF.cpp