Simox  2.3.74.0
VirtualRobot::BaseIO Class Reference
Inheritance diagram for VirtualRobot::BaseIO:
VirtualRobot::ObjectIO VirtualRobot::RobotIO VirtualRobot::SceneIO

Public Types

enum  RobotDescription {
  eFull, eCollisionModel, eStructure, eStructureStore,
  eFullVisAsCol
}
 

Static Public Member Functions

static void makeAbsolutePath (const std::string &basePath, std::string &filename)
 
static void makeRelativePath (const std::string &basePath, std::string &filename)
 
static bool writeXMLFile (const std::string &filename, const std::string &content, bool overwrite=true)
 
static bool isTrue (const char *s)
 
static float convertToFloat (const char *s)
 
static int convertToInt (const char *s)
 
static void processNodeList (rapidxml::xml_node< char > *parentNode, RobotPtr robot, std::vector< RobotNodePtr > &nodeList, bool clearList=true)
 
static void processLimitsNode (rapidxml::xml_node< char > *limitsXMLNode, float &jointLimitLo, float &jointLimitHi)
 
static std::string processFileNode (rapidxml::xml_node< char > *fileNode, const std::string &basePath)
 
static void processTransformNode (rapidxml::xml_node< char > *transformXMLNode, const std::string &nodeName, Eigen::Matrix4f &transform)
 
static Units getUnitsAttribute (rapidxml::xml_node< char > *node, Units::UnitsType u)
 
static std::string processNameAttribute (rapidxml::xml_node< char > *node, bool allowOtherAttributes=false)
 
static float processFloatAttribute (const std::string &attributeName, rapidxml::xml_node< char > *node, bool allowOtherAttributes=false)
 
static int processIntAttribute (const std::string &attributeName, rapidxml::xml_node< char > *node, bool allowOtherAttributes=false)
 
static float getFloatByAttributeName (rapidxml::xml_node< char > *xmlNode, const std::string &attributeName)
 
static float getOptionalFloatByAttributeName (rapidxml::xml_node< char > *xmlNode, const std::string &attributeName, float standardValue)
 
static bool processConfigurationNode (rapidxml::xml_node< char > *configXMLNode, std::vector< RobotConfig::Configuration > &storeConfigDefinitions, std::string &storeConfigName)
 
static bool processConfigurationNodeList (rapidxml::xml_node< char > *configXMLNode, std::vector< std::vector< RobotConfig::Configuration > > &configDefinitions, std::vector< std::string > &configNames, std::vector< std::string > &tcpNames)
 
static std::string getLowerCase (const char *c)
 
static void getLowerCase (std::string &aString)
 
static std::string processStringAttribute (const std::string &attributeName, rapidxml::xml_node< char > *node, bool allowOtherAttributes=false)
 
static VisualizationNodePtr processVisualizationTag (rapidxml::xml_node< char > *visuXMLNode, const std::string &tagName, const std::string &basePath, bool &useAsColModel)
 
static CollisionModelPtr processCollisionTag (rapidxml::xml_node< char > *colXMLNode, const std::string &tagName, const std::string &basePath)
 
static std::vector< Primitive::PrimitivePtrprocessPrimitives (rapidxml::xml_node< char > *primitivesXMLNode)
 
static void processPhysicsTag (rapidxml::xml_node< char > *physicsXMLNode, const std::string &nodeName, SceneObject::Physics &physics)
 
static RobotNodeSetPtr processRobotNodeSet (rapidxml::xml_node< char > *setXMLNode, RobotPtr robo, const std::string &robotRootNode, int &robotNodeSetCounter)
 
static TrajectoryPtr processTrajectory (rapidxml::xml_node< char > *trajectoryXMLNode, std::vector< RobotPtr > &robots)
 
static Eigen::Matrix3f process3x3Matrix (rapidxml::xml_node< char > *matrixXMLNode)
 
static bool processFloatValueTags (rapidxml::xml_node< char > *XMLNode, int dim, Eigen::VectorXf &stroreResult)
 
static bool hasUnitsAttribute (rapidxml::xml_node< char > *node)
 
static std::vector< UnitsgetUnitsAttributes (rapidxml::xml_node< char > *node)
 
static void getAllAttributes (rapidxml::xml_node< char > *node, const std::string &attrString, std::vector< std::string > &storeValues)
 
static void processDHNode (rapidxml::xml_node< char > *dhXMLNode, DHParameter &dh)
 
static NodeMapping processNodeMapping (rapidxml::xml_node< char > *XMLNode, RobotPtr robot)
 
static std::string toXML (const Eigen::Matrix4f &m, std::string ident="\)
 
static std::vector< VisualizationNodePtrprocessVisuFiles (rapidxml::xml_node< char > *visualizationXMLNode, const std::string &basePath, std::string &fileType)
 
static GraspSetPtr processGraspSet (rapidxml::xml_node< char > *graspSetXMLNode, const std::string &objName)
 
static GraspPtr processGrasp (rapidxml::xml_node< char > *graspXMLNode, const std::string &robotType, const std::string &eef, const std::string &objName)
 
static bool processSensor (GraspableSensorizedObjectPtr node, rapidxml::xml_node< char > *sensorXMLNode, RobotDescription loadMode, const std::string &basePath)
 

Protected Member Functions

 BaseIO ()
 
virtual ~BaseIO ()
 

Static Protected Attributes

static std::mutex mutex
 

Detailed Description

Several basic XML IO methods.

See also
RobotIO, SceneIO, ObjectIO

Member Enumeration Documentation

◆ RobotDescription

Enumerator
eFull 
eCollisionModel 
eStructure 
eStructureStore 
eFullVisAsCol 

Constructor & Destructor Documentation

◆ BaseIO()

VirtualRobot::BaseIO::BaseIO ( )
protecteddefault

◆ ~BaseIO()

VirtualRobot::BaseIO::~BaseIO ( )
protectedvirtualdefault

Member Function Documentation

◆ convertToFloat()

float VirtualRobot::BaseIO::convertToFloat ( const char *  s)
static

This method converts s into a float value and returns it. If s is NULL or not a string representation of a float a VirtualRobot::VirtualRobotException is thrown.

Parameters
sthe string to convert to float
Returns
the passed in float value

◆ convertToInt()

int VirtualRobot::BaseIO::convertToInt ( const char *  s)
static

◆ getAllAttributes()

void VirtualRobot::BaseIO::getAllAttributes ( rapidxml::xml_node< char > *  node,
const std::string &  attrString,
std::vector< std::string > &  storeValues 
)
static

◆ getFloatByAttributeName()

float VirtualRobot::BaseIO::getFloatByAttributeName ( rapidxml::xml_node< char > *  xmlNode,
const std::string &  attributeName 
)
static

This method gets the attribute attributeName from xml_node xmlNode and returns its value as float. If an error occurs (NULL data, missing attribute, conversion failed) a VirtualRobot::VirtualRobotException is thrown.

◆ getLowerCase() [1/2]

std::string VirtualRobot::BaseIO::getLowerCase ( const char *  c)
static

This method creates a std::string from the parameter c and calls VirtualRobot::BaseIO::getLowerCase(std::string) on the created string. Afterwards the transformed string is returned.

◆ getLowerCase() [2/2]

void VirtualRobot::BaseIO::getLowerCase ( std::string &  aString)
static

This method applies tolower() to all characters in the string aString.

◆ getOptionalFloatByAttributeName()

float VirtualRobot::BaseIO::getOptionalFloatByAttributeName ( rapidxml::xml_node< char > *  xmlNode,
const std::string &  attributeName,
float  standardValue 
)
static

This method gets an optional attribute attributeName from xml_node xmlNode and returns its value as float. When no attribute attributeName is present the standardValue is returned.

◆ getUnitsAttribute()

Units VirtualRobot::BaseIO::getUnitsAttribute ( rapidxml::xml_node< char > *  node,
Units::UnitsType  u 
)
static

This method processes the unit, units, unitsAngle, unitsLength, unitsTime or unitsWeight attribute of xml_node node. The first matching unit is returned.

Returns
instance of VirtualRobot::Units

◆ getUnitsAttributes()

std::vector< Units > VirtualRobot::BaseIO::getUnitsAttributes ( rapidxml::xml_node< char > *  node)
static

◆ hasUnitsAttribute()

bool VirtualRobot::BaseIO::hasUnitsAttribute ( rapidxml::xml_node< char > *  node)
static

◆ isTrue()

bool VirtualRobot::BaseIO::isTrue ( const char *  s)
static

◆ makeAbsolutePath()

void VirtualRobot::BaseIO::makeAbsolutePath ( const std::string &  basePath,
std::string &  filename 
)
static

◆ makeRelativePath()

void VirtualRobot::BaseIO::makeRelativePath ( const std::string &  basePath,
std::string &  filename 
)
static

◆ process3x3Matrix()

Eigen::Matrix3f VirtualRobot::BaseIO::process3x3Matrix ( rapidxml::xml_node< char > *  matrixXMLNode)
static

◆ processCollisionTag()

CollisionModelPtr VirtualRobot::BaseIO::processCollisionTag ( rapidxml::xml_node< char > *  colXMLNode,
const std::string &  tagName,
const std::string &  basePath 
)
static

◆ processConfigurationNode()

bool VirtualRobot::BaseIO::processConfigurationNode ( rapidxml::xml_node< char > *  configXMLNode,
std::vector< RobotConfig::Configuration > &  storeConfigDefinitions,
std::string &  storeConfigName 
)
static

◆ processConfigurationNodeList()

bool VirtualRobot::BaseIO::processConfigurationNodeList ( rapidxml::xml_node< char > *  configXMLNode,
std::vector< std::vector< RobotConfig::Configuration > > &  configDefinitions,
std::vector< std::string > &  configNames,
std::vector< std::string > &  tcpNames 
)
static

◆ processDHNode()

void VirtualRobot::BaseIO::processDHNode ( rapidxml::xml_node< char > *  dhXMLNode,
DHParameter dh 
)
static

◆ processFileNode()

std::string VirtualRobot::BaseIO::processFileNode ( rapidxml::xml_node< char > *  fileNode,
const std::string &  basePath 
)
static

◆ processFloatAttribute()

float VirtualRobot::BaseIO::processFloatAttribute ( const std::string &  attributeName,
rapidxml::xml_node< char > *  node,
bool  allowOtherAttributes = false 
)
static

This method takes a rapidxml::xml_node and returns the value of the first tag it finds with name attributeName. If an error occurs an exception is thrown If more than one name attribute is found an exception is thrown. If no attribute can be found 0.0 is returned.

Warning
Do NOT use this method if there are several attributes which need to be processed (or set allowOtherAttributes to silently ignore other attributes)
Returns
the value of the attribute or 0.0 if no attribute was found

◆ processFloatValueTags()

bool VirtualRobot::BaseIO::processFloatValueTags ( rapidxml::xml_node< char > *  XMLNode,
int  dim,
Eigen::VectorXf &  stroreResult 
)
static

◆ processGrasp()

GraspPtr VirtualRobot::BaseIO::processGrasp ( rapidxml::xml_node< char > *  graspXMLNode,
const std::string &  robotType,
const std::string &  eef,
const std::string &  objName 
)
static

◆ processGraspSet()

GraspSetPtr VirtualRobot::BaseIO::processGraspSet ( rapidxml::xml_node< char > *  graspSetXMLNode,
const std::string &  objName 
)
static

◆ processIntAttribute()

int VirtualRobot::BaseIO::processIntAttribute ( const std::string &  attributeName,
rapidxml::xml_node< char > *  node,
bool  allowOtherAttributes = false 
)
static

This method takes a rapidxml::xml_node and returns the value of the first tag it finds with name attributeName. If an error occurs an exception is thrown If more than one name attribute is found an exception is thrown. If no attribute can be found 0 is returned.

Warning
Do NOT use this method if there are several attributes which need to be processed (or set allowOtherAttributes to silently ignore other attributes)
Returns
the value of the attribute or 0.0 if no attribute was found

◆ processLimitsNode()

static void VirtualRobot::BaseIO::processLimitsNode ( rapidxml::xml_node< char > *  limitsXMLNode,
float &  jointLimitLo,
float &  jointLimitHi 
)
static

◆ processNameAttribute()

std::string VirtualRobot::BaseIO::processNameAttribute ( rapidxml::xml_node< char > *  node,
bool  allowOtherAttributes = false 
)
static

This method takes a rapidxml::xml_node and returns the value of the first name tag it finds. If an error occurs a message is logged to the console and an empty string is returned. If more than one name attribute is found an exception is thrown.

Warning
Do NOT use this method if there are several attributes which need to be processed (or set allowOtherAttributes to silently ignore other attributes)
Returns
the value of the name attribute or an empty string on error

◆ processNodeList()

void VirtualRobot::BaseIO::processNodeList ( rapidxml::xml_node< char > *  parentNode,
RobotPtr  robot,
std::vector< RobotNodePtr > &  nodeList,
bool  clearList = true 
)
static

This method processes the parentNode Tag and extracts a list of <Node name="xyz"/> tags. All other child tags raise a VirtualRobot::VirtualRobotException. The resulting nodes are stored in nodeList.

If the parameter clearList is true all elements from nodeList are removed.

◆ processNodeMapping()

NodeMapping VirtualRobot::BaseIO::processNodeMapping ( rapidxml::xml_node< char > *  XMLNode,
RobotPtr  robot 
)
static

◆ processPhysicsTag()

void VirtualRobot::BaseIO::processPhysicsTag ( rapidxml::xml_node< char > *  physicsXMLNode,
const std::string &  nodeName,
SceneObject::Physics physics 
)
static

◆ processPrimitives()

std::vector< Primitive::PrimitivePtr > VirtualRobot::BaseIO::processPrimitives ( rapidxml::xml_node< char > *  primitivesXMLNode)
static

◆ processRobotNodeSet()

RobotNodeSetPtr VirtualRobot::BaseIO::processRobotNodeSet ( rapidxml::xml_node< char > *  setXMLNode,
RobotPtr  robo,
const std::string &  robotRootNode,
int &  robotNodeSetCounter 
)
static

◆ processSensor()

bool VirtualRobot::BaseIO::processSensor ( GraspableSensorizedObjectPtr  node,
rapidxml::xml_node< char > *  sensorXMLNode,
RobotDescription  loadMode,
const std::string &  basePath 
)
static

◆ processStringAttribute()

std::string VirtualRobot::BaseIO::processStringAttribute ( const std::string &  attributeName,
rapidxml::xml_node< char > *  node,
bool  allowOtherAttributes = false 
)
static

This method takes a rapidxml::xml_node and returns the value of the first tag it finds with name attributeName. If an error occurs a message is logged to the console and "" is returned. If more than one name attribute is found an exception is thrown. If no attribute can be found 0.0 is returned.

Warning
Do NOT use this method if there are several attributes which need to be processed (or set allowOtherAttributes to silently ignore other attributes)
Returns
the value of the name attribute or an empty string on error

◆ processTrajectory()

TrajectoryPtr VirtualRobot::BaseIO::processTrajectory ( rapidxml::xml_node< char > *  trajectoryXMLNode,
std::vector< RobotPtr > &  robots 
)
static

◆ processTransformNode()

void VirtualRobot::BaseIO::processTransformNode ( rapidxml::xml_node< char > *  transformXMLNode,
const std::string &  tagName,
Eigen::Matrix4f &  transform 
)
static

This method processes <Transform> tags. If transformXMLNode is NULL (e.g. the tag does not exist) transform is set to contain the identity matrix.

◆ processVisualizationTag()

VisualizationNodePtr VirtualRobot::BaseIO::processVisualizationTag ( rapidxml::xml_node< char > *  visuXMLNode,
const std::string &  tagName,
const std::string &  basePath,
bool &  useAsColModel 
)
static

◆ processVisuFiles()

std::vector< VisualizationNodePtr > VirtualRobot::BaseIO::processVisuFiles ( rapidxml::xml_node< char > *  visualizationXMLNode,
const std::string &  basePath,
std::string &  fileType 
)
static

◆ toXML()

std::string VirtualRobot::BaseIO::toXML ( const Eigen::Matrix4f &  m,
std::string  ident = "\t" 
)
static

◆ writeXMLFile()

bool VirtualRobot::BaseIO::writeXMLFile ( const std::string &  filename,
const std::string &  content,
bool  overwrite = true 
)
static

Create a file and store XML content.

Parameters
filenameThe filename
contentThe XML content as string. No checks are performed.
overwriteIf true, a potentially existing file is silently overwritten.
Returns
True on success

Field Documentation

◆ mutex

std::mutex VirtualRobot::BaseIO::mutex
staticprotected