27 # pragma warning(push)
28 # pragma warning(disable: 6011)
41 class ConstraintNlmcpCallback;
46 enum Enum {
NORMAL, IGNORE_FIRST, WRITE_SECOND_FIRST };
396 template< agx::UInt N,
typename DataT >
411 const DataT&
getData()
const {
return m_data; }
494 agx::GWriteState::Enum writeState)
override;
692 agx::GWriteState::Enum writeState )
override;
700 agx::GWriteState::Enum writeState,
775 enum InternalState { NONE = 0, LOCKED = (1<<0), LOCKED_AT_ZERO_SPEED = (1<<1) };
918 using Flags = agx::BitState<Flag, agx::UInt16>;
924 Real m_frictionCoefficient;
925 Real m_lastNormalForce;
1250 agx::GWriteState::Enum writeState)
override;
1260 return &
m_rps[ row ];
1266 return &
m_rps[ row ];
1287 return m_internalData;
1293 # pragma warning(pop)
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXPHYSICS_EXPORT
Class for writing serialized data in binary format to a stream.
Abstract base class for storing/restoring a line/drums with version control.
Type
Type, i.e., defines Axis as 'along' or 'about'.
Constraint attachment pair class.
Base class for constraint angle based elementary constraints (secondary constraints).
virtual void restore(agxStream::InputArchive &in) override
Restore this object from stream.
BasicControllerConstraint()
Used during serialization restore.
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.
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(agx::BasicControllerConstraint)
virtual void store(agxStream::OutputArchive &out) const override
Store this object to stream.
virtual agx::UInt getJacobian(agx::Jacobian6DOFElement *G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState) override
Default constraint callback for writing Jacobian.
BasicControllerConstraint(const agx::ConstraintAngleBasedData &data, agx::Bool enable)
Construct given data containing angle and default enable flag.
Basic data holder class for "angle based" (secondary) constraints.
Constraint solver callback interface with context and start rows for context.
Data holder class for elementary constraint Dot1.
Dot1 elementary constraint: Two orthogonal vectors.
Dot1()
Used during serialization restore.
Dot1(const agx::Dot1Data &data)
Construct given Dot1Data.
virtual agx::UInt getJacobian(agx::Jacobian6DOFElement *G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState) override
Returns the Jacobian of this elementary constraint.
virtual agx::UInt getViolation(agx::Real *g, agx::UInt row) override
Returns the violation of this elementary constraint.
virtual ~Dot1()
Reference counted object, protected destructor.
Data holder class for elementary constraint Dot2.
Dot2 elementary constraint: Separation vector orthogonal to direction vector.
Dot2()
Used during serialization restore.
virtual agx::UInt getViolation(agx::Real *g, agx::UInt row) override
Returns the violation of this elementary constraint.
Dot2(const agx::Dot2Data &data)
Construct given Dot2Data.
virtual ~Dot2()
Reference counted object, protected destructor.
virtual agx::UInt getJacobian(agx::Jacobian6DOFElement *G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState) override
Returns the Jacobian of this elementary constraint.
Implementation of a electric motor controller.
virtual void storeLightData(agxStream::StorageStream &str) const override
Store structural independent data to stream.
virtual agx::UInt getVelocity(agx::Real *v, agx::UInt row) const override
Returns the velocity of this elementary constraint (extra, driving term on the right hand side).
agx::Real getArmatureResistance() const
virtual void restoreLightData(agxStream::StorageStream &str) override
Restore structural independent data from stream.
void setArmatureResistance(agx::Real armatureResistance)
Assign armature resistance (Ohm).
agx::Real m_armatureResistance
ElectricMotorController(const agx::ConstraintAngleBasedData &data)
Construct given basic controller data.
virtual agx::UInt getViolation(agx::Real *v, agx::UInt row) override
Returns the violation of this elementary constraint.
ElectricMotorController()
void setTorqueConstant(agx::Real torqueConstant)
Assign torque constant of this motor in unit torque per Ampere.
void setVoltage(agx::Real voltage)
Available voltage or voltage drop across the terminals of this motor.
static agx::ElectricMotorController * safeCast(const agx::ElementaryConstraint *electricMotorController)
Utility cast method.
virtual ~ElectricMotorController()
virtual void prepare() override
Prepare call.
agx::Real getVoltage() const
agx::Real getTorqueConstant() const
agx::Real m_torqueConstant
Class to hold data for elementary constraints.
const DataT & getData() const
virtual void setAttachmentPair(const agx::AttachmentPair *ap) override
Data has to support assignment of attachment pair.
ElementaryConstraintNData(const DataT &data, agx::Bool enable)
Construct given data and enable flag.
ElementaryConstraintNData()
Helper class to hold data that is general for elementary constraints.
ElementaryConstraintN(agx::Bool enable)
Construct given enable flag.
ElementaryConstraintN()
Used during serialization restore.
Elementary constraint base class with interface and global constraint functionality.
virtual agx::UInt getBounds(agx::RangeReal *bounds, agx::UInt row, agx::Real h) const
Returns the bounds of the Lagrange Multipliers (default (-inf, +inf)).
virtual void prepare()
Prepare call.
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)
virtual agx::Bool isImpacting() const
virtual void setAttachmentPair(const agx::AttachmentPair *ap)
Call for elementary constraints dependent on attachment pairs.
agx::Real * m_lfs
last forces
agx::RegularizationParameters * getRegularizationParameters(const agx::UInt row=0)
virtual agx::Bool getEnable() const
agx::RangeReal * m_ubs
user bounds
virtual agx::Real getCurrentForce(const agx::UInt row=0) const
Returns the force applied last time step by this elementary constraint.
void setForceRange(agx::Real lower, agx::Real upper, const agx::UInt row=0)
Assign force range to a given row.
const agx::ElementaryConstraint::NameType & getName() const
void copyRowFrom(const ElementaryConstraint *source, agx::UInt sourceRow, agx::UInt destRow)
Copy configuration row from the given ElementaryConstraint into this.
const agx::RangeReal & getForceRange(const agx::UInt row=0) const
virtual ~ElementaryConstraint()
Reference counted object, protected destructor.
void setForceRange(agx::RangeReal forceRange, const agx::UInt row=0)
Assign force range to a given row.
void setName(const agx::ElementaryConstraint::NameType &name)
Name this elementary constraint.
virtual agx::UInt getJacobian(agx::Jacobian6DOFElement *G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState)
Returns the Jacobian of this elementary constraint.
void setElasticity(agx::Real elasticity, int row)
Assign elasticity for a given row, or all rows if row = -1 (default).
agx::ElementaryConstraint::NameType m_name
name
virtual void restoreLightData(agxStream::StorageStream &str) override
Restore structural independent data from stream.
agx::VectorPOD< agx::ElementaryConstraint * > PtrContainer
virtual void setEnable(agx::Bool enable)
Enable/disable this elementary constraint.
agx::UInt m_numRows
number of rows
virtual agx::UInt getViolation(agx::Real *g, agx::UInt row)
Returns the violation of this elementary constraint.
agx::UInt getNumRows() const
ElementaryConstraint(agx::Bool enable, agx::UInt numRows, agx::RegularizationParameters *regParamsBuffer, agx::Real *lastForcesBuffer, agx::RangeReal *userBoundsBuffer)
Construct given data.
virtual agx::Bool isActive() const
An elementary constraint is defined to be active if enabled.
virtual agx::UInt postSolveCallback(const agx::Real *solution, agx::UInt row, agx::Real h)
Callback after solve, with the solution.
void setDamping(agx::Real damping)
void setCompliance(agx::Real compliance, int row)
Assign compliance for a given row, or all rows if row = -1 (default).
virtual agx::ConstraintNlmcpCallback * getNlCallback() const
agx::RangeReal & getForceRange(const agx::UInt row=0)
void setCompliance(agx::Real compliance)
virtual void restore(agxStream::InputArchive &in) override
Restore this object from stream.
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).
agx::RegularizationParameters * m_rps
regularization parameters
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 spa...
agx::Real getCompliance(agx::UInt row=0) const
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(agx::ElementaryConstraint)
virtual void store(agxStream::OutputArchive &out) const override
Store this object to stream.
agx::ref_ptr< agx::Referenced > m_internalData
custom, internal data
virtual void storeLightData(agxStream::StorageStream &str) const override
Store structural independent data to stream.
agx::Bool m_enable
enabled
const agx::Real * getCurrentForces() const
agx::Real getElasticity(agx::UInt row=0) const
agx::Vector< agx::ref_ptr< agx::ElementaryConstraint > > RefContainer
agx::Real getDamping(agx::UInt row=0) const
Solver callback class for elementary FrictionController.
Translational or rotational friction controller for Hinge, Prismatic and CylindricalJoint.
void setMinimumStaticFrictionForceRange(agx::RangeReal bound)
Set the minimum force range that this friction controller can apply.
virtual agx::UInt getViolation(agx::Real *g, agx::UInt row) override
Returns the violation of this elementary constraint.
agx::Real getFrictionCoefficient() const
virtual void storeLightData(agxStream::StorageStream &str) const override
/internal
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)).
FrictionController(const agx::ConstraintAngleBasedData &data)
Construct given angle based data.
virtual ~FrictionController()
static agx::FrictionController * safeCast(const agx::ElementaryConstraint *frictionController)
Utility cast method.
void setFrictionCoefficient(agx::Real frictionCoefficient)
Assign friction coefficient.
agx::Bool getEnableNonLinearDirectSolveUpdate() const
agx::UInt iterativePostSolveCallback(const agx::ConstraintImplementation *constraint, const agx::Real *solution, agx::UInt row, agx::Real h)
ConstraintNlmcpCallback * getNlCallback() const override
virtual agx::UInt postSolveCallback(const agx::Real *solution, agx::UInt row, agx::Real h) override
Callback after solve, with the solution.
void setEnableNonLinearDirectSolveUpdate(agx::Bool enable)
Enable/disable non-linear update of the friction conditions given current normal force from the direc...
agx::RangeReal getMinimumStaticFrictionForceRange() const
Get the minimum force range that this friction controller can apply.
virtual void restoreLightData(agxStream::StorageStream &str) override
/internal
virtual agx::Bool isActive() const override
Internal data for any object, ObjT, with methods: agx::Referenced* ObjT::getInternalData() const; voi...
Elementary secondary constraint to keep constraint angle at a given target position.
virtual void storeLightData(agxStream::StorageStream &str) const override
Store structural independent data to stream.
virtual ~LockController()
Reference counted object, protected destructor.
static agx::LockController * safeCast(const agx::ElementaryConstraint *lockController)
Utility cast method.
agx::Real getPosition() const
virtual agx::UInt getViolation(agx::Real *g, agx::UInt row) override
Returns the violation of this elementary constraint.
LockController()
Used during serialization restore.
void setPosition(agx::Real position)
Assign new target position.
virtual void restoreLightData(agxStream::StorageStream &str) override
Restore structural independent data from stream.
LockController(const agx::ConstraintAngleBasedData &data)
Construct given constraint angle based data.
Representation of a name string.
Data holder class for elementary constraint QuatLock.
Locks the three rotational degrees of freedom (relative coordinates).
virtual void setAttachmentPair(const agx::AttachmentPair *ap) override
Propagates ap to custom data from QuatLockData.
virtual agx::UInt getViolation(agx::Real *g, agx::UInt row) override
Returns the violation of this elementary constraint.
virtual agx::UInt getJacobian(agx::Jacobian6DOFElement *G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState) override
Returns the Jacobian of this elementary constraint.
virtual ~QuatLock()
Reference counted object, protected destructor.
QuatLock()
Used during serialization restore.
QuatLock(const agx::QuatLockData &data)
Construct given data.
virtual void linearizeCompliance(const agx::Real *violations, agx::Real *epsilons, agx::Real minPerturbation) const override
Modify epsilon so that this ElementaryConstraint appear to be linear in the "normal" deformantion spa...
Elementary secondary constraint to keep constraint angle within two given values.
virtual void prepare() override
Prepare call.
virtual agx::UInt getViolation(agx::Real *g, agx::UInt row) override
Returns the violation of this elementary constraint.
RangeController()
Used during serialization restore.
virtual void storeLightData(agxStream::StorageStream &str) const override
Store structural independent data to stream.
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::Bool isActive() const override
void setRange(agx::Real lower, agx::Real upper)
Assign range for the constraint angle to between.
const agx::RangeReal & getRange() const
agx::RangeReal & getRange()
void setRange(agx::RangeReal range)
Assign range for the constraint angle to between.
RangeController(const agx::ConstraintAngleBasedData &data)
Construct given constraint angle based data.
virtual ~RangeController()
Reference counted object, protected destructor.
static agx::RangeController * safeCast(const agx::ElementaryConstraint *rangeController)
Utility cast method.
virtual void restoreLightData(agxStream::StorageStream &str) override
Restore structural independent data from stream.
Base class providing referencing counted objects.
All ghost variables have compliance and damping attributes.
ScrewController()
Default constructor used during restore.
virtual ~ScrewController()
Reference counted object, protected destructor.
virtual void restoreLightData(agxStream::StorageStream &str) override
Restore structural independent data from stream.
virtual void storeLightData(agxStream::StorageStream &str) const override
Store structural independent data to stream.
void setLead(agx::Real lead)
Assign lead, i.e., the distance along the screw's axis that is covered by one complete rotation.
agx::Real getLead() const
ScrewController(const agx::ConstraintAngleBasedData &data)
Construct given basic controller data and default lead of the screw.
static agx::ScrewController * safeCast(const agx::ElementaryConstraint *screwController)
Utility cast method.
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 agx::UInt getViolation(agx::Real *g, agx::UInt row) override
Returns the violation of this elementary constraint.
Spherical elementary constraint: Two points in world coincide.
SphericalRel(const agx::ElementaryConstraintData &data)
Construct given SphericalRelData.
SphericalRel()
Used during serialization restore.
virtual agx::UInt getViolation(agx::Real *g, agx::UInt row) override
Returns the violation of this elementary constraint.
virtual agx::UInt getJacobian(agx::Jacobian6DOFElement *G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState) override
Returns the Jacobian of this elementary constraint.
virtual ~SphericalRel()
Reference counted object, protected destructor.
Spherical elementary constraint: Two points in world coincide.
Spherical()
Used during serialization restore.
virtual ~Spherical()
Reference counted object, protected destructor.
Spherical(const agx::ElementaryConstraintData &data)
Construct given SphericalData.
virtual agx::UInt getJacobian(agx::Jacobian6DOFElement *G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState) override
Returns the Jacobian of this elementary constraint.
virtual agx::UInt getViolation(agx::Real *g, agx::UInt row) override
Returns the violation of this elementary constraint.
Data holder class for elementary swing constraint.
Swing elementary constraint: Two orthogonal vectors with hookean behaviour.
Swing()
Used during serialization restore.
Swing(const agx::SwingData &data)
Construct given SwingData.
virtual agx::UInt getViolation(agx::Real *g, agx::UInt row) override
Returns the violation of this elementary constraint.
virtual ~Swing()
Reference counted object, protected destructor.
virtual agx::UInt getJacobian(agx::Jacobian6DOFElement *G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState) override
Returns the Jacobian of this elementary constraint.
Elementary secondary constraint to drive something given target speed (translational or rotational).
agx::Int32 m_internalState
virtual agx::UInt getViolation(agx::Real *g, agx::UInt row) override
Returns the violation of this elementary constraint.
void adjustToCurrentState()
Updates state dependent variables.
void setLocked(agx::Bool locked)
If is true the target speed will be interpreted as zero and the current angle is the reference angle.
void setLockedAtZeroSpeed(agx::Bool lockedAtZeroSpeed)
If this state is set and the speed is set to zero, the behavior is identical to 'setLocked( true )'.
agx::Bool getLockedAtZeroSpeed() const
virtual void restoreLightData(agxStream::StorageStream &str) override
Restore structural independent data from stream.
agx::Real getSpeed() const
agx::Bool getLocked() const
TargetSpeedController(const agx::ConstraintAngleBasedData &data)
Construct given constraint angle based data.
static agx::TargetSpeedController * safeCast(const agx::ElementaryConstraint *targetSpeedController)
Utility cast method.
virtual ~TargetSpeedController()
Reference counted object, protected destructor.
virtual agx::UInt getVelocity(agx::Real *v, agx::UInt row) const override
Returns the velocity of this elementary constraint (extra, driving term on the right hand side).
virtual void storeLightData(agxStream::StorageStream &str) const override
Store structural independent data to stream.
void setSpeed(agx::Real speed)
Assign target speed for this controller.
agx::Bool isLocked() const
TargetSpeedController()
Used during serialization restore.
Data holder class for elementary constraint Twist.
Twist elementary constraint.
virtual agx::UInt getViolation(agx::Real *g, agx::UInt row) override
Returns the violation of this elementary constraint.
Twist()
Used during serialization restore.
virtual agx::UInt getJacobian(agx::Jacobian6DOFElement *G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState) override
Returns the Jacobian of this elementary constraint.
virtual ~Twist()
Reference counted object, protected destructor.
Twist(const agx::TwistData &data)
Construct given TwistData.
virtual void setAttachmentPair(const agx::AttachmentPair *ap) override
Data has to support assignment of attachment pair.
Vector containing 'raw' data.
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
Flags
Flags for specifying what is enabled in the debug rendering system.
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
agx::ref_ptr< Dot2 > Dot2Ref
agx::ref_ptr< Swing > SwingRef
agx::ref_ptr< RangeController > RangeControllerRef
agx::ref_ptr< Dot1 > Dot1Ref
agx::ref_ptr< Spherical > SphericalRef
agx::ref_ptr< LockController > LockControllerRef
agx::ref_ptr< ElectricMotorController > ElectricMotorControllerRef
agx::ref_ptr< SphericalRel > SphericalRelRef
agx::ref_ptr< QuatLock > QuatLockRef
agx::ref_ptr< Twist > TwistRef
agx::ref_ptr< TargetSpeedController > TargetSpeedControllerRef