AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
agx::FrictionModel Class Referenceabstract

Base class for all friction models with interface and some utility/necessary methods implemented. More...

#include <FrictionModel.h>

+ Inheritance diagram for agx::FrictionModel:

Public Types

enum  FrictionCallbackType {
  NONE = 0 , INITIALIZE = 1 << 0 , SCALE_BOUNDS = 1 << 1 , ITERATIVE_PROJECTION = 1 << 2 ,
  HAS_CUSTOM_CONTACT_IMPLEMENTATION = 1 << 3 , ACCURATE_CONE_NL_DIRECT = 1 << 4
}
 
enum  SolveType {
  NOT_DEFINED , DIRECT , ITERATIVE , SPLIT ,
  DIRECT_AND_ITERATIVE
}
 

Public Member Functions

 AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agx::FrictionModel)
 
virtual void calculateTangentPlane (const agxCollide::Geometry *geometry1, const agxCollide::Geometry *geometry2, const agx::Vec3 &point, const agx::Vec3 &normal, const agx::Real depth, agx::Vec3 &ret_u, agx::Vec3 &ret_v) const
 Calculates friction plane given normal.
 
int getCallbackMask () const
 
bool getEnableCallbackMask (FrictionCallbackType mask) const
 
SolveType getSolveType () const
 
bool hasCustomContactImplementation () const
 
virtual void initialize (const Physics::GeometryContactPtr geometryContact, size_t pointIndex, agx::Real dt, agx::RangeReal &ret_boundU, agx::RangeReal &ret_boundV) const =0
 Initializes bounds given contact point (pointIndex).
 
virtual void matchForCustomContactImplementation (agxCollide::GeometryContact *geometryContact, agxSDK::Simulation *simulation)
 
bool needsNlmcpCallbacks () const
 
void setSolveType (SolveType solveType)
 Solve type for a friction model can be either DIRECT (all equations to the direct solver), ITERATIVE (all equations to the iterative solver), SPLIT (normal equations both direct and iterative and tangential equations only iterative) and DIRECT_AND_ITERATIVE (both normal and tangential equations are solved both direct and iterative).
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Static Public Member Functions

static void calculateTangentPlane (const Vec3 &primaryDirectionWorld, const Vec3 &normal, Vec3 &ret_u, Vec3 &ret_v)
 Calculates friction tangents directions given primaryDirectionWorld and contact normal.
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.
 

Protected Member Functions

 FrictionModel (int callbackMask, SolveType preferredSolveType)
 Protected constructor given callback bask and preferred solve type.
 
virtual ~FrictionModel ()
 Destructor.
 
void restore (agxStream::InputArchive &in) override
 Restore.
 
void setEnableCallbackMask (FrictionCallbackType mask, bool enable)
 Enable/disable the given callback mask.
 
void store (agxStream::OutputArchive &out) const override
 Store.
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor.
 
 Serializable (const Serializable &other)
 Copy constructor.
 
void generateUuid ()
 

Additional Inherited Members

- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Base class for all friction models with interface and some utility/necessary methods implemented.

Definition at line 52 of file FrictionModel.h.

Member Enumeration Documentation

◆ FrictionCallbackType

Enumerator
NONE 

Not initialized, scale bounds nor iterative projected.

INITIALIZE 

Initialize bounds callback.

SCALE_BOUNDS 

Scaled bounds, if direct, callbacks from CP-solver.

ITERATIVE_PROJECTION 

Iterative projected bounds.

HAS_CUSTOM_CONTACT_IMPLEMENTATION 

Custom implementation of the contact constraints associated to this friction model with this state.

Geometry contacts with a friction model containing this state will not reach the solver.

ACCURATE_CONE_NL_DIRECT 

Iterative projected cone friction with direct solve type supports exact (anisotropic) projections to the friction cone.

This feature isn't enabled by default because it's computationally more expensive when the convergence rate is lower and the solver may fail more often.

Definition at line 67 of file FrictionModel.h.

◆ SolveType

Enumerator
NOT_DEFINED 
DIRECT 

Normal and friction equation calculated only in the DIRECT solver.

ITERATIVE 

Normal and friction equation calculated only in the ITERATIVE solver.

SPLIT 

First Normal equation is calculated in the DIRECT solver, then in a second pass the normal and the friction equations are solved in the ITERATIVE solver.

DIRECT_AND_ITERATIVE 

Normal and friction equation calculated both in the ITERATIVE and the DIRECT solver.

Definition at line 57 of file FrictionModel.h.

Constructor & Destructor Documentation

◆ FrictionModel()

agx::FrictionModel::FrictionModel ( int  callbackMask,
SolveType  preferredSolveType 
)
protected

Protected constructor given callback bask and preferred solve type.

Parameters
callbackMask- callback mask from FrictionCallbackType
preferredSolveType- if no one assigns solve type, this is the "default" solve type

◆ ~FrictionModel()

virtual agx::FrictionModel::~FrictionModel ( )
protectedvirtual

Destructor.

Member Function Documentation

◆ AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE()

agx::FrictionModel::AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE ( agx::FrictionModel  )

◆ calculateTangentPlane() [1/2]

virtual void agx::FrictionModel::calculateTangentPlane ( const agxCollide::Geometry *  geometry1,
const agxCollide::Geometry *  geometry2,
const agx::Vec3 &  point,
const agx::Vec3 &  normal,
const agx::Real  depth,
agx::Vec3 &  ret_u,
agx::Vec3 &  ret_v 
) const
virtual

Calculates friction plane given normal.

Only valid if normal, ret_u and ret_v are orthogonal.

Parameters
geometry1- first geometry in the geometry contact
geometry2- the other geometry in the geometry contact
point- contact point in world coordinate system
normal- contact normal in world coordinate system
depth- penetration depth
ret_u- returned, primary direction in friction plane
ret_v- returned, secondary direction in the friction plane

Reimplemented in agx::OrientedFrictionModelImpl< agx::BoxFrictionModel >, agx::OrientedFrictionModelImpl< agx::IterativeProjectedConeFriction >, agx::OrientedFrictionModelImpl< agx::ScaleBoxFrictionModel >, agxModel::TireFriction, agxVehicle::TrackFrictionModelImpl< agx::BoxFrictionModel >, agxVehicle::TrackFrictionModelImpl< agx::IterativeProjectedConeFriction >, and agxVehicle::TrackFrictionModelImpl< agx::ScaleBoxFrictionModel >.

◆ calculateTangentPlane() [2/2]

void agx::FrictionModel::calculateTangentPlane ( const Vec3 &  primaryDirectionWorld,
const Vec3 &  normal,
Vec3 &  ret_u,
Vec3 &  ret_v 
)
inlinestatic

Calculates friction tangents directions given primaryDirectionWorld and contact normal.

Parameters
primaryDirectionWorld- primary friction direction in world frame, transformed to ret_u
normal- friction plane normal (contact normal direction)
[out]ret_u- resulting primary direction in world coordinates
[out]ret_v- resulting secondary direction in world coordinates

Definition at line 365 of file FrictionModel.h.

References agx::Attachment::createAttachmentBase(), agx::Vec3T< T >::cross(), agx::Vec3T< T >::normalize(), and agx::RealEpsilon.

Referenced by agx::OrientedFrictionModelImpl< T >::calculateTangentPlane(), and agxVehicle::calculateTrackTangentPlane().

◆ getCallbackMask()

int agx::FrictionModel::getCallbackMask ( ) const
Returns
callback mask, used by solvers to determine which callbacks this friction model needs

Definition at line 386 of file FrictionModel.h.

◆ getEnableCallbackMask()

bool agx::FrictionModel::getEnableCallbackMask ( FrictionCallbackType  mask) const
Parameters
mask- callback mask to check
Returns
true if the given callback mask is enabled

◆ getSolveType()

FrictionModel::SolveType agx::FrictionModel::getSolveType ( ) const
Returns
the current solve type for this friction model

Definition at line 381 of file FrictionModel.h.

◆ hasCustomContactImplementation()

bool agx::FrictionModel::hasCustomContactImplementation ( ) const
inline

Definition at line 396 of file FrictionModel.h.

References HAS_CUSTOM_CONTACT_IMPLEMENTATION.

◆ initialize()

virtual void agx::FrictionModel::initialize ( const Physics::GeometryContactPtr  geometryContact,
size_t  pointIndex,
agx::Real  dt,
agx::RangeReal &  ret_boundU,
agx::RangeReal &  ret_boundV 
) const
pure virtual

Initializes bounds given contact point (pointIndex).

Parameters
geometryContact- geometry contact
pointIndex- point in geometry contact
dt- time step
ret_boundU- returned, primary direction bounds
ret_boundV- returned, secondary direction bounds

Implemented in agxTerrain::ShovelAggregateFrictionModel, agx::BoxFrictionModel, and agx::ScaleBoxFrictionModel.

◆ matchForCustomContactImplementation()

void agx::FrictionModel::matchForCustomContactImplementation ( agxCollide::GeometryContact *  geometryContact,
agxSDK::Simulation *  simulation 
)
inlinevirtual

Reimplemented in agx::DirectMultiTangentsFrictionModel, and agx::TerrainWheelForceModel.

Definition at line 401 of file FrictionModel.h.

◆ needsNlmcpCallbacks()

bool agx::FrictionModel::needsNlmcpCallbacks ( ) const
Returns
true if the friction model needs callbacks for the Non-Linear Mixed Complementary Problem solver (e.g., ScaleBoxFrictionModel)

Definition at line 391 of file FrictionModel.h.

References DIRECT, DIRECT_AND_ITERATIVE, and SCALE_BOUNDS.

◆ restore()

void agx::FrictionModel::restore ( agxStream::InputArchive &  in)
overrideprotected

Restore.

Abstract serializable, so child classes must explicitly call these methods.

◆ setEnableCallbackMask()

void agx::FrictionModel::setEnableCallbackMask ( FrictionCallbackType  mask,
bool  enable 
)
protected

Enable/disable the given callback mask.

Parameters
mask- callback mask to change
enable- enable flag

◆ setSolveType()

void agx::FrictionModel::setSolveType ( SolveType  solveType)

Solve type for a friction model can be either DIRECT (all equations to the direct solver), ITERATIVE (all equations to the iterative solver), SPLIT (normal equations both direct and iterative and tangential equations only iterative) and DIRECT_AND_ITERATIVE (both normal and tangential equations are solved both direct and iterative).

Parameters
solveType- solve type definition

◆ store()

void agx::FrictionModel::store ( agxStream::OutputArchive &  out) const
overrideprotected

Store.

Abstract serializable, so child classes must explicitly call these methods.


The documentation for this class was generated from the following file: