17 #ifndef AGXCONTROL_EVENTSENSOR_H 18 #define AGXCONTROL_EVENTSENSOR_H 19 #include <agx/config.h> 111 virtual void contactCallback(agx::Physics::ParticleGeometryContactInstance contact,
112 agx::Physics::ParticleData& particleData,
113 agx::Physics::GeometryData& geometryData);
156 void removeAllGroups();
165 bool addSensorEvent(
SensorEvent* sEvent,
int priority = 0);
183 SensorEventVector getSensorEvents();
199 void setTriggerFlag(
int flag);
204 int getTriggerFlag();
209 void setCollisionMask(
int mask);
214 int getCollisionMask();
231 void setEnableBlocker(
bool isBlocker);
236 bool getEnableBlocker();
270 virtual void addNotification()
override;
276 virtual void removeNotification()
override;
281 const ParticlePairContactVector& getParticlePairContactsInSensor();
301 agx::Real getNumParticlesInSensor()
const;
306 agx::Real getNumParticleParticleContactsInSensor();
314 bool hasOnlyReference();
325 template <typename T>
334 inline operator T () {
337 inline operator const T ()
const {
340 inline operator int ()
const {
356 typedef std::map<agx::Uuid, EventPrioHolder<SensorEventRef> >
SensorEvents;
386 agx::Physics::ParticleGeometryContactInstance contactIn,
387 agx::Physics::ParticleData& particleDataIn,
388 agx::Physics::GeometryData& geometryDataIn)
389 :t(tIn),contact(contactIn), particleData(particleDataIn), geometryData(geometryDataIn)
393 agx::Physics::ParticleGeometryContactInstance
contact;
407 void constructSortedEventList();
413 void clearContactInformation();
415 void refreshParticlesInsideSensorData();
417 void refreshRigidBodiesInsideSensorData();
423 void triggerContactEvents();
425 void triggerEvents();
427 void triggerPostContactHandling();
429 void triggerEventAddNotification();
435 agx::Physics::ParticleGeometryContactInstance contact,
436 agx::Physics::ParticleData& particleData,
437 agx::Physics::GeometryData& geometryData);
439 void triggerParticleEvents();
443 agx::Physics::ParticleGeometryContactInstance contact,
444 agx::Physics::ParticleData& particleData,
445 agx::Physics::GeometryData& geometryData);
449 agx::Physics::ParticleGeometryContactInstance contact,
450 agx::Physics::ParticleData& particleData,
451 agx::Physics::GeometryData& geometryData);
454 agx::Physics::ParticleGeometryContactInstance contact,
455 agx::Physics::ParticleData& particleData,
456 agx::Physics::GeometryData& geometryData);
TriggerEventStages
Defines the event execution states when the SensorEvents are executed during the timestep of the dete...
This class is for detecting and handling particle collisions with geometries in the simulation...
void AGXPHYSICS_EXPORT init()
Initialize agx.
agx::Physics::GeometryData & geometryData
Derive from this class to implement a listener for simulation Step events.
agx::Vector< agxControl::SensorEvent *> SensorEventVector
Placeholder for information regarding the particle contacts.
agx::SymmetricPair< agx::Physics::GeometryPtr > GeometryPair
bool m_particleCollision
Flags for doing when there is a collision for a particle or geometry.
static agxCollide::GeometryPtrVector g_forbiddenGeometries
bool m_isBlocker
True if the sensor should block the contact from other sensors in the scene under the same timestep...
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_POINTER_TYPES(type)
int m_triggerFlag
Flag for when the events are supposed to be executed during the time-step.
bool hasComputedParticlePairContactsInSensor
Vector that stores particle pair contacts. Will only be computed if the user asks for it (getParticle...
Representation of a name string.
ParticleContactInformation(const agx::TimeStamp tIn, agx::Physics::ParticleGeometryContactInstance contactIn, agx::Physics::ParticleData &particleDataIn, agx::Physics::GeometryData &geometryDataIn)
This is a sensor class that can be attached to an geometry in the simulation.
SensorEventList m_sensorEventList
agx::Physics::ParticleData & particleData
The geometry representation used by the collision detection engine.
AGXPHYSICS_EXPORT void addGroup(const agx::RigidBody *body, unsigned id)
For the specified body, add the collision group ID to its geometries.
GeometryContactQueue m_geomContactQueue
Queues for the contacts.
agx::Vector< agx::Physics::ParticlePairContactPtr > ParticlePairContactVector
Vector containing 'raw' data.
ParticleContactListenerRef m_particleContactListener
Namespace agx contains the dynamics/math part of the AGX Dynamics API.
ParticleContactQueue m_particleContactQueue
agx::HashSet< agx::RigidBody * > m_rigidBodiesInsideSensor
Holds pointers to the current rigid bodies (DEM Objects) where the midpoint is INSIDE the sensor...
agxSDK::CollisionGroupFilterRef m_filter
The collision group filter coupled with the ContactEventListener.
std::map< agx::Uuid, EventPrioHolder< SensorEventRef > > SensorEvents
static agx::UInt32Vector g_forbiddenParticles
typedef void(GLAD_API_PTR *GLDEBUGPROC)(GLenum source
agx::Physics::ParticleGeometryContactInstance contact
The rigid body class, combining a geometric model and a frame of reference.
This file defines a set of operations used internally by the measurement sensor to calculate differen...
agx::VectorPOD< RigidBodyPtr > RigidBodyPtrVector
agx::List< EventPrioHolder< SensorEventRef > > SensorEventList
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
agxCollide::Geometry * m_geometry
The coupled geometry of the sensor.
int m_collisionMask
Get the collision mask for the sensor.
AGXPHYSICS_EXPORT void removeGroup(const agx::RigidBody *body, unsigned id)
For the specified body, remove the collision group ID to its geometries.
An ExecuteFilter that is used to filter out contacts matching a specified criteria based on Collision...
EventPrioHolder(T obj, int priority)
agx::Vector< ParticleContactInformation > ParticleContactQueue
agx::HashSet< agx::RigidBody * > m_rigidBodiesContactingSensor
Holds pointers to the current rigid bodies (DEM Objects) in the sensor.
agx::HashSet< agx::UInt32 > m_particlesInSensor
Holds a set of the current particle id:s that are present in the sensor.
agxSDK::CollisionGroupFilter * m_filter
AGX_DECLARE_VECTOR_TYPES(EventSensor)
A sensor event is an event triggered when the sensor is activated by a contact.
ParticlePairContactVector m_particlePairContacts
int m_priority
Priority of the sensor over all the other sensors.
SensorEvents m_sensorEvents
agx::Vector< ContactInformation > GeometryContactQueue
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
const T sensorEvent() const
agx::HashSet< agx::UInt32 > m_particlesInsideSensor
Holds a set of the current particle id:s whose midpoint is inside the sensor.
GeometryContactEventListenerRef m_contactListener
Listeners that are coupled with the sensor.