The RobotURDF class is a Robot class that reads all of the KDL configuration information from a URDF file. More...
#include <RobotURDF.h>
Classes | |
struct | Joint |
Public Member Functions | |
RobotURDF (const std::string &filename, const std::string &rootLink) | |
Create an instance from the named file. | |
virtual | ~RobotURDF () |
Release any resources used by this class. | |
Private Types | |
typedef std::map< std::string, Joint > | JointMap |
typedef std::map< std::string, KDL::RigidBodyInertia > | LinkMap |
Private Member Functions | |
void | parseFile (const std::string &filename, const std::string &rootLink) |
Load the specified file into memory and create the KDL tree. | |
void | parseJoint (TiXmlElement *element) |
Use the internal collection of elements to create KDL segments, chains, and a tree. |
The RobotURDF class is a Robot class that reads all of the KDL configuration information from a URDF file.
Definition at line 23 of file RobotURDF.h.
typedef std::map<std::string, Joint> RobotURDF::JointMap [private] |
Definition at line 39 of file RobotURDF.h.
typedef std::map<std::string, KDL::RigidBodyInertia> RobotURDF::LinkMap [private] |
Definition at line 38 of file RobotURDF.h.
RobotURDF::RobotURDF | ( | const std::string & | filename, |
const std::string & | rootLink | ||
) |
Create an instance from the named file.
filename | the name of the URDF file that is to be read |
rootLink | the name of the first link in the file |
runtime_error | if any problems are detected with the file |
Definition at line 20 of file RobotURDF.cpp.
RobotURDF::~RobotURDF | ( | ) | [virtual] |
Release any resources used by this class.
Definition at line 30 of file RobotURDF.cpp.
void RobotURDF::parseFile | ( | const std::string & | filename, |
const std::string & | rootLink | ||
) | [private] |
Load the specified file into memory and create the KDL tree.
The file elements are read into internal collections, then the internal collections are used to build the KDL tree.
filename | the name of the URDF file that is to be read |
rootLink | the name of the first link in the file |
runtime_error | if any problems are detected with the file |
Definition at line 49 of file RobotURDF.cpp.
void RobotURDF::parseJoint | ( | TiXmlElement * | element | ) | [private] |
Use the internal collection of elements to create KDL segments, chains, and a tree.
This method is designed to be called recursively. Each call will add another segment to the current chain. If the current segment has no children the current chain will be added to the tree. If the current segment has exactly one child, this method will be called again for that child. If the current segment has multiple children the current chain will be added to the tree and new chains will be created and populated (by calling this method) for each child segment.
chain | the chain that is currently being built |
chainName | the name of the chain that is being built, when new chains are created by this method, this is set to the name of the first joint in the chain. |
chainHook | the name of what this chain should hook into in the tree, when chains are created by this method, this is set to the name of the last segment of the previous chain |
jointName | the name of the joint (baseJoint) that is being processed. |
baseJoint | the name of the joint that is being processed. |
runtime_error | if any problems are detected while combining the URDF elements into a KDL tree. |
Populate the provided map with a list of joints that have the parent with the specified name.
The provided map is cleared before any matching joints are added.
parentName | the of the parent link |
Convert the provided XML element into a KDL::RigidBodyInertia object and store it in the internal link map for later use.
element | a pointer to the XML element that should be parsed |
Convert the provided XML element into the internal Joint structure and store the results in the internal joint map
element | a pointer to the XML element that should be parsed. |
Definition at line 326 of file RobotURDF.cpp.