All Classes Namespaces Files Functions Variables Typedefs Macros
jrl::dynamics::urdf::Parser Class Reference

Parse an URDF file and return a CjrlHumanoidDynamicRobot. More...

#include <jrl/dynamics/urdf/parser.hh>

Public Types

typedef boost::shared_ptr
< ::urdf::Link > 
UrdfLinkPtrType
 
typedef boost::shared_ptr
< ::urdf::Joint > 
UrdfJointPtrType
 
typedef boost::shared_ptr
< ::urdf::JointLimits > 
UrdfJointLimitsPtrType
 
typedef boost::shared_ptr
< const ::urdf::Link > 
UrdfLinkConstPtrType
 
typedef boost::shared_ptr
< const ::urdf::Joint > 
UrdfJointConstPtrType
 
typedef CjrlJoint * JointPtrType
 
typedef CjrlBody * BodyPtrType
 
typedef CjrlHand * HandPtrType
 
typedef CjrlFoot * FootPtrType
 
typedef std::map< std::string,
JointPtrType
MapJrlJoint
 Map of abstract robot dynamics compatible joints. More...
 
typedef std::map< std::string,
UrdfJointPtrType
MapJointType
 Map of URDF joints. More...
 

Public Member Functions

 Parser ()
 Default constructor, do nothing. More...
 
virtual ~Parser ()
 Destructor. More...
 
boost::shared_ptr
< ::urdf::ModelInterface > 
urdfModel () const
 Get parsed URDF model. More...
 
MapJrlJoint mapJrlJoint () const
 Get map of created abstract robot dynamics compatible joints. More...
 
CjrlHumanoidDynamicRobot * parse (const std::string &resourceName)
 Parse an URDF file and return a humanoid robot. More...
 
CjrlHumanoidDynamicRobot * parseStream (const std::string &robotDescription)
 Parse an URDF sent as a stream and return a humanoid robot. More...
 
void specifyREPName (const std::string &link, const std::string &repName)
 Maps link names. More...
 

Public Attributes

XmlRpc::XmlRpcValue JointsNamesByRank_
 

Protected Member Functions

void findSpecialJoints ()
 Find special joints using REP 120. More...
 
void findSpecialJoint (const std::string &linkName, std::string &jointName)
 Retrieve joint name attached to a particular link. More...
 
void parseJoints (const std::string rootJointName)
 Parse URDF model and get joints. More...
 
std::vector< CjrlJoint * > actuatedJoints ()
 Get actuated joints. More...
 
void connectJoints (CjrlJoint *rootJoint)
 Connect recursively joints to their children. More...
 
void addBodiesToJoints ()
 Parse bodies and add them to joints. More...
 
void getChildrenJoint (const std::string &jointName, std::vector< std::string > &result)
 
std::vector< std::string > getChildrenJoint (const std::string &jointName)
 
matrix4d getPoseInReferenceFrame (const std::string &referenceJoint, const std::string &currentJoint)
 
matrix4d poseToMatrix (::urdf::Pose p)
 
vector3d computeAnklePositionInLocalFrame (MapJrlJoint::const_iterator &foot, MapJrlJoint::const_iterator &ankle) const
 
void computeHandsInformation (MapJrlJoint::const_iterator &hand, MapJrlJoint::const_iterator &wrist, vector3d &center, vector3d &thumbAxis, vector3d &foreFingerAxis, vector3d &palmNormal) const
 
void fillHandsAndFeet ()
 

Detailed Description

Parse an URDF file and return a CjrlHumanoidDynamicRobot.

This class automatically reorient frames to match the abstact robot dynamics standard. I.e. rotation joints rotates along the X axis.

The humanoid robot bodies location are guessed by making the assumption that the draft REP "Coordinate Frames for Humanoids Robots" is respected. See https://github.com/laas/rep-coordinate-frames-for-biped-robots for more information. If this is not the case, the tree will exist but the pointers toward specific parts of the body will be null.

Implementation notes:

The robot data are stored as attributes and reset each time a robot is returned to the user through the parse method. Practically speaking, this class never desallocates robots nor joints. It is the user responsibility to do so.

Member Typedef Documentation

Map of URDF joints.

Map of abstract robot dynamics compatible joints.

typedef boost::shared_ptr<const ::urdf::Joint> jrl::dynamics::urdf::Parser::UrdfJointConstPtrType
typedef boost::shared_ptr< ::urdf::JointLimits> jrl::dynamics::urdf::Parser::UrdfJointLimitsPtrType
typedef boost::shared_ptr< ::urdf::Joint> jrl::dynamics::urdf::Parser::UrdfJointPtrType
typedef boost::shared_ptr<const ::urdf::Link> jrl::dynamics::urdf::Parser::UrdfLinkConstPtrType
typedef boost::shared_ptr< ::urdf::Link> jrl::dynamics::urdf::Parser::UrdfLinkPtrType

Constructor & Destructor Documentation

jrl::dynamics::urdf::Parser::Parser ( )
explicit

Default constructor, do nothing.

jrl::dynamics::urdf::Parser::~Parser ( )
virtual

Destructor.

Member Function Documentation

std::vector< CjrlJoint * > jrl::dynamics::urdf::Parser::actuatedJoints ( )
protected

Get actuated joints.

References jrl::dynamics::urdf::createJointList().

Referenced by parseStream().

void jrl::dynamics::urdf::Parser::addBodiesToJoints ( )
protected

Parse bodies and add them to joints.

Referenced by parseStream().

vector3d jrl::dynamics::urdf::Parser::computeAnklePositionInLocalFrame ( MapJrlJoint::const_iterator &  foot,
MapJrlJoint::const_iterator &  ankle 
) const
protected

Referenced by fillHandsAndFeet().

void jrl::dynamics::urdf::Parser::computeHandsInformation ( MapJrlJoint::const_iterator &  hand,
MapJrlJoint::const_iterator &  wrist,
vector3d &  center,
vector3d &  thumbAxis,
vector3d &  foreFingerAxis,
vector3d &  palmNormal 
) const
protected

Referenced by fillHandsAndFeet().

void jrl::dynamics::urdf::Parser::connectJoints ( CjrlJoint *  rootJoint)
protected

Connect recursively joints to their children.

References getChildrenJoint().

Referenced by parseStream().

void jrl::dynamics::urdf::Parser::fillHandsAndFeet ( )
protected
void jrl::dynamics::urdf::Parser::findSpecialJoint ( const std::string &  linkName,
std::string &  jointName 
)
protected

Retrieve joint name attached to a particular link.

Referenced by findSpecialJoints().

void jrl::dynamics::urdf::Parser::findSpecialJoints ( )
protected

Find special joints using REP 120.

This is not direct as abstract-robot-dynamics needs joints where as REP 120 deals with frames/robot links. We have to use the REP naming standard to identify the links and then retrieve the attached joints name.

References findSpecialJoint().

Referenced by parseStream().

void jrl::dynamics::urdf::Parser::getChildrenJoint ( const std::string &  jointName,
std::vector< std::string > &  result 
)
protected

Referenced by connectJoints(), and getChildrenJoint().

std::vector< std::string > jrl::dynamics::urdf::Parser::getChildrenJoint ( const std::string &  jointName)
protected

References getChildrenJoint().

matrix4d jrl::dynamics::urdf::Parser::getPoseInReferenceFrame ( const std::string &  referenceJoint,
const std::string &  currentJoint 
)
protected

References poseToMatrix().

Referenced by parseJoints().

Parser::MapJrlJoint jrl::dynamics::urdf::Parser::mapJrlJoint ( ) const

Get map of created abstract robot dynamics compatible joints.

CjrlHumanoidDynamicRobot * jrl::dynamics::urdf::Parser::parse ( const std::string &  resourceName)

Parse an URDF file and return a humanoid robot.

The URDF file location must use the resource retriever format. For instance, the following strings are allowed:

See resource_retriever documentation for more information.

Parameters
resourceNameresource name using the resource_retriever format.

References parseStream().

void jrl::dynamics::urdf::Parser::parseJoints ( const std::string  rootJointName)
protected
CjrlHumanoidDynamicRobot * jrl::dynamics::urdf::Parser::parseStream ( const std::string &  robotDescription)
matrix4d jrl::dynamics::urdf::Parser::poseToMatrix ( ::urdf::Pose  p)
protected

Referenced by getPoseInReferenceFrame().

void jrl::dynamics::urdf::Parser::specifyREPName ( const std::string &  link,
const std::string &  repName 
)

Maps link names.

between parser internal specifications and actual robot names

boost::shared_ptr<::urdf::ModelInterface > jrl::dynamics::urdf::Parser::urdfModel ( ) const

Get parsed URDF model.

Member Data Documentation

XmlRpc::XmlRpcValue jrl::dynamics::urdf::Parser::JointsNamesByRank_

Referenced by parseStream().