17 #ifndef AGXCONTROL_SENSOROPERATIONS_H
18 #define AGXCONTROL_SENSOROPERATIONS_H
60 agx::Physics::ParticleGeometryContactInstance contact,
61 agx::Physics::ParticleData& particleData,
62 agx::Physics::GeometryData& ,
87 agx::Physics::ParticleGeometryContactInstance ,
88 agx::Physics::ParticleData& ,
89 agx::Physics::GeometryData& ,
123 agx::Physics::ParticleGeometryContactInstance contact,
124 agx::Physics::ParticleData& particleData,
125 agx::Physics::GeometryData& geometryData,
160 agx::Physics::ParticleGeometryContactInstance contact,
161 agx::Physics::ParticleData& particleData,
162 agx::Physics::GeometryData& ,
199 agx::Physics::ParticleGeometryContactInstance contact,
200 agx::Physics::ParticleData& particleData,
201 agx::Physics::GeometryData& geometryData,
256 agx::Physics::ParticleGeometryContactInstance contact,
257 agx::Physics::ParticleData& particleData,
258 agx::Physics::GeometryData& geometryData,
289 bool colorOnSleep =
false,
294 agx::Physics::ParticleGeometryContactInstance contact,
295 agx::Physics::ParticleData& particleData,
296 agx::Physics::GeometryData& geometryData,
324 agx::Physics::ParticleGeometryContactInstance contact,
325 agx::Physics::ParticleData& particleData,
326 agx::Physics::GeometryData& geometryData,
334 void setVelocity(
const agx::Vec3& velocity);
337 void setAngularVelocity(
const agx::Vec3& angularVelocity);
338 const agx::Vec3& getAngularVelocity()
const;
386 agx::Physics::ParticleGeometryContactInstance contact,
387 agx::Physics::ParticleData& particleData,
388 agx::Physics::GeometryData& geometryData,
424 bool cloneTeleportation =
false,
437 agx::Physics::ParticleGeometryContactInstance contact,
438 agx::Physics::ParticleData& particleData,
439 agx::Physics::GeometryData& ,
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXPHYSICS_EXPORT
This operation changes the color of the particles given in the contact.
void setEnableMixColors(bool mixColors)
virtual ~ColorParticles()
bool getEnableMixColors()
virtual void triggerParticleEvent(const agx::TimeStamp &t, agxSDK::Simulation *simulation, agx::Physics::ParticleGeometryContactInstance contact, agx::Physics::ParticleData &particleData, agx::Physics::GeometryData &geometryData, agxControl::EventSensor *sensor) override
Triggers the sensor event by passing particle contact information.
ColorParticles(const agx::Name &name=agx::Name(), const agx::Vec3 &color=agx::Vec3(0.5, 0.5, 0.5), bool mixColors=false)
This is a sensor class that can be attached to an geometry in the simulation.
This operation applies a "kinematic state" to particles that collide with the sensor.
void triggerEvent(const agx::TimeStamp &, agxSDK::Simulation *simulation, agxCollide::GeometryContact *cd, agxControl::EventSensor *sensor) override
Triggers the sensor event by passing contact information.
virtual ~MakeParticleKinematicOperation()
MakeParticleKinematicOperation(const agx::Name &name=agx::Name(), ParticleFreezeMode mode=FREEZE_PARTILCES)
ParticleFreezeMode
Enum describing what mode the operation should be in. If it should freeze or unfreeze particles.
virtual void triggerParticleEvent(const agx::TimeStamp &t, agxSDK::Simulation *simulation, agx::Physics::ParticleGeometryContactInstance contact, agx::Physics::ParticleData &particleData, agx::Physics::GeometryData &geometryData, agxControl::EventSensor *sensor) override
Triggers the sensor event by passing particle contact information.
This operation dumps particle contact information to a file.
virtual void update(const agx::TimeStamp &t) override
Used to update the sensor operation each time step, if they have time dependent components.
ParticleContactDumper(const agx::Name &name, const agx::Name &filepath, agx::UInt32 samplingStride=1, bool exportOnce=false)
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 void triggerParticleEvent(const agx::TimeStamp &t, agxSDK::Simulation *, agx::Physics::ParticleGeometryContactInstance contact, agx::Physics::ParticleData &particleData, agx::Physics::GeometryData &, agxControl::EventSensor *) override
Triggers the sensor event by passing particle contact information.
agx::Name & getFilePath()
agx::UInt32 m_samplingStride
agx::HashTable< agx::Index, agx::Bool > m_handledParticleIds
std::ofstream m_outStream
virtual ~ParticleContactDumper()
agx::UInt32 m_framesSinceLastSampling
agx::Name m_completeFilePath
void createFileName(const agx::Name &filePath)
agx::String generateDateStamp()
ParticleContactDumper(const agx::Name &name=agx::Name())
This operation applies a kinematic "sleep state" to particles inside the sensor that are under a spec...
agx::Real m_sleepSpeedThreshold
virtual void triggerParticleEvent(const agx::TimeStamp &t, agxSDK::Simulation *simulation, agx::Physics::ParticleGeometryContactInstance contact, agx::Physics::ParticleData &particleData, agx::Physics::GeometryData &geometryData, agxControl::EventSensor *sensor) override
Triggers the sensor event by passing particle contact information.
virtual ~ParticleKinematicSleepOperation()
ParticleKinematicSleepOperation(const agx::Name &name=agx::Name(), agx::Real sleepSpeedThreshold=1.0, bool colorOnSleep=false, agx::Vec4f sleepColor=agxRender::Color::Yellow())
This operations removes all the particles in the contact supplied by the sensor.
void triggerParticleEvent(const agx::TimeStamp &, agxSDK::Simulation *, agx::Physics::ParticleGeometryContactInstance contact, agx::Physics::ParticleData &particleData, agx::Physics::GeometryData &, agxControl::EventSensor *) override
Triggers the sensor event by passing particle contact information.
RemoveParticles(const agx::Name &name=agx::Name())
virtual ~RemoveParticles()
This operation removes the rigid body given by the geometry in the contact supplied by the sensor.
void triggerEvent(const agx::TimeStamp &, agxSDK::Simulation *simulation, agxCollide::GeometryContact *cd, agxControl::EventSensor *sensor) override
Triggers the sensor event by passing contact information.
bool m_onlyRemoveEmittedBodies
RemoveRigidBody(const agx::Name &name=agx::Name(), bool onlyRemoveEmittedBodies=false)
virtual ~RemoveRigidBody()
virtual ~ReplaceParticleMaterialOperation()
ReplaceParticleMaterialOperation(const agx::Name &name=agx::Name())
virtual void triggerParticleEvent(const agx::TimeStamp &t, agxSDK::Simulation *simulation, agx::Physics::ParticleGeometryContactInstance contact, agx::Physics::ParticleData &particleData, agx::Physics::GeometryData &geometryData, agxControl::EventSensor *sensor) override
Triggers the sensor event by passing particle contact information.
ReplaceParticleMaterialOperation(const agx::Name &name, const agx::Name &materialName)
agx::Name getMaterialName()
void triggerEvent(const agx::TimeStamp &t, agxSDK::Simulation *simulation, agxCollide::GeometryContact *cd, agxControl::EventSensor *sensor) override
Triggers the sensor event by passing contact information.
void setMaterialName(const agx::String &material)
A specific type of sensor event that triggers a change in the simulation when activated by a contact.
This sensor operation class sets a speed to the object that collides with the sensor,...
virtual void triggerParticleEvent(const agx::TimeStamp &t, agxSDK::Simulation *simulation, agx::Physics::ParticleGeometryContactInstance contact, agx::Physics::ParticleData &particleData, agx::Physics::GeometryData &geometryData, agxControl::EventSensor *sensor) override
Triggers the sensor event by passing particle contact information.
const agx::Vec3 & getAngularVelocity() const
virtual void triggerEvent(const agx::TimeStamp &t, agxSDK::Simulation *simulation, agxCollide::GeometryContact *cd, agxControl::EventSensor *sensor) override
Triggers the sensor event by passing contact information.
SetVelocityOperation(const agx::Name &name, const agx::Vec3 &velocity, const agx::Vec3 &angularVelocity, bool setInLocalFrame=false)
agx::Vec3 m_angularVelocity
agx::FrameRef m_localFrame
void setAngularVelocity(const agx::Vec3 &angularVelocity)
const agx::Vec3 & getVelocity() const
SetVelocityOperation(const agx::Name &name=agx::Name())
virtual ~SetVelocityOperation()
void setVelocity(const agx::Vec3 &velocity)
This sensor operation class store particle id's of particles that are in contact with the sensor.
virtual void triggerEvent(const agx::TimeStamp &t, agxSDK::Simulation *simulation, agxCollide::GeometryContact *cd, agxControl::EventSensor *sensor) override
Triggers the sensor event by passing contact information.
virtual ~StoreParticlesOperation()
StoreParticlesOperation(const agx::Name &name=agx::Name())
agx::Physics::ParticlePtrVector getParticlesInContact() const
agx::Physics::ParticlePtrVector m_particlesInContact
virtual void triggerParticleEvent(const agx::TimeStamp &t, agxSDK::Simulation *simulation, agx::Physics::ParticleGeometryContactInstance contact, agx::Physics::ParticleData &particleData, agx::Physics::GeometryData &geometryData, agxControl::EventSensor *sensor) override
Triggers the sensor event by passing particle 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.
This operation can be used to know when a sensor has been activated by a contact.
TagOperation(const agx::Name &name=agx::Name())
virtual void triggerEvent(const agx::TimeStamp &, agxSDK::Simulation *, agxCollide::GeometryContact *, agxControl::EventSensor *) override
Triggers the sensor event by passing contact information.
void setIsExecuted(bool executed)
virtual void triggerParticleEvent(const agx::TimeStamp &, agxSDK::Simulation *, agx::Physics::ParticleGeometryContactInstance, agx::Physics::ParticleData &, agx::Physics::GeometryData &, agxControl::EventSensor *) override
Triggers the sensor event by passing particle contact information.
This sensor operation can teleport contacting particles to a target sensor geometry with arbitrary ti...
void triggerParticleEvent(const agx::TimeStamp &t, agxSDK::Simulation *, agx::Physics::ParticleGeometryContactInstance contact, agx::Physics::ParticleData &particleData, agx::Physics::GeometryData &, agxControl::EventSensor *sensor) override
Triggers the sensor event by passing particle contact information.
void teleportParticles(const agx::TimeStamp &t, agxControl::EventSensor *sensor, agx::Physics::GranularBodySystem *system)
agx::HashSet< agx::UInt32 > m_previousContactingParticleIds
std::pair< agx::TimeStamp, agx::Index > TimeParticleIdPair
ParticleTeleportQueue m_particleSpawnQueue
TeleportToSensorOperation(const agx::Name &name=agx::Name())
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::List< TimeParticleIdPair > ParticleTeleportQueue
agx::FrameRef m_targetOffsetFrame
bool m_shouldCloneTeleport
TeleportToSensorOperation(const agx::Name &name, EventSensor *target, agx::Real teleportTimeDilation=0, bool cloneTeleportation=false, agx::Frame *sourceoffset=nullptr, agx::Frame *targetoffset=nullptr)
agxControl::EventSensor * m_targetSensor
void addNotification(EventSensor *sensor) override
Function will be executed when the sensor that the operations is added to is added to a simulation.
agxData::EntityStorageRef m_particleTeleportStorage
agx::Real m_teleportTimeDilation
agx::FrameRef m_sourceOffsetFrame
void triggerEvent(const agx::TimeStamp &t, agxSDK::Simulation *simulation, agxCollide::GeometryContact *cd, agxControl::EventSensor *sensor) override
Triggers the sensor event by passing contact information.
static agxRender::Color Yellow()
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
The object defining a frame of reference and providing transformations operations.
Inheritance with partial specialization due to bug with ref_ptr containers.
Representation of a name string.
A class holding 4 dimensional vectors and providing basic arithmetic.
This namespace contains general operation and action classes which can be used to control a agxSDK::S...