DART  6.6.2
dart::collision::FCLCollisionDetector Class Reference

#include <FCLCollisionDetector.hpp>

Inheritance diagram for dart::collision::FCLCollisionDetector:
dart::collision::CollisionDetector

Classes

class  FCLCollisionGeometryDeleter
 This deleter is responsible for deleting fcl::CollisionGeometry and removing it from mShapeMap when it is not shared by any CollisionObjects. More...
 

Public Types

enum  PrimitiveShape { PRIMITIVE = 0 , MESH }
 Whether to use analytic collision checking for primitive shapes. More...
 
enum  ContactPointComputationMethod { FCL = 0 , DART }
 Whether to use FCL's contact point computation. More...
 
using Factory = common::Factory< std::string, CollisionDetector, std::shared_ptr< CollisionDetector > >
 
using SingletonFactory = common::Singleton< Factory >
 
template<typename Derived >
using Registrar = common::FactoryRegistrar< std::string, CollisionDetector, Derived, std::shared_ptr< CollisionDetector > >
 

Public Member Functions

virtual ~FCLCollisionDetector ()
 Constructor. More...
 
std::shared_ptr< CollisionDetectorcloneWithoutCollisionObjects () override
 Create a clone of this CollisionDetector. More...
 
const std::string & getType () const override
 Return collision detection engine type as a std::string. More...
 
std::unique_ptr< CollisionGroupcreateCollisionGroup () override
 Create a collision group. More...
 
bool collide (CollisionGroup *group, const CollisionOption &option=CollisionOption(false, 1u, nullptr), CollisionResult *result=nullptr) override
 Perform collision check for a single group. More...
 
bool collide (CollisionGroup *group1, CollisionGroup *group2, const CollisionOption &option=CollisionOption(false, 1u, nullptr), CollisionResult *result=nullptr) override
 Perform collision check for two groups. More...
 
double distance (CollisionGroup *group, const DistanceOption &option=DistanceOption(false, 0.0, nullptr), DistanceResult *result=nullptr) override
 Get the minimum signed distance between the Shape pairs in the given CollisionGroup. More...
 
double distance (CollisionGroup *group1, CollisionGroup *group2, const DistanceOption &option=DistanceOption(false, 0.0, nullptr), DistanceResult *result=nullptr) override
 Get the minimum signed distance between the Shape pairs where a pair consist of two shapes from each groups (one from group1 and one from group2). More...
 
void setPrimitiveShapeType (PrimitiveShape type)
 Set primitive shape type. More...
 
PrimitiveShape getPrimitiveShapeType () const
 Get primitive shape type. More...
 
void setContactPointComputationMethod (ContactPointComputationMethod method)
 Set contact point computation method. More...
 
ContactPointComputationMethod getContactPointComputationMethod () const
 Get contact point computation method. More...
 
virtual std::unique_ptr< CollisionGroupcreateCollisionGroup ()=0
 Create a collision group. More...
 
template<typename... Args>
std::unique_ptr< CollisionGroupcreateCollisionGroup (const Args &... args)
 Create a collision group from any objects that are supported by CollisionGroup::addShapeFramesOf(). More...
 
template<typename... Args>
std::unique_ptr< CollisionGroupcreateCollisionGroup (const Args &... args)
 Create a collision group from any objects that are supported by CollisionGroup::addShapeFramesOf(). More...
 
std::shared_ptr< CollisionGroupcreateCollisionGroupAsSharedPtr ()
 Helper function that creates and returns CollisionGroup as a shared_ptr. More...
 
template<typename... Args>
std::shared_ptr< CollisionGroupcreateCollisionGroupAsSharedPtr (const Args &... args)
 Helper function that creates and returns CollisionGroup as shared_ptr. More...
 

Static Public Member Functions

static std::shared_ptr< FCLCollisionDetectorcreate ()
 
static const std::string & getStaticType ()
 Get collision detector type for this class. More...
 
static FactorygetFactory ()
 Returns the singleton factory. More...
 

Protected Member Functions

 FCLCollisionDetector ()
 Constructor. More...
 
std::unique_ptr< CollisionObjectcreateCollisionObject (const dynamics::ShapeFrame *shapeFrame) override
 Create CollisionObject. More...
 
fcl_shared_ptr< dart::collision::fcl::CollisionGeometryclaimFCLCollisionGeometry (const dynamics::ConstShapePtr &shape)
 Return fcl::CollisionGeometry associated with give Shape. More...
 
std::shared_ptr< CollisionObjectclaimCollisionObject (const dynamics::ShapeFrame *shapeFrame)
 Claim CollisionObject associated with shapeFrame. More...
 
virtual void notifyCollisionObjectDestroying (CollisionObject *object)
 Notify that a CollisionObject is destroying. Do nothing by default. More...
 

Protected Attributes

PrimitiveShape mPrimitiveShapeType
 
ContactPointComputationMethod mContactPointComputationMethod
 
std::unique_ptr< CollisionObjectManagermCollisionObjectManager
 

Private Types

using ShapeMap = std::map< dynamics::ConstShapePtr, fcl_weak_ptr< dart::collision::fcl::CollisionGeometry > >
 

Private Member Functions

fcl_shared_ptr< dart::collision::fcl::CollisionGeometrycreateFCLCollisionGeometry (const dynamics::ConstShapePtr &shape, FCLCollisionDetector::PrimitiveShape type, const FCLCollisionGeometryDeleter &deleter)
 Create fcl::CollisionGeometry with the custom deleter FCLCollisionGeometryDeleter. More...
 

Private Attributes

ShapeMap mShapeMap
 

Static Private Attributes

static Registrar< FCLCollisionDetectormRegistrar
 

Member Typedef Documentation

◆ Factory

◆ Registrar

template<typename Derived >
using dart::collision::CollisionDetector::Registrar = common::FactoryRegistrar< std::string, CollisionDetector, Derived, std::shared_ptr<CollisionDetector> >
inherited

◆ ShapeMap

◆ SingletonFactory

Member Enumeration Documentation

◆ ContactPointComputationMethod

Whether to use FCL's contact point computation.

FCL: Use FCL's contact point computation. DART: Use DART's own contact point computation

Warning: FCL's contact computation is not correct. See: https://github.com/flexible-collision-library/fcl/issues/106 We recommend using DART until it's fixed in FCL.

Enumerator
FCL 
DART 

◆ PrimitiveShape

Whether to use analytic collision checking for primitive shapes.

PRIMITIVE: Use FCL's analytic collision checking for primitive shapes. MESH: Don't use it. Instead, use approximate mesh shapes for the primitive shapes. The contact result is probably less accurate than the analytic result.

Warning: FCL's primitive shape support is not complete. FCL 0.4.0 improved the support alot, but it still returns single contact point for a shape pair except for box-box collision. For this reason, we recommend using MESH until FCL fully supports primitive shapes.

Enumerator
PRIMITIVE 
MESH 

Constructor & Destructor Documentation

◆ ~FCLCollisionDetector()

dart::collision::FCLCollisionDetector::~FCLCollisionDetector ( )
virtual

Constructor.

◆ FCLCollisionDetector()

dart::collision::FCLCollisionDetector::FCLCollisionDetector ( )
protected

Constructor.

Member Function Documentation

◆ claimCollisionObject()

std::shared_ptr< CollisionObject > dart::collision::CollisionDetector::claimCollisionObject ( const dynamics::ShapeFrame shapeFrame)
protectedinherited

Claim CollisionObject associated with shapeFrame.

New CollisionObject will be created if it hasn't created yet for shapeFrame.

◆ claimFCLCollisionGeometry()

fcl_shared_ptr< fcl::CollisionGeometry > dart::collision::FCLCollisionDetector::claimFCLCollisionGeometry ( const dynamics::ConstShapePtr shape)
protected

Return fcl::CollisionGeometry associated with give Shape.

New fcl::CollisionGeome will be created if it hasn't created yet.

◆ cloneWithoutCollisionObjects()

std::shared_ptr< CollisionDetector > dart::collision::FCLCollisionDetector::cloneWithoutCollisionObjects ( )
overridevirtual

Create a clone of this CollisionDetector.

All the properties will be copied over, but not collision objects.

Implements dart::collision::CollisionDetector.

◆ collide() [1/2]

bool dart::collision::FCLCollisionDetector::collide ( CollisionGroup group,
const CollisionOption option = CollisionOption(false, 1u, nullptr),
CollisionResult result = nullptr 
)
overridevirtual

Perform collision check for a single group.

If nullptr is passed to result, then the this returns only simple information whether there is a collision of not.

Implements dart::collision::CollisionDetector.

◆ collide() [2/2]

bool dart::collision::FCLCollisionDetector::collide ( CollisionGroup group1,
CollisionGroup group2,
const CollisionOption option = CollisionOption(false, 1u, nullptr),
CollisionResult result = nullptr 
)
overridevirtual

Perform collision check for two groups.

If nullptr is passed to result, then the this returns only simple information whether there is a collision of not.

Implements dart::collision::CollisionDetector.

◆ create()

std::shared_ptr< FCLCollisionDetector > dart::collision::FCLCollisionDetector::create ( )
static

◆ createCollisionGroup() [1/4]

std::unique_ptr< CollisionGroup > dart::collision::FCLCollisionDetector::createCollisionGroup ( )
overridevirtual

Create a collision group.

Implements dart::collision::CollisionDetector.

◆ createCollisionGroup() [2/4]

virtual std::unique_ptr<CollisionGroup> dart::collision::CollisionDetector::createCollisionGroup
virtual

Create a collision group.

Implements dart::collision::CollisionDetector.

◆ createCollisionGroup() [3/4]

template<typename... Args>
std::unique_ptr< CollisionGroup > dart::collision::CollisionDetector::createCollisionGroup ( const Args &...  args)
inherited

Create a collision group from any objects that are supported by CollisionGroup::addShapeFramesOf().

The objects can be any of ShapeFrame, std::vector<ShapeFrame>, CollisionGroup, BodyNode, and Skeleton.

Note that this function adds only the ShapeFrames of each object at the moment that this function is called. Any later addition to or removal of the ShapeFrames that are attached to these objects will NOT be noticed.

◆ createCollisionGroup() [4/4]

template<typename... Args>
std::unique_ptr< CollisionGroup > dart::collision::CollisionDetector::createCollisionGroup ( typename...  Args)

Create a collision group from any objects that are supported by CollisionGroup::addShapeFramesOf().

The objects can be any of ShapeFrame, std::vector<ShapeFrame>, CollisionGroup, BodyNode, and Skeleton.

Note that this function adds only the ShapeFrames of each object at the moment that this function is called. Any later addition to or removal of the ShapeFrames that are attached to these objects will NOT be noticed.

◆ createCollisionGroupAsSharedPtr() [1/2]

std::shared_ptr< CollisionGroup > dart::collision::CollisionDetector::createCollisionGroupAsSharedPtr ( )
inherited

Helper function that creates and returns CollisionGroup as a shared_ptr.

Internally, this function creates a shared_ptr from unique_ptr returned from createCollisionGroup() so the performance would be slighly worse than using std::make_unique.

◆ createCollisionGroupAsSharedPtr() [2/2]

template<typename... Args>
std::shared_ptr< CollisionGroup > dart::collision::CollisionDetector::createCollisionGroupAsSharedPtr ( const Args &...  args)
inherited

Helper function that creates and returns CollisionGroup as shared_ptr.

◆ createCollisionObject()

std::unique_ptr< CollisionObject > dart::collision::FCLCollisionDetector::createCollisionObject ( const dynamics::ShapeFrame shapeFrame)
overrideprotectedvirtual

◆ createFCLCollisionGeometry()

fcl_shared_ptr< fcl::CollisionGeometry > dart::collision::FCLCollisionDetector::createFCLCollisionGeometry ( const dynamics::ConstShapePtr shape,
FCLCollisionDetector::PrimitiveShape  type,
const FCLCollisionGeometryDeleter deleter 
)
private

Create fcl::CollisionGeometry with the custom deleter FCLCollisionGeometryDeleter.

◆ distance() [1/2]

double dart::collision::FCLCollisionDetector::distance ( CollisionGroup group,
const DistanceOption option = DistanceOption(false, 0.0, nullptr),
DistanceResult result = nullptr 
)
overridevirtual

Get the minimum signed distance between the Shape pairs in the given CollisionGroup.

The detailed results are stored in the given DistanceResult if provided.

The results can be different by DistanceOption. By default, non-negative minimum distance (distance >= 0) is returned for all the shape pairs without computing nearest points.

Implements dart::collision::CollisionDetector.

◆ distance() [2/2]

double dart::collision::FCLCollisionDetector::distance ( CollisionGroup group1,
CollisionGroup group2,
const DistanceOption option = DistanceOption(false, 0.0, nullptr),
DistanceResult result = nullptr 
)
overridevirtual

Get the minimum signed distance between the Shape pairs where a pair consist of two shapes from each groups (one from group1 and one from group2).

Note that the distance between shapes within the same CollisionGroup are not accounted.

The detailed results are stored in the given DistanceResult if provided.

The results can be different by DistanceOption. By default, non-negative minimum distance (distance >= 0) is returned for all the shape pairs without computing nearest points.

Implements dart::collision::CollisionDetector.

◆ getContactPointComputationMethod()

FCLCollisionDetector::ContactPointComputationMethod dart::collision::FCLCollisionDetector::getContactPointComputationMethod ( ) const

Get contact point computation method.

◆ getFactory()

CollisionDetector::Factory * dart::collision::CollisionDetector::getFactory ( )
staticinherited

Returns the singleton factory.

◆ getPrimitiveShapeType()

FCLCollisionDetector::PrimitiveShape dart::collision::FCLCollisionDetector::getPrimitiveShapeType ( ) const

Get primitive shape type.

◆ getStaticType()

const std::string & dart::collision::FCLCollisionDetector::getStaticType ( )
static

Get collision detector type for this class.

◆ getType()

const std::string & dart::collision::FCLCollisionDetector::getType ( ) const
overridevirtual

Return collision detection engine type as a std::string.

Implements dart::collision::CollisionDetector.

◆ notifyCollisionObjectDestroying()

void dart::collision::CollisionDetector::notifyCollisionObjectDestroying ( CollisionObject object)
protectedvirtualinherited

Notify that a CollisionObject is destroying. Do nothing by default.

Reimplemented in dart::collision::BulletCollisionDetector.

◆ setContactPointComputationMethod()

void dart::collision::FCLCollisionDetector::setContactPointComputationMethod ( FCLCollisionDetector::ContactPointComputationMethod  method)

Set contact point computation method.

◆ setPrimitiveShapeType()

void dart::collision::FCLCollisionDetector::setPrimitiveShapeType ( FCLCollisionDetector::PrimitiveShape  type)

Set primitive shape type.

Member Data Documentation

◆ mCollisionObjectManager

std::unique_ptr<CollisionObjectManager> dart::collision::CollisionDetector::mCollisionObjectManager
protectedinherited

◆ mContactPointComputationMethod

ContactPointComputationMethod dart::collision::FCLCollisionDetector::mContactPointComputationMethod
protected

◆ mPrimitiveShapeType

PrimitiveShape dart::collision::FCLCollisionDetector::mPrimitiveShapeType
protected

◆ mRegistrar

FCLCollisionDetector::Registrar< FCLCollisionDetector > dart::collision::FCLCollisionDetector::mRegistrar
staticprivate
Initial value:
{
[]() -> std::shared_ptr<FCLCollisionDetector> {
}}
static const std::string & getStaticType()
Get collision detector type for this class.
Definition: FCLCollisionDetector.cpp:682
static std::shared_ptr< FCLCollisionDetector > create()
Definition: FCLCollisionDetector.cpp:657

◆ mShapeMap

ShapeMap dart::collision::FCLCollisionDetector::mShapeMap
private