38 class ShovelAggregateContactMaterialContainer;
110 ShovelDebugRenderSettings* settings =
nullptr);
127 ShovelDebugRenderSettings* settings =
nullptr );
823 ENABLE_CREATE_DYNAMIC_MASS = 1 << 1,
824 ENABLE_FORCE_FEEDBACK = 1 << 2
826 using Flags = agx::BitState<StateFlags, agx::UInt32>;
827 Flags m_excavationFlags;
837 agx::Plane calculateCutTopPlane();
845 agx::Plane calculateTeethTopPlane();
852 void setEdgesCodirectional();
854 bool getShovelPlanes(
agx::Plane& bottomPlane,
855 agx::Plane& backPlane,
856 agx::Plane& leftPlane,
857 agx::Plane& rightPlane) const;
859 void removeTerrainShovelContacts(Terrain* terrain);
862 void removeTerrainShovelContactsDeformer(Terrain* terrain);
864 agx::Real getSubmergedEdgeLength(const
agx::Line& edge, const Terrain* terrain) const;
866 agx::Vec3 getSurfaceTangentFromDeadLoad(
agx::Real deadload) const;
868 agx::Vec3 getCuttingEdgeVelocity();
870 void setInnerContactArea(
agx::Real contactArea );
873 void setSettingsAreDirty(
bool enable);
875 bool getSettingsAreDirty() const;
877 bool hasValidTeethVolume() const;
879 bool hasValidToothSettings() const;
881 void updateVoxelCollisionGeometries();
883 agx::Physics::GranularBodySystem* getGranularBodySystem() const;
885 virtual
void onAssemblyAdd(
agxSDK::Assembly* assembly ) override;
892 agx::Vec3 getUpDirection() const;
894 const
agx::Vec3iVector& getVoxelsInActiveZoneLastTimeStep();
898 void updateTeethGeometry();
900 ShovelDebugRenderSettings* getDebugRenderSettings()
const {
return m_debugRenderSettings; }
902 void aggregatePreCollide();
904 void updateAggregateCacheData();
906 void debugRenderAggregatePositions();
908 agx::Vec3 getGeneratedForwardVector()
const {
return m_forwardDirection; }
910 agx::Vec3 getGeneratedBottomVector()
const {
return m_bottomPlateDirection; }
929 agx::Real computeDefaultContactRegionThreshold() const;
936 agx::Frame* createParentFrame();
938 void initSoilAggregate();
940 agxSDK::TerrainManager* getTerrainManager();
947 virtual
void addNotification() override;
952 virtual
void removeNotification() override;
958 void setAggregateMaterial(
agx::Material* material);
963 void initalizeContactMaterialsForExistingTerrains(
agxSDK::Simulation* simulation);
970 void checkContactMaterials();
980 virtual
void preCollide() override;
991 virtual
void pre() override;
997 virtual
void post() override;
1003 virtual
void last() override;
1008 void calculateDeadLoadFraction();
1013 bool shovelHasParticles() const;
1018 void clearActiveZoneWedges() const;
1023 void calculateForbiddenBounds();
1042 void createDeformers(
const agx::Line& cuttingEdge,
1056 void addDeformers(
const std::array<DeformerCollectionRef, 3>& deformers);
1058 bool shouldDeformMass(
Terrain* terrain);
1064 agx::Vec3 computeBottomPlateDirection();
1075 void constructAndAddDeformers();
1158 agx::Vector<
agx::ContactMaterialRef > m_contactMaterials;
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXTERRAIN_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Axis aligned bounding box implementation.
The geometry representation used by the collision detection engine.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Class for writing serialized data in binary format to a stream.
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
static bool isGeometryShovel(const agxCollide::Geometry *geometry)
static bool isRigidBodyShovel(const agx::RigidBody *rigidBody)
static void setIsRigidBodyShovel(agx::RigidBody *rigidBody, bool enable)
Class containing the settings for the different ExcavationModes for a shovel.
ExcavationSettings()
Default constructor.
void setEnable(bool enable)
Set whether the excavation mode should be enabled, creating dynamic mass and generating force feedbac...
ExcavationSettings(agx::UInt32 state)
Constructor taking an internal state variable from another excavation setting object.
agx::UInt32 getState() const
void store(agxStream::OutputArchive &out) const
bool getEnableForceFeedback() const
void setEnableForceFeedback(bool enable)
Set true/false if the excavation mode should generate force feedback from created aggregates.
void restore(agxStream::InputArchive &in)
void setEnableCreateDynamicMass(bool enable)
Set true/false if the excavation mode should create dynamic mass.
bool getEnableCreateDynamicMass() const
Shovel object used to interact with a terrain via an active zone that converts solid terrain to dynam...
bool setShovelAggregateContactMaterial(agx::ContactMaterial *contactMaterial, Shovel::ExcavationMode mode=Shovel::ExcavationMode::PRIMARY)
Explicitly set contact material properties in a shovel-aggregate contact for a specific excavation mo...
agx::Plane getCutTopPlaneWorld() const
agx::Vec3 getAggregateTerrainContactForce(Shovel::ExcavationMode excavationMode) const
Get the terrain <-> aggregate contact force for the given excavation mode.
agx::Real getTotalSoilBulkVolume(agx::Real packingFraction=0.67) const
Returns the total bulk volume moved by the shovel, both in the inner shapes and in the soil wedges in...
agx::Vec3 getContactForce() const
Given geometry contacts exists and the solver has solved them - calculates total shovel contact force...
size_t getNumberOfActiveContactPoints()
agx::Real getInnerSoilBulkVolume() const
Get the last computed dead load bulk volume of the shovel, i.e the inner volume that is filled with d...
void setConnectedShovel(Shovel *shovel)
agx::Plane getSeparationPlatePlane() const
agx::Real getAggregateTerrainContactDepth(Shovel::ExcavationMode excavationMode) const
const agx::Plane & getTeethTopPlane() const
agx::RigidBodyRef m_shovelBody
agx::Vec3 m_bottomPlateDirection
agx::Real getInnerSoilMass() const
agx::Vec3 getSeparationNormalForce() const
Given geometry contacts exists and the solver has solved them - calculates total contact normal force...
bool collisionGeometriesAreInsideTerrain(Terrain *terrain) const
Check if any of the collision geometries are inside terrain bounds.
agx::Vec3 getSecondaryForwardVector() const
agx::Real getInnerVolume() const
SoilParticleVector getInnerSoilParticles() const
ShovelDebugRenderSettingsRef m_debugRenderSettings
DeformController * getDeformController() const
static Shovel * find(const agxSDK::Simulation *simulation, const agx::Name &name)
Find first shovel with given name.
agx::Plane getCurrentSeparationPlane(ExcavationMode mode) const
virtual bool isValid() const override
agx::Plane getTeethTopPlaneWorld() const
Shovel * m_connectedShovel
const agx::Vector< agxCollide::BoundingAABB > & getForbiddenBounds()
Get the shovels forbidden bounds.
agx::Real m_deadLoadFraction
static ShovelPtrVector findAll(const agxSDK::Simulation *simulation)
Finds all shovels in the given simulation.
agx::Frame * getParentFrame() const
agx::Vec3 getBottomPlateDirection() const
agx::Plane getTeethSeparationPlane() const
SoilParticleAggregate * getSoilParticleAggregate() const
agx::Material * getAggregateMaterial() const
Shovel * getConnectedShovel()
void setEnableShovelTerrainGeometryContacts(Terrain *terrain, bool enable)
Set if regular geometry contacts should be created between the shovel geometries and the associated t...
void setCutTopPlane(agx::Plane cutTopPlane)
Set the cutting plane in local space.
agx::Vec3 getBottomPlateDirectionWorld() const
agx::Vector< agxCollide::BoundingAABB > m_forbiddenBounds
const agx::RigidBody * getWedgeAggregate(Shovel::ExcavationMode excavationMode) const
agxCollide::GeometryContactPtrVector getShovelAggregateContacts(Shovel::ExcavationMode excavationMode) const
Get the shovel <-> aggregate contacts with the soil particle aggregate for the given excavation mode.
agx::Real getDynamicMass() const
agx::Line getTeethEdgeWorld() const
agx::Real getTotalSoilMass() const
agx::MaterialRef m_aggregateMaterial
agx::Vec3 getDeformationContactForce() const
Given geometry contacts exists and the solver has solved them - calculates total contact force betwee...
agx::FrameRef m_parentFrame
void setTopEdge(agx::Line topEdge)
Set the top edge in local space.
ShovelAggregateContactMaterialContainer * getShovelTerrainContactMaterialContainer() const
Shovel(agx::RigidBody *shovelBody, const agx::Line &topEdge, const agx::Line &cuttingEdge, const agx::Line &teethEdge, ShovelDebugRenderSettings *settings=nullptr)
Alternative basic constructor that takes a teeth location edge instead of direction in local space to...
agx::Vec3 getToothOrCuttingDirectionWorld() const
const agxCollide::GeometryRefVector & getVoxelCollisionGeometries() const
agx::Real getSoilAggregateMass(Shovel::ExcavationMode excavationMode) const
Returns the total soil aggregate mass in the shovel for the specific excavation mode.
agx::Line getTeethEdge() const
agx::Plane getExcavationTopPlane() const
bool getEnable() const
Access the state enable flag.
void setTeethEdge(agx::Line teethEdge)
Set the teeth edge in local space.
agx::Vec3 getCuttingDirectionWorld() const
agx::Vec3 getSeparationContactForce() const
Given geometry contacts exists and the solver has solved them - calculates total contact force betwee...
ShovelAggregateContactMaterialContainerRef m_shovelAggregateCMContainer
ShovelSettings * getSettings()
void setEnableForTerrain(Terrain *terrain, bool enable)
Set if the shovel is enabled for the particular terrain.
agxCollide::GeometryRefVector m_voxelCollisionGeometries
SoilParticleAggregateRef m_soilParticleAggregate
agx::Real getSecondarySeparationAngle() const
AggregateContactGenerator * getAggregateContactGenerator() const
SoilParticleVector getTotalSoilParticles() const
agx::Real getDeadLoadFraction() const
Get the last computed dead load fraction of the shovel, i.e how much of it's inner volume that is fil...
agx::Vec3 getAggregateTerrainTangentialForce(Shovel::ExcavationMode excavationMode) const
Get the terrain <-> aggregate tangential force for the given excavation mode.
agx::Vec3iVector m_voxelsInPrimaryActiveZoneLastTimeStep
agx::Vec3 getCuttingDirection() const
const agx::Plane & getCutTopPlane() const
PrimaryActiveZone * getActiveZone() const
agx::Line getTopEdgeWorld() const
Terrain * m_activeTerrain
agx::Plane getExcavationTopPlaneWorld() const
std::array< ExcavationSettings, 4 > m_excavationSettings
const agx::Line & getTopEdge() const
void setEnable(bool enable)
Change state enable of this shovel.
SoilPenetrationResistanceRef m_penetrationResistance
const ShovelSettings * getSettings() const
agx::ContactMaterial * getShovelAggregateContactMaterial(Shovel::ExcavationMode mode=Shovel::ExcavationMode::PRIMARY) const
Get the explicitly set contact material in a shovel-aggregate contact corresponding to a specified ex...
size_t getMaximumNumberOfContactPoints()
agx::Vec3 getSeparationFrictionForce() const
Given geometry contacts exists and the solver has solved them - calculates total contact friction for...
agxCollide::BoundingAABB m_collisionBound
agx::Line getCuttingEdgeWorld() const
Terrain * getActiveTerrain() const
bool isDigging() const
Check if the shovel is currently in digging mode with a terrain, i.e if the cutting edge is submerged...
PrimaryActiveZoneRef m_activeZone
void setExcavationSettings(ExcavationMode mode, ExcavationSettings excavationSettings)
Set a settings object for an ExcavationMode of the shovel.
agx::Real getInnerParticleVolume() const
AdvancedShovelSettings * getAdvancedSettings()
agxCollide::GeometryContactPtrVector getAggregateTerrainContacts(Shovel::ExcavationMode excavationMode) const
Get the aggregate <-> terrain geometry contacts with the shovel given an excavation mode.
bool getPenetrationForce(agx::Vec3 &force, agx::Vec3 &torque) const
The result includes the active force and torque from the penetration resistance from the active terra...
Shovel(agx::RigidBody *shovelBody, const agx::Line &topEdge, const agx::Line &cuttingEdge, const agx::Vec3 &toothDirection=agx::Vec3(0, 0, 0), agx::Real toothLength=0.15, ShovelDebugRenderSettings *settings=nullptr)
Basic constructor.
static Shovel * find(const agxSDK::Simulation *simulation, const agx::Uuid &uuid)
Find shovel with given UUID.
agx::Vec3 getAggregateTerrainNormalForce(Shovel::ExcavationMode excavationMode) const
Get the terrain <-> aggregate normal force for the given excavation mode.
agx::Real getInnerContactArea() const
Get the last computed inner contact area of the shovel, i.e the estimated cross-section area of the i...
agx::Real getAggregateTerrainContactArea(Shovel::ExcavationMode excavationMode) const
Get the aggregate <-> terrain contact area given an excavation mode and a shovel.
agx::Bool canDeformTerrain(Terrain *terrain) const
agx::Vec3 getToothOrCuttingDirection() const
TangentPatchData m_tangentData
agx::Line getExcavationEdgeWorld() const
AggregateContactGeneratorRef m_aggregateContactGenerator
SoilPenetrationResistance * getPenetrationResistance() const
agx::Vec3 getSecondaryForwardVectorWorld() const
const agxCollide::BoundingAABB & getCollisionBound() const
AdvancedShovelSettings * getAdvancedSettings() const
ShovelSettingsRef m_shovelSettings
std::array< DeformerCollectionRef, 3 > m_deformers
agx::Vec3 m_forwardDirection
agx::RigidBody * getRigidBody() const
bool getEnableForTerrain(Terrain *terrain) const
agx::Vec3 getExcavationModeContactForce(Shovel::ExcavationMode excavationMode) const
Calculates total contact force between the soil aggregate associated with the specified excavation mo...
agx::Plane m_teethTopPlane
bool setSoilPenetrationModel(agxTerrain::SoilPenetrationResistance::PenetrationModel model)
Set the soil penetration model used for the shovel.
bool getSoilPenetrationModel(agxTerrain::SoilPenetrationResistance::PenetrationModel &model) const
Get the soil penetration model used for the shovel.
agx::Vec3 getToothDirectionWorld() const
DeformControllerRef m_deformController
agx::Real m_innerContactArea
const agx::Line & getCuttingEdge() const
ExcavationSettings & getExcavationSettings(ExcavationMode mode)
ExcavationMode
Enum for describing the different excavation modes of a shovel:
void setCuttingEdge(agx::Line cuttingEdge)
Set the cutting edge in local space.
agx::Real computeCuttingEdgeLength() const
This class is used to describe the general material properties of the Terrain.
A terrain model based a 3D grid model with overlapping height field that can be deformed by interacti...
The object defining a frame of reference and providing transformations operations.
Main material class which acts as a holder of a Surface Material and a Bulk material.
Representation of a name string.
Class representing the mathematical concept of a plane, also called a half- space.
Base class providing referencing counted objects.
The rigid body class, combining a geometric model and a frame of reference.
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
Vector containing 'raw' data.
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
This namespace consists of a set of classes for handling geometric intersection tests including boole...
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
agx::Vector< TangentPatch > TangentPatchData
The agx namespace contains the dynamics/math part of the AGX Dynamics API.