AGX Dynamics  2.35.0.1
MeasurementOperations.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_MEASUREMENT_OPERATIONS_H
18 #define AGXCONTROL_MEASUREMENT_OPERATIONS_H
19 
20 #include <agxControl/SensorEvent.h>
21 #include <agxControl/EventSensor.h>
22 
23 namespace agxControl
24 {
25 
31  {
32  public:
34  DataFilter(agx::Real samplingTime);
35 
37  virtual void filterValue(agx::Real inValue) = 0;
38 
40  agx::Real getFilteredValue() const;
41 
43  virtual bool setSamplingTime(agx::Real samplingTime);
44 
45  protected:
47  virtual ~DataFilter();
48 
50  // Variables
52  protected:
53  agx::Real m_filteredValue; // Current filtered value
54  agx::Real m_samplingTime; // Discrete sampling time
55  };
56 
58 
65  {
66  public:
68  ExponentialFilter( agx::Real samplingTime, agx::Real periodTime );
69 
71  void filterValue(agx::Real inValue) override;
72 
74  bool setSamplingTime(agx::Real samplingTime) override;
75 
77  bool setPeriodTime(agx::Real periodTime);
78 
79  protected:
81  virtual ~ExponentialFilter();
82 
84 
86  // Variables
88  protected:
89  agx::Real m_periodTime; // Period Time
90  agx::Real m_a; // Time constant
91  };
92 
93  /*
94  * Base class of operations used by the measurement sensor. Handles filters for data smoothing.
95  */
98  {
99  public:
102 
103  virtual void postContactHandling(agxSDK::Simulation *simulation, EventSensor * sensor) override = 0;
104 
107 
110 
112  void setFilter(DataFilter * filter);
113 
116 
117  protected:
120 
122  virtual agx::Real getValue() const = 0;
123 
125  void updateFilter();
126 
128  // Variables
130  protected:
132  };
133 
134  /*
135  * This operations calculates the total mass of the bodies _inside_ the sensor geometry.
136  */
139  {
140  public:
143 
144  void postContactHandling(agxSDK::Simulation *simulation, EventSensor * sensor) override;
145 
148 
149  protected:
151  virtual ~CalculateTotalMass() {}
152 
153  virtual agx::Real getValue() const override;
154 
156  // Variables
158  protected:
160  };
161 
162  /*
163  * This operations calculates the total volume of the bodies _inside_ the sensor geometry.
164  */
167  {
168  public:
171 
172  void postContactHandling(agxSDK::Simulation *simulation, EventSensor * sensor) override;
173 
176 
179 
180  protected:
182  virtual ~VolumeCalculator() {}
183 
184  virtual agx::Real getValue() const override;
185 
187  // Variables
189  protected:
193  };
194 
195  /*
196  * Operation that calculates the average mass flow _inside_ the sensor volume
197  */
200  {
201  public:
204 
205  void postContactHandling(agxSDK::Simulation *simulation, EventSensor * sensor) override;
206 
209 
210  protected:
213 
214  virtual agx::Real getValue() const override;
215 
217  // Variables
219  protected:
221  };
222 
223  /*
224  * This operations calculates the total mass of the bodies _inside_ the sensor geometry.
225  */
228  {
229  public:
232 
233  void postContactHandling(agxSDK::Simulation *simulation, EventSensor * sensor) override;
234 
237 
238  protected:
241 
242  virtual agx::Real getValue() const override;
243 
245  // Variables
247  protected:
249  };
250 
251  /*
252  * Operation that calculates the average mass flow _inside_ the sensor volume
253  */
256  {
257  public:
260 
261  void postContactHandling(agxSDK::Simulation *simulation, EventSensor * sensor) override;
262 
265 
266  protected:
269 
270  virtual agx::Real getValue() const override;
271 
273  // Variables
275  protected:
277  };
278 
279 
280  /*
281  * This operations calculates the total volume of the bodies _inside_ the sensor geometry.
282  */
285  {
286  public:
289 
290  void postContactHandling(agxSDK::Simulation *simulation, EventSensor * sensor) override;
291 
294 
297 
298  protected:
301 
302  virtual agx::Real getValue() const override;
303 
305  // Variables
307  protected:
311  };
312 }
313 
314 #endif
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXPHYSICS_EXPORT
agx::Real getTotalMassFlow() const
Returns the latest calculated mass flow from the operation (kg/s).
virtual ~CalculateTotalMassFlow()
Default destructor.
CalculateTotalMassFlow(const agx::Name &name=agx::Name())
Default constructor.
virtual agx::Real getValue() const override
Gets a raw value from the subclass.
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...
agx::Real getTotalMass() const
Returns the latest calculated mass from the operation.
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...
virtual agx::Real getValue() const override
Gets a raw value from the subclass.
CalculateTotalMass(const agx::Name &name=agx::Name())
Default constructor.
virtual ~CalculateTotalMass()
Default destructor.
agx::Real getTotalMassFlow() const
Returns the latest calculated mass flow from the operation (kg/s).
virtual agx::Real getValue() const override
Gets a raw value from the subclass.
virtual ~CalculateTotalRigidBodyDEMMassFlow()
Default destructor.
CalculateTotalRigidBodyDEMMassFlow(const agx::Name &name=agx::Name())
Default constructor.
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...
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...
CalculateTotalRigidBodyDEMMass(const agx::Name &name=agx::Name())
Default constructor.
virtual ~CalculateTotalRigidBodyDEMMass()
Default destructor.
agx::Real getTotalMass() const
Returns the latest calculated mass from the operation.
virtual agx::Real getValue() const override
Gets a raw value from the subclass.
Virtual base class of a data filter for data smoothing.
agx::Real getFilteredValue() const
Returns the current filtered value.
DataFilter(agx::Real samplingTime)
Default constructor.
virtual bool setSamplingTime(agx::Real samplingTime)
Set the discrete sampling time of the filter.
virtual ~DataFilter()
Default destructor.
virtual void filterValue(agx::Real inValue)=0
Returns the a filtered signal given a value supplied to the filter.
This is a sensor class that can be attached to an geometry in the simulation.
Definition: EventSensor.h:48
Exponential filter that smoothes values in the form: x_filter(t) = a * x_filter(t-1) + ( 1 - a ) * x_...
ExponentialFilter(agx::Real samplingTime, agx::Real periodTime)
Constructor for the Exponential filter.
void filterValue(agx::Real inValue) override
Filters the value from a given thing.
bool setPeriodTime(agx::Real periodTime)
Set the period time.
virtual ~ExponentialFilter()
Default Destructor.
bool setSamplingTime(agx::Real samplingTime) override
Set sampling time.
DataFilter * getFilter()
Gets the current active filter in the operation.
virtual agx::Real getValue() const =0
Gets a raw value from the subclass.
virtual void postContactHandling(agxSDK::Simulation *simulation, EventSensor *sensor) override=0
Post function that will be triggered for the event after all the contacts have handled in the operati...
virtual ~MeasurementSensorOperation()
Default destructor.
void updateFilter()
Updates the internal filter.
void setFilter(DataFilter *filter)
Set a filter on the operation that handles the values given.
agx::Real getRawValue() const
Returns the latest calculated value from the operation.
MeasurementSensorOperation(const agx::Name &name=agx::Name())
Default constructor.
agx::Real getFilteredValue() const
Returns the latest calculated value from the operation. Returns the raw value if no filter is attache...
RigidBodyDEMVolumeCalculator(const agx::Name &name=agx::Name())
Default constructor.
virtual ~RigidBodyDEMVolumeCalculator()
Default destructor.
agx::Real getTotalVolume() const
Returns the latest calculated volume from the operation.
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...
agx::Real getPackingFractionInSensor() const
Returns the latest calculated packing fraction from the operation.
virtual agx::Real getValue() const override
Gets a raw value from the subclass.
A specific type of sensor event that triggers a change in the simulation when activated by a contact.
Definition: SensorEvent.h:118
VolumeCalculator(const agx::Name &name=agx::Name())
Default constructor.
agx::Real getPackingFractionInSensor() const
Returns the latest calculated packing fraction from the operation.
virtual agx::Real getValue() const override
Gets a raw value from the subclass.
agx::Real getTotalVolume() const
Returns the latest calculated volume from the operation.
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...
virtual ~VolumeCalculator()
Default destructor.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
Representation of a name string.
Definition: Name.h:33
Base class providing referencing counted objects.
Definition: Referenced.h:114
#define AGX_FORCE_INLINE
Definition: macros.h:58
This namespace contains general operation and action classes which can be used to control a agxSDK::S...
double Real
Definition: Real.h:42