Simox  2.3.74.0
VirtualRobot::LocalRobot Class Reference
Inheritance diagram for VirtualRobot::LocalRobot:
VirtualRobot::Robot VirtualRobot::SceneObject

Public Member Functions

 LocalRobot (const std::string &name, const std::string &type="")
 
 ~LocalRobot () override
 
void setRootNode (RobotNodePtr node) override
 
RobotNodePtr getRootNode () const override
 
void registerRobotNode (RobotNodePtr node) override
 
void deregisterRobotNode (RobotNodePtr node) override
 
bool hasRobotNode (const std::string &robotNodeName) const override
 
bool hasRobotNode (RobotNodePtr node) const override
 
RobotNodePtr getRobotNode (const std::string &robotNodeName) const override
 
void getRobotNodes (std::vector< RobotNodePtr > &storeNodes, bool clearVector=true) const override
 
void registerRobotNodeSet (RobotNodeSetPtr nodeSet) override
 
void deregisterRobotNodeSet (RobotNodeSetPtr nodeSet) override
 
bool hasRobotNodeSet (const std::string &name) const override
 
RobotNodeSetPtr getRobotNodeSet (const std::string &nodeSetName) const override
 
void getRobotNodeSets (std::vector< RobotNodeSetPtr > &storeNodeSet) const override
 
void registerEndEffector (EndEffectorPtr endEffector) override
 
bool hasEndEffector (const std::string &endEffectorName) const override
 
EndEffectorPtr getEndEffector (const std::string &endEffectorName) const override
 
void getEndEffectors (std::vector< EndEffectorPtr > &storeEEF) const override
 
void setGlobalPose (const Eigen::Matrix4f &globalPose, bool applyJointValues=true) override
 Set the global pose of this robot. More...
 
void setGlobalPose (const Eigen::Matrix4f &globalPose) override
 
Eigen::Matrix4f getGlobalPose () const override
 
- Public Member Functions inherited from VirtualRobot::Robot
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Robot (const std::string &name, const std::string &type="")
 
 ~Robot () override
 
virtual void applyJointValues ()
 
virtual void setThreadsafe (bool)
 
template<typename T >
std::shared_ptr< T > getVisualization (SceneObject::VisualizationType visuType=SceneObject::Full, bool sensors=true)
 
void showStructure (bool enable, const std::string &type="")
 
void showCoordinateSystems (bool enable, const std::string &type="")
 
void showPhysicsInformation (bool enableCoM, bool enableInertial, VisualizationNodePtr comModel=VisualizationNodePtr()) override
 
void setupVisualization (bool showVisualization, bool showAttachedVisualizations) override
 
virtual std::string getName () const
 
virtual std::string getType () const
 
void setType (const std::string &type)
 
void setName (const std::string &name)
 
void print (bool printChildren=false, bool printDecoration=true) const override
 
void setUpdateVisualization (bool enable) override
 
void setUpdateCollisionModel (bool enable) override
 
std::shared_ptr< Robotshared_from_this () const
 
virtual RobotConfigPtr getConfig () const
 
virtual bool setConfig (RobotConfigPtr c)
 
virtual std::vector< RobotNodePtrgetRobotNodes () const
 
virtual std::vector< std::string > getRobotNodeNames () const
 
virtual bool hasRobotNodeSet (RobotNodeSetPtr nodeSet) const
 
virtual std::vector< RobotNodeSetPtrgetRobotNodeSets () const
 
virtual std::vector< std::string > getRobotNodeSetNames () const
 
const NodeMappinggetNodeMapping () const
 
virtual bool hasEndEffector (EndEffectorPtr endEffector) const
 
virtual std::vector< EndEffectorPtrgetEndEffectors () const
 
virtual std::vector< CollisionModelPtrgetCollisionModels () const
 
CollisionCheckerPtr getCollisionChecker () override
 
virtual void highlight (VisualizationPtr visualization, bool enable)
 
int getNumFaces (bool collisionModel=false) override
 
virtual Eigen::Matrix4f getGlobalPoseForRobotNode (const RobotNodePtr &node, const Eigen::Matrix4f &globalPoseNode) const
 Get the global pose of this robot so that the RobotNode node is at pose globalPoseNode. More...
 
virtual void setGlobalPoseForRobotNode (const RobotNodePtr &node, const Eigen::Matrix4f &globalPoseNode)
 Set the global pose of this robot so that the RobotNode node is at pose globalPoseNode. More...
 
virtual Eigen::Matrix4f getGlobalPositionForRobotNode (const RobotNodePtr &node, const Eigen::Vector3f &globalPositionNode) const
 Get the global position of this robot so that the RobotNode node is at position globalPoseNode. More...
 
virtual void setGlobalPositionForRobotNode (const RobotNodePtr &node, const Eigen::Vector3f &globalPositionNode)
 Set the global position of this robot so that the RobotNode node is at position globalPoseNode. More...
 
Eigen::Vector3f getCoMLocal () override
 Return center of mass of this robot in local coordinate frame. All RobotNodes of this robot are considered according to their mass. More...
 
Eigen::Vector3f getCoMGlobal () override
 Return Center of Mass of this robot in global coordinates. All RobotNodes of this robot are considered according to their mass. More...
 
virtual float getMass () const
 Return accumulated mass of this robot. More...
 
virtual RobotPtr extractSubPart (RobotNodePtr startJoint, const std::string &newRobotType, const std::string &newRobotName, bool cloneRNS=true, bool cloneEEFs=true, CollisionCheckerPtr collisionChecker=CollisionCheckerPtr(), float scaling=1.0f, bool preventCloningMeshesIfScalingIs1=false)
 
virtual RobotPtr clone (const std::string &name, CollisionCheckerPtr collisionChecker=CollisionCheckerPtr(), float scaling=1.0f, bool preventCloningMeshesIfScalingIs1=false)
 
virtual RobotPtr clone (CollisionCheckerPtr collisionChecker=CollisionCheckerPtr(), float scaling=1.0f, bool preventCloningMeshesIfScalingIs1=false)
 
virtual RobotPtr cloneScaling ()
 Clones this robot and keeps the current scaling for the robot and each robot node. More...
 
virtual void setFilename (const std::string &filename)
 Just storing the filename. More...
 
virtual std::string getFilename () const
 Retrieve the stored filename. More...
 
virtual ReadLockPtr getReadLock ()
 
virtual WriteLockPtr getWriteLock ()
 
virtual void setJointValue (RobotNodePtr rn, float jointValue)
 
virtual void setJointValue (const std::string &nodeName, float jointValue)
 
virtual void setJointValues (const std::map< std::string, float > &jointValues)
 
virtual std::map< std::string, float > getJointValues () const
 
virtual void setJointValues (const std::map< RobotNodePtr, float > &jointValues)
 
virtual void setJointValues (RobotNodeSetPtr rns, const std::vector< float > &jointValues)
 
virtual void setJointValues (const std::vector< RobotNodePtr > rn, const std::vector< float > &jointValues)
 
virtual void setJointValues (RobotNodeSetPtr rns, const Eigen::VectorXf &jointValues)
 
virtual void setJointValues (RobotConfigPtr config)
 
virtual void setJointValues (RobotNodeSetPtr rns, RobotConfigPtr config)
 
virtual void setJointValues (TrajectoryPtr trajectory, float t)
 
virtual BoundingBox getBoundingBox (bool collisionModel=true) const
 
virtual SensorPtr getSensor (const std::string &name) const
 
template<class SensorType >
std::shared_ptr< SensorType > getSensor (const std::string &name) const
 
virtual std::vector< SensorPtrgetSensors () const
 
template<class SensorType >
std::vector< std::shared_ptr< SensorType > > getSensors () const
 
virtual std::string toXML (const std::string &basePath=".", const std::string &modelPath="models", bool storeEEF=true, bool storeRNS=true, bool storeSensors=true, bool storeModelFiles=true) const
 
float getScaling () const
 
void setScaling (float scaling)
 
void inflateCollisionModel (float inflationInMM)
 Inflates the collision models of all robot nodes of this robot. Useful for motion planning with a safety margin. More...
 
bool getPropagatingJointValuesEnabled () const
 
void setPropagatingJointValuesEnabled (bool enabled)
 
void setPassive ()
 
bool isPassive () const
 
void registerNodeMapping (const NodeMapping &nodeMapping)
 
- 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 Eigen::Vector3f getGlobalPosition () const
 
virtual Eigen::Matrix3f getGlobalOrientation () const
 
virtual Eigen::Matrix4f getGlobalPose (const Eigen::Matrix4f &localPose) const
 
virtual Eigen::Vector3f getGlobalPosition (const Eigen::Vector3f &localPosition) const
 
virtual Eigen::Vector3f getGlobalDirection (const Eigen::Vector3f &localDircetion) const
 
virtual Eigen::Matrix3f getGlobalOrientation (const Eigen::Matrix3f &localOrientation) const
 
virtual void setGlobalPoseNoChecks (const Eigen::Matrix4f &pose)
 
virtual CollisionModelPtr getCollisionModel ()
 
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 >())
 
bool getUpdateVisualizationStatus ()
 
bool getUpdateCollisionModelStatus ()
 
virtual void showCoordinateSystem (bool enable, float scaling=1.0f, std::string *text=NULL, const std::string &visualizationType="")
 
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) const
 
Eigen::Matrix4f getTransformationFrom (const SceneObjectPtr otherObject) const
 
Eigen::Matrix4f transformTo (const SceneObjectPtr otherObject, const Eigen::Matrix4f &poseInOtherCoordSystem)
 
Eigen::Vector3f transformTo (const SceneObjectPtr otherObject, const Eigen::Vector3f &positionInOtherCoordSystem)
 
void setCoMLocal (const Eigen::Vector3f &comLocal)
 Set a new position for the CoM of this bode. More...
 
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 (https://en.wikipedia.org/wiki/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 >
std::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
 
SceneObjectPtr clone (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 () const
 
virtual SceneObjectPtr getParent () const
 
virtual std::vector< SceneObjectPtrgetChildren () const
 
virtual void updatePose (bool updateChildren=true)
 Compute the global pose of this object. More...
 
virtual void copyPoseFrom (const SceneObjectPtr &other)
 
virtual bool saveModelFiles (const std::string &modelPath, bool replaceFilenames)
 
void setScaling (float scaling)
 
float getScaling ()
 
bool reloadVisualizationFromXML (bool useVisAsColModelIfMissing=true)
 
const std::string & getVisualizationModelXML () const
 

Protected Member Functions

void applyJointValuesNoLock () override
 
- Protected Member Functions inherited from VirtualRobot::Robot
 Robot ()
 
void validateNodeMapping (const NodeMapping &nodeMapping) const
 
void createVisualizationFromCollisionModels ()
 
- Protected Member Functions inherited from VirtualRobot::SceneObject
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, const std::string &modelPathRelative="")
 basic data, used by Obstacle and ManipulationObject More...
 
virtual bool initializePhysics ()
 

Protected Attributes

RobotNodePtr rootNode
 
std::map< std::string, RobotNodePtrrobotNodeMap
 
std::map< std::string, RobotNodeSetPtrrobotNodeSetMap
 
std::map< std::string, EndEffectorPtrendEffectorMap
 
- Protected Attributes inherited from VirtualRobot::Robot
std::string filename
 
std::string type
 
bool updateVisualization
 
std::recursive_mutex mutex
 
bool use_mutex
 
bool propagatingJointValuesEnabled = true
 
bool passive {false}
 
- Protected Attributes inherited from VirtualRobot::SceneObject
std::string name
 
bool initialized
 
Eigen::Matrix4f globalPose
 
std::vector< SceneObjectPtrchildren
 
SceneObjectWeakPtr parent
 
CollisionModelPtr collisionModel
 
std::string collisionModelXML
 
VisualizationNodePtr visualizationModel
 
std::string visualizationModelXML
 
std::filesystem::path basePath
 
bool updateVisualization
 
bool updateCollisionModel
 
Physics physics
 
CollisionCheckerPtr collisionChecker
 
float scaling = 1.0f
 

Additional Inherited Members

- Public Types inherited from VirtualRobot::SceneObject
enum  VisualizationType { Full, Collision, CollisionData }
 
- Static Public Member Functions inherited from VirtualRobot::SceneObject
static Eigen::Matrix3f shiftInertia (const Eigen::Matrix3f inertiaMatrix, const Eigen::Vector3f &shift, float mass)
 The shift is done using the parallel axis theorem (https://en.wikipedia.org/wiki/Parallel_axis_theorem) More...
 
- Static Public Attributes inherited from VirtualRobot::Robot
static const RobotPtr NullPtr {nullptr}
 

Constructor & Destructor Documentation

◆ LocalRobot()

VirtualRobot::LocalRobot::LocalRobot ( const std::string &  name,
const std::string &  type = "" 
)

◆ ~LocalRobot()

VirtualRobot::LocalRobot::~LocalRobot ( )
override

Member Function Documentation

◆ applyJointValuesNoLock()

void VirtualRobot::LocalRobot::applyJointValuesNoLock ( )
overrideprotectedvirtual

Can be called internally, when lock is already set.

Reimplemented from VirtualRobot::Robot.

◆ deregisterRobotNode()

void VirtualRobot::LocalRobot::deregisterRobotNode ( RobotNodePtr  node)
overridevirtual

Implements VirtualRobot::Robot.

◆ deregisterRobotNodeSet()

void VirtualRobot::LocalRobot::deregisterRobotNodeSet ( RobotNodeSetPtr  nodeSet)
overridevirtual

Implements VirtualRobot::Robot.

◆ getEndEffector()

EndEffectorPtr VirtualRobot::LocalRobot::getEndEffector ( const std::string &  endEffectorName) const
overridevirtual
Returns
reference to endeffector with name endEffectorName or Null-Pointer otherwise

Implements VirtualRobot::Robot.

◆ getEndEffectors()

void VirtualRobot::LocalRobot::getEndEffectors ( std::vector< EndEffectorPtr > &  storeEEF) const
overridevirtual

This method stores all endeffectors belonging to the robot in storeEEF. If there are no registered endeffectors storeEEF will be empty.

Implements VirtualRobot::Robot.

◆ getGlobalPose()

Eigen::Matrix4f VirtualRobot::LocalRobot::getGlobalPose ( ) const
overridevirtual

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.

◆ getRobotNode()

RobotNodePtr VirtualRobot::LocalRobot::getRobotNode ( const std::string &  robotNodeName) const
overridevirtual

Implements VirtualRobot::Robot.

◆ getRobotNodes()

void VirtualRobot::LocalRobot::getRobotNodes ( std::vector< RobotNodePtr > &  storeNodes,
bool  clearVector = true 
) const
overridevirtual

This method stores all nodes belonging to the robot in storeNodes. If there are no registered nodes storeNodes will be empty.

Implements VirtualRobot::Robot.

◆ getRobotNodeSet()

RobotNodeSetPtr VirtualRobot::LocalRobot::getRobotNodeSet ( const std::string &  nodeSetName) const
overridevirtual

Implements VirtualRobot::Robot.

◆ getRobotNodeSets()

void VirtualRobot::LocalRobot::getRobotNodeSets ( std::vector< RobotNodeSetPtr > &  storeNodeSets) const
overridevirtual

This method stores all endeffectors belonging to the robot in storeEEF. If there are no registered endeffectors storeEEF will be empty.

Implements VirtualRobot::Robot.

◆ getRootNode()

RobotNodePtr VirtualRobot::LocalRobot::getRootNode ( ) const
overridevirtual

This method returns a reference to Robot::rootNode;

Implements VirtualRobot::Robot.

◆ hasEndEffector()

bool VirtualRobot::LocalRobot::hasEndEffector ( const std::string &  endEffectorName) const
overridevirtual
Returns
true if instance of VirtualRobot::Robot contains an endeffector with name endEffectorName and false otherwise

Implements VirtualRobot::Robot.

◆ hasRobotNode() [1/2]

bool VirtualRobot::LocalRobot::hasRobotNode ( const std::string &  robotNodeName) const
overridevirtual

Implements VirtualRobot::Robot.

◆ hasRobotNode() [2/2]

bool VirtualRobot::LocalRobot::hasRobotNode ( RobotNodePtr  node) const
overridevirtual

Implements VirtualRobot::Robot.

◆ hasRobotNodeSet()

bool VirtualRobot::LocalRobot::hasRobotNodeSet ( const std::string &  name) const
overridevirtual

Implements VirtualRobot::Robot.

◆ registerEndEffector()

void VirtualRobot::LocalRobot::registerEndEffector ( EndEffectorPtr  endEffector)
overridevirtual

This method registers endEffector with the current VirtualRobot::Robot instance. It throws an exception if a VirtualRobot::EndEffector with the same name has already been registered.

Implements VirtualRobot::Robot.

◆ registerRobotNode()

void VirtualRobot::LocalRobot::registerRobotNode ( RobotNodePtr  node)
overridevirtual

This method is automatically called in RobotNode's initialization routine.

Implements VirtualRobot::Robot.

◆ registerRobotNodeSet()

void VirtualRobot::LocalRobot::registerRobotNodeSet ( RobotNodeSetPtr  nodeSet)
overridevirtual

This method is automatically called in RobotNodeSet's initialization routine.

Implements VirtualRobot::Robot.

◆ setGlobalPose() [1/2]

void VirtualRobot::LocalRobot::setGlobalPose ( const Eigen::Matrix4f &  globalPose,
bool  applyValues = true 
)
overridevirtual

Set the global pose of this robot.

Implements VirtualRobot::Robot.

◆ setGlobalPose() [2/2]

void VirtualRobot::LocalRobot::setGlobalPose ( const Eigen::Matrix4f &  pose)
overridevirtual

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

Parameters
poseThe new pose of this object

Reimplemented from VirtualRobot::Robot.

◆ setRootNode()

void VirtualRobot::LocalRobot::setRootNode ( RobotNodePtr  node)
overridevirtual

The root node is the first RobotNode of this robot.

Implements VirtualRobot::Robot.

Field Documentation

◆ endEffectorMap

std::map< std::string, EndEffectorPtr > VirtualRobot::LocalRobot::endEffectorMap
protected

◆ robotNodeMap

std::map< std::string, RobotNodePtr > VirtualRobot::LocalRobot::robotNodeMap
protected

◆ robotNodeSetMap

std::map< std::string, RobotNodeSetPtr > VirtualRobot::LocalRobot::robotNodeSetMap
protected

◆ rootNode

RobotNodePtr VirtualRobot::LocalRobot::rootNode
protected