Simox
2.3.74.0
|
Public Member Functions | |
CDManager (CollisionCheckerPtr colChecker=CollisionCheckerPtr()) | |
if pColChecker is not set, the global collision checker is used More... | |
CDManager (const CDManager &)=default | |
virtual | ~CDManager () |
void | addCollisionModel (SceneObjectSetPtr m) |
void | addCollisionModelPair (SceneObjectSetPtr m1, SceneObjectSetPtr m2) |
void | addCollisionModelPair (SceneObjectPtr m1, SceneObjectSetPtr m2) |
void | addCollisionModelPair (SceneObjectPtr m1, SceneObjectPtr m2) |
template<class SetT > | |
std::enable_if< std::is_base_of< SceneObjectSet, SetT >::value >::type | addCollisionModelPair (const std::shared_ptr< SetT > &m1, const std::shared_ptr< SetT > &m2) |
void | addCollisionModel (SceneObjectPtr m) |
void | addCollisionModel (const std::vector< RobotNodePtr > &nodes, const std::string &setName="") |
bool | hasSceneObjectSet (SceneObjectSetPtr m) |
bool | hasSceneObject (SceneObjectPtr m) |
bool | isInCollision () |
Returns true if one of the specified collision checks report a collision. More... | |
bool | isInCollision (SceneObjectSetPtr m) |
float | getDistance () |
Returns minimum distance of all sets that have been added for consideration. More... | |
float | getDistance (SceneObjectSetPtr m) |
float | getDistance (Eigen::Vector3f &P1, Eigen::Vector3f &P2, int &trID1, int &trID2) |
Stores min dist position and collision IDs. More... | |
float | getDistance (SceneObjectSetPtr m, Eigen::Vector3f &P1, Eigen::Vector3f &P2, int &trID1, int &trID2) |
std::vector< SceneObjectSetPtr > | getSceneObjectSets () |
All SceneObjectSets that have been added. More... | |
CollisionCheckerPtr | getCollisionChecker () |
Protected Member Functions | |
bool | _hasSceneObjectSet (SceneObjectSetPtr m) |
bool | isInCollision (SceneObjectSetPtr m, std::vector< SceneObjectSetPtr > &sets) |
float | getDistance (SceneObjectSetPtr m, std::vector< SceneObjectSetPtr > &sets, Eigen::Vector3f &P1, Eigen::Vector3f &P2, int &trID1, int &trID2) |
float | getDistance (SceneObjectSetPtr m, std::vector< SceneObjectSetPtr > &sets) |
Protected Attributes | |
std::vector< SceneObjectSetPtr > | colModels |
CollisionCheckerPtr | colChecker |
std::map< SceneObjectSetPtr, std::vector< SceneObjectSetPtr > > | colModelPairs |
A framework that can handle different sets of collision models. With a collision detection manager (cdm) multiple sets collision models can be specified for convenient collision detection or distance calculations. Two methods can be used to add collisionModelSets: addCollisionModel(): All added sets are checked against each other. addCollisionModelPair(): Only the specific pairs are checked.
The methods can be safely mixed.
VirtualRobot::CDManager::CDManager | ( | CollisionCheckerPtr | colChecker = CollisionCheckerPtr() | ) |
if pColChecker is not set, the global collision checker is used
|
default |
|
virtualdefault |
|
protected |
Performs also a check for sets with only one object added in order to cover potentionally added single SceneObjects.
void VirtualRobot::CDManager::addCollisionModel | ( | SceneObjectSetPtr | m | ) |
Sets of SceneObjects can be added. All added SceneObjectSets sets are checked against each other. Internally for all SceneObjectSets that have been added earlier, the method addCollisionModelPair() is called.
void VirtualRobot::CDManager::addCollisionModel | ( | SceneObjectPtr | m | ) |
Here single collision models can be added. Internally they are wrapped by a SceneObjectSet.
void VirtualRobot::CDManager::addCollisionModel | ( | const std::vector< RobotNodePtr > & | nodes, |
const std::string & | setName = "" |
||
) |
void VirtualRobot::CDManager::addCollisionModelPair | ( | SceneObjectSetPtr | m1, |
SceneObjectSetPtr | m2 | ||
) |
Here, a specific pair of SceneObjectSets can be added. m1 and m2 will only be checked against each other and will not be checked against the other SceneObjectSets, that may be part of this CDManager.
void VirtualRobot::CDManager::addCollisionModelPair | ( | SceneObjectPtr | m1, |
SceneObjectSetPtr | m2 | ||
) |
void VirtualRobot::CDManager::addCollisionModelPair | ( | SceneObjectPtr | m1, |
SceneObjectPtr | m2 | ||
) |
|
inline |
CollisionCheckerPtr VirtualRobot::CDManager::getCollisionChecker | ( | ) |
float VirtualRobot::CDManager::getDistance | ( | ) |
Returns minimum distance of all sets that have been added for consideration.
float VirtualRobot::CDManager::getDistance | ( | SceneObjectSetPtr | m | ) |
Calculates the shortest distance of m to all added SceneObjectSets. m may be an already added SceneObjectSets.
float VirtualRobot::CDManager::getDistance | ( | Eigen::Vector3f & | P1, |
Eigen::Vector3f & | P2, | ||
int & | trID1, | ||
int & | trID2 | ||
) |
Stores min dist position and collision IDs.
float VirtualRobot::CDManager::getDistance | ( | SceneObjectSetPtr | m, |
Eigen::Vector3f & | P1, | ||
Eigen::Vector3f & | P2, | ||
int & | trID1, | ||
int & | trID2 | ||
) |
Calculates the shortest distance of SceneObjectSet m to all added colModels. Stores nearest positions and corresponding IDs, where P1 and trID1 is used to store the data of m and P2 and trID2 is used to store the data of this CDManager.
|
protected |
|
protected |
std::vector< SceneObjectSetPtr > VirtualRobot::CDManager::getSceneObjectSets | ( | ) |
All SceneObjectSets that have been added.
bool VirtualRobot::CDManager::hasSceneObject | ( | SceneObjectPtr | m | ) |
bool VirtualRobot::CDManager::hasSceneObjectSet | ( | SceneObjectSetPtr | m | ) |
bool VirtualRobot::CDManager::isInCollision | ( | ) |
Returns true if one of the specified collision checks report a collision.
bool VirtualRobot::CDManager::isInCollision | ( | SceneObjectSetPtr | m | ) |
Checks if the model m collides with one of the added colModels. (all SceneObjectSets that have been added are considered) It is allowed to use an already added SceneObjectSets. Returns true if there is a collision.
|
protected |
|
protected |
|
protected |
|
protected |