Description

Collision engine based on the Bullet library.

Contains both the broadphase and the narrow phase Bullet methods.

#include <ChCollisionSystemBullet.h>

Inheritance diagram for chrono::collision::ChCollisionSystemBullet:
Collaboration diagram for chrono::collision::ChCollisionSystemBullet:

Public Member Functions

 ChCollisionSystemBullet ()
 
virtual ChCollisionSystemType GetType () const override
 Return the type of this collision system.
 
virtual void Clear (void) override
 Clears all data instanced by this algorithm if any (like persistent contact manifolds)
 
virtual void Add (ChCollisionModel *model) override
 Adds a collision model to the collision engine (custom data may be allocated).
 
virtual void Remove (ChCollisionModel *model) override
 Removes a collision model from the collision engine (custom data may be deallocated).
 
virtual void SetNumThreads (int nthreads) override
 Removes all collision models from the collision engine (custom data may be deallocated). More...
 
virtual void Run () override
 Run the algorithm and finds all the contacts. More...
 
virtual void GetBoundingBox (ChVector<> &aabb_min, ChVector<> &aabb_max) const override
 Return an AABB bounding all collision shapes in the system.
 
virtual void ResetTimers () override
 Reset timers for collision detection.
 
virtual double GetTimerCollisionBroad () const override
 Return the time (in seconds) for broadphase collision detection.
 
virtual double GetTimerCollisionNarrow () const override
 Return the time (in seconds) for narrowphase collision detection.
 
virtual void ReportContacts (ChContactContainer *mcontactcontainer) override
 After the Run() has completed, you can call this function to fill a 'contact container', that is an object inherited from class ChContactContainer. More...
 
virtual void ReportProximities (ChProximityContainer *mproximitycontainer) override
 After the Run() has completed, you can call this function to fill a 'proximity container' (container of narrow phase pairs), that is an object inherited from class ChProximityContainer. More...
 
virtual bool RayHit (const ChVector<> &from, const ChVector<> &to, ChRayhitResult &result) const override
 Perform a ray-hit test with all collision models.
 
virtual bool RayHit (const ChVector<> &from, const ChVector<> &to, ChCollisionModel *model, ChRayhitResult &result) const override
 Perform a ray-hit test with the specified collision model.
 
virtual void RegisterVisualizationCallback (std::shared_ptr< VisualizationCallback > callback) override
 Specify a callback object to be used for debug rendering of collision shapes.
 
virtual void Visualize (int flags) override
 Method to trigger debug visualization of collision shapes. More...
 
cbtCollisionWorld * GetBulletCollisionWorld ()
 
- Public Member Functions inherited from chrono::collision::ChCollisionSystem
virtual void PreProcess ()
 Removes all collision models from the collision engine (custom data may be deallocated). More...
 
virtual void PostProcess ()
 Optional synchronization operations, invoked after running the collision detection.
 
void RegisterBroadphaseCallback (std::shared_ptr< BroadphaseCallback > callback)
 Specify a callback object to be used each time a pair of 'near enough' collision shapes is found by the broad-phase collision step. More...
 
void RegisterNarrowphaseCallback (std::shared_ptr< NarrowphaseCallback > callback)
 Specify a callback object to be used each time a collision pair is found during the narrow-phase collision detection step. More...
 
virtual void ArchiveOut (ChArchiveOut &marchive)
 Method to allow serialization of transient data to archives.
 
virtual void ArchiveIn (ChArchiveIn &marchive)
 Method to allow de-serialization of transient data from archives.
 
void SetSystem (ChSystem *sys)
 Set associated Chrono system.
 

Static Public Member Functions

static void SetContactBreakingThreshold (double threshold)
 

Additional Inherited Members

- Public Types inherited from chrono::collision::ChCollisionSystem
enum  VisualizationModes {
  VIS_None = 0, VIS_Shapes = 1 << 0, VIS_Aabb = 1 << 1, VIS_Contacts = 1 << 2,
  VIS_MAX_MODES
}
 Enumeration of supported flags for collision debug visualization. More...
 
- Protected Attributes inherited from chrono::collision::ChCollisionSystem
ChSystemm_system
 associated Chrono system
 
std::shared_ptr< BroadphaseCallbackbroad_callback
 user callback for each near-enough pair of shapes
 
std::shared_ptr< NarrowphaseCallbacknarrow_callback
 user callback for each collision pair
 
std::shared_ptr< VisualizationCallbackvis_callback
 user callback for debug visualization
 
int m_vis_flags
 

Constructor & Destructor Documentation

◆ ChCollisionSystemBullet()

chrono::collision::ChCollisionSystemBullet::ChCollisionSystemBullet ( )

bt_dispatcher->registerCollisionCreateFunc(SPHERE_SHAPE_PROXYTYPE, CYLINDER_SHAPE_PROXYTYPE, m_collision_sph_cyl); /bt_dispatcher->registerCollisionCreateFunc(CYLINDER_SHAPE_PROXYTYPE, SPHERE_SHAPE_PROXYTYPE, m_collision_cyl_sph);

Member Function Documentation

◆ ReportContacts()

void chrono::collision::ChCollisionSystemBullet::ReportContacts ( ChContactContainer mcontactcontainer)
overridevirtual

After the Run() has completed, you can call this function to fill a 'contact container', that is an object inherited from class ChContactContainer.

For instance ChSystem, after each Run() collision detection, calls this method multiple times for all contact containers in the system, The basic behavior of the implementation is the following: collision system will call in sequence the functions BeginAddContact(), AddContact() (x n times), EndAddContact() of the contact container.

Implements chrono::collision::ChCollisionSystem.

◆ ReportProximities()

void chrono::collision::ChCollisionSystemBullet::ReportProximities ( ChProximityContainer mproximitycontainer)
overridevirtual

After the Run() has completed, you can call this function to fill a 'proximity container' (container of narrow phase pairs), that is an object inherited from class ChProximityContainer.

For instance ChSystem, after each Run() collision detection, calls this method multiple times for all proximity containers in the system, The basic behavior of the implementation is the following: collision system will call in sequence the functions BeginAddProximities(), AddProximity() (x n times), EndAddProximities() of the proximity container.

Implements chrono::collision::ChCollisionSystem.

◆ Run()

void chrono::collision::ChCollisionSystemBullet::Run ( )
overridevirtual

Run the algorithm and finds all the contacts.

(Contacts will be managed by the Bullet persistent contact cache).

Implements chrono::collision::ChCollisionSystem.

◆ SetNumThreads()

void chrono::collision::ChCollisionSystemBullet::SetNumThreads ( int  nthreads)
overridevirtual

Removes all collision models from the collision engine (custom data may be deallocated).

Set the number of OpenMP threads for collision detection.

Reimplemented from chrono::collision::ChCollisionSystem.

◆ Visualize()

void chrono::collision::ChCollisionSystemBullet::Visualize ( int  flags)
overridevirtual

Method to trigger debug visualization of collision shapes.

The 'flags' argument can be any of the VisualizationModes enums, or a combination thereof (using bit-wise operators). The calling program must invoke this function from within the simulation loop. No-op if a visualization callback was not specified with RegisterVisualizationCallback().

Reimplemented from chrono::collision::ChCollisionSystem.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono/collision/ChCollisionSystemBullet.h
  • /builds/uwsbel/chrono/src/chrono/collision/ChCollisionSystemBullet.cpp