AGX Dynamics 2.41.3.0
Loading...
Searching...
No Matches
agx::FrictionController Class Reference

Translational or rotational friction controller for Hinge, Prismatic and CylindricalJoint. More...

#include <ElementaryConstraint.h>

+ Inheritance diagram for agx::FrictionController:

Public Member Functions

 FrictionController (const agx::ConstraintAngleBasedData &data)
 Construct given angle based data.
 
 AGXSTREAM_DECLARE_SERIALIZABLE_BASE (agx::FrictionController)
 
agx::Bool getEnableNonLinearDirectSolveUpdate () const
 
agx::Real getFrictionCoefficient () const
 
agx::RangeReal getMinimumStaticFrictionForceRange () const
 Get the minimum force range that this friction controller can apply.
 
ConstraintNlmcpCallbackgetNlCallback () const override
 
virtual agx::Bool isActive () const override
 
agx::UInt iterativePostSolveCallback (const agx::ConstraintImplementation *constraint, const agx::Real *solution, agx::UInt row, agx::Real h)
 
virtual void restoreLightData (agxStream::StorageStream &str) override
 /internal
 
void setEnableNonLinearDirectSolveUpdate (agx::Bool enable)
 Enable/disable non-linear update of the friction conditions given current normal force from the direct solver.
 
void setFrictionCoefficient (agx::Real frictionCoefficient)
 Assign friction coefficient.
 
void setMinimumStaticFrictionForceRange (agx::RangeReal bound)
 Set the minimum force range that this friction controller can apply.
 
virtual void storeLightData (agxStream::StorageStream &str) const override
 /internal
 
- Public Member Functions inherited from agx::BasicControllerConstraint
 BasicControllerConstraint (const agx::ConstraintAngleBasedData &data, agx::Bool enable)
 Construct given data containing angle and default enable flag.
 
 AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agx::BasicControllerConstraint)
 
- Public Member Functions inherited from agx::ElementaryConstraintNData< 1, ConstraintAngleBasedData >
 ElementaryConstraintNData (const ConstraintAngleBasedData &data, agx::Bool enable)
 Construct given data and enable flag.
 
ConstraintAngleBasedDatagetData ()
 
const ConstraintAngleBasedDatagetData () const
 
virtual void setAttachmentPair (const agx::AttachmentPair *ap) override
 Data has to support assignment of attachment pair.
 
- Public Member Functions inherited from agx::ElementaryConstraintN< N >
 ElementaryConstraintN (agx::Bool enable)
 Construct given enable flag.
 
- Public Member Functions inherited from agx::ElementaryConstraint
 AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agx::ElementaryConstraint)
 
void copyRowFrom (const ElementaryConstraint *source, agx::UInt sourceRow, agx::UInt destRow)
 Copy configuration row from the given ElementaryConstraint into this.
 
virtual agx::UInt getBounds (agx::RangeReal *bounds, agx::UInt row, agx::Real h) const
 Returns the bounds of the Lagrange Multipliers (default (-inf, +inf)).
 
agx::Real getCompliance (agx::UInt row=0) const
 
virtual agx::Real getCurrentForce (const agx::UInt row=0) const
 Returns the force applied last time step by this elementary constraint.
 
const agx::RealgetCurrentForces () const
 
agx::Real getDamping (agx::UInt row=0) const
 
agx::Real getElasticity (agx::UInt row=0) const
 
virtual agx::Bool getEnable () const
 
agx::RangeRealgetForceRange (const agx::UInt row=0)
 
const agx::RangeRealgetForceRange (const agx::UInt row=0) const
 
virtual agx::UInt getJacobian (agx::Jacobian6DOFElement *G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState)
 Returns the Jacobian of this elementary constraint.
 
const agx::ElementaryConstraint::NameTypegetName () const
 
virtual agx::ConstraintNlmcpCallbackgetNlCallback () const
 
agx::UInt getNumRows () const
 
agx::RegularizationParametersgetRegularizationParameters (const agx::UInt row=0)
 
const agx::RegularizationParametersgetRegularizationParameters (const agx::UInt row=0) const
 
virtual agx::UInt getVelocity (agx::Real *v, agx::UInt row) const
 Returns the velocity of this elementary constraint (extra, driving term on the right hand side).
 
virtual agx::UInt getViolation (agx::Real *g, agx::UInt row)
 Returns the violation of this elementary constraint.
 
virtual agx::Bool isActive () const
 An elementary constraint is defined to be active if enabled.
 
virtual agx::Bool isImpacting () const
 
virtual void linearizeCompliance (const agx::Real *violations, agx::Real *epsilons, agx::Real minPerturbation) const
 Modify epsilon so that this ElementaryConstraint appear to be linear in the "normal" deformantion space instead any other space that the ElementaryConstraint may be using.
 
virtual agx::UInt postSolveCallback (const agx::Real *solution, agx::UInt row, agx::Real h)
 Callback after solve, with the solution.
 
virtual void prepare ()
 Prepare call.
 
void reset ()
 Reset call.
 
virtual void restore (agxStream::InputArchive &in) override
 Restore this object from stream.
 
virtual void restoreLightData (agxStream::StorageStream &str) override
 Restore structural independent data from stream.
 
virtual void setAttachmentPair (const agx::AttachmentPair *ap)
 Call for elementary constraints dependent on attachment pairs.
 
void setCompliance (agx::Real compliance)
 
void setCompliance (agx::Real compliance, int row)
 Assign compliance for a given row, or all rows if row = -1 (default).
 
void setDamping (agx::Real damping)
 
void setDamping (agx::Real damping, int row)
 Assign damping for a given row, or all rows if row = -1 (default).
 
void setElasticity (agx::Real elasticity)
 
void setElasticity (agx::Real elasticity, int row)
 Assign elasticity for a given row, or all rows if row = -1 (default).
 
virtual void setEnable (agx::Bool enable)
 Enable/disable this elementary constraint.
 
void setForceRange (agx::RangeReal forceRange, const agx::UInt row=0)
 Assign force range to a given row.
 
void setForceRange (agx::Real lower, agx::Real upper, const agx::UInt row=0)
 Assign force range to a given row.
 
void setName (const agx::ElementaryConstraint::NameType &name)
 Name this elementary constraint.
 
virtual void store (agxStream::OutputArchive &out) const override
 Store this object to stream.
 
virtual void storeLightData (agxStream::StorageStream &str) const override
 Store structural independent data to stream.
 
- 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.
 
Referencedoperator= (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 agxStream::Serializablecreate (agxStream::InputArchive &)
 
static agx::FrictionControllersafeCast (const agx::ElementaryConstraint *frictionController)
 Utility cast method.
 
- 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

 FrictionController ()
 
virtual ~FrictionController ()
 
virtual agx::UInt getBounds (agx::RangeReal *bounds, agx::UInt row, agx::Real h) const override
 Returns the bounds of the Lagrange Multipliers (default (-inf, +inf)).
 
virtual agx::UInt getViolation (agx::Real *g, agx::UInt row) override
 Returns the violation of this elementary constraint.
 
virtual agx::UInt postSolveCallback (const agx::Real *solution, agx::UInt row, agx::Real h) override
 Callback after solve, with the solution.
 
- Protected Member Functions inherited from agx::BasicControllerConstraint
 BasicControllerConstraint ()
 Used during serialization restore.
 
virtual agx::UInt getJacobian (agx::Jacobian6DOFElement *G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState) override
 Default constraint callback for writing Jacobian.
 
virtual void restore (agxStream::InputArchive &in) override
 Restore this object from stream.
 
virtual void store (agxStream::OutputArchive &out) const override
 Store this object to stream.
 
virtual agx::UInt writeJacobian (agx::Jacobian6DOFElement *G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState, const agx::Vec3 &dir1, const agx::Vec3 &dir2, agx::Angle::Type type) const
 Internal utility method to write the Jacobian given direction and angle type.
 
- Protected Member Functions inherited from agx::ElementaryConstraintNData< 1, ConstraintAngleBasedData >
 ElementaryConstraintNData ()
 
- Protected Member Functions inherited from agx::ElementaryConstraintN< N >
 ElementaryConstraintN ()
 Used during serialization restore.
 
- Protected Member Functions inherited from agx::ElementaryConstraint
 ElementaryConstraint (agx::Bool enable, agx::UInt numRows, agx::RegularizationParameters *regParamsBuffer, agx::Real *lastForcesBuffer, agx::RangeReal *userBoundsBuffer)
 Construct given data.
 
virtual ~ElementaryConstraint ()
 Reference counted object, protected destructor.
 
- 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

- Public Types inherited from agx::ElementaryConstraint
typedef agx::Name NameType
 
typedef agx::VectorPOD< agx::ElementaryConstraint * > PtrContainer
 
typedef agx::Vector< agx::ref_ptr< agx::ElementaryConstraint > > RefContainer
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandlergetDeleteHandler ()
 
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::ElementaryConstraintNData< 1, ConstraintAngleBasedData >
ConstraintAngleBasedData m_data
 Data.
 
- Protected Attributes inherited from agx::ElementaryConstraintN< N >
agx::RangeReal m_bounds [N]
 Bounds buffer.
 
agx::Real m_forces [N]
 Forces buffer.
 
agx::RegularizationParameters m_regParams [N]
 Regularization parameters buffer.
 
- Protected Attributes inherited from agx::ElementaryConstraint
agx::Bool m_enable
 enabled
 
agx::ref_ptr< agx::Referencedm_internalData
 custom, internal data
 
agx::Realm_lfs
 last forces
 
agx::ElementaryConstraint::NameType m_name
 name
 
agx::UInt m_numRows
 number of rows
 
agx::RegularizationParametersm_rps
 regularization parameters
 
agx::RangeRealm_ubs
 user bounds

 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Translational or rotational friction controller for Hinge, Prismatic and CylindricalJoint.

Definition at line 812 of file ElementaryConstraint.h.

Constructor & Destructor Documentation

◆ FrictionController() [1/2]

agx::FrictionController::FrictionController ( const agx::ConstraintAngleBasedData data)

Construct given angle based data.

This controller is by default disabled.

◆ FrictionController() [2/2]

agx::FrictionController::FrictionController ( )
protected

◆ ~FrictionController()

virtual agx::FrictionController::~FrictionController ( )
protectedvirtual

Member Function Documentation

◆ AGXSTREAM_DECLARE_SERIALIZABLE_BASE()

agx::FrictionController::AGXSTREAM_DECLARE_SERIALIZABLE_BASE ( agx::FrictionController  )

◆ create()

static agxStream::Serializable * agx::FrictionController::create ( agxStream::InputArchive )
inlinestatic

Definition at line 880 of file ElementaryConstraint.h.

◆ getBounds()

virtual agx::UInt agx::FrictionController::getBounds ( agx::RangeReal bounds,
agx::UInt  row,
agx::Real  h 
) const
overrideprotectedvirtual

Returns the bounds of the Lagrange Multipliers (default (-inf, +inf)).

Note that the bounds buffer has to be provided by the caller.

Note
Dimension of the Lagrange Multipliers are Force * Time (argument h = time step length).
Parameters
bounds- bounds buffer
row- start row in bounds buffer bounds
h- current time step length
Returns
the number of rows used (= elements written) in the bounds buffer

Reimplemented from agx::ElementaryConstraint.

◆ getEnableNonLinearDirectSolveUpdate()

agx::Bool agx::FrictionController::getEnableNonLinearDirectSolveUpdate ( ) const
Returns
true if non-linear direct solve update is enabled - otherwise false

◆ getFrictionCoefficient()

agx::Real agx::FrictionController::getFrictionCoefficient ( ) const
Returns
the friction coefficient

◆ getMinimumStaticFrictionForceRange()

agx::RangeReal agx::FrictionController::getMinimumStaticFrictionForceRange ( ) const

Get the minimum force range that this friction controller can apply.

See also
setMinimumStaticFrictionForceRange

◆ getNlCallback()

ConstraintNlmcpCallback * agx::FrictionController::getNlCallback ( ) const
overridevirtual
Returns
solver callback instance if supported by this elementary constraint

Reimplemented from agx::ElementaryConstraint.

◆ getViolation()

virtual agx::UInt agx::FrictionController::getViolation ( agx::Real g,
agx::UInt  row 
)
overrideprotectedvirtual

Returns the violation of this elementary constraint.

Note that the violation buffer has to be provided by the caller.

Parameters
g- violation buffer
row- start row in violation buffer g
Returns
the number of rows used (= elements written) in violation buffer

Reimplemented from agx::ElementaryConstraint.

◆ isActive()

virtual agx::Bool agx::FrictionController::isActive ( ) const
overridevirtual
Returns
true when this controller is enabled and has a friction coefficient larger than zero - otherwise false

Reimplemented from agx::ElementaryConstraint.

◆ iterativePostSolveCallback()

agx::UInt agx::FrictionController::iterativePostSolveCallback ( const agx::ConstraintImplementation constraint,
const agx::Real solution,
agx::UInt  row,
agx::Real  h 
)

◆ postSolveCallback()

virtual agx::UInt agx::FrictionController::postSolveCallback ( const agx::Real solution,
agx::UInt  row,
agx::Real  h 
)
overrideprotectedvirtual

Callback after solve, with the solution.

Parameters
solution- solution of the last solve
row- start row in solution for this elementary constraint
h- current time step length
Returns
number of rows read (= number of rows of this elementary constraint)

Reimplemented from agx::ElementaryConstraint.

◆ restoreLightData()

virtual void agx::FrictionController::restoreLightData ( agxStream::StorageStream str)
overridevirtual

/internal

Restore structural independent data from stream.

Reimplemented from agx::ElementaryConstraint.

◆ safeCast()

static agx::FrictionController * agx::FrictionController::safeCast ( const agx::ElementaryConstraint frictionController)
static

Utility cast method.

◆ setEnableNonLinearDirectSolveUpdate()

void agx::FrictionController::setEnableNonLinearDirectSolveUpdate ( agx::Bool  enable)

Enable/disable non-linear update of the friction conditions given current normal force from the direct solver.

When enabled - this feature is similar to scale box friction models with solve type DIRECT.

Default: Disabled

Note
This feature only supports constraint solve types DIRECT and DIRECT_AND_ITERATIVE - meaning, if the constraint has solve type ITERATIVE, this feature is ignored.
Parameters
enable- true to enable, false to disable (Disabled by default.)

◆ setFrictionCoefficient()

void agx::FrictionController::setFrictionCoefficient ( agx::Real  frictionCoefficient)

Assign friction coefficient.

Default: 0.4167.

Note
If this controller is rotational (Hinge or CylindriclJoint) the radius of the axle should be included in the friction coefficient for the comparisons with the normal force to be dimensionally correct. I.e., friction_torque <= friction_coefficient * axle_radius * normal_force
Parameters
frictionCoefficient- friction coefficient

◆ setMinimumStaticFrictionForceRange()

void agx::FrictionController::setMinimumStaticFrictionForceRange ( agx::RangeReal  bound)

Set the minimum force range that this friction controller can apply.

Can be used to simulate static friction. Default: (0, 0)

◆ storeLightData()

virtual void agx::FrictionController::storeLightData ( agxStream::StorageStream str) const
overridevirtual

/internal

Store structural independent data to stream.

Reimplemented from agx::ElementaryConstraint.


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