AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
ShovelSettings.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. 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 <agx/BitState.h>
20#include <agxTerrain/export.h>
21#include <agx/Line.h>
25#include <agx/Referenced.h>
26
27
28namespace agxTerrain
29{
30
31 class AdvancedShovelSettings;
33
34
37 {
38 public:
39
40 /*
41 Settings class for shovel.
42 */
43 ShovelSettings(const agx::Line& cuttingEdge, const agx::Vec3& toothDirection, agx::Real toothLength);
44
45 // Common settings
46
58
79
84 void setPenetrationForceScaling(agx::Real penetrationForceScaling);
85
90
91
96 void setMaxPenetrationForce(agx::Real maxPenetrationForce);
102
107
112
117
127 void setToothDirection( const agx::Vec3& toothDirection);
128
136 void setEnableCustomTeethGeometry( bool enable );
137
146
155
164
169
174
179
184
193
200
205
213
219
224 void setVerticalBladeSoilMergeDistance(agx::Real verticalSoilBladeMergeDistance);
230
232
233 /*
234 Constructor for serialization
235 */
237
239
240 void store(agxStream::OutputArchive& out) const;
241 void restore( agxStream::InputArchive& in);
242
243 /* This method is only used internally for restore from TerrainToolCollection */
244 void restorePreShovelRefactor(agxStream::InputArchive& in, const agx::Line& cuttingEdge, bool& enabled);
245
249 AdvancedShovelSettings* getAdvancedSettings() { return m_advanced; }
250 AdvancedShovelSettings* getAdvancedSettings() const { return m_advanced; }
251
252 bool isDirty() const { return m_dirty; };
253 void setDirty( bool enable ) { m_dirty = enable; }
254
256
257 private:
258
259 enum CommonFlags : agx::UInt32
260 {
261 ENABLE_PARTICLE_FREE_DEFORMATION = 1 << 0,
262 ENABLE_GENERATE_TEETH_GEOMETRY = 1 << 1,
263 ENABLE_CUSTOM_TEETH_GEOMETRY = 1 << 3,
264 ENABLE_EXCAVATION_AT_TEETH_EDGE = 1 << 4
265 };
266 using CommonBitState = agx::BitState<CommonFlags, agx::UInt32>;
267
268 CommonBitState m_flags;
269
270 /* teeth parameters for the penetration resistance model */
271 struct TeethProperties
272 {
273 agx::Real toothLength;
274 agx::Real toothMinRadius;
275 agx::Real toothMaxRadius;
276 agx::UInt numberOfTeeth;
277 agx::Vec3 toothDirection;
278 };
279 TeethProperties m_teethProps;
280 agx::Vec3 m_customTeethGeometryHalfVec;
281
282 /* struct for soil penetration parameters */
283 struct SoilPenetrationParameters
284 {
285 agx::Real depthThreshold;
286 agx::Real forceScaling;
287 agx::Real maxForce;
288 };
289
290 SoilPenetrationParameters m_soilPenetrationParameters;
291 agx::Real m_verticalSoilBladeMergeDistance;
292 // Contains advanced settings for the shovel
293 AdvancedShovelSettingsRef m_advanced;
294
295 bool m_dirty;
296 };
297
298 /*
299 Advanced settings class for shovel.
300 */
302 {
303 public:
304
309
314
320
325
333
340
348
354
361
366
367 /*
368 Set whenever custom friction models should be used in the
369 shovel <-> aggregate contacts.
370 \param enable - True if custom friction models should be used. (Default: true)
371 */
372 void setUseCustomFrictionModel(bool enable);
373
378
382 void setNoMergeExtensionDistance(agx::Real extensionDistance);
383
388
392 void setMinimumSubmergedContactLengthFraction(agx::Real minimumSubmergedContactLengthFraction);
393
398
404 void setSecondarySeparationDeadloadLimit(agx::Real secondarySeparationLimit);
405
411
420 void setContactRegionThreshold(agx::Real contactRegionThreshold);
421
430
439
440 /*
441 Get the maximum vertical distance from the shovel bottom plane where regular geometry
442 contacts between the shovel and the terrain are allowed to be created. Contacts past that distance
443 will be filtered away.
444 \return the maximum vertical distance from the shovel bottom plane where regular geometry
445 contacts between the shovel and the terrain are allowed to be created. ( Default: cuttingEdgeLength / 10.0 )
446 */
448
459
467
473 void setCustomExcavationStiffnessMultiplier(agx::Real excavationStiffnessMultiplier);
474
480
486 void setNumContactPatches( agx::UInt numContactPatches );
487
493
498 void setEnableCustomPartitioning( bool enable );
499
505
512
519
525
531
537
543
548 void setAggregateVelocityToShovel( bool enable );
549
555
560 void setNonHolonomicContacts( bool enable );
561
567
573
579
585
591
597
603
607 void setDisableShovelSideContacts( bool enable );
608
613
619 void setShouldUpdateContactPatches( bool shouldUpdate );
620
627
638 void setEnableCustomForwardVector( bool enable );
639
646
656 void setEnableCustomBottomVector( bool enable );
657
664
675 void setCustomForwardVector( const agx::Vec3& forwardVector );
676
681
692 void setCustomBottomVector( const agx::Vec3& bottomVector );
693
698
708 void setEnableTeethVolume( bool enable );
709
716
717 bool isDirty() const { return m_dirty; };
718
719 void setDirty( bool enable ) { m_dirty = enable; }
720
721 protected:
722 friend class ShovelSettings;
725
726 private:
727 enum AdvancedFlags : agx::UInt32
728 {
729 REMOVE_SHOVEL_CONTACTS = 1 << 0,
730 INNER_SHAPE_CREATE_DYNAMIC_MASS = 1 << 1,
731 ENABLE_PARTICLE_FREE_DEFORMATION = 1 << 2,
732 ENABLE_PARTICLE_FORCE_FEEDBACK = 1 << 3,
733 SET_ZERO_AGGREGATE_VELOCITY = 1 << 4,
734 USE_CUSTOM_FRICTION_MODELS = 1 << 5,
735 CLAMP_AGGREGATE_VELOCITY_TO_PARTICLES = 1 << 6,
736 SET_AGGREGATE_VELOCITY_TO_SHOVEL = 1 << 7,
737 SET_NON_HOLONOMIC_CONTACTS = 1 << 8,
738 CUSTOM_PATCH_PARTITIONING = 1 << 9,
739 DISABLE_PRIMARY_WEDGE_AGGREGATES = 1 << 10,
740 INNER_SHAPE_STRICT_PARTICLE_INCLUSION = 1 << 11,
741 DISABLE_SHOVEL_SIDE_CONTACTS = 1 << 12,
742 ENABLE_CUSTOM_FORWARD_VECTOR = 1 << 13,
743 ENABLE_CUSTOM_BOTTOM_VECTOR = 1 << 14,
744 DISABLE_TEETH_SHAPE = 1 << 15,
745 };
746 using AdvancedBitState = agx::BitState<AdvancedFlags, agx::UInt32>;
747 AdvancedBitState m_advancedFlags;
748
749 agx::Real m_noMergeExtensionDistance;
750 agx::Real m_minimumSubmergedContactLengthFraction;
751 agx::Real m_secondarySeparationDeadLoadLimit;
752 agx::Real m_particleInclusionMultiplier;
753 agx::Real m_contactThreshold;
754 agx::Real m_verticalContactLimit;
755 agx::Real m_excavationStiffnessMultiplier;
756
757 agx::UInt m_numContactPatches;
758 agx::UInt m_numPatchSamplingPoints;
759 agx::Real m_contactSamplingAngleCutoff;
760 agx::RealVector m_customAngleThresholds;
761 bool m_shouldUpdateContactPatches;
762 agx::Vec3 m_customForwardVector;
763 agx::Vec3 m_customBottomVector;
764 bool m_dirty;
765 };
766
768
769 AGX_DECLARE_POINTER_TYPES( ShovelDebugRenderSettings );
770 class AGXTERRAIN_EXPORT ShovelDebugRenderSettings : public agx::Referenced
771 {
772 public:
773 ShovelDebugRenderSettings();
774
775 void setRenderForbiddenBounds( bool enable );
776 bool getEnableRenderForbiddenBounds() const;
777
778 void setEnableRenderAggregateContactArea( bool enable );
779 bool getEnableRenderAggregateContactArea() const;
780
781 void setEnableRenderAggregateContacts( bool enable );
782 bool getEnableRenderAggregateContacts() const;
783
784 void setEnableRenderContactPatches( bool enable );
785 bool getEnableRenderContactPatches() const;
786
787 void setEnableRenderInnerParticles( bool enable );
788 bool getEnableRenderInnerParticles() const;
789
790 void setEnableRenderWedgeParticles( bool enable );
791 bool getEnableRenderWedgeParticles() const;
792
793 void setEnableRenderWedgeVoxels( bool enable );
794 bool getEnableRenderWedgeVoxels() const;
795
796 void setEnableRenderExcludedInnerParticles( bool enable );
797 bool getEnableRenderExcludedInnerParticles() const;
798
799 void setEnableRenderContactPartitioning( bool enable );
800 bool getEnableRenderContactPartitioning() const;
801
802 void setEnableRenderSideWallContactPartitioning( bool enable );
803 bool getEnableRenderSideWallContactPartitioning() const;
804
805 void setRenderWedgeLocks( bool enable );
806 bool getRenderWedgeLocks() const;
807
808 void setParticleScalingFactor( agx::Real scalingFactor );
809 agx::Real getParticleScalingFactor() const;
810
811 void setRenderActiveZone( bool enable );
812 bool getRenderActiveZone() const;
813
814 void setRenderSoilWedges( bool enable );
815 bool getRenderSoilWedges() const;
816
817 void setRenderInnerShapeAlgorithm( bool enable );
818 bool getRenderInnerShapeAlgorithm() const;
819
820 void setRenderContactPatchIntersectionTest( bool enable );
821 bool getRenderContactPatchIntersectionTest() const;
822
823 void setContactRenderSize( agx::Real size );
824 agx::Real getContactRenderSize() const;
825
826 void setRenderTeeth( bool enable );
827 bool getRenderTeeth() const;
828
829 void setRenderShovelPrimaryVectors( bool enable );
830 bool getRenderShovelPrimaryVectors() const;
831
832 void setRenderShovelDeformerVectors( bool enable );
833 bool getRenderShovelDeformerVectors() const;
834
835 void setRenderInnerShapes( bool enable );
836 bool getRenderInnerShapes() const;
837
838 void setRenderBottomPlateAlgorithm( bool enable );
839 bool getRenderBottomPlateAlgorithm() const;
840
841 void setRenderInnerPlaneAlgorithm( bool enable );
842 bool getRenderInnerPlaneAlgorithm() const;
843
844 void setRenderShovelDeadloadParticles( bool enable );
845 bool getRenderShovelDeadloadParticles() const;
846
847 void setRenderSecondarySeparation( bool enable );
848 bool getRenderSecondarySeparation() const;
849
850 void setRenderParticleContactsConvexHull( bool enable );
851 bool getRenderParticleContactsConvexHull() const;
852
853 void setRenderSoilWedgeVelocities(bool enable);
854 bool getRenderSoilWedgeVelocities() const;
855
856 private:
857 enum AdvancedFlags : agx::UInt32
858 {
859 RENDER_FORBIDDEN_BOUNDS = 1 << 0,
860 RENDER_AGGREGATE_CONTACTS = 1 << 1,
861 RENDER_AGGREGATE_CONTACT_AREA = 1 << 2,
862 RENDER_AGGREGATE_CONTACT_PARTITIONING = 1 << 3,
863 RENDER_AGGREGATE_SIDE_CONTACT_PARTITIONING = 1 << 4,
864 RENDER_INNER_SHAPE_PARTICLES = 1 << 5,
865 RENDER_WEDGE_SHAPE_PARTICLES = 1 << 6,
866 RENDER_EXCLUDED_INNER_SHAPE_PARTICLES = 1 << 7,
867 RENDER_CONTACT_PATCHES = 1 << 8,
868 RENDER_WEDGE_LOCKS = 1 << 9,
869 RENDER_SOIL_WEDGES = 1 << 10,
870 RENDER_ACTIVE_ZONE = 1 << 11,
871 RENDER_INNER_SHAPE_ALGORITHM = 1 << 12,
872 RENDER_CONTACT_PATCH_INTERSECTION_TEST = 1 << 13,
873 RENDER_SHOVEL_TEETH = 1 << 14,
874 RENDER_SHOVEL_PRIMARY_VECTORS = 1 << 15,
875 RENDER_SHOVEL_DEFORMER_VECTORS = 1 << 16,
876 RENDER_SHOVEL_INNER_SHAPES = 1 << 17,
877 RENDER_BOTTOM_PLANE_ALGORITHM = 1 << 18,
878 RENDER_INNER_PLANE_ALGORITHM = 1 << 19,
879 RENDER_SHOVEL_DEADLOAD_PARTICLES = 1 << 20,
880 RENDER_SHOVEL_SECONDARY_SEPARATION = 1 << 21,
881 RENDER_WEDGE_VOXELS = 1 << 22,
882 RENDER_PARTICLE_CONTACTS_CONVEX_HULL = 1 << 23,
883 RENDER_WEDGE_VELOCITIES = 1 << 24
884 };
885 using RenderState = agx::BitState<AdvancedFlags, agx::UInt32>;
886 RenderState m_flags;
887 agx::Real m_particleScalingFactor;
888 agx::Real m_contactRenderSize;
889 };
890
892}
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#define AGXTERRAIN_EXPORT
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:57
void setUseZeroAggregateVelocity(bool enable)
Set whenever the innerbody aggregate should have zero velocity before solve step as opposed to using ...
void setEnableInnerShapeCreateDynamicMass(bool enable)
Set if inner shape alone should always create dynamic mass.
bool getEnableTeethVolume() const
Checks whether the teeth volume feature is enabled.
void setEnableCustomPartitioning(bool enable)
Set whenever custom contact partitions should be used or not.
void setCustomBottomVector(const agx::Vec3 &bottomVector)
Sets the custom bottom plate direction vector.
void setCustomContactPatchAngleTresholds(const agx::RealVector &angleThresholds)
Specify cutsom contact patches by givin custom angle thresholds.
void setEnableCustomBottomVector(bool enable)
Enables or disables the use of a custom bottom vector.
agx::Real getContactSamplingAngleCutoff() const
void setCustomForwardVector(const agx::Vec3 &forwardVector)
Sets the custom forward vector.
void setAlwaysRemoveShovelContacts(bool enable)
Set to true/false if shovel <-> terrain contacts should always be removed.
AdvancedShovelSettings()
Constructor for serialization.
bool getEnableCustomForwardVector() const
Checks whether a custom forward vector is enabled.
agx::Bool getNonHolonomicContacts() const
agx::Real getMinimumSubmergedContactLengthFraction() const
Get the minimum submerged cutting edge length fraction [0-1] that generates submerged cutting.
void setEnableTeethVolume(bool enable)
Enables or disables the teeth volume feature.
agx::Bool getClampAggregateVelocityToParticles() const
void setSecondarySeparationDeadloadLimit(agx::Real secondarySeparationLimit)
Sets the dead-load limit where secondary separation will start to activate where the forward directio...
bool getEnableInnerShapeCreateDynamicMass() const
Get if inner shape alone should always create dynamic mass.
agx::Bool getDisablePrimaryWedgeAggregates() const
void setAggregateVelocityToShovel(bool enable)
Set if the inner shape aggregate velocity should explicitly be set to the shovel velocity.
void setUseCustomFrictionModel(bool enable)
void setDisablePrimaryWedgeAggregates(bool enable)
Set if we should disabled wedge aggregates for primary excavation.
void setParticleInclusionMultiplier(agx::Real radiusMultiplier)
Set the radius multiplier for extending the inclusion bound with particle radius during post-excavati...
void setContactRegionVerticalLimit(agx::Real verticalLimit)
Set the maximum vertical distance from the shovel bottom plane where regular geometry contacts betwee...
agx::Bool getEnableCustomPartitioning() const
agx::Real getContactRegionVerticalLimit() const
agx::Real getSecondarySeparationDeadloadLimit() const
void setEnableParticleForceFeedback(bool enable)
Set whenever the excavation force feedback during PRIMARY excavation should be generated from particl...
agx::UInt getNumContactPatches() const
Get the number of contact patches that will be created inside the shovel to generate shovel <-> aggre...
agx::Real getCustomExcavationStiffnessMultiplier() const
agx::Real getContactRegionThreshold() const
Get the starting distance threshold from the shovel planes where regular geometry contacts between th...
void setNonHolonomicContacts(bool enable)
Set if shovel <-> aggregate contacts should be set to use non-holonomic constraints,...
agx::RealVector getCustomContactPatchAngleThresholds() const
Specify cutsom contact patches by givin custom angle thresholds.
void setClampAggregateVelocityToParticles(bool enable)
Set if the inner shape aggregate velocity should clamped to the total soil particle velocity.
agx::Real getParticleInclusionMultiplier() const
agx::Vec3 getCustomForwardVector() const
void setDisableShovelSideContacts(bool enable)
Set if shovel <-> aggregate side contacts should be disabled.
void restore(agxStream::InputArchive &in)
void setEnableInnerShapeMidpointInclusion(bool enable)
Set if we limit the particle inner shape inclusion to the particle midpoint.
void setNoMergeExtensionDistance(agx::Real extensionDistance)
Set the extension outside the shovel bounding box where soil particle merging is forbidden.
void setContactRegionThreshold(agx::Real contactRegionThreshold)
Set the starting distance threshold from the shovel planes where regular geometry contacts between th...
void setShouldUpdateContactPatches(bool shouldUpdate)
Set if we should update contact patches of the shovel, this is set when the shovel contact patch sett...
void setEnableCustomForwardVector(bool enable)
Enables or disables the use of a custom forward vector.
agx::Vec3 getCustomBottomVector() const
void setNumContactPatchSamplingPoints(agx::UInt numSamples)
Set the number of sampling points used when tracing the shovel outline during creation of contact pat...
agx::Real getNoMergeExtensionDistance() const
Get the margin outside the shovel bonding box where soil particle merging is forbidden.
void setCustomExcavationStiffnessMultiplier(agx::Real excavationStiffnessMultiplier)
Set the custom excavation stiffness multiplier, which is used to multiply the Young's modulus of the ...
void setMinimumSubmergedContactLengthFraction(agx::Real minimumSubmergedContactLengthFraction)
Set the minimum submerged cutting edge length fraction [0-1] that generates submerged cutting.
agx::Bool getEnableInnerShapeMidpointInclusion() const
AdvancedShovelSettings(const agx::Line &cuttingEdge)
Constructor of advanced shovel settings from the necessary initial info from a shovel.
agx::UInt getNumContactPatchSamplingPoints() const
void store(agxStream::OutputArchive &out) const
void setContactSamplingAngleCutoff(agx::Real angleCutoff)
Set the angle cutoff from the cutting edge when the contact sampling inside the shovel will stop.
agx::Bool getAggregateVelocityToShovel() const
void setNumContactPatches(agx::UInt numContactPatches)
Set number of contact patches that will be created inside the shovel to generate shovel <-> aggregate...
bool getEnableCustomBottomVector() const
Checks whether a custom bottom vector is enabled.
void setPenetrationDepthThreshold(agx::Real depthThreshold)
Set the vertical penetration depth threshold for when the shovel tooth for penetration resistance sho...
agx::Real getPenetrationDepthThreshold() const
Get the vertical penetration depth threshold for when the shovel tooth for penetration resistance sho...
void setToothMaximumRadius(agx::Real radius)
agx::Vec3 getToothDirection() const
bool getEnableCustomTeethGeometry() const
Get whenever custom tooth geometry dimensions should be used instead of automatically generating a te...
agx::Real getVerticalBladeSoilMergeDistance() const
Get the vertical distance under the blade cutting edge that the soil is allowed to instantly merge up...
agx::Real getMaxPenetrationForce() const
Set the maximum limit on penetration force (N) that the terrain will generate on this shovel.
void setMaxPenetrationForce(agx::Real maxPenetrationForce)
Set a maximum limit on penetration force (N) that the terrain will generate on this shovel.
void setEnableGenerateTeethGeometry(bool enable)
Set whenever a teeth geometry should be generated between the cutting edge and the teeth edge from th...
void setNumberOfTeeth(agx::UInt count)
agx::Real getToothMinimumRadius() const
bool getEnableGenerateTeethGeometry() const
agx::UInt getNumberOfTeeth() const
agx::Vec3 getCustomTeethGeometryHalfVec() const
Get the custom tooth geometry box half vector dimensions to be used when generating a custom teeth ge...
void setToothDirection(const agx::Vec3 &toothDirection)
Set the tooth direction of the shovel.
void setToothLength(agx::Real length)
void setToothMinimumRadius(agx::Real radius)
agx::Real getToothMaximumRadius() const
void setVerticalBladeSoilMergeDistance(agx::Real verticalSoilBladeMergeDistance)
Sets the vertical distance under the blade cutting edge that the soil is allowed to instantly merge u...
ShovelSettings(const agx::Line &cuttingEdge, const agx::Vec3 &toothDirection, agx::Real toothLength)
void setCustomTeethGeometryHalfVec(const agx::Vec3 &halfVec)
Set the custom tooth geometry box half vector dimensions to be used when generating a custom teeth ge...
void setEnableExcavationAtTeethEdge(bool enable)
Set whenever a excavation at the teeth edge should be enabled so that digging starts at the teeth edg...
void setEnableParticleFreeDeformers(bool enable)
Set true/false if the shovel deformers should make particle free deformations.
agx::Real getPenetrationForceScaling() const
void setEnableCustomTeethGeometry(bool enable)
Set whenever custom tooth geometry dimensions should be used instead of automatically generating a te...
agx::Real getToothLength() const
void setPenetrationForceScaling(agx::Real penetrationForceScaling)
Set the linear scaling coefficient for the penetration force (Default: 1.0)
bool getEnableParticleFreeDeformers() const
bool getEnableExcavationAtTeethEdge() const
Base class providing referencing counted objects.
Definition: Referenced.h:120
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:89
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:88
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition: Geometry.h:59
agx::ref_ptr< AdvancedShovelSettings > AdvancedShovelSettingsRef
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition: Integer.h:32
bool Bool
Definition: Integer.h:40
uint64_t UInt
Definition: Integer.h:27
double Real
Definition: Real.h:41