17 #ifndef AGXCONTROL_EVENTSENSOR_H 18 #define AGXCONTROL_EVENTSENSOR_H 19 #include <agx/config.h> 110 virtual void contactCallback(agx::Physics::ParticleGeometryContactInstance contact,
111 agx::Physics::ParticleData& particleData,
112 agx::Physics::GeometryData& geometryData);
155 void removeAllGroups();
164 bool addSensorEvent(
SensorEvent* sEvent,
int priority = 0);
182 SensorEventVector getSensorEvents();
198 void setTriggerFlag(
int flag);
203 int getTriggerFlag();
208 void setCollisionMask(
int mask);
213 int getCollisionMask();
230 void setEnableBlocker(
bool isBlocker);
235 bool getEnableBlocker();
262 virtual void addNotification()
override;
268 virtual void removeNotification()
override;
273 const ParticlePairContactVector& getParticlePairContactsInSensor();
293 agx::Real getNumParticlesInSensor()
const;
298 agx::Real getNumParticleParticleContactsInSensor();
306 bool hasOnlyReference();
312 void setRealDummyMethod(
agx::
Real ) { }
317 template <typename T>
326 inline operator T () {
329 inline operator const T ()
const {
332 inline operator int ()
const {
348 typedef std::map<agx::Uuid, EventPrioHolder<SensorEventRef> >
SensorEvents;
378 agx::Physics::ParticleGeometryContactInstance contactIn,
379 agx::Physics::ParticleData& particleDataIn,
380 agx::Physics::GeometryData& geometryDataIn)
381 :t(tIn),contact(contactIn), particleData(particleDataIn), geometryData(geometryDataIn)
385 agx::Physics::ParticleGeometryContactInstance
contact;
399 void constructSortedEventList();
405 void clearContactInformation();
407 void refreshParticlesInsideSensorData();
409 void refreshRigidBodiesInsideSensorData();
415 void triggerContactEvents();
417 void triggerEvents();
419 void triggerPostContactHandling();
421 void triggerEventAddNotification();
427 agx::Physics::ParticleGeometryContactInstance contact,
428 agx::Physics::ParticleData& particleData,
429 agx::Physics::GeometryData& geometryData);
431 void triggerParticleEvents();
435 agx::Physics::ParticleGeometryContactInstance contact,
436 agx::Physics::ParticleData& particleData,
437 agx::Physics::GeometryData& geometryData);
441 agx::Physics::ParticleGeometryContactInstance contact,
442 agx::Physics::ParticleData& particleData,
443 agx::Physics::GeometryData& geometryData);
446 agx::Physics::ParticleGeometryContactInstance contact,
447 agx::Physics::ParticleData& particleData,
448 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 Dynamics API including thread resources and must be executed before using the AGX API...
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
The agx namespace 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
agx::Physics::ParticleGeometryContactInstance contact
The rigid body class, combining a geometric model and a frame of reference.
This namespace contains general operation and action classes which can be used to control a agxSDK::S...
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
Triggered in a PRE solve/integration step.
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
#define AGX_DECLARE_VECTOR_TYPES(type)
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.