DART  6.7.3
dart::utils::DartLoader Class Reference

#include <DartLoader.hpp>

Public Member Functions

 DartLoader ()
 Constructor with the default ResourceRetriever. More...
 
void addPackageDirectory (const std::string &_packageName, const std::string &_packageDirectory)
 Specify the directory of a ROS package. More...
 
dynamics::SkeletonPtr parseSkeleton (const common::Uri &_uri, const common::ResourceRetrieverPtr &_resourceRetriever=nullptr)
 Parse a file to produce a Skeleton. More...
 
dynamics::SkeletonPtr parseSkeletonString (const std::string &_urdfString, const common::Uri &_baseUri, const common::ResourceRetrieverPtr &_resourceRetriever=nullptr)
 Parse a text string to produce a Skeleton. More...
 
dart::simulation::WorldPtr parseWorld (const common::Uri &_uri, const common::ResourceRetrieverPtr &_resourceRetriever=nullptr)
 Parse a file to produce a World. More...
 
dart::simulation::WorldPtr parseWorldString (const std::string &_urdfString, const common::Uri &_baseUri, const common::ResourceRetrieverPtr &_resourceRetriever=nullptr)
 Parse a text string to produce a World. More...
 

Private Types

typedef std::shared_ptr< dynamics::BodyNode::PropertiesBodyPropPtr
 
typedef std::shared_ptr< dynamics::Joint::PropertiesJointPropPtr
 

Private Member Functions

common::ResourceRetrieverPtr getResourceRetriever (const common::ResourceRetrieverPtr &_resourceRetriever)
 

Static Private Member Functions

static dart::dynamics::SkeletonPtr modelInterfaceToSkeleton (const urdf::ModelInterface *_model, const common::Uri &_baseUri, const common::ResourceRetrieverPtr &_resourceRetriever)
 @function modelInterfaceToSkeleton More...
 
static bool createSkeletonRecursive (const urdf::ModelInterface *model, dynamics::SkeletonPtr _skel, const urdf::Link *_lk, dynamics::BodyNode *_parent, const common::Uri &_baseUri, const common::ResourceRetrieverPtr &_resourceRetriever)
 
static bool addMimicJointsRecursive (const urdf::ModelInterface *model, dynamics::SkeletonPtr _skel, const urdf::Link *_lk)
 
template<class VisualOrCollision >
static dynamics::ShapePtr createShape (const VisualOrCollision *_vizOrCol, const common::Uri &_baseUri, const common::ResourceRetrieverPtr &_resourceRetriever)
 @function createShape More...
 
static dynamics::BodyNodecreateDartJointAndNode (const urdf::Joint *_jt, const dynamics::BodyNode::Properties &_body, dynamics::BodyNode *_parent, dynamics::SkeletonPtr _skeleton, const common::Uri &_baseUri, const common::ResourceRetrieverPtr &_resourceRetriever)
 @function createDartJoint More...
 
static bool createDartNodeProperties (const urdf::Link *_lk, dynamics::BodyNode::Properties &properties, const common::Uri &_baseUri, const common::ResourceRetrieverPtr &_resourceRetriever)
 @function createDartNode More...
 
static bool createShapeNodes (const urdf::ModelInterface *model, const urdf::Link *lk, dynamics::BodyNode *bodyNode, const common::Uri &baseUri, const common::ResourceRetrieverPtr &resourceRetriever)
 
static Eigen::Isometry3d toEigen (const urdf::Pose &_pose)
 @function pose2Affine3d More...
 
static Eigen::Vector3d toEigen (const urdf::Vector3 &_vector)
 
static bool readFileToString (const common::ResourceRetrieverPtr &_resourceRetriever, const common::Uri &_uri, std::string &_output)
 @function readXml More...
 

Private Attributes

common::LocalResourceRetrieverPtr mLocalRetriever
 
utils::PackageResourceRetrieverPtr mPackageRetriever
 
utils::CompositeResourceRetrieverPtr mRetriever
 

Member Typedef Documentation

◆ BodyPropPtr

◆ JointPropPtr

Constructor & Destructor Documentation

◆ DartLoader()

dart::utils::DartLoader::DartLoader ( )

Constructor with the default ResourceRetriever.

Member Function Documentation

◆ addMimicJointsRecursive()

bool dart::utils::DartLoader::addMimicJointsRecursive ( const urdf::ModelInterface *  model,
dynamics::SkeletonPtr  _skel,
const urdf::Link *  _lk 
)
staticprivate

◆ addPackageDirectory()

void dart::utils::DartLoader::addPackageDirectory ( const std::string &  _packageName,
const std::string &  _packageDirectory 
)

Specify the directory of a ROS package.

In your URDF files, you may see strings with a package URI pattern such as:

"package://my_robot/meshes/mesh_for_my_robot.stl"
\______/ \______/\___________________________/
| | |
package package file path with respect to
keyword name the package directory

For us to successfully parse a URDF, we need to be told what the path to the package directory is, using addPackageDirectory(). In this case, suppose the path to the my_robot package is /path/to/my_robot. Then you should use addPackageDirectory("my_robot", "/path/to/my_robot"). Altogether, this implies that a file named "/path/to/my_robot/meshes/mesh_for_my_robot.stl" exists. Whatever you specify as the package directory will end up replacing the 'package keyword' and 'package name' components of the URI string.

◆ createDartJointAndNode()

dynamics::BodyNode * dart::utils::DartLoader::createDartJointAndNode ( const urdf::Joint *  _jt,
const dynamics::BodyNode::Properties _body,
dynamics::BodyNode _parent,
dynamics::SkeletonPtr  _skeleton,
const common::Uri _baseUri,
const common::ResourceRetrieverPtr _resourceRetriever 
)
staticprivate

@function createDartJoint

◆ createDartNodeProperties()

bool dart::utils::DartLoader::createDartNodeProperties ( const urdf::Link *  _lk,
dynamics::BodyNode::Properties properties,
const common::Uri _baseUri,
const common::ResourceRetrieverPtr _resourceRetriever 
)
staticprivate

@function createDartNode

◆ createShape()

template<class VisualOrCollision >
dynamics::ShapePtr dart::utils::DartLoader::createShape ( const VisualOrCollision *  _vizOrCol,
const common::Uri _baseUri,
const common::ResourceRetrieverPtr _resourceRetriever 
)
staticprivate

@function createShape

◆ createShapeNodes()

bool dart::utils::DartLoader::createShapeNodes ( const urdf::ModelInterface *  model,
const urdf::Link *  lk,
dynamics::BodyNode bodyNode,
const common::Uri baseUri,
const common::ResourceRetrieverPtr resourceRetriever 
)
staticprivate

◆ createSkeletonRecursive()

bool dart::utils::DartLoader::createSkeletonRecursive ( const urdf::ModelInterface *  model,
dynamics::SkeletonPtr  _skel,
const urdf::Link *  _lk,
dynamics::BodyNode _parent,
const common::Uri _baseUri,
const common::ResourceRetrieverPtr _resourceRetriever 
)
staticprivate

◆ getResourceRetriever()

common::ResourceRetrieverPtr dart::utils::DartLoader::getResourceRetriever ( const common::ResourceRetrieverPtr _resourceRetriever)
private

◆ modelInterfaceToSkeleton()

dynamics::SkeletonPtr dart::utils::DartLoader::modelInterfaceToSkeleton ( const urdf::ModelInterface *  _model,
const common::Uri _baseUri,
const common::ResourceRetrieverPtr _resourceRetriever 
)
staticprivate

@function modelInterfaceToSkeleton

Read the ModelInterface and spits out a Skeleton object

◆ parseSkeleton()

dynamics::SkeletonPtr dart::utils::DartLoader::parseSkeleton ( const common::Uri _uri,
const common::ResourceRetrieverPtr _resourceRetriever = nullptr 
)

Parse a file to produce a Skeleton.

◆ parseSkeletonString()

dynamics::SkeletonPtr dart::utils::DartLoader::parseSkeletonString ( const std::string &  _urdfString,
const common::Uri _baseUri,
const common::ResourceRetrieverPtr _resourceRetriever = nullptr 
)

Parse a text string to produce a Skeleton.

◆ parseWorld()

simulation::WorldPtr dart::utils::DartLoader::parseWorld ( const common::Uri _uri,
const common::ResourceRetrieverPtr _resourceRetriever = nullptr 
)

Parse a file to produce a World.

◆ parseWorldString()

simulation::WorldPtr dart::utils::DartLoader::parseWorldString ( const std::string &  _urdfString,
const common::Uri _baseUri,
const common::ResourceRetrieverPtr _resourceRetriever = nullptr 
)

Parse a text string to produce a World.

◆ readFileToString()

bool dart::utils::DartLoader::readFileToString ( const common::ResourceRetrieverPtr _resourceRetriever,
const common::Uri _uri,
std::string &  _output 
)
staticprivate

@function readXml

◆ toEigen() [1/2]

Eigen::Isometry3d dart::utils::DartLoader::toEigen ( const urdf::Pose &  _pose)
staticprivate

@function pose2Affine3d

◆ toEigen() [2/2]

Eigen::Vector3d dart::utils::DartLoader::toEigen ( const urdf::Vector3 &  _vector)
staticprivate

Member Data Documentation

◆ mLocalRetriever

common::LocalResourceRetrieverPtr dart::utils::DartLoader::mLocalRetriever
private

◆ mPackageRetriever

utils::PackageResourceRetrieverPtr dart::utils::DartLoader::mPackageRetriever
private

◆ mRetriever

utils::CompositeResourceRetrieverPtr dart::utils::DartLoader::mRetriever
private