Simox  2.3.50
VirtualRobot::RobotIO Class Reference
Inheritance diagram for VirtualRobot::RobotIO:
VirtualRobot::BaseIO

Data Structures

struct  ChildFromRobotDef
 

Public Types

enum  RobotDescription { eFull, eCollisionModel, eStructure }
 

Static Public Member Functions

static RobotPtr loadRobot (const std::string &xmlFile, RobotDescription loadMode=eFull)
 
static RobotPtr createRobotFromString (const std::string &xmlString, const std::string &basePath="", RobotDescription loadMode=eFull)
 
static bool saveXML (RobotPtr robot, const std::string &filename, const std::string &basePath, const std::string &modelDir="models", bool storeEEF=true, bool storeRNS=true, bool storeSensors=true, bool storeModelFiles=true)
 
- Static Public Member Functions inherited from VirtualRobot::BaseIO
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 std::string toXML (const Eigen::Matrix4f &m, std::string ident="\t")
 
static std::vector< VisualizationNodePtrprocessVisuFiles (rapidxml::xml_node< char > *visualizationXMLNode, const std::string &basePath, std::string &fileType)
 

Protected Member Functions

 RobotIO ()
 
virtual ~RobotIO ()
 
- Protected Member Functions inherited from VirtualRobot::BaseIO
 BaseIO ()
 
virtual ~BaseIO ()
 

Static Protected Member Functions

static RobotPtr processRobot (rapidxml::xml_node< char > *robotXMLNode, const std::string &basePath, RobotDescription loadMode=eFull)
 
static RobotPtr processRobotAttributes (rapidxml::xml_node< char > *robotXMLNode, std::string &robotRoot)
 
static void processRobotChildNodes (rapidxml::xml_node< char > *robotXMLNode, RobotPtr robo, const std::string &robotRoot, const std::string &basePath, std::map< RobotNodePtr, std::vector< ChildFromRobotDef > > &childrenFromRobotFilesMap, std::vector< rapidxml::xml_node< char > * > &robotNodeSetNodes, std::vector< rapidxml::xml_node< char > * > &endeffectorNodes, RobotDescription loadMode=eFull)
 
static RobotNodePtr processRobotNode (rapidxml::xml_node< char > *robotNodeXMLNode, RobotPtr robo, const std::string &basePath, int &robotNodeCounter, std::vector< std::string > &childrenNames, std::vector< ChildFromRobotDef > &childrenFromRobot, RobotDescription loadMode=eFull, RobotNode::RobotNodeType rntype=RobotNode::Generic)
 
static EndEffectorPtr processEndeffectorNode (rapidxml::xml_node< char > *endeffectorXMLNode, RobotPtr robo)
 
static EndEffectorActorPtr processEndeffectorActorNode (rapidxml::xml_node< char > *endeffectorActorXMLNode, RobotPtr robo)
 
static void processEndeffectorStaticNode (rapidxml::xml_node< char > *endeffectorStaticXMLNode, RobotPtr robo, std::vector< RobotNodePtr > &staticNodesList)
 
static EndEffectorActor::CollisionMode processEEFColAttributes (rapidxml::xml_node< char > *node, bool allowOtherAttributes=false)
 
static void processActorNodeList (rapidxml::xml_node< char > *parentNode, RobotPtr robot, std::vector< EndEffectorActor::ActorDefinition > &actorList, bool clearList=true)
 
static void processChildNode (rapidxml::xml_node< char > *childXMLNode, std::vector< std::string > &childrenNames)
 
static RobotNodePtr processJointNode (rapidxml::xml_node< char > *jointXMLNode, const std::string &robotNodeName, RobotPtr robot, VisualizationNodePtr visualizationNode, CollisionModelPtr collisionModel, SceneObject::Physics &physics, RobotNode::RobotNodeType rntype, Eigen::Matrix4f &transformationMatrix)
 
static void processChildFromRobotNode (rapidxml::xml_node< char > *childXMLNode, const std::string &nodeName, std::vector< ChildFromRobotDef > &childrenFromRobot)
 
static void processLimitsNode (rapidxml::xml_node< char > *limitsXMLNode, float &jointLimitLo, float &jointLimitHi)
 
static bool processSensor (RobotNodePtr rn, rapidxml::xml_node< char > *sensorXMLNode, RobotDescription loadMode, const std::string &basePath)
 
static VisualizationNodePtr checkUseAsColModel (rapidxml::xml_node< char > *visuXMLNode, const std::string &robotNodeName, const std::string &basePath)
 

Static Protected Attributes

static std::map< std::string, int > robot_name_counter
 
- Static Protected Attributes inherited from VirtualRobot::BaseIO
static boost::mutex mutex
 

Member Enumeration Documentation

Enumerator
eFull 
eCollisionModel 
eStructure 

Constructor & Destructor Documentation

VirtualRobot::RobotIO::RobotIO ( )
protected
VirtualRobot::RobotIO::~RobotIO ( )
protectedvirtual

Member Function Documentation

VisualizationNodePtr VirtualRobot::RobotIO::checkUseAsColModel ( rapidxml::xml_node< char > *  visuXMLNode,
const std::string &  robotNodeName,
const std::string &  basePath 
)
staticprotected
VirtualRobot::RobotPtr VirtualRobot::RobotIO::createRobotFromString ( const std::string &  xmlString,
const std::string &  basePath = "",
RobotDescription  loadMode = eFull 
)
static

Creates Robot from string.

Parameters
xmlStringThe input string.
basePathIf any <childFromRobot> tags are given, the path for searching the robot files can be specified.
loadModeStandard: eFull, When eStructure is used no visualization and collision models are loaded for faster access.
VirtualRobot::RobotPtr VirtualRobot::RobotIO::loadRobot ( const std::string &  xmlFile,
RobotDescription  loadMode = eFull 
)
static

Loads robot from file.

Parameters
xmlFileThe file
loadModeStandard: eFull, When eStructure is used no visualization and collision models are loaded for faster access.
Returns
Returns an empty pointer, when file access failed.
void VirtualRobot::RobotIO::processActorNodeList ( rapidxml::xml_node< char > *  parentNode,
RobotPtr  robot,
std::vector< EndEffectorActor::ActorDefinition > &  actorList,
bool  clearList = true 
)
staticprotected

This method processes the parentNode Tag and extracts a list of <Node name="xyz" speed="0123" /> 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.

void VirtualRobot::RobotIO::processChildFromRobotNode ( rapidxml::xml_node< char > *  childXMLNode,
const std::string &  nodeName,
std::vector< ChildFromRobotDef > &  childrenFromRobot 
)
staticprotected
void VirtualRobot::RobotIO::processChildNode ( rapidxml::xml_node< char > *  childXMLNode,
std::vector< std::string > &  childrenNames 
)
staticprotected
EndEffectorActor::CollisionMode VirtualRobot::RobotIO::processEEFColAttributes ( rapidxml::xml_node< char > *  node,
bool  allowOtherAttributes = false 
)
staticprotected
EndEffectorActorPtr VirtualRobot::RobotIO::processEndeffectorActorNode ( rapidxml::xml_node< char > *  endeffectorActorXMLNode,
RobotPtr  robo 
)
staticprotected

This method processes the attributes and the children of an actor tag which itself is a child of the endeffector tag. First the name attribute is retrieved and afterwards the child nodes are processed which make up the actor.

EndEffectorPtr VirtualRobot::RobotIO::processEndeffectorNode ( rapidxml::xml_node< char > *  endeffectorXMLNode,
RobotPtr  robo 
)
staticprotected

This method parses the EndEffector which are child tags of the Robot tag. Each EndEffector has a name, a base node, a list of static robot nodes and a list of actors. Each actor itself consists of a list of robot nodes.

The static parts and the actors are retrieved by delegating the processing to RobotIO::processEndeffectorActorNode and RobotIO::processEndeffectorStaticNode.

Returns
instance of VirtualRobot::EndEffector
void VirtualRobot::RobotIO::processEndeffectorStaticNode ( rapidxml::xml_node< char > *  endeffectorStaticXMLNode,
RobotPtr  robo,
std::vector< RobotNodePtr > &  staticNodesList 
)
staticprotected

This method processes the children of the static tag which itself is a child of the endeffector tag.

RobotNodePtr VirtualRobot::RobotIO::processJointNode ( rapidxml::xml_node< char > *  jointXMLNode,
const std::string &  robotNodeName,
RobotPtr  robot,
VisualizationNodePtr  visualizationNode,
CollisionModelPtr  collisionModel,
SceneObject::Physics physics,
RobotNode::RobotNodeType  rntype,
Eigen::Matrix4f &  transformationMatrix 
)
staticprotected
void VirtualRobot::RobotIO::processLimitsNode ( rapidxml::xml_node< char > *  limitsXMLNode,
float &  jointLimitLo,
float &  jointLimitHi 
)
staticprotected

This method processes Limits tags. The values for the attributes "lo" and "hi" are extracted based on the "unit" or "units" attribute.

The values are stored in jointLimitLo and jointLimitHi

RobotPtr VirtualRobot::RobotIO::processRobot ( rapidxml::xml_node< char > *  robotXMLNode,
const std::string &  basePath,
RobotDescription  loadMode = eFull 
)
staticprotected
RobotPtr VirtualRobot::RobotIO::processRobotAttributes ( rapidxml::xml_node< char > *  robotXMLNode,
std::string &  robotRoot 
)
staticprotected
void VirtualRobot::RobotIO::processRobotChildNodes ( rapidxml::xml_node< char > *  robotXMLNode,
RobotPtr  robo,
const std::string &  robotRoot,
const std::string &  basePath,
std::map< RobotNodePtr, std::vector< ChildFromRobotDef > > &  childrenFromRobotFilesMap,
std::vector< rapidxml::xml_node< char > * > &  robotNodeSetNodes,
std::vector< rapidxml::xml_node< char > * > &  endeffectorNodes,
RobotDescription  loadMode = eFull 
)
staticprotected
RobotNodePtr VirtualRobot::RobotIO::processRobotNode ( rapidxml::xml_node< char > *  robotNodeXMLNode,
RobotPtr  robo,
const std::string &  basePath,
int &  robotNodeCounter,
std::vector< std::string > &  childrenNames,
std::vector< ChildFromRobotDef > &  childrenFromRobot,
RobotDescription  loadMode = eFull,
RobotNode::RobotNodeType  rntype = RobotNode::Generic 
)
staticprotected
bool VirtualRobot::RobotIO::processSensor ( RobotNodePtr  rn,
rapidxml::xml_node< char > *  sensorXMLNode,
RobotDescription  loadMode,
const std::string &  basePath 
)
staticprotected
bool VirtualRobot::RobotIO::saveXML ( RobotPtr  robot,
const std::string &  filename,
const std::string &  basePath,
const std::string &  modelDir = "models",
bool  storeEEF = true,
bool  storeRNS = true,
bool  storeSensors = true,
bool  storeModelFiles = true 
)
static

Creates an XML string that defines the robot and stores it to the file basePath/filename. All visualizations and collision models are stored to the basePath/modeDir directory

Parameters
robotThe robot to save.
filenameThe filename without path.
basePathThe directory to store the robot to
modelDirThe local directory where all visualization files should be stored to.

Field Documentation

std::map< std::string, int > VirtualRobot::RobotIO::robot_name_counter
staticprotected