Drake
xmlUtil.h File Reference
#include <map>
#include <string>
#include <Eigen/Dense>
#include "spruce.hh"
#include "drake/drakeXMLUtil_export.h"
#include "drake/systems/plants/pose_map.h"
#include "drake/thirdParty/zlib/tinyxml2/tinyxml2.h"
Include dependency graph for xmlUtil.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef std::map< std::string, std::string > PackageMap
 

Functions

template<typename Scalar >
bool parseScalarValue (tinyxml2::XMLElement *node, Scalar &val)
 
template<typename Scalar >
bool parseScalarValue (tinyxml2::XMLElement *node, const char *element_name, Scalar &val)
 
template<typename Scalar >
bool parseScalarAttribute (tinyxml2::XMLElement *node, const char *attribute_name, Scalar &val)
 
DRAKEXMLUTIL_EXPORT void ParseThreeVectorValue (const char *strval, Eigen::Vector3d *val)
 Parses a three vector value from parameter strval. More...
 
DRAKEXMLUTIL_EXPORT void ParseThreeVectorValue (const tinyxml2::XMLElement *node, Eigen::Vector3d *val)
 Parses a three vector value from parameter node, which is an XML node. More...
 
DRAKEXMLUTIL_EXPORT void ParseThreeVectorValue (const tinyxml2::XMLElement *node, const char *element_name, Eigen::Vector3d *val)
 Parses a three vector value from parameter node, which is an XML node. More...
 
DRAKEXMLUTIL_EXPORT void ParseThreeVectorAttribute (const tinyxml2::XMLElement *node, const char *attribute_name, Eigen::Vector3d *val)
 Parses a three vector value from parameter node, which is an XML node. More...
 
DRAKEXMLUTIL_EXPORT double StringToDouble (const std::string &str)
 Converts a string to a double value. More...
 
DRAKEXMLUTIL_EXPORT bool parseVectorAttribute (const tinyxml2::XMLElement *node, const char *attribute_name, Eigen::Vector3d &val)
 
DRAKEXMLUTIL_EXPORT bool parseVectorAttribute (const tinyxml2::XMLElement *node, const char *attribute_name, Eigen::Vector4d &val)
 
DRAKEXMLUTIL_EXPORT bool parseVectorValue (tinyxml2::XMLElement *node, const char *element_name, Eigen::Vector3d &val)
 
DRAKEXMLUTIL_EXPORT bool parseVectorValue (tinyxml2::XMLElement *node, const char *element_name, Eigen::Vector4d &val)
 
DRAKEXMLUTIL_EXPORT bool parseStringValue (tinyxml2::XMLElement *node, const char *element_name, std::string &val)
 
DRAKEXMLUTIL_EXPORT void originAttributesToTransform (tinyxml2::XMLElement *node, Eigen::Isometry3d &T)
 
DRAKEXMLUTIL_EXPORT void poseValueToTransform (tinyxml2::XMLElement *node, const PoseMap &pose_map, Eigen::Isometry3d &T, const Eigen::Isometry3d &T_default_frame=Eigen::Isometry3d::Identity())
 
DRAKEXMLUTIL_EXPORT void populatePackageMap (PackageMap &package_map)
 
DRAKEXMLUTIL_EXPORT std::string resolveFilename (const std::string &filename, const PackageMap &package_map, const std::string &root_dir)
 Resolves the fully-qualified name of a file. More...
 

Typedef Documentation

typedef std::map<std::string, std::string> PackageMap

Function Documentation

DRAKEXMLUTIL_EXPORT void originAttributesToTransform ( tinyxml2::XMLElement *  node,
Eigen::Isometry3d &  T 
)

Here is the call graph for this function:

Here is the caller graph for this function:

bool parseScalarAttribute ( tinyxml2::XMLElement *  node,
const char *  attribute_name,
Scalar &  val 
)

Here is the call graph for this function:

Here is the caller graph for this function:

bool parseScalarValue ( tinyxml2::XMLElement *  node,
Scalar &  val 
)

Here is the caller graph for this function:

bool parseScalarValue ( tinyxml2::XMLElement *  node,
const char *  element_name,
Scalar &  val 
)

Here is the call graph for this function:

DRAKEXMLUTIL_EXPORT bool parseStringValue ( tinyxml2::XMLElement *  node,
const char *  element_name,
std::string &  val 
)

Here is the caller graph for this function:

DRAKEXMLUTIL_EXPORT void ParseThreeVectorAttribute ( const tinyxml2::XMLElement *  node,
const char *  attribute_name,
Eigen::Vector3d *  val 
)

Parses a three vector value from parameter node, which is an XML node.

The value is specified by an attribute within the XML whose name is apecified by parameter attribute_name.This method also supports a three vector specified by a single scalar value, which it automatically converts into a three vector by using the same scalar value for all three dimensions.

Parameters
[in]nodeA pointer to the XML element node that contains an attribute with a three vector or a scalar value.
[in]attribute_nameThe name of the attribute containing the three vector or scalar value.
[out]valThe three vector where the results should be stored.
Returns
Whether the three vector was successfully parsed from the XML element node.
Exceptions
std::invalid_argumentIf any problem is encountered parsing the three vector value.

Here is the call graph for this function:

Here is the caller graph for this function:

DRAKEXMLUTIL_EXPORT void ParseThreeVectorValue ( const char *  strval,
Eigen::Vector3d *  val 
)

Parses a three vector value from parameter strval.

There are two formats of strval that can be successfully parsed. The first format is "val1 val2 val3" where val1, val2, and val3 are double values. The second valid format is "val" where val is a double type. In this case, this method automatically converts the val1 scalar value into a three vector by using the same scalar value for all three dimensions.

Parameters
[in]strvalA pointer to the character array describing a three vector or a scalar value.
[out]valThe three vector into which the results should be stored.
Returns
Whether the three vector was successfully parsed from strval.
Exceptions
std::invalid_argumentIf any problem is encountered parsing the three vector value.

Here is the call graph for this function:

Here is the caller graph for this function:

DRAKEXMLUTIL_EXPORT void ParseThreeVectorValue ( const tinyxml2::XMLElement *  node,
Eigen::Vector3d *  val 
)

Parses a three vector value from parameter node, which is an XML node.

It also supports a single scalar value, which it automatically converts to a three vector by using the same scalar value for all three dimensions.

Parameters
[in]nodeA pointer to the XML element node that contains either a three vector or a scalar value.
[out]valThe three vector into which the results should be stored.
Returns
Whether the three vector was successfully parsed from the XML element node.
Exceptions
std::invalid_argumentIf any problem is encountered parsing the three vector value.

Here is the call graph for this function:

DRAKEXMLUTIL_EXPORT void ParseThreeVectorValue ( const tinyxml2::XMLElement *  node,
const char *  element_name,
Eigen::Vector3d *  val 
)

Parses a three vector value from parameter node, which is an XML node.

The value is contained in an element within node, as specified by parameter element_name. This method also supports a three vector specified by a single scalar value, which it automatically converts into a three vector by using the same scalar value for all three dimensions.

Parameters
[in]nodeA pointer to the XML element node that contains either a three vector or a scalar value.
[in]element_nameThe name of the child XML element containing the scale three vector or scalar value.
[out]valThe three vector where the results should be stored.
Returns
Whether the three vector was successfully parsed from the XML element node.
Exceptions
std::invalid_argumentIf any problem is encountered parsing the three vector value.

Here is the call graph for this function:

DRAKEXMLUTIL_EXPORT bool parseVectorAttribute ( const tinyxml2::XMLElement *  node,
const char *  attribute_name,
Eigen::Vector3d &  val 
)

Here is the caller graph for this function:

DRAKEXMLUTIL_EXPORT bool parseVectorAttribute ( const tinyxml2::XMLElement *  node,
const char *  attribute_name,
Eigen::Vector4d &  val 
)
DRAKEXMLUTIL_EXPORT bool parseVectorValue ( tinyxml2::XMLElement *  node,
const char *  element_name,
Eigen::Vector3d &  val 
)

Here is the caller graph for this function:

DRAKEXMLUTIL_EXPORT bool parseVectorValue ( tinyxml2::XMLElement *  node,
const char *  element_name,
Eigen::Vector4d &  val 
)
DRAKEXMLUTIL_EXPORT void populatePackageMap ( PackageMap package_map)
DRAKEXMLUTIL_EXPORT void poseValueToTransform ( tinyxml2::XMLElement *  node,
const PoseMap pose_map,
Eigen::Isometry3d &  T,
const Eigen::Isometry3d &  T_default_frame = Eigen::Isometry3d::Identity() 
)

Here is the call graph for this function:

Here is the caller graph for this function:

DRAKEXMLUTIL_EXPORT std::string resolveFilename ( const std::string &  filename,
const PackageMap package_map,
const std::string &  root_dir 
)

Resolves the fully-qualified name of a file.

If filename starts with "package:", the ROS packages specified in package_map are searched. Otherwise, filename is appended to the end of root_dir and checked for existence. If the file does not exist or is not found, a warning is printed to std::cerr and an empty string is returned.

Parameters
[in]filenameThe name of the file to find.
[in]package_mapA map where the keys are ROS package names and the values are the paths to the packages. This is only used if filename starts with "package:".
[in]root_dirThe root directory to look in. This is only used when assuming filename does not start with "package:".
Returns
The file's fully-qualified name or an empty string if the file is not found or does not exist.
DRAKEXMLUTIL_EXPORT double StringToDouble ( const std::string &  str)

Converts a string to a double value.

Parameters
[in]strA pointer to a string containing a representation of a double value.
Returns
The corresponding double value that was represented in str.
Exceptions
std::invalid_argumentIf any problem is encountered while parsing the double value represented within str.

Here is the caller graph for this function: