Simox  2.3.74.0
VirtualRobot::CollisionModel Class Reference

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW CollisionModel (const VisualizationNodePtr &visu, const std::string &name="", CollisionCheckerPtr colChecker=CollisionCheckerPtr(), int id=666, float margin=0.0f)
 
 CollisionModel (const TriMeshModelPtr &mesh)
 
 CollisionModel (const TriMeshModel &mesh)
 
virtual ~CollisionModel ()
 
std::string getName ()
 
BoundingBox getBoundingBox (bool global=true)
 
BoundingBox getLocalBoundingBox ()
 
BoundingBox getGlobalBoundingBox ()
 
Eigen::Matrix4f getGlobalPose () const
 
virtual void setGlobalPose (const Eigen::Matrix4f &pose)
 
Eigen::Vector3f transformToGlobal (const Eigen::Vector3f &p) const
 
Eigen::Vector3f transformFromGlobal (const Eigen::Vector3f &p) const
 
CollisionCheckerPtr getCollisionChecker ()
 
const std::shared_ptr< CollisionModelPQP > & getCollisionModelImplementation ()
 
CollisionModelPtr clone (CollisionCheckerPtr colChecker=CollisionCheckerPtr(), float scaling=1.0f, bool deepVisuCopy=true)
 
void setVisualization (const VisualizationNodePtr visu)
 
int getId ()
 
void setUpdateVisualization (bool enable)
 
bool getUpdateVisualizationStatus ()
 
VisualizationNodePtr getVisualization ()
 
VisualizationNodePtr getModelDataVisualization ()
 
template<class T >
std::shared_ptr< T > getVisualization ()
 
virtual int getNumFaces ()
 get number of faces (i.e. triangles) of this object More...
 
virtual void print ()
 
std::vector< Eigen::Vector3f > getModelVeticesGlobal ()
 
TriMeshModelPtr getTriMeshModel ()
 
std::string toXML (const std::string &basePath, int tabs)
 
std::string toXML (const std::string &basePath, const std::string &filename, int tabs)
 
virtual bool saveModel (const std::string &modelPath, const std::string &filename)
 
virtual void scale (Eigen::Vector3f &scaleFactor)
 
float getMargin () const
 
void inflateModel (float margin)
 in/deflates the model. If value is <0 the model is deflated. More...
 

Static Public Member Functions

static CollisionModelPtr CreateUnitedCollisionModel (const std::vector< CollisionModelPtr > &colModels)
 

Protected Member Functions

 CollisionModel (const VisualizationNodePtr &visu, const std::string &name, CollisionCheckerPtr colChecker, int id, InternalCollisionModelPtr collisionModel)
 
void destroyData ()
 delete all data More...
 

Protected Attributes

VisualizationNodePtr visualization
 
VisualizationNodePtr origVisualization
 
VisualizationNodePtr modelVisualization
 
bool updateVisualization
 
TriMeshModelPtr model
 
float margin
 
BoundingBox bbox
 
std::string name
 the name More...
 
int id
 
CollisionCheckerPtr colChecker
 
Eigen::Matrix4f globalPose
 
std::shared_ptr< CollisionModelPQPcollisionModelImplementation
 

Detailed Description

An abstract representation of an object that can be used for collision queries.

Constructor & Destructor Documentation

◆ CollisionModel() [1/4]

VirtualRobot::CollisionModel::CollisionModel ( const VisualizationNodePtr visu,
const std::string &  name = "",
CollisionCheckerPtr  colChecker = CollisionCheckerPtr(),
int  id = 666,
float  margin = 0.0f 
)

Standard Constructor If collision checks should be done in parallel, different CollisionCheckers can be specified.

Parameters
visuA visualization that is used for creating an internal triangle based representation of the object.
nameThe name of this object.
colCheckerIf not specified, the global singleton instance is used. Only useful, when parallel collision checks should be performed.
idA user id.

◆ CollisionModel() [2/4]

VirtualRobot::CollisionModel::CollisionModel ( const TriMeshModelPtr mesh)

◆ CollisionModel() [3/4]

VirtualRobot::CollisionModel::CollisionModel ( const TriMeshModel mesh)

◆ ~CollisionModel()

VirtualRobot::CollisionModel::~CollisionModel ( )
virtual

Standard Destructor

◆ CollisionModel() [4/4]

VirtualRobot::CollisionModel::CollisionModel ( const VisualizationNodePtr visu,
const std::string &  name,
CollisionCheckerPtr  colChecker,
int  id,
InternalCollisionModelPtr  collisionModel 
)
protected

Member Function Documentation

◆ clone()

VirtualRobot::CollisionModelPtr VirtualRobot::CollisionModel::clone ( CollisionCheckerPtr  colChecker = CollisionCheckerPtr(),
float  scaling = 1.0f,
bool  deepVisuCopy = true 
)

◆ CreateUnitedCollisionModel()

VirtualRobot::CollisionModelPtr VirtualRobot::CollisionModel::CreateUnitedCollisionModel ( const std::vector< CollisionModelPtr > &  colModels)
static

Create a united collision model. All triangle data is copied to one model which usually improves the collision detection performance.

◆ destroyData()

void VirtualRobot::CollisionModel::destroyData ( )
protected

delete all data

◆ getBoundingBox()

BoundingBox VirtualRobot::CollisionModel::getBoundingBox ( bool  global = true)

Return bounding box of this object.

Parameters
globalIf set, the boundignBox is transformed to globalCoordinate system. Otherwise the local BBox is returned.

◆ getCollisionChecker()

CollisionCheckerPtr VirtualRobot::CollisionModel::getCollisionChecker ( )
inline

◆ getCollisionModelImplementation()

const std::shared_ptr< CollisionModelPQP >& VirtualRobot::CollisionModel::getCollisionModelImplementation ( )
inline

◆ getGlobalBoundingBox()

BoundingBox VirtualRobot::CollisionModel::getGlobalBoundingBox ( )
inline

◆ getGlobalPose()

Eigen::Matrix4f VirtualRobot::CollisionModel::getGlobalPose ( ) const
inline

The global pose defines the position of the joint in the world. This value is used for visualization.

◆ getId()

int VirtualRobot::CollisionModel::getId ( )

◆ getLocalBoundingBox()

BoundingBox VirtualRobot::CollisionModel::getLocalBoundingBox ( )
inlinebound

◆ getMargin()

float VirtualRobot::CollisionModel::getMargin ( ) const

◆ getModelDataVisualization()

VirtualRobot::VisualizationNodePtr VirtualRobot::CollisionModel::getModelDataVisualization ( )

◆ getModelVeticesGlobal()

std::vector< Eigen::Vector3f > VirtualRobot::CollisionModel::getModelVeticesGlobal ( )

Return a vector with all vertices of this object at the current global pose.

◆ getName()

std::string VirtualRobot::CollisionModel::getName ( )

Returns name of this model.

◆ getNumFaces()

int VirtualRobot::CollisionModel::getNumFaces ( )
virtual

get number of faces (i.e. triangles) of this object

◆ getTriMeshModel()

TriMeshModelPtr VirtualRobot::CollisionModel::getTriMeshModel ( )
inline

◆ getUpdateVisualizationStatus()

bool VirtualRobot::CollisionModel::getUpdateVisualizationStatus ( )

◆ getVisualization() [1/2]

VisualizationNodePtr VirtualRobot::CollisionModel::getVisualization ( )

◆ getVisualization() [2/2]

template<class T >
std::shared_ptr<T> VirtualRobot::CollisionModel::getVisualization ( )
inline

◆ inflateModel()

void VirtualRobot::CollisionModel::inflateModel ( float  margin)

in/deflates the model. If value is <0 the model is deflated.

Parameters
marginEach vertex of the model is moved about this margin along its normal.

◆ print()

void VirtualRobot::CollisionModel::print ( )
virtual

Print information about this model.

◆ saveModel()

bool VirtualRobot::CollisionModel::saveModel ( const std::string &  modelPath,
const std::string &  filename 
)
virtual

Saves model file to model path.

Parameters
modelPathThe directory.
filenameThe new filename without path.

◆ scale()

void VirtualRobot::CollisionModel::scale ( Eigen::Vector3f &  scaleFactor)
virtual

◆ setGlobalPose()

void VirtualRobot::CollisionModel::setGlobalPose ( const Eigen::Matrix4f &  pose)
virtual

◆ setUpdateVisualization()

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

Enables/Disables the visualization updates of the collision model. This just handles the visualization, the collision data is not affected.

◆ setVisualization()

void VirtualRobot::CollisionModel::setVisualization ( const VisualizationNodePtr  visu)

◆ toXML() [1/2]

std::string VirtualRobot::CollisionModel::toXML ( const std::string &  basePath,
int  tabs 
)

◆ toXML() [2/2]

std::string VirtualRobot::CollisionModel::toXML ( const std::string &  basePath,
const std::string &  filename,
int  tabs 
)

◆ transformFromGlobal()

Eigen::Vector3f VirtualRobot::CollisionModel::transformFromGlobal ( const Eigen::Vector3f &  p) const
inline

◆ transformToGlobal()

Eigen::Vector3f VirtualRobot::CollisionModel::transformToGlobal ( const Eigen::Vector3f &  p) const
inline

Field Documentation

◆ bbox

BoundingBox VirtualRobot::CollisionModel::bbox
protected

◆ colChecker

CollisionCheckerPtr VirtualRobot::CollisionModel::colChecker
protected

◆ collisionModelImplementation

std::shared_ptr< CollisionModelPQP > VirtualRobot::CollisionModel::collisionModelImplementation
protected

◆ globalPose

Eigen::Matrix4f VirtualRobot::CollisionModel::globalPose
protected

◆ id

int VirtualRobot::CollisionModel::id
protected

◆ margin

float VirtualRobot::CollisionModel::margin
protected

◆ model

TriMeshModelPtr VirtualRobot::CollisionModel::model
protected

◆ modelVisualization

VisualizationNodePtr VirtualRobot::CollisionModel::modelVisualization
protected

◆ name

std::string VirtualRobot::CollisionModel::name
protected

the name

◆ origVisualization

VisualizationNodePtr VirtualRobot::CollisionModel::origVisualization
protected

◆ updateVisualization

bool VirtualRobot::CollisionModel::updateVisualization
protected

◆ visualization

VisualizationNodePtr VirtualRobot::CollisionModel::visualization
protected