Simox  2.3.62
VirtualRobot::SceneObject Class Reference
Inheritance diagram for VirtualRobot::SceneObject:
VirtualRobot::Obstacle VirtualRobot::Robot VirtualRobot::RobotNode VirtualRobot::Sensor VirtualRobot::ManipulationObject VirtualRobot::LocalRobot VirtualRobot::RobotNodeFixed VirtualRobot::RobotNodePrismatic VirtualRobot::RobotNodeRevolute VirtualRobot::CameraSensor VirtualRobot::ContactSensor VirtualRobot::ForceTorqueSensor VirtualRobot::PositionSensor

Data Structures

struct  Physics

Public Types

enum  VisualizationType { Full, Collision, CollisionData }

Public Member Functions

 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 Eigen::Matrix4f getGlobalPose () const
virtual void setGlobalPoseNoChecks (const Eigen::Matrix4f &pose)
virtual void setGlobalPose (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 bool initialize (SceneObjectPtr parent=SceneObjectPtr(), const std::vector< SceneObjectPtr > &children=std::vector< SceneObjectPtr >())
virtual void setUpdateVisualization (bool enable)
bool getUpdateVisualizationStatus ()
virtual void setUpdateCollisionModel (bool enable)
bool getUpdateCollisionModelStatus ()
virtual void setupVisualization (bool showVisualization, bool showAttachedVisualizations)
virtual void showCoordinateSystem (bool enable, float scaling=1.0f, std::string *text=NULL, const std::string &visualizationType="")
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 ()
virtual void print (bool printChildren=false, bool printDecoration=true) const
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 void updatePose (bool updateChildren=true)
 Compute the global pose of this object. More...
virtual bool saveModelFiles (const std::string &modelPath, bool replaceFilenames)

Protected Member Functions

virtual SceneObject_clone (const std::string &name, CollisionCheckerPtr colChecker=CollisionCheckerPtr(), float scaling=1.0f) const
virtual void detachedFromParent ()
 Parent detached this object. More...
virtual void attached (SceneObjectPtr parent)
 Parent attached this object. More...
virtual void updatePose (const Eigen::Matrix4f &parentPose, bool updateChildren=true)
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

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 RobotFactory

Member Enumeration Documentation


the full model


the collision model


a visualization of the collision model data that is internally used (this mode is only for debug purposes, the model is static, i.e. updates/movements/rotations are not visualized!)

Constructor & Destructor Documentation

VirtualRobot::SceneObject::SceneObject ( const std::string &  name,
VisualizationNodePtr  visualization = VisualizationNodePtr(),
CollisionModelPtr  collisionModel = CollisionModelPtr(),
const Physics p = Physics(),
CollisionCheckerPtr  colChecker = CollisionCheckerPtr() 
VirtualRobot::SceneObject::~SceneObject ( )
VirtualRobot::SceneObject::SceneObject ( )

Member Function Documentation

SceneObject * VirtualRobot::SceneObject::_clone ( const std::string &  name,
CollisionCheckerPtr  colChecker = CollisionCheckerPtr(),
float  scaling = 1.0f 
) const
bool VirtualRobot::SceneObject::attachChild ( SceneObjectPtr  child)

Attach a connected object. The connected object is linked to this SceneObject and moves accordingly. Any call to the child's setGlobalPose is forbidden and will fail.

childThe child to attach
void VirtualRobot::SceneObject::attached ( SceneObjectPtr  parent)

Parent attached this object.

SceneObjectPtr VirtualRobot::SceneObject::clone ( const std::string &  name,
CollisionCheckerPtr  colChecker = CollisionCheckerPtr(),
float  scaling = 1.0f 
) const

Clones this object. If no col checker is given, the one of the original object is used.

void VirtualRobot::SceneObject::detachChild ( SceneObjectPtr  child)

Removes the child from children list.

void VirtualRobot::SceneObject::detachedFromParent ( )

Parent detached this object.

bool VirtualRobot::SceneObject::ensureVisualization ( const std::string &  visualizationType = "")

Builds a dummy visualization if necessary.

visualizationTypeIf given the visualization is forced to be this type. If not set, the first registered visualization from VisualizationFactory is used.
std::vector< SceneObjectPtr > VirtualRobot::SceneObject::getChildren ( ) const
VirtualRobot::CollisionCheckerPtr VirtualRobot::SceneObject::getCollisionChecker ( )

Reimplemented in VirtualRobot::Robot.

VirtualRobot::CollisionModelPtr VirtualRobot::SceneObject::getCollisionModel ( )
Eigen::Vector3f VirtualRobot::SceneObject::getCoMGlobal ( )

Return Center of Mass in global coordinates. This method does not consider children.

Reimplemented in VirtualRobot::Robot.

Eigen::Vector3f VirtualRobot::SceneObject::getCoMLocal ( )

Return Center of Mass in local coordinate frame. This method does not consider children.

Reimplemented in VirtualRobot::Robot.

std::string VirtualRobot::SceneObject::getFilenameReplacementColModel ( const std::string  standardExtension = ".wrl")
std::string VirtualRobot::SceneObject::getFilenameReplacementVisuModel ( const std::string  standardExtension = ".wrl")
float VirtualRobot::SceneObject::getFriction ( )
Eigen::Matrix4f VirtualRobot::SceneObject::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 in VirtualRobot::LocalRobot, and VirtualRobot::RobotNode.

std::vector< std::string > VirtualRobot::SceneObject::getIgnoredCollisionModels ( )

Collisions with these models are ignored by physics engine (only considered within the SimDynamics package!).

Eigen::Matrix3f VirtualRobot::SceneObject::getInertiaMatrix ( )
Eigen::Matrix3f VirtualRobot::SceneObject::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 (

shiftHow the system should be shifted.
The Inertia Matrix at the shifted system
Eigen::Matrix3f VirtualRobot::SceneObject::getInertiaMatrix ( const Eigen::Vector3f &  shift,
const Eigen::Matrix3f &  rotation 
Eigen::Matrix3f VirtualRobot::SceneObject::getInertiaMatrix ( const Eigen::Matrix4f &  transform)
float VirtualRobot::SceneObject::getMass ( ) const

Mass in Kg

std::string VirtualRobot::SceneObject::getName ( ) const
int VirtualRobot::SceneObject::getNumFaces ( bool  collisionModel = false)

get number of faces (i.e. triangles) of this object collisionModel Indicates weather the faces of the collision model or the full model should be returned.

Reimplemented in VirtualRobot::Robot.

VirtualRobot::SceneObjectPtr VirtualRobot::SceneObject::getParent ( ) const
If this object is attached, the parent is returned. Otherwise an empty object is returned.
SceneObject::Physics VirtualRobot::SceneObject::getPhysics ( )
std::string VirtualRobot::SceneObject::getSceneObjectXMLString ( const std::string &  basePath,
int  tabs 

basic data, used by Obstacle and ManipulationObject

SceneObject::Physics::SimulationType VirtualRobot::SceneObject::getSimulationType ( ) const

The simulation type is of interest in SimDynamics.

Eigen::Matrix4f VirtualRobot::SceneObject::getTransformationFrom ( const SceneObjectPtr  otherObject)

Returns the transformation matrix from otherObject to this object

Eigen::Matrix4f VirtualRobot::SceneObject::getTransformationTo ( const SceneObjectPtr  otherObject)

Returns the transformation matrix from this object to otherObject

bool VirtualRobot::SceneObject::getUpdateCollisionModelStatus ( )
bool VirtualRobot::SceneObject::getUpdateVisualizationStatus ( )
VirtualRobot::VisualizationNodePtr VirtualRobot::SceneObject::getVisualization ( SceneObject::VisualizationType  visuType = SceneObject::Full)

Return visualization object.

visuTypeSet the type of visualization.
template<typename T >
boost::shared_ptr< T > VirtualRobot::SceneObject::getVisualization ( SceneObject::VisualizationType  visuType = SceneObject::Full)

Retrieve a visualization in the given format. Example usage: boost::shared_ptr<VirtualRobot::CoinVisualization> visualization = robot->getVisualization<CoinVisualization>(); SoNode* visualisationNode = NULL; if (visualization) visualisationNode = visualization->getCoinVisualization();

See also
CoinVisualizationFactory::getCoinVisualization() for convenient access!

This method creates a new Visualization subclass which is given by the template parameter T. T must be a subclass of VirtualRobot::Visualization. A compile time error is thrown if a different class type is used as template argument.

bool VirtualRobot::SceneObject::hasChild ( SceneObjectPtr  child,
bool  recursive = false 
) const
true, if child is attached
bool VirtualRobot::SceneObject::hasChild ( const std::string &  childName,
bool  recursive = false 
) const
true, if child is attached
bool VirtualRobot::SceneObject::hasParent ( )
true, if this object is attached to another object.
VisualizationNode VirtualRobot::SceneObject::highlight ( VisualizationPtr  visualization,
bool  enable 

Convenient method for highlighting the visualization of this object. It is automatically checked whether the collision model or the full model is part of the visualization.

See also
visualizationThe visualization for which the highlighting should be performed.
enableSet or unset highlighting.
bool VirtualRobot::SceneObject::initialize ( SceneObjectPtr  parent = SceneObjectPtr(),
const std::vector< SceneObjectPtr > &  children = std::vector<SceneObjectPtr>() 

Initialize this object. Optionally the parents and children can be specified.

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

bool VirtualRobot::SceneObject::initializePhysics ( )
bool VirtualRobot::SceneObject::saveModelFiles ( const std::string &  modelPath,
bool  replaceFilenames 

Saves model files (visu and col model, if present) to model path.

modelPathThe path where the model files should be stored.
replsceFilenamesIf set, the filenames will be replaced with 'name_visu' and 'name_col'. Otherwise the original filename is used without any preceding paths.
void VirtualRobot::SceneObject::setCollisionModel ( CollisionModelPtr  colModel)
void VirtualRobot::SceneObject::setFriction ( float  friction)
void VirtualRobot::SceneObject::setGlobalPose ( const Eigen::Matrix4f &  pose)

Update the pose of this object. The visualization and collision models are updated accordingly.

poseThe new pose of this object

Reimplemented in VirtualRobot::LocalRobot, VirtualRobot::Robot, VirtualRobot::RobotNode, and VirtualRobot::Sensor.

void VirtualRobot::SceneObject::setGlobalPoseNoChecks ( const Eigen::Matrix4f &  pose)

Usually it is checked weather the object is linked to a parent. This check can be omitted (be careful, just do this if you know the effects)

poseThe new pose of this object
void VirtualRobot::SceneObject::setInertiaMatrix ( const Eigen::Matrix3f &  im)
void VirtualRobot::SceneObject::setMass ( float  m)
void VirtualRobot::SceneObject::setName ( const std::string &  name)

Rename this object

void VirtualRobot::SceneObject::setSimulationType ( Physics::SimulationType  s)
void VirtualRobot::SceneObject::setUpdateCollisionModel ( bool  enable)

Reimplemented in VirtualRobot::Robot.

void VirtualRobot::SceneObject::setUpdateVisualization ( bool  enable)

Enables/Disables the visualization updates of collision model and visualization model.

Reimplemented in VirtualRobot::Robot.

void VirtualRobot::SceneObject::setupVisualization ( bool  showVisualization,
bool  showAttachedVisualizations 

Setup the visualization of this object.

showVisualizationIf false, the visualization is disabled.
showAttachedVisualizationsIf false, the visualization of any attached optional visualizations is disabled.

Reimplemented in VirtualRobot::Robot.

void VirtualRobot::SceneObject::setVisualization ( VisualizationNodePtr  visualization)

Sets the main visualization of this object.

void VirtualRobot::SceneObject::showBoundingBox ( bool  enable,
bool  wireframe = false 

Display the bounding box of this object's collisionModel. The bbox is not updated when you move the object, so you have to call this method again after touching the scene in order to ensure a correct visualization. If the object does not own a visualization yet, the VisualizationFactory is queried to get the first registered VisualizationType in order to build a valid visualization. enable Show or hide bounding box wireframe Wireframe or solid visualization.

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

Display the coordinate system of this object. If the object does not own a visualization yet, the VisualizationFactory is queried to get the first registered VisualizationType in order to build a valid 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.

Reimplemented in VirtualRobot::RobotNode.

bool VirtualRobot::SceneObject::showCoordinateSystemState ( )

Returns true when the coordinate system is currently shown.

void VirtualRobot::SceneObject::showPhysicsInformation ( bool  enableCoM,
bool  enableInertial,
VisualizationNodePtr  comModel = VisualizationNodePtr() 

Display some physics debugging information. enableCoM If true, the center of mass is shown (if given). If a comModel is given it is used for visualization, otherwise a standrad marker is shown. enableInertial If true, a visualization of the inertial matrix is shown (if given). comModel If set, this visualization is used to display the CoM location. If not set, a standard marker is used.

Reimplemented in VirtualRobot::Robot.

Eigen::Matrix4f VirtualRobot::SceneObject::toGlobalCoordinateSystem ( const Eigen::Matrix4f &  poseLocal) const

Transforms the pose, given in local coordinate system, to the global coordinate system.

poseLocalThe pose, given in local coordinate system of this joint, that should be transformed to the global coordinate system.
The transformed pose.
Eigen::Vector3f VirtualRobot::SceneObject::toGlobalCoordinateSystemVec ( const Eigen::Vector3f &  positionLocal) const
Eigen::Matrix4f VirtualRobot::SceneObject::toLocalCoordinateSystem ( const Eigen::Matrix4f &  poseGlobal) const

Transforms the pose, given in global coordinate system, to the local coordinate system of this object.

poseGlobalThe pose, given in global coordinate system, that should be transformed to the local coordinate system of this joint.
The transformed pose.
Eigen::Vector3f VirtualRobot::SceneObject::toLocalCoordinateSystemVec ( const Eigen::Vector3f &  positionGlobal) const
Eigen::Matrix4f VirtualRobot::SceneObject::transformTo ( const SceneObjectPtr  otherObject,
const Eigen::Matrix4f &  poseInOtherCoordSystem 

Transform pose to local coordinate system of this object

Eigen::Vector3f VirtualRobot::SceneObject::transformTo ( const SceneObjectPtr  otherObject,
const Eigen::Vector3f &  positionInOtherCoordSystem 

Transform position to local coordinate system of this object

void VirtualRobot::SceneObject::updatePose ( bool  updateChildren = true)

Compute the global pose of this object.

Reimplemented in VirtualRobot::RobotNode, and VirtualRobot::Sensor.

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

Friends And Related Function Documentation

friend class RobotFactory

Field Documentation

std::vector<SceneObjectPtr> VirtualRobot::SceneObject::children
CollisionCheckerPtr VirtualRobot::SceneObject::collisionChecker
CollisionModelPtr VirtualRobot::SceneObject::collisionModel
Eigen::Matrix4f VirtualRobot::SceneObject::globalPose
bool VirtualRobot::SceneObject::initialized
std::string VirtualRobot::SceneObject::name
SceneObjectWeakPtr VirtualRobot::SceneObject::parent
Physics VirtualRobot::SceneObject::physics
bool VirtualRobot::SceneObject::updateCollisionModel
bool VirtualRobot::SceneObject::updateVisualization
VisualizationNodePtr VirtualRobot::SceneObject::visualizationModel