Description

Chrono custom multicore collision system.

Contains both the broadphase and the narrow phase methods.

#include <ChCollisionSystemChrono.h>

Inheritance diagram for chrono::collision::ChCollisionSystemChrono:
Collaboration diagram for chrono::collision::ChCollisionSystemChrono:

Public Member Functions

virtual ChCollisionSystemType GetType () const override
 Return the type of this collision system.
 
void SetEnvelope (double envelope)
 Set collision envelope for rigid shapes (default: ChCollisionModel::GetDefaultSuggestedEnvelope). More...
 
void SetBroadphaseGridResolution (const ChVector< int > &num_bins)
 Set a fixed number of grid bins (default 10x10x10). More...
 
void SetBroadphaseGridSize (const ChVector<> &bin_size)
 Set a variable number of grids, such that each bin has roughly the specified size. More...
 
void SetBroadphaseGridDensity (double density)
 Set a variable number of grid bins, such that there are roughly density collision shapes per bin. More...
 
void SetNarrowphaseAlgorithm (ChNarrowphase::Algorithm algorithm)
 Set the narrowphase algorithm (default: ChNarrowphase::Algorithm::HYBRID). More...
 
void EnableActiveBoundingBox (const ChVector<> &aabb_min, const ChVector<> &aabb_max)
 Enable monitoring of shapes outside active bounding box (default: false). More...
 
bool GetActiveBoundingBox (ChVector<> &aabb_min, ChVector<> &aabb_max) const
 Get the dimensions of the "active" box. More...
 
virtual void Clear (void) override
 Clear all data instanced by this algorithm if any (like persistent contact manifolds).
 
virtual void Add (ChCollisionModel *model) override
 Add a collision model to the collision engine.
 
virtual void Remove (ChCollisionModel *model) override
 Remove a collision model from the collision engine. More...
 
virtual void SetNumThreads (int nthreads) override
 Set the number of OpenMP threads for collision detection.
 
virtual void PreProcess () override
 Synchronization operations, invoked before running the collision detection. More...
 
virtual void Run () override
 Run the algorithm and finds all the contacts.
 
virtual void PostProcess () override
 Synchronization operations, invoked after running the collision detection. 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 any timers associated with 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 *container) override
 Fill in the provided contact container with collision information after Run().
 
virtual void ReportProximities (ChProximityContainer *mproximitycontainer) override
 Fill in the provided proximity container with near point information after Run(). More...
 
virtual bool RayHit (const ChVector<> &from, const ChVector<> &to, ChRayhitResult &result) const override
 Perform a ray-hit test with all collision models. More...
 
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. More...
 
virtual std::vector< vec2 > GetOverlappingPairs ()
 Return the pairs of IDs for overlapping contact shapes.
 
- Public Member Functions inherited from chrono::collision::ChCollisionSystem
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.
 

Protected Member Functions

virtual void GetOverlappingAABB (std::vector< char > &active_id, real3 Amin, real3 Amax)
 Mark bodies whose AABB is contained within the specified box.
 
void GenerateAABB ()
 Generate the current axis-aligned bounding boxes of collision shapes.
 

Protected Attributes

std::shared_ptr< ChCollisionDatacd_data
 
collision::ChBroadphase broadphase
 methods for broad-phase collision detection
 
collision::ChNarrowphase narrowphase
 methods for narrow-phase collision detection
 
std::vector< char > body_active
 
bool use_aabb_active
 enable freezing of objects outside the active bounding box
 
real3 active_aabb_min
 lower corner of active bounding box
 
real3 active_aabb_max
 upper corner of active bounding box
 
ChTimer m_timer_broad
 
ChTimer m_timer_narrow
 
- 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
 

Member Function Documentation

◆ EnableActiveBoundingBox()

void chrono::collision::ChCollisionSystemChrono::EnableActiveBoundingBox ( const ChVector<> &  aabb_min,
const ChVector<> &  aabb_max 
)

Enable monitoring of shapes outside active bounding box (default: false).

If enabled, objects whose collision shapes exit the active bounding box are deactivated (frozen). The size of the bounding box is specified by its min and max extents.

◆ GetActiveBoundingBox()

bool chrono::collision::ChCollisionSystemChrono::GetActiveBoundingBox ( ChVector<> &  aabb_min,
ChVector<> &  aabb_max 
) const

Get the dimensions of the "active" box.

The return value indicates whether or not the active box feature is enabled.

◆ PostProcess()

void chrono::collision::ChCollisionSystemChrono::PostProcess ( )
overridevirtual

Synchronization operations, invoked after running the collision detection.

This function updates the list of active bodies (if active bounding box enabled).

Reimplemented from chrono::collision::ChCollisionSystem.

Reimplemented in chrono::collision::ChCollisionSystemChronoMulticore.

◆ PreProcess()

void chrono::collision::ChCollisionSystemChrono::PreProcess ( )
overridevirtual

Synchronization operations, invoked before running the collision detection.

This function copies contactable state information in the collision system's data structures.

Reimplemented from chrono::collision::ChCollisionSystem.

Reimplemented in chrono::collision::ChCollisionSystemChronoMulticore.

◆ RayHit() [1/2]

bool chrono::collision::ChCollisionSystemChrono::RayHit ( const ChVector<> &  from,
const ChVector<> &  to,
ChCollisionModel model,
ChRayhitResult result 
) const
overridevirtual

Perform a ray-hit test with the specified collision model.

Currently not implemented.

Implements chrono::collision::ChCollisionSystem.

◆ RayHit() [2/2]

bool chrono::collision::ChCollisionSystemChrono::RayHit ( const ChVector<> &  from,
const ChVector<> &  to,
ChRayhitResult result 
) const
overridevirtual

Perform a ray-hit test with all collision models.

Currently not implemented.

Implements chrono::collision::ChCollisionSystem.

◆ Remove()

void chrono::collision::ChCollisionSystemChrono::Remove ( ChCollisionModel model)
overridevirtual

Remove a collision model from the collision engine.

Currently not implemented.

Implements chrono::collision::ChCollisionSystem.

Reimplemented in chrono::collision::ChCollisionSystemDistributed.

◆ ReportProximities()

virtual void chrono::collision::ChCollisionSystemChrono::ReportProximities ( ChProximityContainer mproximitycontainer)
inlineoverridevirtual

Fill in the provided proximity container with near point information after Run().

Not used.

Implements chrono::collision::ChCollisionSystem.

Reimplemented in chrono::collision::ChCollisionSystemChronoMulticore.

◆ SetBroadphaseGridDensity()

void chrono::collision::ChCollisionSystemChrono::SetBroadphaseGridDensity ( double  density)

Set a variable number of grid bins, such that there are roughly density collision shapes per bin.

By default, a fixed number of bins is used (see SetBroadphaseGridResolution).

◆ SetBroadphaseGridResolution()

void chrono::collision::ChCollisionSystemChrono::SetBroadphaseGridResolution ( const ChVector< int > &  num_bins)

Set a fixed number of grid bins (default 10x10x10).

This is the default setting; to continuously adjust the number of bins, use SetBroadphaseGridSize or SetBroadphaseGridDensity.

◆ SetBroadphaseGridSize()

void chrono::collision::ChCollisionSystemChrono::SetBroadphaseGridSize ( const ChVector<> &  bin_size)

Set a variable number of grids, such that each bin has roughly the specified size.

By default, a fixed grid resolution is used (see SetBroadphaseGridResolution).

◆ SetEnvelope()

void chrono::collision::ChCollisionSystemChrono::SetEnvelope ( double  envelope)

Set collision envelope for rigid shapes (default: ChCollisionModel::GetDefaultSuggestedEnvelope).

For stability of NSC contact, the envelope should be set to 5-10% of the smallest collision shape size (too large a value will slow down the narrowphase collision detection). The envelope is the amount by which each collision shape is inflated prior to performing the collision detection, in order to create contact constraints before shapes actually come in contact. This collision detection system uses a global envelope, used for all rigid shapes in the system.

◆ SetNarrowphaseAlgorithm()

void chrono::collision::ChCollisionSystemChrono::SetNarrowphaseAlgorithm ( ChNarrowphase::Algorithm  algorithm)

Set the narrowphase algorithm (default: ChNarrowphase::Algorithm::HYBRID).

The Chrono collision detection system provides several analytical collision detection algorithms, for particular pairs of shapes (see ChNarrowphasePRIMS). For general convex shapes, the collision system relies on the Minkovski Portal Refinement algorithm (see ChNarrowphaseMPR).


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