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. | |
typedef std::map< std::string, UrdfJointPtrType > | MapJointType |
Map of URDF joints. | |
Public Member Functions | |
Parser () | |
Default constructor, do nothing. | |
virtual | ~Parser () |
Destructor. | |
boost::shared_ptr < ::urdf::ModelInterface > | urdfModel () const |
Get parsed URDF model. | |
MapJrlJoint | mapJrlJoint () const |
Get map of created abstract robot dynamics compatible joints. | |
CjrlHumanoidDynamicRobot * | parse (const std::string &resourceName) |
Parse an URDF file and return a humanoid robot. | |
CjrlHumanoidDynamicRobot * | parseStream (const std::string &robotDescription) |
Parse an URDF sent as a stream and return a humanoid robot. | |
void | specifyREPName (const std::string &link, const std::string &repName) |
Maps link names. | |
Public Attributes | |
XmlRpc::XmlRpcValue | JointsNamesByRank_ |
Protected Member Functions | |
void | findSpecialJoints () |
Find special joints using REP 120. | |
void | findSpecialJoint (const std::string &linkName, std::string &jointName) |
Retrieve joint name attached to a particular link. | |
void | parseJoints (const std::string rootJointName) |
Parse URDF model and get joints. | |
std::vector< CjrlJoint * > | actuatedJoints () |
Get actuated joints. | |
void | connectJoints (CjrlJoint *rootJoint) |
Connect recursively joints to their children. | |
void | addBodiesToJoints () |
Parse bodies and add them to joints. | |
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 ¤tJoint) |
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 ¢er, vector3d &thumbAxis, vector3d &foreFingerAxis, vector3d &palmNormal) const |
void | fillHandsAndFeet () |
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.
typedef CjrlBody* jrl::dynamics::urdf::Parser::BodyPtrType |
typedef CjrlFoot* jrl::dynamics::urdf::Parser::FootPtrType |
typedef CjrlHand* jrl::dynamics::urdf::Parser::HandPtrType |
typedef CjrlJoint* jrl::dynamics::urdf::Parser::JointPtrType |
typedef std::map<std::string, UrdfJointPtrType> jrl::dynamics::urdf::Parser::MapJointType |
Map of URDF joints.
typedef std::map<std::string, JointPtrType> jrl::dynamics::urdf::Parser::MapJrlJoint |
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 |
jrl::dynamics::urdf::Parser::Parser | ( | ) | [explicit] |
Default constructor, do nothing.
jrl::dynamics::urdf::Parser::~Parser | ( | ) | [virtual] |
Destructor.
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] |
References computeAnklePositionInLocalFrame(), and computeHandsInformation().
Referenced by parseStream().
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.
resourceName | resource name using the resource_retriever format. |
References parseStream().
void jrl::dynamics::urdf::Parser::parseJoints | ( | const std::string | rootJointName | ) | [protected] |
Parse URDF model and get joints.
Each joint in the URDF model is used to build the corresponding CjrlJoint object.
References getPoseInReferenceFrame(), jrl::dynamics::urdf::makeJointAnchor(), jrl::dynamics::urdf::makeJointContinuous(), jrl::dynamics::urdf::makeJointFreeFlyer(), jrl::dynamics::urdf::makeJointRotation(), and jrl::dynamics::urdf::makeJointTranslation().
Referenced by parseStream().
CjrlHumanoidDynamicRobot * jrl::dynamics::urdf::Parser::parseStream | ( | const std::string & | robotDescription | ) |
Parse an URDF sent as a stream and return a humanoid robot.
References actuatedJoints(), addBodiesToJoints(), connectJoints(), fillHandsAndFeet(), jrl::dynamics::urdf::findJoint(), findSpecialJoints(), JointsNamesByRank_, matrix4dTo3d(), and parseJoints().
Referenced by parse().
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.
XmlRpc::XmlRpcValue jrl::dynamics::urdf::Parser::JointsNamesByRank_ |
Referenced by parseStream().