AGX Dynamics  2.35.0.1
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::ParticlePairContactPtr > ParticlePairContactVector
 
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. More...
 
typedef Callback1< Object * > TraverseCallback
 
- Public Types inherited from agx::Object
typedef agx::observer_ptr< const Event > EventConstObserver
 
typedef agx::ref_ptr< const Event > EventConstRef
 
typedef agx::observer_ptr< Event > EventObserver
 
typedef agx::Vector< EventObserver > EventObserverVector
 
typedef agx::VectorPOD< Event * > EventPtrVector
 
typedef agx::ref_ptr< Event > EventRef
 
typedef agx::Vector< EventRef > EventRefVector
 

Public Member Functions

 EventSensor ()
 Default constructor. More...
 
 EventSensor (agxCollide::Geometry *geometry)
 Constructor that takes the geometry to couple the sensor too. More...
 
 EventSensor (agxCollide::Geometry *geometry, int priority)
 Constructor that takes the geometry to couple the sensor too. More...
 
 EventSensor (int priority)
 This constructor takes the priority of the internal contact sensors. More...
 
void addGroup (agx::UInt32 group)
 
void addGroup (const agx::Name &group)
 Functions for adding and removing collision groups. More...
 
virtual void addNotification () override
 This will execute when the sensor is inserted in the simulation. More...
 
bool addSensorEvent (SensorEvent *sEvent, int priority=0)
 Sets a sensor event to the sensor with a priority. More...
 
bool containsSensorEvent (SensorEvent *sEvent)
 Checks if a sensor event already exists in the sensor. More...
 
const char * getClassName () const override
 
int getCollisionMask ()
 
agx::UInt32Vector getContactingParticleIds ()
 
bool getEnableBlocker ()
 
agxCollide::Geometry * getGeometry ()
 Get the geometry of the sensor. More...
 
agxCollide::Geometry * getGeometry () const
 
agx::Real getNumParticleParticleContactsInSensor ()
 
agx::Real getNumParticlesInSensor () const
 
const ParticlePairContactVector & getParticlePairContactsInSensor ()
 Returns the current particle-particle contacts in the sensor geometry. More...
 
agx::UInt32Vector getParticlesInsideSensor ()
 
agx::RigidBodyPtrVector getRigidBodiesInsideSensor (bool onlyRigidBodyDEM=false)
 
SensorEvent * getSensorEvent (const agx::Uuid &uuid)
 Returns a sensor event with the given uuid if there exists one in the sensor. More...
 
SensorEventVector getSensorEvents ()
 Returns the SensorEvents currently active in the Sensor in the order of execution priority. More...
 
agxStream::StorageAgent * getStorageAgent () const override
 
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. More...
 
bool isForbiddenGeometry (agxCollide::Geometry *geom)
 Check if the geometry is marked as forbidden by a sensor in this time step. More...
 
bool isForbiddenParticle (agx::UInt32 particle)
 Check if the particle is marked as forbidden by a sensor in this time step. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
bool removeSensorEvent (SensorEvent *sEvent)
 Removes a sensor event in the sensor. More...
 
virtual void restore (agxStream::InputArchive &in) override
 
void setCollisionMask (int mask)
 Set/get the collision mask for the sensor. More...
 
void setEnableBlocker (bool isBlocker)
 Set the sensor to block the contact from other sensors. More...
 
void setGeometry (agxCollide::Geometry *geometry)
 Sets the geometry of the sensor. More...
 
void setTriggerFlag (int flag)
 Set/get the trigger flag to control when the events will be executed during the time-step of contact detection. More...
 
virtual void store (agxStream::OutputArchive &out) const override
 
- 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. More...
 
const char * getClassName () const override
 
agxStream::StorageAgent * getStorageAgent () const override
 
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. More...
 
virtual void setMask (int mask) override
 Specifies a bitmask which determines which event types will activate this listener. More...
 
- Public Member Functions inherited from agxSDK::EventListener
int getMask () const
 
agx::UInt32 getPriority () const
 
Simulation * getSimulation ()
 
const Simulation * getSimulation () const
 
Type getType () const
 
bool isEnabled () const
 
void setEnable (bool enable)
 Specify whether the listener should react at all at events. More...
 
- 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. More...
 
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::Device * getDevice ()
 
template<typename T >
T * getDevice ()
 
const agx::Device * getDevice () const
 
template<typename T >
const T * getDevice () const
 
size_t getNumObjects (const agx::Name &name) const
 
agx::Object * getObject (const agx::Name &name, agx::Model *model, size_t index=0)
 
const agx::Object * getObject (const agx::Name &name, agx::Model *model, size_t index=0) const
 
agx::Object * getObject (const agx::Name &name, size_t index=0)
 
template<typename T >
T * getObject (const agx::Name &name, size_t index=0)
 
const agx::Object * getObject (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::ObjectRefVector & getObjects () 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 Object * getResourceImpl (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. More...
 
virtual void removeObject (agx::Object *object)
 Remove an object from the component. More...
 
void removeObject (const agx::Name &name, size_t index=0)
 Remove an object with a specified name (and optional index) from the component. More...
 
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)
 
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::Object * getAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr)
 
const agx::Object * getAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr) const
 
agx::Object * getContext ()
 
template<typename T >
T * getContext ()
 
const agx::Object * getContext () const
 
template<typename T >
const T * getContext () const
 
agx::UInt32 getId () const
 
const agx::Name & getImplementationName () const
 
agx::Model * getModel ()
 
const agx::Model * getModel () const
 
const agx::Name & getName () const
 
agx::Object * getNextSibling ()
 
const agx::Object * getNextSibling () 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::Object * getResource (const agx::Path &path, agx::Model *model=nullptr)
 
const agx::Object * getResource (const agx::Path &path, agx::Model *model=nullptr) const
 
agx::Object * getRootContext ()
 
const agx::Object * getRootContext () const
 
bool hasListener (EventListener *listener)
 
bool hasParent (const agx::Object *node) const
 
bool isUnique () const
 
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). More...
 
void setName (const agx::Name &name)
 Set the name of the object. More...
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor. More...
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting. More...
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match. More...
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test. More...
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object. More...
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings. More...
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object. More...
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object. More...
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive. More...
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object. More...
 

Static Public Member Functions

static agxStream::Serializable * create ()
 
static agxStream::Serializable * create (agxStream::InputArchive &)
 
static const char * getConstructClassId ()
 
- Static Public Member Functions inherited from agxSDK::StepEventListener
static agxStream::Serializable * create ()
 
static agxStream::Serializable * create (agxStream::InputArchive &)
 
static const char * getConstructClassId ()
 
- Static Public Member Functions inherited from agxSDK::EventListener
static agxStream::Serializable * create ()
 
static agxStream::Serializable * create (agxStream::InputArchive &)
 
static const char * getConstructClassId ()
 
- Static Public Member Functions inherited from agx::Component
static Component * _load (TiXmlElement *eComponent, Device *device)
 
static agx::Model * ClassModel ()
 
static Component * load (const Path &path, const Name &implementation, Device *device, const Path &_namespace=Path())
 
static Component * load (const String &path, const Path &_namespace=Path())
 
static Component * load (const String &path, Device *device, const Path &_namespace=Path())
 
static Component * load (TiXmlElement *eComponent, Device *device)
 
- Static Public Member Functions inherited from agx::Object
static agx::Model * ClassModel ()
 
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. More...
 
static Object * load (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 Object * load (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 Object * load (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). More...
 
- 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. More...
 

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 GeometryContactEventListener > GeometryContactEventListenerConstObserver
 
typedef agx::ref_ptr< const GeometryContactEventListener > GeometryContactEventListenerConstRef
 
typedef agx::observer_ptr< GeometryContactEventListener > GeometryContactEventListenerObserver
 
typedef agx::Vector< GeometryContactEventListenerObserver > GeometryContactEventListenerObserverVector
 
typedef agx::VectorPOD< GeometryContactEventListener * > GeometryContactEventListenerPtrVector
 
typedef agx::ref_ptr< GeometryContactEventListener > GeometryContactEventListenerRef
 
typedef agx::Vector< GeometryContactEventListenerRef > GeometryContactEventListenerRefVector
 
typedef agx::Vector< ContactInformation > GeometryContactQueue
 
typedef agx::observer_ptr< const ParticleContactListener > ParticleContactListenerConstObserver
 
typedef agx::ref_ptr< const ParticleContactListener > ParticleContactListenerConstRef
 
typedef agx::observer_ptr< ParticleContactListener > ParticleContactListenerObserver
 
typedef agx::Vector< ParticleContactListenerObserver > ParticleContactListenerObserverVector
 
typedef agx::VectorPOD< ParticleContactListener * > ParticleContactListenerPtrVector
 
typedef agx::ref_ptr< ParticleContactListener > ParticleContactListenerRef
 
typedef agx::Vector< ParticleContactListenerRef > ParticleContactListenerRefVector
 
typedef agx::Vector< ParticleContactInformation > ParticleContactQueue
 

Protected Member Functions

virtual ~EventSensor ()
 Destructor. More...
 
void clearContactInformation ()
 
void constructSortedEventList ()
 
bool contactIsValid (agxCollide::GeometryContact *cd)
 
void executeSensorEvents (const agx::TimeStamp &t)
 
agx::RigidBody * getContactingRigidBody (agxCollide::GeometryContact *cd) const
 
SensorEvent * getSensorEventFromName (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. More...
 
- Protected Member Functions inherited from agxSDK::EventListener
 EventListener (Type type=UNDEFINED_TYPE)
 Default constructor. More...
 
virtual ~EventListener ()
 Destructor. More...
 
void setSimulation (Simulation *simulation)
 Set the associated simulation for this EventListener. More...
 
- 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. More...
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor. More...
 
 Serializable (const Serializable &other)
 Copy constructor. More...
 
void generateUuid ()
 

Protected Attributes

bool hasComputedParticlePairContactsInSensor
 Vector that stores particle pair contacts. Will only be computed if the user asks for it (getParticlePairContactsInSensor) More...
 
int m_collisionMask
 Get the collision mask for the sensor. More...
 
GeometryContactEventListenerRef m_contactListener
 Listeners that are coupled with the sensor. More...
 
agxSDK::CollisionGroupFilterRef m_filter
 The collision group filter coupled with the ContactEventListener. More...
 
GeometryContactQueue m_geomContactQueue
 Queues for the contacts. More...
 
agxCollide::Geometry * m_geometry
 The coupled geometry of the sensor. More...
 
bool m_geometryCollision
 
bool m_isBlocker
 True if the sensor should block the contact from other sensors in the scene under the same timestep. More...
 
bool m_particleCollision
 Flags for doing when there is a collision for a particle or geometry. More...
 
ParticleContactListenerRef m_particleContactListener
 
ParticleContactQueue m_particleContactQueue
 
ParticlePairContactVector m_particlePairContacts
 
agx::HashSet< agx::UInt32 > m_particlesInSensor
 Holds a set of the current particle id:s that are present in the sensor. More...
 
agx::HashSet< agx::UInt32 > m_particlesInsideSensor
 Holds a set of the current particle id:s whose midpoint is inside the sensor. More...
 
int m_priority
 Priority of the sensor over all the other sensors. More...
 
agx::HashSet< agx::RigidBody * > m_rigidBodiesContactingSensor
 Holds pointers to the current rigid bodies (DEM Objects) in the sensor. More...
 
agx::HashSet< agx::RigidBody * > m_rigidBodiesInsideSensor
 Holds pointers to the current rigid bodies (DEM Objects) where the midpoint is INSIDE the sensor. More...
 
int m_triggerFlag
 Flag for when the events are supposed to be executed during the time-step. More...
 
- 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 DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More...
 

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

◆ 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() [1/2]

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

Definition at line 308 of file EventSensor.h.

◆ create() [2/2]

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

Definition at line 308 of file EventSensor.h.

◆ executeSensorEvents()

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

◆ getClassName()

const char* agxControl::EventSensor::getClassName ( ) const
inlineoverridevirtual
Returns
the class name of this class.

Reimplemented from agxStream::Serializable.

Reimplemented in agxControl::MeasurementSensor.

Definition at line 308 of file EventSensor.h.

◆ getCollisionMask()

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

◆ getConstructClassId()

static const char* agxControl::EventSensor::getConstructClassId ( )
inlinestatic

Definition at line 308 of file EventSensor.h.

◆ 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

◆ getParticlePairContactsInSensor()

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

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

◆ getParticlesInsideSensor()

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

◆ 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.

◆ getStorageAgent()

agxStream::StorageAgent* agxControl::EventSensor::getStorageAgent ( ) const
inlineoverridevirtual
Returns
the storage agent

Implements agxStream::Serializable.

Reimplemented in agxControl::MeasurementSensor.

Definition at line 308 of file EventSensor.h.

◆ 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

◆ restore()

virtual void agxControl::EventSensor::restore ( agxStream::InputArchive &  in)
overridevirtual

Reimplemented from agxSDK::StepEventListener.

Reimplemented in agxControl::MeasurementSensor.

◆ 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

◆ store()

virtual void agxControl::EventSensor::store ( agxStream::OutputArchive &  out) const
overridevirtual

Reimplemented from agxSDK::StepEventListener.

Reimplemented in agxControl::MeasurementSensor.

◆ 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

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 498 of file EventSensor.h.

◆ m_collisionMask

int agxControl::EventSensor::m_collisionMask
protected

Get the collision mask for the sensor.

Definition at line 462 of file EventSensor.h.

◆ m_contactListener

GeometryContactEventListenerRef agxControl::EventSensor::m_contactListener
protected

Listeners that are coupled with the sensor.

Definition at line 475 of file EventSensor.h.

◆ m_filter

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

The collision group filter coupled with the ContactEventListener.

Definition at line 468 of file EventSensor.h.

◆ m_geomContactQueue

GeometryContactQueue agxControl::EventSensor::m_geomContactQueue
protected

Queues for the contacts.

Definition at line 471 of file EventSensor.h.

◆ m_geometry

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

The coupled geometry of the sensor.

Definition at line 465 of file EventSensor.h.

◆ m_geometryCollision

bool agxControl::EventSensor::m_geometryCollision
protected

Definition at line 495 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 491 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 494 of file EventSensor.h.

◆ m_particleContactListener

ParticleContactListenerRef agxControl::EventSensor::m_particleContactListener
protected

Definition at line 476 of file EventSensor.h.

◆ m_particleContactQueue

ParticleContactQueue agxControl::EventSensor::m_particleContactQueue
protected

Definition at line 472 of file EventSensor.h.

◆ m_particlePairContacts

ParticlePairContactVector agxControl::EventSensor::m_particlePairContacts
protected

Definition at line 499 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 479 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 482 of file EventSensor.h.

◆ m_priority

int agxControl::EventSensor::m_priority
protected

Priority of the sensor over all the other sensors.

Definition at line 459 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 485 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 488 of file EventSensor.h.

◆ m_sensorEventList

SensorEventList agxControl::EventSensor::m_sensorEventList

Definition at line 352 of file EventSensor.h.

◆ m_sensorEvents

SensorEvents agxControl::EventSensor::m_sensorEvents

Definition at line 349 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 456 of file EventSensor.h.


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