AGX Dynamics  2.35.0.1
SensorEvent.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. 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:
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 
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#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
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: agx/Vector.h:34
A contact between two geometries.
Definition: Contacts.h:270
This is a sensor class that can be attached to an geometry in the simulation.
Definition: EventSensor.h:48
A sensor event is an event triggered when the sensor is activated by a contact.
Definition: SensorEvent.h:49
virtual void postContactHandling(agxSDK::Simulation *simulation, EventSensor *sensor)
Post function that will be triggered for the event after all the contacts have handled in the operati...
agx::Name m_name
Name of the sensor event.
Definition: SensorEvent.h:105
virtual void triggerEvent(const agx::TimeStamp &t, agxSDK::Simulation *simulation, agxCollide::GeometryContact *cd, EventSensor *sensor)
Triggers the sensor event by passing contact information.
virtual void triggerParticleEvent(const agx::TimeStamp &t, agxSDK::Simulation *simulation, agx::Physics::ParticleGeometryContactInstance contact, agx::Physics::ParticleData &particleData, agx::Physics::GeometryData &geometryData, EventSensor *sensor)
Triggers the sensor event by passing particle contact information.
SensorEvent(const agx::Name &name=agx::Name())
Default Constructor.
virtual void update(const agx::TimeStamp &t)
Used to update the sensor event each time step, if they have time dependent components.
virtual ~SensorEvent()
Destructor.
const agx::Name & getName() const
virtual void addNotification(EventSensor *sensor)
Function will be executed when the sensor that the operations is added to is added to a simulation.
int priority
The priority of the sensor event.
Definition: SensorEvent.h:107
A specific type of sensor event that triggers a change in the simulation when activated by a contact.
Definition: SensorEvent.h:118
virtual void addNotification(EventSensor *sensor) override
Function will be executed when the sensor that the operations is added to is added to a simulation.
virtual void triggerParticleEvent(const agx::TimeStamp &t, agxSDK::Simulation *simulation, agx::Physics::ParticleGeometryContactInstance contact, agx::Physics::ParticleData &particleData, agx::Physics::GeometryData &geometryData, EventSensor *sensor) override
Triggers the sensor event by passing particle contact information.
virtual void triggerEvent(const agx::TimeStamp &t, agxSDK::Simulation *simulation, agxCollide::GeometryContact *cd, EventSensor *sensor) override
Triggers the sensor event by passing contact information.
virtual void update(const agx::TimeStamp &t) override
Used to update the sensor operation each time step, if they have time dependent components.
SensorOperation(const agx::Name &name=agx::Name())
Default constructor.
virtual ~SensorOperation()
Destructor.
virtual void postContactHandling(agxSDK::Simulation *simulation, EventSensor *sensor) override
Post function that will be triggered for the event after all the contacts have handled in the operati...
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:45
Representation of a name string.
Definition: Name.h:33
Base class providing referencing counted objects.
Definition: Referenced.h:114
This namespace contains general operation and action classes which can be used to control a agxSDK::S...
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31
agx::Real TimeStamp
Definition: TimeStamp.h:26