AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
SuctionGripper.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agxModel/export.h>
20
21#include <agx/Real.h>
22#include <agx/Frame.h>
23#include <agx/Vec2.h>
24#include <agx/Constraint.h>
25#include <agx/Referenced.h>
26#include <agxUtil/agxUtil.h>
29#include <agxSDK/Assembly.h>
30#include <agxCollide/Line.h>
31#include <agxCollide/Sphere.h>
32#include <agxCollide/Mesh.h>
33#include <agx/LockJoint.h>
34
35namespace agxSDK
36{
37 class Simulation;
38}
39
40
41namespace agxModel
42{
43
44
53 {
54 public:
55
58
60 {
62 }
63
68
70 virtual bool match(const agxCollide::Geometry* g0, const agxCollide::Geometry* g1) const override
71 {
72 const agxCollide::Geometry* geos[] = { g0, g1 };
73
74 for (size_t j = 0; j < 2; ++j)
75 {
76 for (size_t i = 0; i < m_collisionGeometries.size(); ++i)
77 {
78 if (geos[j] == m_collisionGeometries[i])
79 return true;
80 }
81 }
82 return false;
83 }
84
85 using ExecuteFilter::match;
86
87 protected:
92
93
94 protected:
97 };
98
99
100
103
106
120 {
121 public:
127
128
132 size_t getSealCount() const;
133
137 bool getCentered() const;
138
145
152
159
166
173
178
183
188
193
194
195 protected:
197
198 friend class SuctionCup;
199 friend class SuctionGripper;
200
201 /*
202 Update the latest position found for where to apply the cvacuum force
203 */
205
210
217
223
229
230 void updateInteractedSeals(size_t sealIndex, agx::Real depth);
231
234
235 agx::Real getSealDepth(size_t sealIndex) const;
236
237 bool hasSealInteraction(size_t sealIndex) const;
238
246 virtual bool updateVacuumForce(const SuctionCup* cup, const VacuumSystem* vacuumSystem, agx::Real fraction);
247
248 void reset();
249
251
253
264 };
265
266
269
381
382
419 {
420 public:
433 agx::Real lipRadius = agx::Real(0.025),
434 agx::Real lipHeight = agx::Real(0.01),
435 size_t sealResolution = size_t(0),
436 agx::Vec3 localLineSensorVector = agx::Vec3(0,0,-0.1),
437 agx::Real sealSensorReach = agx::Real(0.01));
438
439
444
450
455
460
465
473
478
482 bool isValid() const;
483
488
492 size_t getSealResolution() const;
493
498
503
512
517
522 agx::Vector < agxModel::SuctionCupInteraction*> getActiveInteractionsVector() const;
523
528 virtual void updateLeakageArea();
529
533 void applyVacuumForces(const VacuumSystem* vacuumSystem);
534
535
542 void updateVacuumForces(const VacuumSystem* vacuumSystem);
543
544
546
547 protected:
549
550 virtual ~SuctionCup();
551
552 // Contact events.
554
555 friend class SuctionGripper;
556
558
563
565
567
575
583
584
585 friend class SuctionGripper;
586
589
592
594 const agx::TimeStamp&, agxCollide::GeometryPair&);
595
598
603
605 agx::Vec3 pointAtSurface,
606 bool& success);
607
609
611
612 protected:
630 // Implementation dependent temporary variables, only valid per time step.
633
634 };
635
653 {
654 public:
662
667
672
677
682
687
694
696 bool isValid() const;
697
702
707
712
716 void setVacuumSystem(VacuumSystem* vacuumSystem);
717
720 agx::Vec3 holderLocalTranslate,
721 agx::Vec3 cupLocalTranslate);
722
724
725 protected:
727
728 virtual void updateValid();
729
731
732 // Adding to/removing from simulation.
733 virtual void addNotification( agxSDK::Simulation* simulation ) override;
734
736
737 virtual void removeNotification( agxSDK::Simulation* simulation )override;
738
740
741
742 // Step events.
744
745 virtual void preCollide(const agx::TimeStamp&);
746 virtual void pre(const agx::TimeStamp&);
747 virtual void post(const agx::TimeStamp&);
748 virtual void last(const agx::TimeStamp&);
749
750
751
752 protected:
753 // More persistent variables, will be serialized.
759
760 };
761
831}
832
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXMODEL_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition agx/Vector.h:34
A contact between two geometries.
Definition Contacts.h:271
The geometry representation used by the collision detection engine.
Definition Geometry.h:92
Base class for a shape.
Definition Shape.h:54
Triangle mesh for geometric intersection tests.
Definition Trimesh.h:43
agxUtil::TrimeshDeformerRef m_trimeshDeformer
agxUtil::TrimeshDeformer * getTrimeshDeformer() const
agxCollide::TrimeshRef m_trimesh
agxCollide::GeometryRef m_trimeshGeometry
SingleCupSuctionGripper(size_t sealResolution, agx::Real gripperRadius=agx::Real(0.025), agx::Real gripperHeight=agx::Real(0.01), agx::Real cupHeight=agx::Real(0.05), agx::Real lipHeight=agx::Real(0.01), agxCollide::Trimesh *deformableMesh=nullptr, agx::Material *cupMaterial=nullptr, agx::RigidBody *holderBody=nullptr, agx::RigidBody *cupBody=nullptr)
Create a SuctionGripper with one holder body and one suction cup.
agxCollide::Trimesh * getDeformableTrimesh() const
void setupDeformableTrimesh(SuctionCup *cup, agx::Frame *holderFrame)
agx::LockJoint * getLockJoint() const
agxCollide::Geometry * getTrimeshGeometry() const
agx::RigidBody * createDefaultHolderBody(agx::Real radius, agx::Real height) const
agx::ref_ptr< agx::LockJoint > m_lock
virtual bool updateVacuumForce(const SuctionCup *cup, const VacuumSystem *vacuumSystem, agx::Real fraction)
Function responsible for updating the force from the vacuum.
void renderInteraction(const SuctionCup *cup)
agx::Real getCurrentRelativeVelocity() const
bool hasSealInteraction(size_t sealIndex) const
SuctionCupInteraction()
A class for collecting and computing information for one RigidBody nearby a suction cup.
agx::Real getCalculatedScalarForce() const
agx::HashVector< size_t, agx::Real > m_interactedSealDepth
void setCalculatedForce(agx::Vec3 force)
agx::Vec3 getCurrentFrictionForce() const
void updateInteractedSeals(size_t sealIndex, agx::Real depth)
void setRigidBody(agx::RigidBody *body)
agx::Real getSealDepth(size_t sealIndex) const
void setFoundSurfacePositionWorld(agx::Vec3 worldPosition)
agx::Real getCenterDistance() const
agx::Vec3 getFoundSurfacePositionWorld() const
agx::RigidBody * getRigidBody()
agx::Vec3 getCalculatedForce() const
void updateEstimatedForcePosition(const SuctionCup *cup, agx::Real depth)
Updates the surface position of an interacting object where to apply the force.
agx::Vec3 getCurrentContactNormalForce() const
agx::RigidBodyObserver m_body
agx::Vec3 getCenterNormalWorld() const
void setCenterDistance(agx::Real distance)
Set distance to object along a vector considered positioned at the center of the suction cup,...
void setCenterNormalWorld(agx::Vec3 normal)
Set the surface normal of the object at the point at the center under the suction cup.
void setCalculatedScalarForce(agx::Real scalarForce)
void addTemporaryGeometryContact(agxCollide::GeometryContact *gc)
agxCollide::GeometryContactPtrVector m_tempContacts
Class for filtering objects of interest nearby a suction cup.
agxCollide::GeometryRefVector m_sensors
const agxCollide::GeometryRefVector & getGeometries() const
void addGeometry(agxCollide::Geometry *geometry)
virtual bool match(const agxCollide::Geometry *g0, const agxCollide::Geometry *g1) const override
Inherited from agxSDK::ExecuteFilter.
agxCollide::GeometryRefVector m_collisionGeometries
SuctionCupSensorFilter * getSensorFilter()
const SuctionCupInteractionRefVector & getDisabledInteractions() const
agxCollide::Geometry * createSealSensor(agx::RigidBody *body, agx::Vec3 bodyLocalPosition)
agx::Real getArea() const
agx::Vec3 findSurfaceNormal(agxCollide::Shape *collidedShape, agx::Vec3 pointAtSurface, bool &success)
const agxCollide::GeometryRefSetVector & getSealSensors() const
const agx::RigidBody * getRigidBody() const
agx::Vec3 m_localLineSensorVector
SuctionCupSensorFilterRef m_collisionFilter
agx::RigidBody * createDefaultCupBody()
SuctionCupInteraction * getActiveInteraction(agx::RigidBody *rigidBody)
agx::Real getLipRadius() const
agx::ref_ptr< agxUtil::GeneralContactEventListener< SuctionCup > > m_contactCallback
agx::Vec3 calculateLineP2() const
agx::Vector< agxModel::SuctionCupInteraction * > getActiveInteractionsVector() const
agx::Real m_calculatedAvailableVacuumForce
agx::Real getSensorDistance() const
void setMountingRadius(agx::Real radius)
Set the mounting radius.
agx::HashVector< agx::RigidBody *, SuctionCupInteractionRef > m_activeInteractions
agx::Real getCurrentLeakageArea() const
agx::Real getMountingRadius() const
agx::AffineMatrix4x4 m_miniSphereTransform
void addNotification(agxSDK::Simulation *simulation)
Makes sure all suction cup bodies and constraints are given to the simulation.
SuctionCupInteractionRefVector m_interactionsPool
agx::RigidBodyRef m_body
void applyVacuumForces(const VacuumSystem *vacuumSystem)
Responsible for applying forces to rigid bodies of the cup interactions.
SuctionCup(agx::RigidBody *cupBody, agx::Real lipRadius=agx::Real(0.025), agx::Real lipHeight=agx::Real(0.01), size_t sealResolution=size_t(0), agx::Vec3 localLineSensorVector=agx::Vec3(0, 0,-0.1), agx::Real sealSensorReach=agx::Real(0.01))
The SuctionCup contains a rigid body with a local attachment frame which will be used to position it ...
agx::Vec3 getNormal() const
virtual agxModel::SuctionCupInteraction * createInteraction()
Function creating an interaction.
virtual void updateLeakageArea()
calculates the leakage area.
agxCollide::GeometryRef m_lineSensor
agx::ref_ptr< agxCollide::Line > m_line
size_t getSealResolution() const
void separation(const agx::TimeStamp &, agxCollide::GeometryPair &)
agx::RigidBody * getRigidBody()
void removeNotification(agxSDK::Simulation *simulation)
void collectCollisionGeometries()
agx::Real getAvailableVacuumForce() const
The available vacuum force is a pre calculated value by the virtual VacuumSystem::calculateAvailableV...
agxSDK::ContactEventListener::KeepContactPolicy contact(const agx::TimeStamp &, agxCollide::GeometryContact *gc)
agxSDK::ContactEventListener::KeepContactPolicy impact(const agx::TimeStamp &, agxCollide::GeometryContact *gc)
agx::RealVector m_sealDepthMeasurements
agxCollide::GeometryRefSetVector m_sealSensors
agxCollide::SphereRef m_miniSphere
const agx::HashVector< agx::RigidBody *, SuctionCupInteractionRef > & getActiveInteractions() const
agxSDK::ContactEventListener::KeepContactPolicy handleContacts(const agx::TimeStamp &, agxCollide::GeometryContact *gc)
void updateVacuumForces(const VacuumSystem *vacuumSystem)
Will call the virtual function VacuumSystem::calculateAvailableVacuumForce; then apply the vacuum for...
bool isValid() const
Verify if the cup is valid.
This should be considered a template class used as a base for Suction Gripper simulation models.
agx::RigidBody * getHolderRigidBody()
void addSuctionCup(SuctionCup *cup)
Add one suction cup to the gripper.
SuctionCupRefVector & getSuctionCups()
virtual void last(const agx::TimeStamp &)
agxModel::SuctionCupRefVector m_suctionCups
VacuumSystem * getVacuumSystem()
VacuumSystemRef m_vacuumSystem
SuctionGripper(agx::RigidBody *holderBody)
The SuctionGripper must be initialized with a holder body.
agx::Real getCurrentLeakage() const
void setVacuumSystem(VacuumSystem *vacuumSystem)
Set a new vacuum system to the gripper.
static agx::LockJoint * positionAndLockSuctionCup(agxModel::SuctionGripper *gripper, agxModel::SuctionCup *cup, agx::Vec3 holderLocalTranslate, agx::Vec3 cupLocalTranslate)
virtual void pre(const agx::TimeStamp &)
virtual void preCollide(const agx::TimeStamp &)
const agx::RigidBody * getHolderRigidBody() const
virtual void addNotification(agxSDK::Simulation *simulation) override
Called when this assembly is added to a simulation (given that it not already is in the simulation).
agx::RigidBodyRef m_holderBody
virtual void updateValid()
const VacuumSystem * getVacuumSystem() const
bool setHolderRigidBody(agx::RigidBody *holderBody)
Set the rigid body of the holder.
virtual void post(const agx::TimeStamp &)
const SuctionCupRefVector & getSuctionCups() const
agx::ref_ptr< agxUtil::GeneralStepListener< SuctionGripper > > m_stepCallback
Basic model for a vacuum system used by a SuctionGripper.
void setEnablePump(const bool &enable)
agx::Real getOutsideGasDensity() const
Get the gas density outside the vacuum system [kg / m^3].
agx::Real getOutsidePressure() const
Get the pressure outside the vacuum system in Pascal[Pa].
agx::Real getDesiredVacuum() const
Set the desired vacuum level (0-1) for the system.
void setDesiredVacuum(agx::Real vacuumLevel)
Set the current vacuum level (0-1) for the system If set outside the valid range, the value is clampe...
void setCurrentVacuum(agx::Real vacuum)
Set the current vacuum for the system.
virtual agx::Real calculateAvailableVacuumForce(SuctionCup *cup) const
A virtual function which is responsible to calculate the actual force a suction cup can apply to obje...
virtual void step(agx::Real dt, const SuctionGripper *gripper)
A virtual function for updating the vacuum system.
agx::Real calculateGasSpeedAtLip(const SuctionCup *cup) const
agx::Real getCurrentVacuum() const
void setOutsidePressure(agx::Real pressure)
Set the pressure outside the vacuum system in Pascal [Pa].
bool getEnablePump() const
void setOutsideGasDensity(agx::Real density)
Set the gas density outside the vacuum system [kg / m^3].
VacuumSystem(agx::Real desiredVacuum)
Create a vacuum system with a constant desired vacuum level.
agx::Real calculateMaximumSuctionForce(SuctionCup *cup) const
An assembly is a collection of basic simulation objects, such as rigid bodies, constraints,...
Definition Assembly.h:68
virtual void removeNotification(agxSDK::Simulation *)
Called when this assembly is removed from a simulation.
Definition Assembly.h:657
virtual void addNotification(agxSDK::Simulation *)
Called when this assembly is added to a simulation (given that it not already is in the simulation).
Definition Assembly.h:652
KeepContactPolicy
Defines whether contact should be kept or removed after contact/impact methods returns.
Abstract base class that implements a filter that selects which events should trigger a Listener.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition Simulation.h:126
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Utility class to get contact event callbacks to any class having the methods implemented.
Definition agxUtil.h:573
Utility class to get step event callbacks to any class having the methods implemented.
Definition agxUtil.h:525
size_t size() const
Definition Container.h:134
The object defining a frame of reference and providing transformations operations.
Definition agx/Frame.h:68
Inheritance with partial specialization due to bug with ref_ptr containers.
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition HashVector.h:41
Constraint that removes all 6 DOF between two bodies, or one body and the world.
Definition LockJoint.h:31
Main material class which acts as a holder of a Surface Material and a Bulk material.
Definition Material.h:376
Base class providing referencing counted objects.
Definition Referenced.h:120
The rigid body class, combining a geometric model and a frame of reference.
Definition RigidBody.h:52
void clear(ClearPolicy policy=SHRINK_BUFFER_AVERAGED)
Remove all elements, optionally with maintained buffer allocation.
Definition agx/Vector.h:491
void push_back(const T2 &value)
Definition agx/Vector.h:715
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition FlowUnit.h:37
agx::HashSet< SuctionCupRef > SuctionCupRefSet
The SuctionCup model owns a body which is mean to be attached somewhere on a SuctionGripper holder.
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition Constraint.h:31
double Real
Definition Real.h:42
agx::Real TimeStamp
Definition TimeStamp.h:26