Simox  2.3.62
VirtualRobot::RobotNode Class Referenceabstract
Inheritance diagram for VirtualRobot::RobotNode:
VirtualRobot::SceneObject VirtualRobot::RobotNodeFixed VirtualRobot::RobotNodePrismatic VirtualRobot::RobotNodeRevolute

Public Types

enum  RobotNodeType { Generic, Joint, Body, Transform }
 Experimental: Additional information about the node. More...
- Public Types inherited from VirtualRobot::SceneObject
enum  VisualizationType { Full, Collision, CollisionData }

Public Member Functions

 RobotNode (RobotWeakPtr rob, const std::string &name, float jointLimitLo, float jointLimitHi, VisualizationNodePtr visualization=VisualizationNodePtr(), CollisionModelPtr collisionModel=CollisionModelPtr(), float jointValueOffset=0.0f, const SceneObject::Physics &p=SceneObject::Physics(), CollisionCheckerPtr colChecker=CollisionCheckerPtr(), RobotNodeType type=Generic)
virtual ~RobotNode ()
RobotPtr getRobot () const
void setJointValue (float q)
void collectAllRobotNodes (std::vector< RobotNodePtr > &storeNodes)
virtual float getJointValue () const
void respectJointLimits (float &jointValue) const
bool checkJointLimits (float jointValue, bool verbose=false) const
virtual Eigen::Matrix4f getLocalTransformation ()
virtual bool initialize (SceneObjectPtr parent=SceneObjectPtr(), const std::vector< SceneObjectPtr > &children=std::vector< SceneObjectPtr >())
virtual void setGlobalPose (const Eigen::Matrix4f &pose)
virtual Eigen::Matrix4f getGlobalPose () const
virtual Eigen::Matrix4f getPoseInRootFrame () const
virtual Eigen::Vector3f getPositionInRootFrame () const
virtual void showCoordinateSystem (bool enable, float scaling=1.0f, std::string *text=NULL, const std::string &visualizationType="")
virtual void print (bool printChildren=false, bool printDecoration=true) const
float getJointLimitLo ()
float getJointLimitHi ()
virtual void setJointLimits (float lo, float hi)
virtual bool isTranslationalJoint () const
virtual bool isRotationalJoint () const
virtual void setLimitless (bool limitless)
bool isLimitless ()
virtual float getDelta (float target)
virtual void showStructure (bool enable, const std::string &visualizationType="")
virtual std::vector< RobotNodePtrgetAllParents (RobotNodeSetPtr rns=RobotNodeSetPtr())
virtual RobotNodePtr clone (RobotPtr newRobot, bool cloneChildren=true, RobotNodePtr initializeWithParent=RobotNodePtr(), CollisionCheckerPtr colChecker=CollisionCheckerPtr(), float scaling=1.0f)
float getJointValueOffset () const
float getJointLimitHigh () const
float getJointLimitLow () const
virtual void setMaxVelocity (float maxVel)
virtual void setMaxAcceleration (float maxAcc)
virtual void setMaxTorque (float maxTo)
float getMaxVelocity ()
float getMaxAcceleration ()
float getMaxTorque ()
RobotNodeType getType ()
SceneObjectPtr clone (const std::string &, CollisionCheckerPtr=CollisionCheckerPtr(), float=1.0f) const
 Forbid cloning method from SceneObject. We need to know the new robot for cloning. More...
const DHParametergetOptionalDHParameters ()
virtual void updatePose (bool updateChildren=true)
virtual void propagateJointValue (const std::string &jointName, float factor=1.0f)
virtual SensorPtr getSensor (const std::string &name) const
virtual bool hasSensor (const std::string &name) const
virtual std::vector< SensorPtrgetSensors () const
virtual bool registerSensor (SensorPtr sensor)
virtual std::string toXML (const std::string &basePath, const std::string &modelPathRelative="models", bool storeSensors=true)
void setLocalTransformation (Eigen::Matrix4f &newLocalTransformation)
virtual void setJointValueNoUpdate (float q)
- Public Member Functions inherited from VirtualRobot::SceneObject
 SceneObject (const std::string &name, VisualizationNodePtr visualization=VisualizationNodePtr(), CollisionModelPtr collisionModel=CollisionModelPtr(), const Physics &p=Physics(), CollisionCheckerPtr colChecker=CollisionCheckerPtr())
virtual ~SceneObject ()
std::string getName () const
void setName (const std::string &name)
virtual void setGlobalPoseNoChecks (const Eigen::Matrix4f &pose)
virtual CollisionModelPtr getCollisionModel ()
virtual CollisionCheckerPtr getCollisionChecker ()
void setVisualization (VisualizationNodePtr visualization)
void setCollisionModel (CollisionModelPtr colModel)
virtual VisualizationNodePtr getVisualization (SceneObject::VisualizationType visuType=SceneObject::Full)
virtual void setUpdateVisualization (bool enable)
bool getUpdateVisualizationStatus ()
virtual void setUpdateCollisionModel (bool enable)
bool getUpdateCollisionModelStatus ()
virtual void setupVisualization (bool showVisualization, bool showAttachedVisualizations)
virtual void showPhysicsInformation (bool enableCoM, bool enableInertial, VisualizationNodePtr comModel=VisualizationNodePtr())
virtual bool showCoordinateSystemState ()
virtual void showBoundingBox (bool enable, bool wireframe=false)
virtual bool ensureVisualization (const std::string &visualizationType="")
Eigen::Matrix4f toLocalCoordinateSystem (const Eigen::Matrix4f &poseGlobal) const
Eigen::Vector3f toLocalCoordinateSystemVec (const Eigen::Vector3f &positionGlobal) const
Eigen::Matrix4f toGlobalCoordinateSystem (const Eigen::Matrix4f &poseLocal) const
Eigen::Vector3f toGlobalCoordinateSystemVec (const Eigen::Vector3f &positionLocal) const
Eigen::Matrix4f getTransformationTo (const SceneObjectPtr otherObject)
Eigen::Matrix4f getTransformationFrom (const SceneObjectPtr otherObject)
Eigen::Matrix4f transformTo (const SceneObjectPtr otherObject, const Eigen::Matrix4f &poseInOtherCoordSystem)
Eigen::Vector3f transformTo (const SceneObjectPtr otherObject, const Eigen::Vector3f &positionInOtherCoordSystem)
virtual int getNumFaces (bool collisionModel=false)
virtual Eigen::Vector3f getCoMLocal ()
virtual Eigen::Vector3f getCoMGlobal ()
float getMass () const
void setMass (float m)
Physics::SimulationType getSimulationType () const
void setSimulationType (Physics::SimulationType s)
Eigen::Matrix3f getInertiaMatrix ()
Eigen::Matrix3f getInertiaMatrix (const Eigen::Vector3f &shift)
 If the Inertia Matrix is given at the CoM, this function returns the Inertia Matrix at the parallel shifted coordinate system. The shift is done using the parallel axis theorem ( More...
Eigen::Matrix3f getInertiaMatrix (const Eigen::Vector3f &shift, const Eigen::Matrix3f &rotation)
Eigen::Matrix3f getInertiaMatrix (const Eigen::Matrix4f &transform)
void setInertiaMatrix (const Eigen::Matrix3f &im)
float getFriction ()
void setFriction (float friction)
SceneObject::Physics getPhysics ()
std::vector< std::string > getIgnoredCollisionModels ()
template<typename T >
boost::shared_ptr< T > getVisualization (SceneObject::VisualizationType visuType=SceneObject::Full)
void highlight (VisualizationPtr visualization, bool enable)
SceneObjectPtr clone (const std::string &name, CollisionCheckerPtr colChecker=CollisionCheckerPtr(), float scaling=1.0f) const
virtual bool attachChild (SceneObjectPtr child)
virtual void detachChild (SceneObjectPtr child)
virtual bool hasChild (SceneObjectPtr child, bool recursive=false) const
virtual bool hasChild (const std::string &childName, bool recursive=false) const
virtual bool hasParent ()
virtual SceneObjectPtr getParent () const
virtual std::vector< SceneObjectPtrgetChildren () const
virtual bool saveModelFiles (const std::string &modelPath, bool replaceFilenames)

Protected Member Functions

virtual void updateTransformationMatrices ()
virtual void updatePose (const Eigen::Matrix4f &parentPose, bool updateChildren=true)
virtual void updateVisualizationPose (const Eigen::Matrix4f &globalPose, bool updateChildren=false)
virtual void updateVisualizationPose (const Eigen::Matrix4f &globalPose, float jointValue, bool updateChildren=false)
virtual void checkValidRobotNodeType ()
 Checks if nodeType constraints are fulfilled. Otherwise an exception is thrown. Called on initialization. More...
 RobotNode ()
virtual void updateTransformationMatrices (const Eigen::Matrix4f &parentPose)
virtual RobotNodePtr _clone (const RobotPtr newRobot, const VisualizationNodePtr visualizationModel, const CollisionModelPtr collisionModel, CollisionCheckerPtr colChecker, float scaling)=0
virtual SceneObject_clone (const std::string &, CollisionCheckerPtr=CollisionCheckerPtr(), float=1.0f) const
virtual std::string _toXML (const std::string &modelPath)=0
void setJointValueNotInitialized (float q)
- Protected Member Functions inherited from VirtualRobot::SceneObject
virtual void detachedFromParent ()
 Parent detached this object. More...
virtual void attached (SceneObjectPtr parent)
 Parent attached this object. More...
std::string getFilenameReplacementVisuModel (const std::string standardExtension=".wrl")
std::string getFilenameReplacementColModel (const std::string standardExtension=".wrl")
 SceneObject ()
std::string getSceneObjectXMLString (const std::string &basePath, int tabs)
 basic data, used by Obstacle and ManipulationObject More...
virtual bool initializePhysics ()

Protected Attributes

float jointValueOffset
float jointLimitLo
float jointLimitHi
bool limitless
DHParameter optionalDHParameter
float maxVelocity
float maxAcceleration
 given in m/s More...
float maxTorque
 given in m/s^2 More...
Eigen::Matrix4f localTransformation
 given in Nm More...
std::map< std::string, float > propagatedJointValues
RobotWeakPtr robot
RobotNodeType nodeType
std::vector< SensorPtrsensors
float jointValue
- Protected Attributes inherited from VirtualRobot::SceneObject
std::string name
bool initialized
Eigen::Matrix4f globalPose
std::vector< SceneObjectPtrchildren
SceneObjectWeakPtr parent
CollisionModelPtr collisionModel
VisualizationNodePtr visualizationModel
bool updateVisualization
bool updateCollisionModel
Physics physics
CollisionCheckerPtr collisionChecker


class Robot
class LocalRobot
class RobotIO
class RobotNodeSet
class RobotConfig
class RobotFactory
class RobotNodeActuator
class ColladaIO

Detailed Description

Each RobotNode may consider two transformations: localTransformation: This transformation is fixed. jointTransformation: This is the flexible part of the joint. Here, the jointValue is used to compute the transformation according to the implementation of the joint type.

The visualization (of limb and/or coordinateAxis) is linked to the local coordinate sysytem of this joint: localTransformation*jointTransformation The global pose of this joint is the same: localTransformation*jointTransformation

Member Enumeration Documentation

Experimental: Additional information about the node.


No constraints.


Only pre-joint transformations allowed (e.g. DH-theta for revolute joints). No visualization/collision models.


No transformations allowed. Only visualization and/or collision models together with physic information.

Only transformations allowed. No joint or model tags.

Constructor & Destructor Documentation

VirtualRobot::RobotNode::RobotNode ( RobotWeakPtr  rob,
const std::string &  name,
float  jointLimitLo,
float  jointLimitHi,
VisualizationNodePtr  visualization = VisualizationNodePtr(),
CollisionModelPtr  collisionModel = CollisionModelPtr(),
float  jointValueOffset = 0.0f,
const SceneObject::Physics p = SceneObject::Physics(),
CollisionCheckerPtr  colChecker = CollisionCheckerPtr(),
RobotNodeType  type = Generic 

Constructor with settings.

VirtualRobot::RobotNode::~RobotNode ( )
VirtualRobot::RobotNode::RobotNode ( )

Member Function Documentation

virtual RobotNodePtr VirtualRobot::RobotNode::_clone ( const RobotPtr  newRobot,
const VisualizationNodePtr  visualizationModel,
const CollisionModelPtr  collisionModel,
CollisionCheckerPtr  colChecker,
float  scaling 
protectedpure virtual

Derived classes must implement their clone method here. Passed models are already scaled. Scaling factor should be only used for kinematic computations.

Implemented in VirtualRobot::RobotNodeRevolute, VirtualRobot::RobotNodePrismatic, and VirtualRobot::RobotNodeFixed.

virtual SceneObject* VirtualRobot::RobotNode::_clone ( const std::string &  ,
CollisionCheckerPtr  = CollisionCheckerPtr(),
float  = 1.0f 
) const

Reimplemented from VirtualRobot::SceneObject.

virtual std::string VirtualRobot::RobotNode::_toXML ( const std::string &  modelPath)
protectedpure virtual

Derived classes add custom XML tags here

Implemented in VirtualRobot::RobotNodeRevolute, VirtualRobot::RobotNodePrismatic, and VirtualRobot::RobotNodeFixed.

bool VirtualRobot::RobotNode::checkJointLimits ( float  jointValue,
bool  verbose = false 
) const

Checks if jointValue is within joint limits. If verbose is set a warning is printed.

void VirtualRobot::RobotNode::checkValidRobotNodeType ( )

Checks if nodeType constraints are fulfilled. Otherwise an exception is thrown. Called on initialization.

Reimplemented in VirtualRobot::RobotNodeRevolute, VirtualRobot::RobotNodePrismatic, and VirtualRobot::RobotNodeFixed.

RobotNodePtr VirtualRobot::RobotNode::clone ( RobotPtr  newRobot,
bool  cloneChildren = true,
RobotNodePtr  initializeWithParent = RobotNodePtr(),
CollisionCheckerPtr  colChecker = CollisionCheckerPtr(),
float  scaling = 1.0f 

Clone this RobotNode.

newRobotThe newly created RobotNode belongs to newRobot.
cloneChildrenIf true, all children are cloned (and their children, etc).
initializeWithParentIf given, the RobotNode is initialized with this parent.
colCheckerMust only be set if the cloned RobotNode should be registered to a different collision checker instance.
scalingScale Can be set to create a scaled version of this robot. Scaling is applied on kinematic, visual, and collision data.
SceneObjectPtr VirtualRobot::RobotNode::clone ( const std::string &  ,
CollisionCheckerPtr  = CollisionCheckerPtr(),
float  = 1.0f 
) const

Forbid cloning method from SceneObject. We need to know the new robot for cloning.

void VirtualRobot::RobotNode::collectAllRobotNodes ( std::vector< RobotNodePtr > &  storeNodes)

All children and their children (and so on) are collected. The current instance is also added.

std::vector< RobotNodePtr > VirtualRobot::RobotNode::getAllParents ( RobotNodeSetPtr  rns = RobotNodeSetPtr())

Find all robot nodes whose movements affect this RobotNode

rnsIf set, the search is limited to the rns.
float VirtualRobot::RobotNode::getDelta ( float  target)
targetthe target joint value in [rad]
the signed distance between current and target joint values in [rad]. If the given target value violates joint limits or this robotnode is not a joint, 0.0f is returned instead.
Eigen::Matrix4f VirtualRobot::RobotNode::getGlobalPose ( ) const

The global pose defines the position of the object in the world. For non-joint objects it is identical with the visualization frame.

Reimplemented from VirtualRobot::SceneObject.

float VirtualRobot::RobotNode::getJointLimitHi ( )
float VirtualRobot::RobotNode::getJointLimitHigh ( ) const
float VirtualRobot::RobotNode::getJointLimitLo ( )
float VirtualRobot::RobotNode::getJointLimitLow ( ) const
float VirtualRobot::RobotNode::getJointValue ( ) const
float VirtualRobot::RobotNode::getJointValueOffset ( ) const
virtual Eigen::Matrix4f VirtualRobot::RobotNode::getLocalTransformation ( )

The preJoint/preVisualization transformation. This transformation is applied before the joint and the visualization.

float VirtualRobot::RobotNode::getMaxAcceleration ( )

Maximum acceleration in rad/s^2 or m/s^2. Returns -1.0f if no maxium value is set.

float VirtualRobot::RobotNode::getMaxTorque ( )

Maximum acceleration in Nm. Returns -1.0f if no maxium value is set.

float VirtualRobot::RobotNode::getMaxVelocity ( )

Maximum velocity in rad/s or m/s. Returns -1.0f if no maxium value is set.

const DHParameter& VirtualRobot::RobotNode::getOptionalDHParameters ( )

When joint was created via DH parameters, they can be accessed here.

Eigen::Matrix4f VirtualRobot::RobotNode::getPoseInRootFrame ( ) const

The pose of this node in the root coordinate system of the robot.

The pose in root frame
Eigen::Vector3f VirtualRobot::RobotNode::getPositionInRootFrame ( ) const

The position of this node in the root coordinate system of the robot.

The position in root frame
RobotPtr VirtualRobot::RobotNode::getRobot ( ) const
SensorPtr VirtualRobot::RobotNode::getSensor ( const std::string &  name) const
std::vector< SensorPtr > VirtualRobot::RobotNode::getSensors ( ) const
RobotNode::RobotNodeType VirtualRobot::RobotNode::getType ( )
bool VirtualRobot::RobotNode::hasSensor ( const std::string &  name) const
bool VirtualRobot::RobotNode::initialize ( SceneObjectPtr  parent = SceneObjectPtr(),
const std::vector< SceneObjectPtr > &  children = std::vector<SceneObjectPtr>() 

Initialize robot node. Here pointers to robot and children are created from names. Be sure all children are created and registered to robot before calling initialize. Usually RobotFactory manages the initialization.

Reimplemented from VirtualRobot::SceneObject.

Reimplemented in VirtualRobot::RobotNodeRevolute, VirtualRobot::RobotNodePrismatic, and VirtualRobot::RobotNodeFixed.

bool VirtualRobot::RobotNode::isLimitless ( )
bool VirtualRobot::RobotNode::isRotationalJoint ( ) const
bool VirtualRobot::RobotNode::isTranslationalJoint ( ) const
void VirtualRobot::RobotNode::print ( bool  printChildren = false,
bool  printDecoration = true 
) const
void VirtualRobot::RobotNode::propagateJointValue ( const std::string &  jointName,
float  factor = 1.0f 

Automatically propagate the joint value to another joint.

jointNameThe name of the other joint. must be part of the same robot.
factorThe propagated joint value is scaled according to this value.
bool VirtualRobot::RobotNode::registerSensor ( SensorPtr  sensor)
void VirtualRobot::RobotNode::respectJointLimits ( float &  jointValue) const

Checks if jointValue is within joint limits. If not jointValue is adjusted.

void VirtualRobot::RobotNode::setGlobalPose ( const Eigen::Matrix4f &  pose)

Calling this method will cause an exception, since RobotNodes are controlled via joint values.

Reimplemented from VirtualRobot::SceneObject.

void VirtualRobot::RobotNode::setJointLimits ( float  lo,
float  hi 

Set joint limits [rad].

void VirtualRobot::RobotNode::setJointValue ( float  q)

Set a joint value [rad]. The internal matrices and visualizations are updated accordingly. If you intend to update multiple joints, use setJointValueNoUpdate(float) for faster access.

void VirtualRobot::RobotNode::setJointValueNotInitialized ( float  q)
void VirtualRobot::RobotNode::setJointValueNoUpdate ( float  q)

Set the joint value without updating the internal matrices. After setting all jointvalues the transformations are calculated by calling applyJointValues() This method is used when multiple joints should be updated at once. Access by RobotNodeSets, Robots or RobotConfigs must be protected by a WriteLock.

qThe joint value [rad] eventually clamped to limits.
void VirtualRobot::RobotNode::setLimitless ( bool  limitless)
limitlesswheter this node has joint limits or not.
void VirtualRobot::RobotNode::setLocalTransformation ( Eigen::Matrix4f &  newLocalTransformation)

Set the local transformation matrix that is used in this node.

void VirtualRobot::RobotNode::setMaxAcceleration ( float  maxAcc)

Set maximum acceleration pf this joint in rad/s^2 or m/s^2. To disbale max. acceleration set to -1.0f.

void VirtualRobot::RobotNode::setMaxTorque ( float  maxTo)

Set maximum torque pf this joint in Nm. To disbale max. torque set to -1.0f.

void VirtualRobot::RobotNode::setMaxVelocity ( float  maxVel)

Set maximum velocity of this joint in rad/s or m/s. To disbale max. velocity set to -1.0f.

void VirtualRobot::RobotNode::showCoordinateSystem ( bool  enable,
float  scaling = 1.0f,
std::string *  text = NULL,
const std::string &  visualizationType = "" 

Display the coordinate system of this RobotNode. This is the global pose of it's visualization. enable Show or hide coordinate system scaling Size of coordinate system text Text to display at coordinate system. If not given, the name of this robot node will be displayed. visualizationType This option is only needed when the current robot node does not yet own a visualization. Then a visualziationNode has to be built and the visualizationType specifies which type of visualization should be used. If not given, the first registered visaulizationfactory is used.

Reimplemented from VirtualRobot::SceneObject.

void VirtualRobot::RobotNode::showStructure ( bool  enable,
const std::string &  visualizationType = "" 

Visualize the structure of this RobotNode. enable Show or hide the structure visualization visualizationType This option is only needed when the current robot node does not yet own a visualization. Then a visualziationNode has to be build and the visualizationType specifies which type of visualization should be used. If not given, the first registered visaulizationfactory is used.

std::string VirtualRobot::RobotNode::toXML ( const std::string &  basePath,
const std::string &  modelPathRelative = "models",
bool  storeSensors = true 

Creates an XML string that defines the robotnode. Filenames of all visualization models are set to modelPath/RobotNodeName_visu and/or modelPath/RobotNodeName_colmodel.

See also
void VirtualRobot::RobotNode::updatePose ( bool  updateChildren = true)

Compute/Update the transformations of this joint and all child joints. Therefore the parent is queried for its pose. This method is called by the robot in order to update the pose matrices.

Reimplemented from VirtualRobot::SceneObject.

void VirtualRobot::RobotNode::updatePose ( const Eigen::Matrix4f &  parentPose,
bool  updateChildren = true 

Update the pose according to parent

Reimplemented from VirtualRobot::SceneObject.

void VirtualRobot::RobotNode::updateTransformationMatrices ( )

Queries parent for global pose and updates visualization accordingly

void VirtualRobot::RobotNode::updateTransformationMatrices ( const Eigen::Matrix4f &  parentPose)
void VirtualRobot::RobotNode::updateVisualizationPose ( const Eigen::Matrix4f &  globalPose,
bool  updateChildren = false 

Can be called by a RobotNodeActuator in order to set the pose of the visualization, which means that the preJointTransform is ignored and the pose of the visualization can be set directly. This is useful, if the node is actuated externally, i.e. via a physics engine. todo: Protect such updates by a mutex.

globalPoseThe new global pose. The joint value is not determined from this pose. The RobotNodeActuator is responsible for setting the corresponding joint value
updateChildrenUsually it is assumed that all RobotNodes are updated this way (updateChildren=false). If not, the children poses can be updated according to this node.

Reimplemented in VirtualRobot::RobotNodeRevolute, and VirtualRobot::RobotNodePrismatic.

void VirtualRobot::RobotNode::updateVisualizationPose ( const Eigen::Matrix4f &  globalPose,
float  jointValue,
bool  updateChildren = false 

Friends And Related Function Documentation

friend class ColladaIO
friend class LocalRobot
friend class Robot
friend class RobotConfig
friend class RobotFactory
friend class RobotIO
friend class RobotNodeActuator
friend class RobotNodeSet

Field Documentation

float VirtualRobot::RobotNode::jointLimitHi
float VirtualRobot::RobotNode::jointLimitLo
float VirtualRobot::RobotNode::jointValue
float VirtualRobot::RobotNode::jointValueOffset
bool VirtualRobot::RobotNode::limitless
Eigen::Matrix4f VirtualRobot::RobotNode::localTransformation

given in Nm

float VirtualRobot::RobotNode::maxAcceleration

given in m/s

float VirtualRobot::RobotNode::maxTorque

given in m/s^2

float VirtualRobot::RobotNode::maxVelocity
RobotNodeType VirtualRobot::RobotNode::nodeType
DHParameter VirtualRobot::RobotNode::optionalDHParameter
std::map< std::string, float > VirtualRobot::RobotNode::propagatedJointValues
RobotWeakPtr VirtualRobot::RobotNode::robot
std::vector<SensorPtr> VirtualRobot::RobotNode::sensors