AGX Dynamics 2.41.1.2
Loading...
Searching...
No Matches
agxControl::EventSensor Class Reference

This is a sensor class that can be attached to an geometry in the simulation. More...

#include <EventSensor.h>

+ Inheritance diagram for agxControl::EventSensor:

Classes

struct  ContactInformation
 
class  EventPrioHolder
 
class  GeometryContactEventListener
 
struct  ParticleContactInformation
 Placeholder for information regarding the particle contacts. More...
 
class  ParticleContactListener
 

Public Types

typedef agx::Vector< agx::Physics::ParticlePairContactPtrParticlePairContactVector
 
typedef agx::List< EventPrioHolder< SensorEventRef > > SensorEventList
 
typedef std::map< agx::Uuid, EventPrioHolder< SensorEventRef > > SensorEvents
 
typedef agx::Vector< agxControl::SensorEvent * > SensorEventVector
 
enum  TriggerEventStages { SENSOR_PRE_STEP , SENSOR_POST_STEP }
 Defines the event execution states when the SensorEvents are executed during the timestep of the detected collision with the sensor. More...
 
- Public Types inherited from agxSDK::StepEventListener
enum  ActivationMask {
  STEP_NONE = 0x0 , PRE_COLLIDE = 0x1 , PRE_STEP = 0x2 , POST_STEP = 0x4 ,
  LAST_STEP = 0x8 , DEFAULT = PRE_STEP | POST_STEP , ALL = PRE_COLLIDE | PRE_STEP | POST_STEP | LAST_STEP
}
 Defines the event states for which a listener will be activated, a mask can be bitwise OR:ed from these members. More...
 
- Public Types inherited from agxSDK::EventListener
enum  Type { UNDEFINED_TYPE , STEP_EVENT_LISTENER , CONTACT_EVENT_LISTENER , GUI_EVENT_LISTENER }
 Type of EventListener. More...
 
- Public Types inherited from agx::Component
typedef Event2< Component *, Object * > ObjectEvent
 Event when adding removing child objects.
 
typedef Callback1< Object * > TraverseCallback
 
- Public Types inherited from agx::Object
typedef agx::observer_ptr< const EventEventConstObserver
 
typedef agx::ref_ptr< const EventEventConstRef
 
typedef agx::observer_ptr< EventEventObserver
 
typedef agx::Vector< EventObserverEventObserverVector
 
typedef agx::VectorPOD< Event * > EventPtrVector
 
typedef agx::ref_ptr< EventEventRef
 
typedef agx::Vector< EventRefEventRefVector
 

Public Member Functions

 EventSensor ()
 Default constructor.
 
 EventSensor (agxCollide::Geometry *geometry)
 Constructor that takes the geometry to couple the sensor too.
 
 EventSensor (agxCollide::Geometry *geometry, int priority)
 Constructor that takes the geometry to couple the sensor too.
 
 EventSensor (int priority)
 This constructor takes the priority of the internal contact sensors.
 
void addGroup (agx::UInt32 group)
 
void addGroup (const agx::Name &group)
 Functions for adding and removing collision groups.
 
virtual void addNotification () override
 This will execute when the sensor is inserted in the simulation.
 
bool addSensorEvent (SensorEvent *sEvent, int priority=0)
 Sets a sensor event to the sensor with a priority.
 
 AGXSTREAM_DECLARE_SERIALIZABLE_BASE (agxControl::EventSensor)
 
bool containsSensorEvent (SensorEvent *sEvent)
 Checks if a sensor event already exists in the sensor.
 
int getCollisionMask ()
 
agx::UInt32Vector getContactingParticleIds ()
 
bool getEnableBlocker ()
 
agxCollide::GeometrygetGeometry ()
 Get the geometry of the sensor.
 
agxCollide::GeometrygetGeometry () const
 
agx::Real getNumParticleParticleContactsInSensor ()
 
agx::Real getNumParticlesInSensor () const
 
agx::UInt getNumRemovedBodies () const
 
agx::UInt getNumRemovedParticles () const
 
const ParticlePairContactVectorgetParticlePairContactsInSensor ()
 Returns the current particle-particle contacts in the sensor geometry.
 
agx::UInt32Vector getParticlesInsideSensor ()
 
agx::Real getRemovedBodyMass () const
 
agx::Real getRemovedParticleMass () const
 
agx::UInt32Vector getRemovedParticles ()
 Get the particles removed by this sensor during the last timestep.
 
agx::RigidBodyPtrVector getRigidBodiesInsideSensor (bool onlyRigidBodyDEM=false)
 
SensorEventgetSensorEvent (const agx::Uuid &uuid)
 Returns a sensor event with the given uuid if there exists one in the sensor.
 
SensorEventVector getSensorEvents ()
 Returns the SensorEvents currently active in the Sensor in the order of execution priority.
 
agx::Real getTotalRemovedMass () const
 
int getTriggerFlag ()
 
bool hasGroup (agx::UInt32 group)
 
bool hasGroup (const agx::Name &group)
 
bool hasOnlyReference ()
 Checks if the sensor keeps the only reference to its internal contact listener. Used in unittest.
 
bool isForbiddenGeometry (agxCollide::Geometry *geom)
 Check if the geometry is marked as forbidden by a sensor in this time step.
 
bool isForbiddenParticle (agx::UInt32 particle)
 Check if the particle is marked as forbidden by a sensor in this time step.
 
virtual void post (const agx::TimeStamp &time) override
 Called after a step is taken in the simulation Implement this method in the derived class to get callbacks.
 
virtual void pre (const agx::TimeStamp &time) override
 Called before a step is taken in the simulation Implement this method in the derived class to get callbacks.
 
virtual void preCollide (const agx::TimeStamp &time) override
 Called before collision detection is performed in the simulation Implement this method in the derived class to get callbacks.
 
void removeAllGroups ()
 
void removeGroup (agx::UInt32 group)
 
void removeGroup (const agx::Name &group)
 
virtual void removeNotification () override
 This function will execute when the sensor is removed form the simulation.
 
bool removeSensorEvent (SensorEvent *sEvent)
 Removes a sensor event in the sensor.
 
void setCollisionMask (int mask)
 Set/get the collision mask for the sensor.
 
void setEnableBlocker (bool isBlocker)
 Set the sensor to block the contact from other sensors.
 
void setGeometry (agxCollide::Geometry *geometry)
 Sets the geometry of the sensor.
 
void setTriggerFlag (int flag)
 Set/get the trigger flag to control when the events will be executed during the time-step of contact detection.
 
bool wasParticleRemovedBySensor (agx::UInt32 particle)
 Check if the particle has been marked as removed by any of the sensor's operations.
 
bool wasRigidBodyRemovedBySensor (agx::UInt32 rigidBody)
 Check if the particle has been marked as removed by any of the sensor's operations.
 
- Public Member Functions inherited from agxSDK::StepEventListener
 StepEventListener (int mask=DEFAULT)
 Default constructor, sets the default activation mask to all (POST_STEP and PRE_STEP) events.
 
 AGXSTREAM_DECLARE_SERIALIZABLE_BASE (agxSDK::StepEventListener)
 
virtual void last (const agx::TimeStamp &time)
 Called after a step is taken in the simulation Implement this method in the derived class to get callbacks.
 
virtual void post (const agx::TimeStamp &time)
 Called after a step is taken in the simulation Implement this method in the derived class to get callbacks.
 
virtual void pre (const agx::TimeStamp &time)
 Called before a step is taken in the simulation Implement this method in the derived class to get callbacks.
 
virtual void preCollide (const agx::TimeStamp &time)
 Called before collision detection is performed in the simulation Implement this method in the derived class to get callbacks.
 
virtual void setMask (int mask) override
 Specifies a bitmask which determines which event types will activate this listener.
 
- Public Member Functions inherited from agxSDK::EventListener
virtual void addNotification ()
 Called when this listener is added to the simulation.
 
 AGXSTREAM_DECLARE_SERIALIZABLE_BASE (agxSDK::EventListener)
 
int getMask () const
 
agx::UInt32 getPriority () const
 
SimulationgetSimulation ()
 
const SimulationgetSimulation () const
 
Type getType () const
 
bool isEnabled () const
 
virtual void removeNotification ()
 Called when this listener is removed from the simulation.
 
void setEnable (bool enable)
 Specify whether the listener should react at all at events.
 
virtual void setMask (int f)
 Specifies a bit mask which determines which event types that will activate this listener.
 
- Public Member Functions inherited from agx::Component
 Component (const agx::Name &name=agx::Name(), agx::Model *model=agx::Component::ClassModel(), agx::Device *device=nullptr)
 
virtual void addObject (agx::Object *object, bool assignContext=true)
 Add an object to the component.
 
virtual String autoComplete (const String &partialName, StringVector &matchingNames) const
 
virtual void buildNavigationTree (agxJson::Value &eNode) const override
 
void configure (Model *model)
 
virtual void configure (TiXmlElement *eComponent) override
 
agx::DevicegetDevice ()
 
template<typename T >
T * getDevice ()
 
const agx::DevicegetDevice () const
 
template<typename T >
const T * getDevice () const
 
size_t getNumObjects (const agx::Name &name) const
 
agx::ObjectgetObject (const agx::Name &name, agx::Model *model, size_t index=0)
 
const agx::ObjectgetObject (const agx::Name &name, agx::Model *model, size_t index=0) const
 
agx::ObjectgetObject (const agx::Name &name, size_t index=0)
 
template<typename T >
T * getObject (const agx::Name &name, size_t index=0)
 
const agx::ObjectgetObject (const agx::Name &name, size_t index=0) const
 
template<typename T >
const T * getObject (const agx::Name &name, size_t index=0) const
 
const agx::ObjectRefVectorgetObjects () const
 
template<typename T >
void getObjects (agx::ObjectPtrVector &result, bool recursive=false) const
 
void getObjects (agx::ObjectPtrVector &result, const agx::Model *model, bool recursive=false) const
 
virtual ObjectgetResourceImpl (const Path &path, agx::Model *model) override
 
virtual void printSubtree () const override
 
void printSubtree (std::ostream &stream, int depth=0) const
 
virtual void rebind () override
 
void removeAllObjects ()
 Remove all components.
 
virtual void removeObject (agx::Object *object)
 Remove an object from the component.
 
void removeObject (const agx::Name &name, size_t index=0)
 Remove an object with a specified name (and optional index) from the component.
 
virtual void snapshot (TiXmlNode *eParent, const String &directory) const override
 
void traverse (ComponentVisitor *)
 
void traverse (const TraverseCallback &callback)
 
- Public Member Functions inherited from agx::Object
 Object (const Name &name=Name(), Model *model=Object::ClassModel())
 
void addListener (EventListener *listener)
 
virtual void buildNavigationTree (agxJson::Value &eNode) const
 
virtual void configure (TiXmlElement *)
 
agx::String fullName () const
 
agx::String fullPath () const
 
agx::String fullPath (const agx::Object *root) const
 
template<typename T >
T * getAutoScopedResource (const agx::Path &path)
 
template<typename T >
const T * getAutoScopedResource (const agx::Path &path) const
 
agx::ObjectgetAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr)
 
const agx::ObjectgetAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr) const
 
agx::ObjectgetContext ()
 
template<typename T >
T * getContext ()
 
const agx::ObjectgetContext () const
 
template<typename T >
const T * getContext () const
 
agx::UInt32 getId () const
 
const agx::NamegetImplementationName () const
 
agx::ModelgetModel ()
 
const agx::ModelgetModel () const
 
const agx::NamegetName () const
 
agx::ObjectgetNextSibling ()
 
const agx::ObjectgetNextSibling () const
 
agx::Path getPath () const
 
agx::Path getPath (const agx::Object *root) const
 
template<typename T >
T * getResource (const agx::Path &path)
 
template<typename T >
const T * getResource (const agx::Path &path) const
 
agx::ObjectgetResource (const agx::Path &path, agx::Model *model=nullptr)
 
const agx::ObjectgetResource (const agx::Path &path, agx::Model *model=nullptr) const
 
virtual agx::ObjectgetResourceImpl (const agx::Path &path, agx::Model *model)
 
agx::ObjectgetRootContext ()
 
const agx::ObjectgetRootContext () const
 
bool hasListener (EventListener *listener)
 
bool hasParent (const agx::Object *node) const
 
bool isUnique () const
 
virtual void printSubtree () const
 
virtual void rebind ()
 
void removeListener (EventListener *listener)
 
virtual void save (TiXmlElement *) const
 
virtual void setContext (agx::Object *context)
 
void setId (UInt32 id)
 
void setModel (agx::Model *model)
 Set the object model (handled automatically).
 
void setName (const agx::Name &name)
 Set the name of the object.
 
virtual void snapshot (TiXmlNode *, const String &) const
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referencedoperator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Static Public Member Functions

static agxStream::Serializablecreate (agxStream::InputArchive &)
 
- Static Public Member Functions inherited from agxSDK::StepEventListener
static agxStream::Serializablecreate (agxStream::InputArchive &)
 
- Static Public Member Functions inherited from agxSDK::EventListener
static agxStream::Serializablecreate (agxStream::InputArchive &)
 
- Static Public Member Functions inherited from agx::Component
static Component_load (TiXmlElement *eComponent, Device *device)
 
static agx::ModelClassModel ()
 
static Componentload (const Path &path, const Name &implementation, Device *device, const Path &_namespace=Path())
 
static Componentload (const String &path, const Path &_namespace=Path())
 
static Componentload (const String &path, Device *device, const Path &_namespace=Path())
 
static Componentload (TiXmlElement *eComponent, Device *device)
 
- Static Public Member Functions inherited from agx::Object
static agx::ModelClassModel ()
 
static agx::String generateName (const agx::String &bindPath)
 
static const HashSet< Object * > & getActiveObjects ()
 
static bool getEnableRebind ()
 Should rebinding be allowed? Right now a global setting.
 
static Objectload (const String &path, Device *device, const String &type, const String &attribute, const String &value)
 
template<typename T >
static T * load (const String &path, Device *device, const String &type, const String &attribute, const String &value)
 
static Objectload (const String &path, Device *device, const String &type="", size_t instance=0)
 
template<typename T >
static T * load (const String &path, Device *device, const String &type="", size_t instance=0)
 
static void load (const String &path, Device *device, ObjectPtrVector &loadedObjects)
 
static Objectload (TiXmlElement *eObject, Device *device)
 
template<typename T >
static T * load (TiXmlElement *eObject, Device *device)
 
static TiXmlDocument openDocument (const String &path)
 
static void setEnableRebind (bool flag)
 Sets if rebinding of objects should be allowed (Right now a global setting).
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.
 

Public Attributes

SensorEventList m_sensorEventList
 
SensorEvents m_sensorEvents
 
- Public Attributes inherited from agx::Component
ObjectEvent addObjectEvent
 
ObjectEvent removeObjectEvent
 

Protected Types

typedef agx::observer_ptr< const GeometryContactEventListenerGeometryContactEventListenerConstObserver
 
typedef agx::ref_ptr< const GeometryContactEventListenerGeometryContactEventListenerConstRef
 
typedef agx::observer_ptr< GeometryContactEventListenerGeometryContactEventListenerObserver
 
typedef agx::Vector< GeometryContactEventListenerObserverGeometryContactEventListenerObserverVector
 
typedef agx::VectorPOD< GeometryContactEventListener * > GeometryContactEventListenerPtrVector
 
typedef agx::ref_ptr< GeometryContactEventListenerGeometryContactEventListenerRef
 
typedef agx::Vector< GeometryContactEventListenerRefGeometryContactEventListenerRefVector
 
typedef agx::Vector< ContactInformationGeometryContactQueue
 
typedef agx::observer_ptr< const ParticleContactListenerParticleContactListenerConstObserver
 
typedef agx::ref_ptr< const ParticleContactListenerParticleContactListenerConstRef
 
typedef agx::observer_ptr< ParticleContactListenerParticleContactListenerObserver
 
typedef agx::Vector< ParticleContactListenerObserverParticleContactListenerObserverVector
 
typedef agx::VectorPOD< ParticleContactListener * > ParticleContactListenerPtrVector
 
typedef agx::ref_ptr< ParticleContactListenerParticleContactListenerRef
 
typedef agx::Vector< ParticleContactListenerRefParticleContactListenerRefVector
 
typedef agx::Vector< ParticleContactInformationParticleContactQueue
 

Protected Member Functions

virtual ~EventSensor ()
 Destructor.
 
void clearContactInformation ()
 
void constructSortedEventList ()
 
bool contactIsValid (agxCollide::GeometryContact *cd)
 
void executeSensorEvents (const agx::TimeStamp &t)
 
agx::RigidBodygetContactingRigidBody (agxCollide::GeometryContact *cd) const
 
SensorEventgetSensorEventFromName (const agx::Name &name)
 
void init ()
 
bool particleContactIsValid (const agx::TimeStamp &t, agx::Physics::ParticleGeometryContactInstance contact, agx::Physics::ParticleData &particleData, agx::Physics::GeometryData &geometryData)
 
void refreshParticlesInsideSensorData ()
 
void refreshRigidBodiesInsideSensorData ()
 
void signalGeometryContact (const agx::TimeStamp &t, agxCollide::GeometryContact *cd)
 
void signalParticleContact (const agx::TimeStamp &t, agx::Physics::ParticleGeometryContactInstance contact, agx::Physics::ParticleData &particleData, agx::Physics::GeometryData &geometryData)
 
void triggerContactEvents ()
 
void triggerEventAddNotification ()
 
void triggerEvents ()
 
void triggerEventsOnContact (const agx::TimeStamp &t, agxCollide::GeometryContact *cd)
 
void triggerParticleEvents ()
 
void triggerParticleEventsOnContact (const agx::TimeStamp &t, agx::Physics::ParticleGeometryContactInstance contact, agx::Physics::ParticleData &particleData, agx::Physics::GeometryData &geometryData)
 
void triggerPostContactHandling ()
 
void tryTriggerEventsOnContact (const agx::TimeStamp &t, agxCollide::GeometryContact *cd)
 
void tryTriggerParticleEventsOnContact (const agx::TimeStamp &t, agx::Physics::ParticleGeometryContactInstance contact, agx::Physics::ParticleData &particleData, agx::Physics::GeometryData &geometryData)
 
void updateSensorEvents (const agx::TimeStamp &t)
 
- Protected Member Functions inherited from agxSDK::StepEventListener
virtual ~StepEventListener ()
 Destructor.
 
- Protected Member Functions inherited from agxSDK::EventListener
 EventListener (Type type=UNDEFINED_TYPE)
 Default constructor.
 
virtual ~EventListener ()
 Destructor.
 
void setSimulation (Simulation *simulation)
 Set the associated simulation for this EventListener.
 
- Protected Member Functions inherited from agx::Component
virtual ~Component ()
 
String expandAutoCompletionMatch (const String &query, const StringVector &matchingNames) const
 
void setDevice (Device *device)
 
- Protected Member Functions inherited from agx::Object
virtual ~Object ()
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor.
 
 Serializable (const Serializable &other)
 Copy constructor.
 
void generateUuid ()
 

Protected Attributes

bool hasComputedParticlePairContactsInSensor
 Vector that stores particle pair contacts. Will only be computed if the user asks for it (getParticlePairContactsInSensor)
 
int m_collisionMask
 Get the collision mask for the sensor.
 
GeometryContactEventListenerRef m_contactListener
 Listeners that are coupled with the sensor.
 
agxSDK::CollisionGroupFilterRef m_filter
 The collision group filter coupled with the ContactEventListener.
 
GeometryContactQueue m_geomContactQueue
 Queues for the contacts.
 
agxCollide::Geometrym_geometry
 The coupled geometry of the sensor.
 
bool m_geometryCollision
 
bool m_isBlocker
 True if the sensor should block the contact from other sensors in the scene under the same timestep.
 
agx::UInt m_numRemovedBodies
 
agx::UInt m_numRemovedParticles
 
bool m_particleCollision
 Flags for doing when there is a collision for a particle or geometry.
 
ParticleContactListenerRef m_particleContactListener
 
ParticleContactQueue m_particleContactQueue
 
ParticlePairContactVector m_particlePairContacts
 
agx::HashSet< agx::UInt32m_particlesInSensor
 Holds a set of the current particle id:s that are present in the sensor.
 
agx::HashSet< agx::UInt32m_particlesInsideSensor
 Holds a set of the current particle id:s whose midpoint is inside the sensor.
 
int m_priority
 Priority of the sensor over all the other sensors.
 
agx::HashSet< agx::UInt32m_removedBodies
 Holds a set of the current particles and bodies that have been marked as removed by an Operation during the time step.
 
agx::Real m_removedBodyMass
 
agx::Real m_removedParticleMass
 
agx::HashSet< agx::UInt32m_removedParticles
 
agx::HashSet< agx::RigidBody * > m_rigidBodiesContactingSensor
 Holds pointers to the current rigid bodies (DEM Objects) in the sensor.
 
agx::HashSet< agx::RigidBody * > m_rigidBodiesInsideSensor
 Holds pointers to the current rigid bodies (DEM Objects) where the midpoint is INSIDE the sensor.
 
int m_triggerFlag
 Flag for when the events are supposed to be executed during the time-step.
 
- Protected Attributes inherited from agxSDK::EventListener
bool m_enabled
 
int m_mask
 
agx::UInt32 m_priority
 
Type m_type
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Static Protected Attributes

static agxCollide::GeometryPtrVector g_forbiddenGeometries
 
static agx::UInt32Vector g_forbiddenParticles
 

Additional Inherited Members

- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandlergetDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 

Detailed Description

This is a sensor class that can be attached to an geometry in the simulation.

When a collision is detected, according to the set rules of activation for the sensor, it will start to execute SensorEvents in a prioritized order. These sensor events can either modify the simulation or record data.

Definition at line 47 of file EventSensor.h.

Member Typedef Documentation

◆ GeometryContactEventListenerConstObserver

◆ GeometryContactEventListenerConstRef

◆ GeometryContactEventListenerObserver

◆ GeometryContactEventListenerObserverVector

◆ GeometryContactEventListenerPtrVector

◆ GeometryContactEventListenerRef

◆ GeometryContactEventListenerRefVector

◆ GeometryContactQueue

◆ ParticleContactListenerConstObserver

◆ ParticleContactListenerConstRef

◆ ParticleContactListenerObserver

◆ ParticleContactListenerObserverVector

◆ ParticleContactListenerPtrVector

◆ ParticleContactListenerRef

◆ ParticleContactListenerRefVector

◆ ParticleContactQueue

◆ ParticlePairContactVector

◆ SensorEventList

◆ SensorEvents

◆ SensorEventVector

Member Enumeration Documentation

◆ TriggerEventStages

Defines the event execution states when the SensorEvents are executed during the timestep of the detected collision with the sensor.

Enumerator
SENSOR_PRE_STEP 

Triggered in a PRE solve/integration step.

SENSOR_POST_STEP 

Triggered in a POST solve/integration step.

Definition at line 62 of file EventSensor.h.

Constructor & Destructor Documentation

◆ EventSensor() [1/4]

agxControl::EventSensor::EventSensor ( )

Default constructor.

◆ EventSensor() [2/4]

agxControl::EventSensor::EventSensor ( int  priority)

This constructor takes the priority of the internal contact sensors.

Parameters
priority- Priority of the internal contact listeners

◆ EventSensor() [3/4]

agxControl::EventSensor::EventSensor ( agxCollide::Geometry geometry)

Constructor that takes the geometry to couple the sensor too.

Parameters
geometryThe geometry that the sensor will register all the contacts from

◆ EventSensor() [4/4]

agxControl::EventSensor::EventSensor ( agxCollide::Geometry geometry,
int  priority 
)

Constructor that takes the geometry to couple the sensor too.

All collision on the geometry will be registered by the sensor.

Parameters
geometryThe geometry that the sensor will register all the contacts from
priority- Priority of the internal contact listeners

◆ ~EventSensor()

virtual agxControl::EventSensor::~EventSensor ( )
protectedvirtual

Destructor.

Member Function Documentation

◆ addGroup() [1/2]

void agxControl::EventSensor::addGroup ( agx::UInt32  group)

◆ addGroup() [2/2]

void agxControl::EventSensor::addGroup ( const agx::Name group)

Functions for adding and removing collision groups.

◆ addNotification()

virtual void agxControl::EventSensor::addNotification ( )
overridevirtual

This will execute when the sensor is inserted in the simulation.

It will add its contactListeners for particles and geometries.

Reimplemented from agxSDK::EventListener.

◆ addSensorEvent()

bool agxControl::EventSensor::addSensorEvent ( SensorEvent sEvent,
int  priority = 0 
)

Sets a sensor event to the sensor with a priority.

Parameters
sEventThe SensorEvent
priorityThe priority of the SensorEvent

◆ AGXSTREAM_DECLARE_SERIALIZABLE_BASE()

agxControl::EventSensor::AGXSTREAM_DECLARE_SERIALIZABLE_BASE ( agxControl::EventSensor  )

◆ clearContactInformation()

void agxControl::EventSensor::clearContactInformation ( )
protected

◆ constructSortedEventList()

void agxControl::EventSensor::constructSortedEventList ( )
protected

◆ contactIsValid()

bool agxControl::EventSensor::contactIsValid ( agxCollide::GeometryContact cd)
protected

◆ containsSensorEvent()

bool agxControl::EventSensor::containsSensorEvent ( SensorEvent sEvent)

Checks if a sensor event already exists in the sensor.

Parameters
sEventThe SensorEvent to be checked

◆ create()

static agxStream::Serializable * agxControl::EventSensor::create ( agxStream::InputArchive )
inlinestatic

Definition at line 348 of file EventSensor.h.

◆ executeSensorEvents()

void agxControl::EventSensor::executeSensorEvents ( const agx::TimeStamp t)
protected

◆ getCollisionMask()

int agxControl::EventSensor::getCollisionMask ( )
Returns
the collision mask for the sensor. This will determine what type of contacts that it will listen to

◆ getContactingParticleIds()

agx::UInt32Vector agxControl::EventSensor::getContactingParticleIds ( )

◆ getContactingRigidBody()

agx::RigidBody * agxControl::EventSensor::getContactingRigidBody ( agxCollide::GeometryContact cd) const
protected

◆ getEnableBlocker()

bool agxControl::EventSensor::getEnableBlocker ( )
Returns
true if sensor will block contact from other sensors

◆ getGeometry() [1/2]

agxCollide::Geometry * agxControl::EventSensor::getGeometry ( )

Get the geometry of the sensor.

◆ getGeometry() [2/2]

agxCollide::Geometry * agxControl::EventSensor::getGeometry ( ) const

◆ getNumParticleParticleContactsInSensor()

agx::Real agxControl::EventSensor::getNumParticleParticleContactsInSensor ( )

◆ getNumParticlesInSensor()

agx::Real agxControl::EventSensor::getNumParticlesInSensor ( ) const

◆ getNumRemovedBodies()

agx::UInt agxControl::EventSensor::getNumRemovedBodies ( ) const
Returns
the number of removed rigid bodies by the sensor.

◆ getNumRemovedParticles()

agx::UInt agxControl::EventSensor::getNumRemovedParticles ( ) const
Returns
the number of removed particles by the sensor.

◆ getParticlePairContactsInSensor()

const ParticlePairContactVector & agxControl::EventSensor::getParticlePairContactsInSensor ( )

Returns the current particle-particle contacts in the sensor geometry.

◆ getParticlesInsideSensor()

agx::UInt32Vector agxControl::EventSensor::getParticlesInsideSensor ( )

◆ getRemovedBodyMass()

agx::Real agxControl::EventSensor::getRemovedBodyMass ( ) const
Returns
the amount of Rigid Body mass removed by the sensor.

◆ getRemovedParticleMass()

agx::Real agxControl::EventSensor::getRemovedParticleMass ( ) const
Returns
the amount of particle mass removed by the sensor.

◆ getRemovedParticles()

agx::UInt32Vector agxControl::EventSensor::getRemovedParticles ( )

Get the particles removed by this sensor during the last timestep.

◆ getRigidBodiesInsideSensor()

agx::RigidBodyPtrVector agxControl::EventSensor::getRigidBodiesInsideSensor ( bool  onlyRigidBodyDEM = false)

◆ getSensorEvent()

SensorEvent * agxControl::EventSensor::getSensorEvent ( const agx::Uuid uuid)

Returns a sensor event with the given uuid if there exists one in the sensor.

◆ getSensorEventFromName()

SensorEvent * agxControl::EventSensor::getSensorEventFromName ( const agx::Name name)
protected

◆ getSensorEvents()

SensorEventVector agxControl::EventSensor::getSensorEvents ( )

Returns the SensorEvents currently active in the Sensor in the order of execution priority.

◆ getTotalRemovedMass()

agx::Real agxControl::EventSensor::getTotalRemovedMass ( ) const
Returns
the total amount of mass removed from the sensor.

◆ getTriggerFlag()

int agxControl::EventSensor::getTriggerFlag ( )
Returns
the trigger flag to control when the events will be executed during the time-step of contact detection

◆ hasGroup() [1/2]

bool agxControl::EventSensor::hasGroup ( agx::UInt32  group)

◆ hasGroup() [2/2]

bool agxControl::EventSensor::hasGroup ( const agx::Name group)

◆ hasOnlyReference()

bool agxControl::EventSensor::hasOnlyReference ( )

Checks if the sensor keeps the only reference to its internal contact listener. Used in unittest.

◆ init()

void agxControl::EventSensor::init ( )
protected

◆ isForbiddenGeometry()

bool agxControl::EventSensor::isForbiddenGeometry ( agxCollide::Geometry geom)

Check if the geometry is marked as forbidden by a sensor in this time step.

◆ isForbiddenParticle()

bool agxControl::EventSensor::isForbiddenParticle ( agx::UInt32  particle)

Check if the particle is marked as forbidden by a sensor in this time step.

◆ particleContactIsValid()

bool agxControl::EventSensor::particleContactIsValid ( const agx::TimeStamp t,
agx::Physics::ParticleGeometryContactInstance  contact,
agx::Physics::ParticleData &  particleData,
agx::Physics::GeometryData &  geometryData 
)
protected

◆ post()

virtual void agxControl::EventSensor::post ( const agx::TimeStamp time)
overridevirtual

Called after a step is taken in the simulation Implement this method in the derived class to get callbacks.

Parameters
time- the current simulation time

Reimplemented from agxSDK::StepEventListener.

◆ pre()

virtual void agxControl::EventSensor::pre ( const agx::TimeStamp time)
overridevirtual

Called before a step is taken in the simulation Implement this method in the derived class to get callbacks.

Parameters
time- the current simulation time

Reimplemented from agxSDK::StepEventListener.

◆ preCollide()

virtual void agxControl::EventSensor::preCollide ( const agx::TimeStamp time)
overridevirtual

Called before collision detection is performed in the simulation Implement this method in the derived class to get callbacks.

Parameters
time- the current simulation time

Reimplemented from agxSDK::StepEventListener.

◆ refreshParticlesInsideSensorData()

void agxControl::EventSensor::refreshParticlesInsideSensorData ( )
protected

◆ refreshRigidBodiesInsideSensorData()

void agxControl::EventSensor::refreshRigidBodiesInsideSensorData ( )
protected

◆ removeAllGroups()

void agxControl::EventSensor::removeAllGroups ( )

◆ removeGroup() [1/2]

void agxControl::EventSensor::removeGroup ( agx::UInt32  group)

◆ removeGroup() [2/2]

void agxControl::EventSensor::removeGroup ( const agx::Name group)

◆ removeNotification()

virtual void agxControl::EventSensor::removeNotification ( )
overridevirtual

This function will execute when the sensor is removed form the simulation.

It removes the sensor's contact event listeners from the simulation.

Reimplemented from agxSDK::EventListener.

◆ removeSensorEvent()

bool agxControl::EventSensor::removeSensorEvent ( SensorEvent sEvent)

Removes a sensor event in the sensor.

Parameters
sEventThe SensorEvent to be removed

◆ setCollisionMask()

void agxControl::EventSensor::setCollisionMask ( int  mask)

Set/get the collision mask for the sensor.

This will determine what type of contacts that it will listen to

◆ setEnableBlocker()

void agxControl::EventSensor::setEnableBlocker ( bool  isBlocker)

Set the sensor to block the contact from other sensors.

This will block the other sensors in the scene from detecting and responding to this contact under the rest of the time-step

◆ setGeometry()

void agxControl::EventSensor::setGeometry ( agxCollide::Geometry geometry)

Sets the geometry of the sensor.

◆ setTriggerFlag()

void agxControl::EventSensor::setTriggerFlag ( int  flag)

Set/get the trigger flag to control when the events will be executed during the time-step of contact detection.

◆ signalGeometryContact()

void agxControl::EventSensor::signalGeometryContact ( const agx::TimeStamp t,
agxCollide::GeometryContact cd 
)
protected

◆ signalParticleContact()

void agxControl::EventSensor::signalParticleContact ( const agx::TimeStamp t,
agx::Physics::ParticleGeometryContactInstance  contact,
agx::Physics::ParticleData &  particleData,
agx::Physics::GeometryData &  geometryData 
)
protected

◆ triggerContactEvents()

void agxControl::EventSensor::triggerContactEvents ( )
protected

◆ triggerEventAddNotification()

void agxControl::EventSensor::triggerEventAddNotification ( )
protected

◆ triggerEvents()

void agxControl::EventSensor::triggerEvents ( )
protected

◆ triggerEventsOnContact()

void agxControl::EventSensor::triggerEventsOnContact ( const agx::TimeStamp t,
agxCollide::GeometryContact cd 
)
protected

◆ triggerParticleEvents()

void agxControl::EventSensor::triggerParticleEvents ( )
protected

◆ triggerParticleEventsOnContact()

void agxControl::EventSensor::triggerParticleEventsOnContact ( const agx::TimeStamp t,
agx::Physics::ParticleGeometryContactInstance  contact,
agx::Physics::ParticleData &  particleData,
agx::Physics::GeometryData &  geometryData 
)
protected

◆ triggerPostContactHandling()

void agxControl::EventSensor::triggerPostContactHandling ( )
protected

◆ tryTriggerEventsOnContact()

void agxControl::EventSensor::tryTriggerEventsOnContact ( const agx::TimeStamp t,
agxCollide::GeometryContact cd 
)
protected

◆ tryTriggerParticleEventsOnContact()

void agxControl::EventSensor::tryTriggerParticleEventsOnContact ( const agx::TimeStamp t,
agx::Physics::ParticleGeometryContactInstance  contact,
agx::Physics::ParticleData &  particleData,
agx::Physics::GeometryData &  geometryData 
)
protected

◆ updateSensorEvents()

void agxControl::EventSensor::updateSensorEvents ( const agx::TimeStamp t)
protected

◆ wasParticleRemovedBySensor()

bool agxControl::EventSensor::wasParticleRemovedBySensor ( agx::UInt32  particle)

Check if the particle has been marked as removed by any of the sensor's operations.

◆ wasRigidBodyRemovedBySensor()

bool agxControl::EventSensor::wasRigidBodyRemovedBySensor ( agx::UInt32  rigidBody)

Check if the particle has been marked as removed by any of the sensor's operations.

Member Data Documentation

◆ g_forbiddenGeometries

agxCollide::GeometryPtrVector agxControl::EventSensor::g_forbiddenGeometries
staticprotected

Definition at line 57 of file EventSensor.h.

◆ g_forbiddenParticles

agx::UInt32Vector agxControl::EventSensor::g_forbiddenParticles
staticprotected

Definition at line 58 of file EventSensor.h.

◆ hasComputedParticlePairContactsInSensor

bool agxControl::EventSensor::hasComputedParticlePairContactsInSensor
protected

Vector that stores particle pair contacts. Will only be computed if the user asks for it (getParticlePairContactsInSensor)

Definition at line 555 of file EventSensor.h.

◆ m_collisionMask

int agxControl::EventSensor::m_collisionMask
protected

Get the collision mask for the sensor.

Definition at line 511 of file EventSensor.h.

◆ m_contactListener

GeometryContactEventListenerRef agxControl::EventSensor::m_contactListener
protected

Listeners that are coupled with the sensor.

Definition at line 524 of file EventSensor.h.

◆ m_filter

agxSDK::CollisionGroupFilterRef agxControl::EventSensor::m_filter
protected

The collision group filter coupled with the ContactEventListener.

Definition at line 517 of file EventSensor.h.

◆ m_geomContactQueue

GeometryContactQueue agxControl::EventSensor::m_geomContactQueue
protected

Queues for the contacts.

Definition at line 520 of file EventSensor.h.

◆ m_geometry

agxCollide::Geometry* agxControl::EventSensor::m_geometry
protected

The coupled geometry of the sensor.

Definition at line 514 of file EventSensor.h.

◆ m_geometryCollision

bool agxControl::EventSensor::m_geometryCollision
protected

Definition at line 552 of file EventSensor.h.

◆ m_isBlocker

bool agxControl::EventSensor::m_isBlocker
protected

True if the sensor should block the contact from other sensors in the scene under the same timestep.

Definition at line 548 of file EventSensor.h.

◆ m_numRemovedBodies

agx::UInt agxControl::EventSensor::m_numRemovedBodies
protected

Definition at line 545 of file EventSensor.h.

◆ m_numRemovedParticles

agx::UInt agxControl::EventSensor::m_numRemovedParticles
protected

Definition at line 544 of file EventSensor.h.

◆ m_particleCollision

bool agxControl::EventSensor::m_particleCollision
protected

Flags for doing when there is a collision for a particle or geometry.

Definition at line 551 of file EventSensor.h.

◆ m_particleContactListener

ParticleContactListenerRef agxControl::EventSensor::m_particleContactListener
protected

Definition at line 525 of file EventSensor.h.

◆ m_particleContactQueue

ParticleContactQueue agxControl::EventSensor::m_particleContactQueue
protected

Definition at line 521 of file EventSensor.h.

◆ m_particlePairContacts

ParticlePairContactVector agxControl::EventSensor::m_particlePairContacts
protected

Definition at line 556 of file EventSensor.h.

◆ m_particlesInSensor

agx::HashSet<agx::UInt32> agxControl::EventSensor::m_particlesInSensor
protected

Holds a set of the current particle id:s that are present in the sensor.

Definition at line 528 of file EventSensor.h.

◆ m_particlesInsideSensor

agx::HashSet<agx::UInt32> agxControl::EventSensor::m_particlesInsideSensor
protected

Holds a set of the current particle id:s whose midpoint is inside the sensor.

Definition at line 531 of file EventSensor.h.

◆ m_priority

int agxControl::EventSensor::m_priority
protected

Priority of the sensor over all the other sensors.

Definition at line 508 of file EventSensor.h.

◆ m_removedBodies

agx::HashSet<agx::UInt32> agxControl::EventSensor::m_removedBodies
protected

Holds a set of the current particles and bodies that have been marked as removed by an Operation during the time step.

Definition at line 540 of file EventSensor.h.

◆ m_removedBodyMass

agx::Real agxControl::EventSensor::m_removedBodyMass
protected

Definition at line 543 of file EventSensor.h.

◆ m_removedParticleMass

agx::Real agxControl::EventSensor::m_removedParticleMass
protected

Definition at line 542 of file EventSensor.h.

◆ m_removedParticles

agx::HashSet<agx::UInt32> agxControl::EventSensor::m_removedParticles
protected

Definition at line 541 of file EventSensor.h.

◆ m_rigidBodiesContactingSensor

agx::HashSet<agx::RigidBody*> agxControl::EventSensor::m_rigidBodiesContactingSensor
protected

Holds pointers to the current rigid bodies (DEM Objects) in the sensor.

Definition at line 534 of file EventSensor.h.

◆ m_rigidBodiesInsideSensor

agx::HashSet<agx::RigidBody*> agxControl::EventSensor::m_rigidBodiesInsideSensor
protected

Holds pointers to the current rigid bodies (DEM Objects) where the midpoint is INSIDE the sensor.

Definition at line 537 of file EventSensor.h.

◆ m_sensorEventList

SensorEventList agxControl::EventSensor::m_sensorEventList

Definition at line 401 of file EventSensor.h.

◆ m_sensorEvents

SensorEvents agxControl::EventSensor::m_sensorEvents

Definition at line 398 of file EventSensor.h.

◆ m_triggerFlag

int agxControl::EventSensor::m_triggerFlag
protected

Flag for when the events are supposed to be executed during the time-step.

Definition at line 505 of file EventSensor.h.


The documentation for this class was generated from the following file: