DART  6.10.1
dart::collision::OdeCollisionDetector Class Reference

OdeCollisionDetector wraps the ODE collision detector. More...

#include <OdeCollisionDetector.hpp>

Inheritance diagram for dart::collision::OdeCollisionDetector:
dart::collision::CollisionDetector

Public Types

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 ~OdeCollisionDetector ()
 Constructor. More...
 
std::shared_ptr< CollisionDetectorcloneWithoutCollisionObjects () const 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
 
double distance (CollisionGroup *group1, CollisionGroup *group2, const DistanceOption &option=DistanceOption(false, 0.0, nullptr), DistanceResult *result=nullptr) override
 
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...
 
virtual bool raycast (CollisionGroup *group, const Eigen::Vector3d &from, const Eigen::Vector3d &to, const RaycastOption &option=RaycastOption(), RaycastResult *result=nullptr)
 Performs raycast to a collision group. More...
 

Static Public Member Functions

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

Protected Member Functions

 OdeCollisionDetector ()
 Constructor. More...
 
std::unique_ptr< CollisionObjectcreateCollisionObject (const dynamics::ShapeFrame *shapeFrame) override
 Create CollisionObject. More...
 
void refreshCollisionObject (CollisionObject *object) override
 Update the collision geometry of a ShapeFrame. More...
 
dWorldID getOdeWorldId () const
 
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

dWorldID mWorldId
 Top-level world for all bodies. More...
 
std::unique_ptr< CollisionObjectManagermCollisionObjectManager
 

Private Member Functions

dGeomID createOdeCollisionGeometry (const dynamics::ConstShapePtr &shape)
 

Private Attributes

dContactGeom contactCollisions [250]
 

Static Private Attributes

static Registrar< OdeCollisionDetectormRegistrar
 

Friends

class OdeCollisionObject
 

Detailed Description

OdeCollisionDetector wraps the ODE collision detector.

The supported collision shape types are sphere, box, capsule, cylinder, plane, and trimesh.

ODE additionally supports ray and heightfiled, but DART doesn't support them yet.

Member Typedef Documentation

◆ Factory

◆ Registrar

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

◆ SingletonFactory

Constructor & Destructor Documentation

◆ ~OdeCollisionDetector()

dart::collision::OdeCollisionDetector::~OdeCollisionDetector ( )
virtual

Constructor.

◆ OdeCollisionDetector()

dart::collision::OdeCollisionDetector::OdeCollisionDetector ( )
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.

◆ cloneWithoutCollisionObjects()

std::shared_ptr< CollisionDetector > dart::collision::OdeCollisionDetector::cloneWithoutCollisionObjects ( ) const
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::OdeCollisionDetector::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::OdeCollisionDetector::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< OdeCollisionDetector > dart::collision::OdeCollisionDetector::create ( )
static

◆ createCollisionGroup() [1/4]

std::unique_ptr< CollisionGroup > dart::collision::OdeCollisionDetector::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::OdeCollisionDetector::createCollisionObject ( const dynamics::ShapeFrame shapeFrame)
overrideprotectedvirtual

◆ createOdeCollisionGeometry()

dGeomID dart::collision::OdeCollisionDetector::createOdeCollisionGeometry ( const dynamics::ConstShapePtr shape)
private

◆ distance() [1/2]

double dart::collision::OdeCollisionDetector::distance ( CollisionGroup group,
const DistanceOption option = DistanceOption(false, 0.0, nullptr),
DistanceResult result = nullptr 
)
overridevirtual
Warning
Not implemented yet.

Implements dart::collision::CollisionDetector.

◆ distance() [2/2]

double dart::collision::OdeCollisionDetector::distance ( CollisionGroup group1,
CollisionGroup group2,
const DistanceOption option = DistanceOption(false, 0.0, nullptr),
DistanceResult result = nullptr 
)
overridevirtual
Warning
Not implemented yet.

Implements dart::collision::CollisionDetector.

◆ getFactory()

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

Returns the singleton factory.

◆ getOdeWorldId()

dWorldID dart::collision::OdeCollisionDetector::getOdeWorldId ( ) const
protected

◆ getStaticType()

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

Get collision detector type for this class.

◆ getType()

const std::string & dart::collision::OdeCollisionDetector::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.

◆ raycast()

bool dart::collision::CollisionDetector::raycast ( CollisionGroup group,
const Eigen::Vector3d &  from,
const Eigen::Vector3d &  to,
const RaycastOption option = RaycastOption(),
RaycastResult result = nullptr 
)
virtualinherited

Performs raycast to a collision group.

Parameters
[in]groupThe collision group the ray will be casted onto.
[in]fromThe start point of the ray in world coordinates.
[in]toThe end point of the ray in world coordinates.
[in]optionThe raycast option.
[in]resultThe raycast result.
Returns
True if the ray hit an collision object.

Reimplemented in dart::collision::BulletCollisionDetector.

◆ refreshCollisionObject()

void dart::collision::OdeCollisionDetector::refreshCollisionObject ( CollisionObject object)
overrideprotectedvirtual

Update the collision geometry of a ShapeFrame.

Implements dart::collision::CollisionDetector.

Friends And Related Function Documentation

◆ OdeCollisionObject

friend class OdeCollisionObject
friend

Member Data Documentation

◆ contactCollisions

dContactGeom dart::collision::OdeCollisionDetector::contactCollisions[250]
private

◆ mCollisionObjectManager

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

◆ mRegistrar

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

◆ mWorldId

dWorldID dart::collision::OdeCollisionDetector::mWorldId
protected

Top-level world for all bodies.