Simox
2.3.74.0
|
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 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 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) 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) |
virtual int | getNumFaces (bool collisionModel=false) |
virtual Eigen::Vector3f | getCoMLocal () |
void | setCoMLocal (const Eigen::Vector3f &comLocal) |
Set a new position for the CoM of this bode. More... | |
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 (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 () |
virtual void | print (bool printChildren=false, bool printDecoration=true) const |
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< SceneObjectPtr > | getChildren () 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 |
Static Public Member Functions | |
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... | |
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, const std::string &modelPathRelative="") |
basic data, used by Obstacle and ManipulationObject More... | |
virtual bool | initializePhysics () |
Protected Attributes | |
std::string | name |
bool | initialized |
Eigen::Matrix4f | globalPose |
std::vector< SceneObjectPtr > | children |
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 |
Friends | |
class | RobotFactory |
VirtualRobot::SceneObject::SceneObject | ( | const std::string & | name, |
VisualizationNodePtr | visualization = VisualizationNodePtr() , |
||
CollisionModelPtr | collisionModel = CollisionModelPtr() , |
||
const Physics & | p = Physics() , |
||
CollisionCheckerPtr | colChecker = CollisionCheckerPtr() |
||
) |
|
virtual |
|
inlineprotected |
|
protectedvirtual |
Reimplemented in VirtualRobot::RobotNode, and VirtualRobot::Sensor.
|
virtual |
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.
child | The child to attach |
|
protectedvirtual |
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.
SceneObjectPtr VirtualRobot::SceneObject::clone | ( | CollisionCheckerPtr | colChecker = CollisionCheckerPtr() , |
float | scaling = 1.0f |
||
) | const |
|
virtual |
Reimplemented in VirtualRobot::RobotNode.
|
virtual |
Removes the child from children list.
|
protectedvirtual |
Parent detached this object.
|
virtual |
Builds a dummy visualization if necessary.
visualizationType | If given the visualization is forced to be this type. If not set, the first registered visualization from VisualizationFactory is used. |
|
virtual |
|
virtual |
Reimplemented in VirtualRobot::Robot.
|
virtual |
|
virtual |
Return Center of Mass in global coordinates. This method does not consider children.
Reimplemented in VirtualRobot::Robot.
|
virtual |
Return Center of Mass in local coordinate frame. This method does not consider children.
Reimplemented in VirtualRobot::Robot.
|
protected |
|
protected |
float VirtualRobot::SceneObject::getFriction | ( | ) |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
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.
|
virtual |
|
virtual |
|
virtual |
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 (https://en.wikipedia.org/wiki/Parallel_axis_theorem)
shift | How the system should be shifted. |
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 |
|
virtual |
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.
|
virtual |
SceneObject::Physics VirtualRobot::SceneObject::getPhysics | ( | ) |
float VirtualRobot::SceneObject::getScaling | ( | ) |
|
protected |
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 | ) | const |
Returns the transformation matrix from otherObject to this object
Eigen::Matrix4f VirtualRobot::SceneObject::getTransformationTo | ( | const SceneObjectPtr | otherObject | ) | const |
Returns the transformation matrix from this object to otherObject
bool VirtualRobot::SceneObject::getUpdateCollisionModelStatus | ( | ) |
bool VirtualRobot::SceneObject::getUpdateVisualizationStatus | ( | ) |
|
virtual |
Return visualization object.
visuType | Set the type of visualization. |
std::shared_ptr< T > VirtualRobot::SceneObject::getVisualization | ( | SceneObject::VisualizationType | visuType = SceneObject::Full | ) |
Retrieve a visualization in the given format. Example usage: std::shared_ptr<VirtualRobot::CoinVisualization> visualization = robot->getVisualization<CoinVisualization>(); SoNode* visualisationNode = NULL; if (visualization) visualisationNode = visualization->getCoinVisualization();
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.
const std::string & VirtualRobot::SceneObject::getVisualizationModelXML | ( | ) | const |
|
virtual |
|
virtual |
|
virtual |
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.
visualization | The visualization for which the highlighting should be performed. |
enable | Set or unset highlighting. |
|
virtual |
Initialize this object. Optionally the parents and children can be specified.
Reimplemented in VirtualRobot::RobotNode, VirtualRobot::Sensor, VirtualRobot::RobotNodeHemisphere, VirtualRobot::RobotNodePrismatic, VirtualRobot::RobotNodeFixed, VirtualRobot::RobotNodeRevolute, and VirtualRobot::GraspableSensorizedObject.
|
protectedvirtual |
|
virtual |
Reimplemented in VirtualRobot::RobotNode, VirtualRobot::Robot, VirtualRobot::RobotNodeHemisphere, VirtualRobot::Sensor, VirtualRobot::ContactSensor, VirtualRobot::RobotNodePrismatic, VirtualRobot::RobotNodeFixed, VirtualRobot::RobotNodeRevolute, VirtualRobot::ForceTorqueSensor, VirtualRobot::PositionSensor, and VirtualRobot::CameraSensor.
bool VirtualRobot::SceneObject::reloadVisualizationFromXML | ( | bool | useVisAsColModelIfMissing = true | ) |
|
virtual |
Saves model files (visu and col model, if present) to model path.
modelPath | The path where the model files should be stored. |
replsceFilenames | If 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::setCoMLocal | ( | const Eigen::Vector3f & | comLocal | ) |
Set a new position for the CoM of this bode.
comLocal | Center of Mass in local frame. |
void VirtualRobot::SceneObject::setFriction | ( | float | friction | ) |
|
virtual |
Update the pose of this object. The visualization and collision models are updated accordingly.
pose | The new pose of this object |
Reimplemented in VirtualRobot::LocalRobot, VirtualRobot::Robot, VirtualRobot::RobotNode, and VirtualRobot::Sensor.
|
virtual |
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)
pose | The 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::setScaling | ( | float | scaling | ) |
void VirtualRobot::SceneObject::setSimulationType | ( | Physics::SimulationType | s | ) |
|
virtual |
Reimplemented in VirtualRobot::Robot.
|
virtual |
Enables/Disables the visualization updates of collision model and visualization model.
Reimplemented in VirtualRobot::Robot.
|
virtual |
Setup the visualization of this object.
showVisualization | If false, the visualization is disabled. |
showAttachedVisualizations | If 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.
|
static |
The shift is done using the parallel axis theorem (https://en.wikipedia.org/wiki/Parallel_axis_theorem)
inertiaMatrix | |
shift | |
mass |
|
virtual |
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.
|
virtual |
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.
|
virtual |
Returns true when the coordinate system is currently shown.
|
virtual |
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.
poseLocal | The pose, given in local coordinate system of this joint, that should be transformed to the global coordinate system. |
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.
poseGlobal | The pose, given in global coordinate system, that should be transformed to the local coordinate system of this joint. |
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
|
virtual |
Compute the global pose of this object.
Reimplemented in VirtualRobot::RobotNode, and VirtualRobot::Sensor.
|
protectedvirtual |
Reimplemented in VirtualRobot::RobotNode, and VirtualRobot::Sensor.
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |