AGX Dynamics  2.37.3.2
SensorEvent.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXCONTROL_SENSOREVENT_H
18 #define AGXCONTROL_SENSOREVENT_H
19 
20 #include <agx/config.h>
21 
22 #include <agx/agxPhysics_export.h>
23 #include <agx/Referenced.h>
24 #include <agx/Name.h>
25 #include <agx/TimeStamp.h>
26 #include <agxCollide/Contacts.h>
27 #include <agxStream/Serializable.h>
28 #include <agxCollide/Geometry.h>
31 
32 namespace agxSDK
33 {
34  class Simulation;
35 }
36 
37 namespace agxControl
38 {
39  class EventSensor;
40 
43 
49  {
50 
51  public:
52 
54  SensorEvent( const agx::Name& name = agx::Name());
55 
59  const agx::Name& getName() const;
60 
64  virtual void triggerEvent(const agx::TimeStamp& t,
65  agxSDK::Simulation* simulation,
67  EventSensor* sensor);
68 
72  virtual void triggerParticleEvent(const agx::TimeStamp& t,
73  agxSDK::Simulation* simulation,
74  agx::Physics::ParticleGeometryContactInstance contact,
75  agx::Physics::ParticleData& particleData,
76  agx::Physics::GeometryData& geometryData,
77  EventSensor* sensor);
78 
82  virtual void postContactHandling(agxSDK::Simulation *simulation, EventSensor * sensor);
83 
88  virtual void addNotification(EventSensor * sensor);
89 
93  virtual void update(const agx::TimeStamp& t);
94 
96 
97  friend class EventSensor;
98 
99  protected:
101  virtual ~SensorEvent();
102 
103  protected:
107  int priority;
108 
109  };
110 
118  {
119  public:
121  SensorOperation( const agx::Name& name = agx::Name());
122 
126  virtual void triggerEvent(const agx::TimeStamp& t, agxSDK::Simulation * simulation, agxCollide::GeometryContact *cd, EventSensor * sensor) override;
127 
131  virtual void triggerParticleEvent(const agx::TimeStamp& t,
132  agxSDK::Simulation* simulation,
133  agx::Physics::ParticleGeometryContactInstance contact,
134  agx::Physics::ParticleData& particleData,
135  agx::Physics::GeometryData& geometryData,
136  EventSensor* sensor) override;
137 
141  virtual void postContactHandling(agxSDK::Simulation *simulation, EventSensor * sensor) override;
142 
147  virtual void addNotification(EventSensor * sensor) override;
148 
152  virtual void update(const agx::TimeStamp& t) override;
153 
155 
156  protected:
158  virtual ~SensorOperation();
159 
160  };
161 }
162 
163 #endif /*SENSOREVENT_H_*/
164 
A contact between two geometries.
Definition: Contacts.h:270
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
Representation of a name string.
Definition: Name.h:32
agx::Real TimeStamp
Definition: TimeStamp.h:26
This is a sensor class that can be attached to an geometry in the simulation.
Definition: EventSensor.h:47
int priority
The priority of the sensor event.
Definition: SensorEvent.h:107
Base class providing referencing counted objects.
Definition: Referenced.h:119
This namespace contains general operation and action classes which can be used to control a agxSDK::S...
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:126
A sensor event is an event triggered when the sensor is activated by a contact.
Definition: SensorEvent.h:48
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: Vector.h:34
A specific type of sensor event that triggers a change in the simulation when activated by a contact...
Definition: SensorEvent.h:117
agx::Name m_name
Name of the sensor event.
Definition: SensorEvent.h:105
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30