tinyrobotics
Loading...
Searching...
No Matches
parser.hpp File Reference

Contains various functions for parsing URDF files and strings to create a tinyrobotics model. More...

#include <tinyxml2.h>
#include "math.hpp"
#include "model.hpp"

Go to the source code of this file.

Functions

template<typename Scalar >
Eigen::Matrix< Scalar, 3, 1 > tinyrobotics::vec_from_string (const std::string &vector_str)
 Get Eigen3 vector from a URDF vector element.
 
template<typename Scalar >
Eigen::Matrix< Scalar, 3, 3 > tinyrobotics::rot_from_string (const std::string &rotation_str)
 Get Eigen3 rotation from a URDF rpy string.
 
template<typename Scalar >
Eigen::Transform< Scalar, 3, Eigen::Isometry > tinyrobotics::transform_from_xml (tinyxml2::XMLElement *xml)
 Get the Eigen3 transform from a URDF xml element.
 
template<typename Scalar >
Eigen::Matrix< Scalar, 6, 6 > tinyrobotics::spatial_transform_from_xml (tinyxml2::XMLElement *xml)
 Get the spatial transform from a URDF xml element.
 
const char * tinyrobotics::get_parent_link_name (tinyxml2::XMLElement *c)
 Get the name of the link's parent link.
 
template<typename Scalar >
Link< Scalar > tinyrobotics::link_from_xml (tinyxml2::XMLElement *xml)
 Construct a Link from a URDF xml element.
 
template<typename Scalar >
Joint< Scalar > tinyrobotics::joint_from_xml (tinyxml2::XMLElement *xml)
 Construct a new Joint object from a URDF file description.
 
template<typename Scalar , int nq>
void tinyrobotics::init_link_tree (Model< Scalar, nq > &model, std::vector< Joint< Scalar > > &joints)
 Initialize the link tree in the model.
 
template<typename Scalar , int nq>
void tinyrobotics::init_dynamics (Model< Scalar, nq > &model)
 Updates dynamic links with any fixed joints associated with them, and updates the indices of the dynamic links and their parents.
 
template<typename Scalar , int nq>
Model< Scalar, nq > tinyrobotics::import_urdf (const std::string &path_to_urdf)
 Construct a new Model object from URDF file description.
 

Detailed Description

Contains various functions for parsing URDF files and strings to create a tinyrobotics model.

Function Documentation

◆ get_parent_link_name()

const char * tinyrobotics::get_parent_link_name ( tinyxml2::XMLElement *  c)
inline

Get the name of the link's parent link.

Parameters
xmlThe XML element containing the link description
Returns
The name of the link's parent link.

◆ import_urdf()

template<typename Scalar , int nq>
Model< Scalar, nq > tinyrobotics::import_urdf ( const std::string &  path_to_urdf)

Construct a new Model object from URDF file description.

Parameters
xml_stringThe XML string of the URDF file.
Returns
The URDF parsed Model object.

◆ init_dynamics()

template<typename Scalar , int nq>
void tinyrobotics::init_dynamics ( Model< Scalar, nq > &  model)

Updates dynamic links with any fixed joints associated with them, and updates the indices of the dynamic links and their parents.

Parameters
modelTinyrobtics model.
Template Parameters
ScalarScalar type of the model.
nqNumber of configuration coordinates (degrees of freedom).

◆ init_link_tree()

template<typename Scalar , int nq>
void tinyrobotics::init_link_tree ( Model< Scalar, nq > &  model,
std::vector< Joint< Scalar > > &  joints 
)

Initialize the link tree in the model.

Parameters
modelTinyrobtics model.
Template Parameters
ScalarScalar type of the model.
nqNumber of configuration coordinates (degrees of freedom).

◆ joint_from_xml()

template<typename Scalar >
Joint< Scalar > tinyrobotics::joint_from_xml ( tinyxml2::XMLElement *  xml)

Construct a new Joint object from a URDF file description.

Parameters
xmlThe XML element containing the joint description
Returns
The Joint object

◆ link_from_xml()

template<typename Scalar >
Link< Scalar > tinyrobotics::link_from_xml ( tinyxml2::XMLElement *  xml)

Construct a Link from a URDF xml element.

Parameters
xmlThe XML element containing the link description
Returns
The Link object

◆ rot_from_string()

template<typename Scalar >
Eigen::Matrix< Scalar, 3, 3 > tinyrobotics::rot_from_string ( const std::string &  rotation_str)

Get Eigen3 rotation from a URDF rpy string.

Parameters
rotation_strThe rpy string
Returns
A 3x3 Eigen3 rotation matrix

◆ spatial_transform_from_xml()

template<typename Scalar >
Eigen::Matrix< Scalar, 6, 6 > tinyrobotics::spatial_transform_from_xml ( tinyxml2::XMLElement *  xml)

Get the spatial transform from a URDF xml element.

Parameters
xmlThe XML element
Returns
A spatial transform

◆ transform_from_xml()

template<typename Scalar >
Eigen::Transform< Scalar, 3, Eigen::Isometry > tinyrobotics::transform_from_xml ( tinyxml2::XMLElement *  xml)

Get the Eigen3 transform from a URDF xml element.

Parameters
xmlThe XML element
Returns
A Eigen3 affine transform

◆ vec_from_string()

template<typename Scalar >
Eigen::Matrix< Scalar, 3, 1 > tinyrobotics::vec_from_string ( const std::string &  vector_str)

Get Eigen3 vector from a URDF vector element.

Parameters
vector_strThe vector string
Returns
A 3x1 Eigen3 vector