|
AGX Dynamics 2.41.2.0
|
The base class for a constraint. More...
#include <Constraint.h>
Inheritance diagram for agx::Constraint:Public Types | |
| enum | SolveType { DIRECT = 1 , ITERATIVE = (1<<2) , DIRECT_AND_ITERATIVE = (DIRECT | ITERATIVE) } |
| Specifies in what solvers the constraint will be solved. More... | |
Public Member Functions | |
| agx::Bool | addElementaryConstraint (const agx::Name &name, agx::ElementaryConstraint *elementaryConstraint) |
| Add elementary constraint (like Spherical, Dot1, Dot2 etc) given name. | |
| agx::Bool | addSecondaryConstraint (const agx::Name &name, agx::ElementaryConstraint *secondaryConstraint) |
| Add secondary constraint (like motor, range and/or lock etc) given name. | |
| AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agx::Constraint) | |
| template<typename T > | |
| T * | as () |
| Try to do dynamic_cast on the constraint and return a pointer to the casted constraint. | |
| template<typename T > | |
| const T * | as () const |
| Try to do dynamic_cast on the constraint and return a pointer to the casted constraint. | |
| RealVector | calculateCurrentViolation () const |
| Calculates the current violation of the ordinary degrees of freedom of this constraint, e.g., three translational and two rotational (total 5 elements) of a hinge, i.e., controllers DOF are not included. | |
| agx::UInt | calculateNumActiveRows () const |
| Calculates the current number of active rows, including both elementary and secondary constraints. | |
| template<typename T > | |
| ref_ptr< T > | createFromBody (Vec3 bodyPoint, Vec3 bodyAxis, RigidBody *rb1, RigidBody *rb2) |
| template<typename T > | |
| ref_ptr< T > | createFromWorld (Vec3 worldPoint, Vec3 worldAxis, RigidBody *rb1, RigidBody *rb2) |
| agx::Attachment * | getAttachment (agx::UInt i) const |
| agx::RigidBodyAttachment * | getAttachment (const agx::RigidBody *rb) const |
| agx::AttachmentPair * | getAttachmentPair () const |
| agx::RigidBody * | getBodyAt (agx::UInt i) |
| const agx::RigidBody * | getBodyAt (agx::UInt i) const |
| virtual agx::Real | getCompliance (agx::UInt dof) const |
| Get the compliance for DOF i. | |
| agx::Real | getCurrentForce (agx::UInt dof) const |
Consider using getLastForce instead. | |
| virtual Real | getDamping (agx::UInt dof) const |
Get the damping for DOF dof. | |
| virtual agx::Real | getElasticity (agx::UInt dof) const |
| Get the elasticity for DOF i. | |
| agx::ElementaryConstraint * | getElementaryConstraint (const agx::UInt index) const |
| agx::ElementaryConstraint * | getElementaryConstraintGivenName (const agx::Name &name) const |
| Find elementary constraint given name. | |
| agx::Bool | getEnable () const |
| agx::Bool | getEnableComputeForces () const |
| bool | getEnableDebugRendering () const |
| bool | getEnableLinearization () const |
| agx::UInt32 | getEntityId () const |
| agx::RangeReal | getForceRange (agx::UInt dof=0) const |
Get the force range for DOF dof. | |
| agx::Bool | getLastForce (agx::UInt bodyIndex, agx::Vec3 &retForce, agx::Vec3 &retTorque, agx::Bool giveForceAtCm=false) const |
If 'compute forces' is enabled, returns the last force and torque applied by this constraint on the body with bodyIndex. | |
| agx::Bool | getLastForce (const agx::RigidBody *rb, agx::Vec3 &retForce, agx::Vec3 &retTorque, agx::Bool giveForceAtCm=false) const |
If 'compute forces' is enabled, returns the last force and torque applied by this constraint on the body rb. | |
| agx::Bool | getLastLocalForce (agx::UInt bodyIndex, agx::Vec3 &retForce, agx::Vec3 &retTorque, agx::Bool giveForceAtCm=false) const |
If 'compute forces' is enabled, returns the last force and torque applied by this constraint on the body with bodyIndex. | |
| agx::Bool | getLastLocalForce (const agx::RigidBody *rb, agx::Vec3 &retForce, agx::Vec3 &retTorque, agx::Bool giveForceAtCm=false) const |
If 'compute forces' is enabled, returns the last force and torque applied by this constraint on the body rb. | |
| agx::UInt | getNumBodies () const |
| returns the number of bodies involved | |
| virtual int | getNumDOF () const =0 |
| agx::UInt | getNumElementaryConstraints () const |
| agx::UInt | getNumSecondaryConstraints () const |
| virtual agx::RegularizationParameters * | getRegularizationParameters (agx::UInt i) |
| virtual const agx::RegularizationParameters * | getRegularizationParameters (agx::UInt i) const |
| agx::ConstraintImplementation * | getRep () |
| const agx::ConstraintImplementation * | getRep () const |
| agx::ElementaryConstraint * | getSecondaryConstraint (const agx::UInt index) const |
| agx::ElementaryConstraint * | getSecondaryConstraintGivenName (const agx::Name &name) const |
| Find secondary constraint given name. | |
| agx::Constraint::SolveType | getSolveType () const |
| agx::Bool | getValid () const |
| agx::Bool | isEnabled () const |
| virtual agx::Bool | rebind () |
| Rebind this constraint, i.e., use current state as the initial configuration. | |
| agx::Bool | removeElementaryConstraint (agx::ElementaryConstraint *elementaryConstraint) |
| Remove elementary constraint. | |
| agx::Bool | removeElementaryConstraint (const agx::Name &name) |
| Remove elementary constraint. | |
| agx::Bool | removeSecondaryConstraint (agx::ElementaryConstraint *secondaryConstraint) |
| Remove secondary constraint. | |
| agx::Bool | removeSecondaryConstraint (const agx::Name &name) |
| Remove secondary constraint. | |
| virtual void | render (class agxRender::RenderManager *mgr, float scale) const =0 |
| Inherited method of how to render this constraint into DebugRenderer. | |
| void | restore (agxStream::InputArchive &in) override |
| virtual void | restoreLightData (agxStream::StorageStream &str) override |
| void | setCompliance (agx::Real compliance) |
| Set the compliance of this constraint for all DOFs. | |
| virtual void | setCompliance (agx::Real compliance, agx::Int dof) |
| Set the compliance of this constraint for the i:th DOF. | |
| void | setDamping (agx::Real damping) |
| Set the damping of this constraint for all DOFs. | |
| virtual void | setDamping (agx::Real damping, agx::Int dof) |
| Set the damping of this constraint for the i:th DOF. | |
| virtual void | setElasticity (agx::Real elasticity) |
| Set the elasticity of this constraint for all DOFs. | |
| virtual void | setElasticity (agx::Real elasticity, agx::Int dof) |
| Set the elasticity of this constraint for the i:th DOF. | |
| virtual void | setEnable (agx::Bool enable) |
| Enable/disable a constraint. | |
| void | setEnableComputeForces (agx::Bool enable) |
| Enable (or disable) computation of the forces applied to the dynamic bodies in this constraint. | |
| void | setEnableDebugRendering (agx::Bool enable) |
| Enable/disable debug rendering of this constraint. | |
| void | setEnableLinearization (bool enable) |
Pass true to enable linearization of constraint compliance. | |
| void | setForceRange (agx::RangeReal forceRange) |
| Assign force range for all DOF of the elementary constraints. | |
| void | setForceRange (agx::RangeReal forceRange, agx::Int dof) |
| Assign force range, of an elementary constraint, for a given DOF. | |
| void | setForceRange (agx::Real lower, agx::Real upper, agx::Int dof) |
| Assign force range, of an elementary constraint, for a given DOF. | |
| void | setSolveType (agx::Constraint::SolveType solveType) |
| Specify the solve type for this constraint. | |
| void | store (agxStream::OutputArchive &out) const override |
| virtual void | storeLightData (agxStream::StorageStream &str) const override |
Public Member Functions inherited from agx::Interaction | |
| Interaction () | |
| Default constructor. | |
| AGXSTREAM_DECLARE_SERIALIZABLE_BASE (agx::Interaction) | |
| const agx::Name & | getName () const |
| agx::PropertyContainer * | getPropertyContainer () |
| const agx::PropertyContainer * | getPropertyContainer () const |
| agxSDK::SimulationProxy * | getSimulationProxy () const |
| agx::Bool | hasPropertyContainer () const |
| virtual void | postSystemCallback (agx::DynamicsSystem *) |
| Called after all post step events, after solve. | |
| virtual void | preSystemCallback (agx::DynamicsSystem *) |
| Called after all pre step events, before solve. | |
| void | setName (const agx::Name &name) |
| Name this interaction. | |
| void | setPropertyContainer (agx::PropertyContainer *propertyContainer) |
| Assign a new property container. | |
| virtual void | updateForce (agx::DynamicsSystem *dynamicsSystem) |
| This virtual method is implemented so that it computes the interaction forces on all the physical bodies implicated. | |
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 agx::Bool | calculateFramesFromBody (agx::Vec3 bodyPoint, agx::Vec3 bodyAxis, agx::Vec3 secondBodyAxis, const agx::RigidBody *body, agx::Frame *bodyFrame, const agx::RigidBody *otherBody, agx::Frame *otherFrame) |
Calculates the constraint attachment frames given point and axes in body coordinates of body. | |
| static agx::Bool | calculateFramesFromBody (agx::Vec3 bodyPoint, agx::Vec3 bodyAxis, const agx::RigidBody *body, agx::Frame *bodyFrame, const agx::RigidBody *otherBody, agx::Frame *otherFrame) |
Calculates the constraint attachment frames given point and axis in body coordinates of body. | |
| static agx::Bool | calculateFramesFromWorld (agx::Vec3 worldPoint, agx::Vec3 worldAxis, agx::Vec3 secondWorldAxis, const agx::RigidBody *rb1, agx::Frame *rb1Frame, const agx::RigidBody *rb2, agx::Frame *rb2Frame) |
| Given a point and two axes in world, this function calculates each local attachment frame for one or two bodies. | |
| static agx::Bool | calculateFramesFromWorld (agx::Vec3 worldPoint, agx::Vec3 worldAxis, const agx::RigidBody *rb1, agx::Frame *rb1Frame, const agx::RigidBody *rb2, agx::Frame *rb2Frame) |
| Given a point and an axis in world, this function calculates each local attachment frame for one or two bodies. | |
| template<typename T > | |
| static agx::ref_ptr< T > | createFromBody (agx::Vec3 bodyPoint, agx::Vec3 bodyAxis, agx::RigidBody *rb1, agx::RigidBody *rb2=nullptr) |
Creates a constraint given a point and an axis in rb1 model frame. | |
| template<typename T > | |
| static agx::ref_ptr< T > | createFromWorld (agx::Vec3 worldPoint, agx::Vec3 worldAxis, agx::RigidBody *rb1, agx::RigidBody *rb2=nullptr) |
| Creates a constraint given a point and an axis in world frame. | |
Static Public Member Functions inherited from agx::Interaction | |
| static agxStream::Serializable * | create (agxStream::InputArchive &) |
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 | |
| Constraint () | |
| virtual | ~Constraint () |
| virtual void | addNotification () override |
| Called when added to a simulation. | |
| virtual void | postSystemCallback (agx::DynamicsSystem *dynamicsSystem) override |
| Called after all post step events, after solve. | |
| virtual void | preSystemCallback (agx::DynamicsSystem *dynamicsSystem) override |
| Called after all pre step events, before solve. | |
| virtual void | removeNotification () override |
| Called when removed from a simulation. | |
| void | setRep (agx::ConstraintImplementation *_rep) |
| virtual void | setSimulation (agxSDK::Simulation *simulation) override |
| Assign simulation. | |
| virtual void | setSystem (agx::DynamicsSystem *) |
Protected Member Functions inherited from agx::Interaction | |
| virtual | ~Interaction () |
| Reference counted object, protected destructor. | |
| virtual void | addNotification () |
| Called when added to a simulation. | |
| virtual void | removeNotification () |
| Called when removed from a simulation. | |
| virtual void | setSimulation (agxSDK::Simulation *simulation) |
| Assign simulation. | |
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 () |
Protected Attributes | |
| agx::ConstraintImplementation * | m_implementation |
Protected Attributes inherited from agx::Referenced | |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| AtomicValue | m_refCount |
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. | |
The base class for a constraint.
This is an interface class for all constraints. The virtual functions are place holders for the computation of Jacobians and constraint value. In addition, there are interfaces defined here to setup the interacting bodies.
Consider the case of two constrained rigid bodies. Before the constraint is applied, the relative motion is the manifold \(R^3\times SO(3)\). If the constraint is a prismatic joint, the remaining manifold of relative motion is just \(R\), the Real line. We put a chart on that manifold so we can put a value on the extension of the prismatic joint. On the resulting joint coordinate, we might then enforce a secondary constraint such as joint limits, a position lock, or a driver that imposes a velocity.
The constraint processing consists of the following stages: -perform necessary geometric computation from rigid bodies' kinematic data -evaluate the constraint value and basic Jacobians -configure dynamical parameters (compliance and damping) -compute joint angles according to manifold chart if needed -if there are secondary constraints:
Definition at line 88 of file Constraint.h.
Specifies in what solvers the constraint will be solved.
| Enumerator | |
|---|---|
| DIRECT | Solved only in the DIRECT solver. |
| ITERATIVE | Solved only in the ITERATIVE solver. |
| DIRECT_AND_ITERATIVE | Solved both in the ITERATIVE and the DIRECT solver. |
Definition at line 92 of file Constraint.h.
|
protected |
|
protectedvirtual |
| agx::Bool agx::Constraint::addElementaryConstraint | ( | const agx::Name & | name, |
| agx::ElementaryConstraint * | elementaryConstraint | ||
| ) |
Add elementary constraint (like Spherical, Dot1, Dot2 etc) given name.
General for elementary constraints is that their input is based on body relative data (far from general).
|
overrideprotectedvirtual |
Called when added to a simulation.
Reimplemented from agx::Interaction.
Reimplemented in agx::IGenericConstraint, and agxDriveTrain::VelocityConstraint.
| agx::Bool agx::Constraint::addSecondaryConstraint | ( | const agx::Name & | name, |
| agx::ElementaryConstraint * | secondaryConstraint | ||
| ) |
Add secondary constraint (like motor, range and/or lock etc) given name.
General for secondary constraints is that their input is based on the current constraint angle.
| agx::Constraint::AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE | ( | agx::Constraint | ) |
| T * agx::Constraint::as |
Try to do dynamic_cast on the constraint and return a pointer to the casted constraint.
Definition at line 940 of file Constraint.h.
| const T * agx::Constraint::as |
Try to do dynamic_cast on the constraint and return a pointer to the casted constraint.
Definition at line 947 of file Constraint.h.
| RealVector agx::Constraint::calculateCurrentViolation | ( | ) | const |
Calculates the current violation of the ordinary degrees of freedom of this constraint, e.g., three translational and two rotational (total 5 elements) of a hinge, i.e., controllers DOF are not included.
|
static |
Calculates the constraint attachment frames given point and axes in body coordinates of body.
The frames' z-axis will be aligned with the bodyAxis and its y-axis will be normal to the bodyAxis-secondBodyAxis plane.
| bodyPoint | - point in body coordinates of reference rigid body "body" |
| bodyAxis | - axis in body coordinates of reference rigid body "body" |
| secondBodyAxis | - non-parallel axis to bodyAxis in body coordinates of reference rigid body "body" |
| body | - reference body, invalid if null |
| bodyFrame | - reference body attachment frame, invalid if null |
| otherBody | - other rigid body, if null otherFrame will be calculated in world frame |
| otherFrame | - other frame, invalid if null |
|
static |
Calculates the constraint attachment frames given point and axis in body coordinates of body.
| bodyPoint | - point in body coordinates of reference rigid body "body" |
| bodyAxis | - axis in body coordinates of reference rigid body "body" |
| body | - reference body, invalid if null |
| bodyFrame | - reference body attachment frame, invalid if null |
| otherBody | - other rigid body, if null otherFrame will be calculated in world frame |
| otherFrame | - other frame, invalid if null |
|
static |
Given a point and two axes in world, this function calculates each local attachment frame for one or two bodies.
The frames' z-axis will be aligned with the worldAxis and its y-axis will be normal to the worldAxis-secondWorldAxis plane. The first body, rb1, has to be valid. If the second body, rb2, is zero the second frame, rb2Frame, will be given in world frame.
| worldPoint | - point in world |
| worldAxis | - axis in world (for example prismatic- or hinge axis) |
| secondWorldAxis | - axis in world (must be non-parallel to worldAxis) |
| rb1 | - first rigid body, invalid if null |
| rb1Frame | - frame to calculate for rb1, invalid if null |
| rb2 | - second rigid body, if null rb2Frame will be given in world |
| rb2Frame | - frame to calculate for rb2, invalid if null |
|
static |
Given a point and an axis in world, this function calculates each local attachment frame for one or two bodies.
The first body, rb1, has to be valid. If the second body, rb2, is zero the second frame, rb2Frame, will be given in world frame.
| worldPoint | - point in world |
| worldAxis | - axis in world (for example prismatic- or hinge axis) |
| rb1 | - first rigid body, invalid if null |
| rb1Frame | - frame to calculate for rb1, invalid if null |
| rb2 | - second rigid body, if null rb2Frame will be given in world |
| rb2Frame | - frame to calculate for rb2, invalid if null |
| agx::UInt agx::Constraint::calculateNumActiveRows | ( | ) | const |
Calculates the current number of active rows, including both elementary and secondary constraints.
The result can be used to allocate temporary buffers for additional calls to solver related methods, e.g., getViolation.
|
static |
Creates a constraint given a point and an axis in rb1 model frame.
Seen from body one frame - both relative attachment frames will coincide at the given point with their z-axes pointing in the axis direction.
| bodyPoint | - constraint center point given in first body's frame |
| bodyAxis | - constraint axis given in first body's frame |
| rb1 | - first rigid body (not defined if null) |
| rb2 | - second rigid body, if null, rb1 will be attached in world |
| ref_ptr< T > agx::Constraint::createFromBody | ( | Vec3 | bodyPoint, |
| Vec3 | bodyAxis, | ||
| RigidBody * | rb1, | ||
| RigidBody * | rb2 | ||
| ) |
Definition at line 929 of file Constraint.h.
|
static |
Creates a constraint given a point and an axis in world frame.
Both relative attachment frames will coincide at the given world point with their z-axes pointing in the given world axis direction.
| worldPoint | - constraint center point given in the world frame |
| worldAxis | - constraint axis given in world frame |
| rb1 | - first rigid body (not defined if null) |
| rb2 | - second rigid body, if null, rb1 will be attached in world |
| ref_ptr< T > agx::Constraint::createFromWorld | ( | Vec3 | worldPoint, |
| Vec3 | worldAxis, | ||
| RigidBody * | rb1, | ||
| RigidBody * | rb2 | ||
| ) |
Definition at line 919 of file Constraint.h.
| agx::Attachment * agx::Constraint::getAttachment | ( | agx::UInt | i | ) | const |
i (call equal to constraint->getAttachment( constraint->getBodyAt( i ) )) | agx::RigidBodyAttachment * agx::Constraint::getAttachment | ( | const agx::RigidBody * | rb | ) | const |
rb if present - otherwise 0 | agx::AttachmentPair * agx::Constraint::getAttachmentPair | ( | ) | const |
| agx::RigidBody * agx::Constraint::getBodyAt | ( | agx::UInt | i | ) |
| const agx::RigidBody * agx::Constraint::getBodyAt | ( | agx::UInt | i | ) | const |
Get the compliance for DOF i.
Note that indices > number of DOF for this constraint is not defined, so compliance of index 0 will be returned.
| dof | - index of the requested DOF |
Reimplemented in agx::DistanceJoint, agx::SingleControllerConstraint1DOF, and agxWire::EyeNodeArea.
Consider using getLastForce instead.
This method returns the magnitude of the force in a given degree of freedom (DOF). Enabled controllers in the given DOF will NOT be included, agx::ElementaryConstraint::getCurrentForce has to be used for that.
Get the damping for DOF dof.
Note that indices > number of DOF for this constraint is not defined, so damping of index 0 will be returned.
| dof | - index of the requested DOF |
Reimplemented in agx::DistanceJoint, agx::SingleControllerConstraint1DOF, and agxWire::EyeNodeArea.
Get the elasticity for DOF i.
Note that indices > number of DOF for this constraint is not defined, so elasticity of index 0 will be returned.
| dof | - index of the requested DOF |
| agx::ElementaryConstraint * agx::Constraint::getElementaryConstraint | ( | const agx::UInt | index | ) | const |
| index | - index of the elementary constraint |
| agx::ElementaryConstraint * agx::Constraint::getElementaryConstraintGivenName | ( | const agx::Name & | name | ) | const |
Find elementary constraint given name.
| name | - name of the elementary constraint |
| agx::Bool agx::Constraint::getEnable | ( | ) | const |
| agx::Bool agx::Constraint::getEnableComputeForces | ( | ) | const |
| bool agx::Constraint::getEnableDebugRendering | ( | ) | const |
| bool agx::Constraint::getEnableLinearization | ( | ) | const |
| agx::UInt32 agx::Constraint::getEntityId | ( | ) | const |
| agx::RangeReal agx::Constraint::getForceRange | ( | agx::UInt | dof = 0 | ) | const |
Get the force range for DOF dof.
| dof | - index of the requested DOF |
| agx::Bool agx::Constraint::getLastForce | ( | agx::UInt | bodyIndex, |
| agx::Vec3 & | retForce, | ||
| agx::Vec3 & | retTorque, | ||
| agx::Bool | giveForceAtCm = false |
||
| ) | const |
If 'compute forces' is enabled, returns the last force and torque applied by this constraint on the body with bodyIndex.
The force is given in world coordinates and is the one applied at the anchor position of this constraint.
The result includes force and torque from this constraint including all enabled controllers (e.g., motors, locks, ranges).
| bodyIndex | - index of body, if number of bodies = 1 and bodyIndex = 1, the force and torque applied to "the world body" is returned |
| retForce | - the force applied by this constraint on body at bodyIndex last solve |
| retTorque | - the torque applied by this constraint on body at bodyIndex last solve |
| giveForceAtCm | - this parameter affects the resulting torque. The default behavior (giveForceAtCm = false) calculates the force applied by this constraint at the anchor position. Letting giveForceAtCm = true, the force will be applied at center of mass, affecting the torque as \( T_{new} = T - r \times F \) where r is the vector from the anchor point to the center of mass of the body. |
retForce and retTorque - otherwise false | agx::Bool agx::Constraint::getLastForce | ( | const agx::RigidBody * | rb, |
| agx::Vec3 & | retForce, | ||
| agx::Vec3 & | retTorque, | ||
| agx::Bool | giveForceAtCm = false |
||
| ) | const |
If 'compute forces' is enabled, returns the last force and torque applied by this constraint on the body rb.
The force is given in world coordinates and is the one applied at the anchor position of this constraint.
The result includes force and torque from this constraint including all enabled controllers (e.g., motors, locks, ranges).
| rb | - body in this constraint. If this constraint is attached in world, nullptr can be used. |
| retForce | - the force applied by this constraint on body rb at the last solve |
| retTorque | - the torque applied by this constraint on body rb at the last solve |
| giveForceAtCm | - this parameter affects the resulting torque. The default behavior (giveForceAtCm = false) calculates the force applied by this constraint at the anchor position. Letting giveForceAtCm = true, the force will be applied at center of mass, affecting the torque as \(T_{new} = T - r \times F\) where r is the vector from the anchor point to the center of mass of the body. |
retForce and retTorque - otherwise false | agx::Bool agx::Constraint::getLastLocalForce | ( | agx::UInt | bodyIndex, |
| agx::Vec3 & | retForce, | ||
| agx::Vec3 & | retTorque, | ||
| agx::Bool | giveForceAtCm = false |
||
| ) | const |
If 'compute forces' is enabled, returns the last force and torque applied by this constraint on the body with bodyIndex.
The force is given in the frame of the constraint.
The result includes force and torque from this constraint including all enabled controllers (e.g., motors, locks, ranges).
| bodyIndex | - index of body, if number of bodies = 1 and bodyIndex = 1, the force and torque applied to "the world body" is returned |
| retForce | - the force applied by this constraint on body at bodyIndex last solve |
| retTorque | - the torque applied by this constraint on body at bodyIndex last solve |
| giveForceAtCm | - this parameter affects the resulting torque. The default behavior (giveForceAtCm = false) calculates the force applied by this constraint at the anchor position. Letting giveForceAtCm = true, the force will be applied at center of mass, affecting the torque as \(T_{new} = T - r \times F\) where r is the vector from the anchor point to the center of mass of the body. |
retForce and retTorque - otherwise false | agx::Bool agx::Constraint::getLastLocalForce | ( | const agx::RigidBody * | rb, |
| agx::Vec3 & | retForce, | ||
| agx::Vec3 & | retTorque, | ||
| agx::Bool | giveForceAtCm = false |
||
| ) | const |
If 'compute forces' is enabled, returns the last force and torque applied by this constraint on the body rb.
The force is given in the frame of the constraint.
The result includes force and torque from this constraint including all enabled controllers (e.g., motors, locks, ranges).
| rb | - body in this constraint. If this constraint is attached in world, nullptr can be used. |
| retForce | - the force applied by this constraint on body rb at the last solve |
| retTorque | - the torque applied by this constraint on body rb at the last solve |
| giveForceAtCm | - this parameter affects the resulting torque. The default behavior (giveForceAtCm = false) calculates the force applied by this constraint at the anchor position. Letting giveForceAtCm = true, the force will be applied at center of mass, affecting the torque as \(T_{new} = T - r \times F\) where r is the vector from the anchor point to the center of mass of the body. |
retForce and retTorque - otherwise false | agx::UInt agx::Constraint::getNumBodies | ( | ) | const |
returns the number of bodies involved
|
pure virtual |
Implemented in agx::AngularLockJoint, agx::BallJoint, agx::CylindricalJoint, agx::DistanceJoint, agx::Dot1Joint, agx::GenericConstraint, agx::Hinge, agx::IGenericConstraint, agx::LockJoint, agx::PlaneJoint, agx::Prismatic, agx::PrismaticUniversalJoint, agx::SingleControllerConstraint1DOF, agx::SlackCylindricalJoint, agx::SlackHingeJoint, agx::SlackLockJoint, agx::SlackPrismaticJoint, agx::SplineJoint, agx::SwingTwistLock, agx::UniversalJoint, agxDriveTrain::ElectricMotorConstraint, agxDriveTrain::VelocityConstraint, agxUtil::ConstraintHolder, agxVehicle::Steering, agxVehicle::Ackermann, agxVehicle::WheelJoint, agxWire::EyeNodeArea, and agx::AngularJointBase.
| agx::UInt agx::Constraint::getNumElementaryConstraints | ( | ) | const |
| agx::UInt agx::Constraint::getNumSecondaryConstraints | ( | ) | const |
|
virtual |
Reimplemented in agx::DistanceJoint, and agx::SingleControllerConstraint1DOF.
|
virtual |
Reimplemented in agx::DistanceJoint, and agx::SingleControllerConstraint1DOF.
|
inline |
Definition at line 908 of file Constraint.h.
Referenced by agxSDK::MergeSplitHandler::getProperties().
|
inline |
Definition at line 913 of file Constraint.h.
| agx::ElementaryConstraint * agx::Constraint::getSecondaryConstraint | ( | const agx::UInt | index | ) | const |
| index | - index of the secondary constraint |
| agx::ElementaryConstraint * agx::Constraint::getSecondaryConstraintGivenName | ( | const agx::Name & | name | ) | const |
Find secondary constraint given name.
| name | - name of the elementary constraint |
| agx::Constraint::SolveType agx::Constraint::getSolveType | ( | ) | const |
| agx::Bool agx::Constraint::getValid | ( | ) | const |
| agx::Bool agx::Constraint::isEnabled | ( | ) | const |
|
overrideprotectedvirtual |
Called after all post step events, after solve.
Reimplemented from agx::Interaction.
|
overrideprotectedvirtual |
Called after all pre step events, before solve.
Reimplemented from agx::Interaction.
|
virtual |
Rebind this constraint, i.e., use current state as the initial configuration.
| agx::Bool agx::Constraint::removeElementaryConstraint | ( | agx::ElementaryConstraint * | elementaryConstraint | ) |
Remove elementary constraint.
| elementaryConstraint | - elementary constraint to remove |
Remove elementary constraint.
| name | - name of the elementary constraint to remove |
|
overrideprotectedvirtual |
Called when removed from a simulation.
Reimplemented from agx::Interaction.
Reimplemented in agx::IGenericConstraint.
| agx::Bool agx::Constraint::removeSecondaryConstraint | ( | agx::ElementaryConstraint * | secondaryConstraint | ) |
Remove secondary constraint.
| secondaryConstraint | - secondary constraint to remove |
Remove secondary constraint.
| name | - name of the secondary constraint to remove |
|
pure virtual |
Inherited method of how to render this constraint into DebugRenderer.
Implemented in agxDriveTrain::ElectricMotorConstraint, agxDriveTrain::VelocityConstraint, agx::AngularJointBase, agx::BallJoint, agx::CylindricalJoint, agx::DistanceJoint, agx::Dot1Joint, agx::LockJoint, agx::Prismatic, agx::SingleControllerConstraint1DOF, agx::SlackCylindricalJoint, agx::SlackLockJoint, agx::SlackPrismaticJoint, agx::SwingTwistLock, agxWire::EyeNodeArea, agx::AngularLockJoint, agx::PlaneJoint, agxUtil::ConstraintHolder, agx::GenericConstraint, agx::IGenericConstraint, agx::Hinge, agx::SlackHingeJoint, agxVehicle::Steering, agxVehicle::WheelJoint, and agx::SplineJoint.
|
override |
|
overridevirtual |
| void agx::Constraint::setCompliance | ( | agx::Real | compliance | ) |
Set the compliance of this constraint for all DOFs.
| compliance | - value of compliance |
Set the compliance of this constraint for the i:th DOF.
| compliance | - value of compliance |
| dof | - index of the requested DOF (-1 indicates all) |
Reimplemented in agxWire::EyeNodeArea, agx::DistanceJoint, and agx::SingleControllerConstraint1DOF.
Referenced by agxModel::BeamStiffnessDamping::apply().
| void agx::Constraint::setDamping | ( | agx::Real | damping | ) |
Set the damping of this constraint for all DOFs.
| damping | - value of damping |
Set the damping of this constraint for the i:th DOF.
| damping | - value of damping |
| dof | - index of the requested DOF (-1 indicates all). |
Reimplemented in agxWire::EyeNodeArea, agx::DistanceJoint, and agx::SingleControllerConstraint1DOF.
Referenced by agxModel::BeamStiffnessDamping::apply().
|
virtual |
Set the elasticity of this constraint for all DOFs.
| elasticity | - value of elasticity |
Set the elasticity of this constraint for the i:th DOF.
Elasticity is 1 / compliance.
| elasticity | - value of elasticity |
| dof | - index of the requested DOF (-1 indicates all) |
|
virtual |
Enable/disable a constraint.
| enable | - If true the constraint will be enabled. |
| void agx::Constraint::setEnableComputeForces | ( | agx::Bool | enable | ) |
Enable (or disable) computation of the forces applied to the dynamic bodies in this constraint.
Matrix-vector operation to compute the forces after solve.
| enable | - true to enable, false to disable |
Referenced by agxSDK::ConstraintLogListener::addConstraint().
| void agx::Constraint::setEnableDebugRendering | ( | agx::Bool | enable | ) |
Enable/disable debug rendering of this constraint.
| void agx::Constraint::setEnableLinearization | ( | bool | enable | ) |
Pass true to enable linearization of constraint compliance.
This makes constraint violation a linear function of the force or torque used to violate the constraint also for the elementary constraint types for which this isn't already the case, such as QuatLock. The effect of this is that the parameters sent to the solver by the constraint are tweaked to make the constrain more closely follow Hook's law.
Setting this to true has no effect on most constraints. It does have an effect on the rotational part of AngularLockJoint, LockJoint, and Prismatic.
When false, the default, the resulting violation of any QuatLock in the constraint is linear in quaternion space instead of degrees and radians.
| void agx::Constraint::setForceRange | ( | agx::RangeReal | forceRange | ) |
Assign force range for all DOF of the elementary constraints.
| forceRange | - value of force range for all elementary DOFs |
| void agx::Constraint::setForceRange | ( | agx::RangeReal | forceRange, |
| agx::Int | dof | ||
| ) |
Assign force range, of an elementary constraint, for a given DOF.
| forceRange | - value of force range for the given DOF |
| dof | - index of the DOF (-1 indicates all) |
Assign force range, of an elementary constraint, for a given DOF.
| lower | - lower value of force range for the given DOF |
| upper | - lower value of force range for the given DOF |
| dof | - index of the DOF (-1 indicates all) |
|
protected |
|
overrideprotectedvirtual |
| void agx::Constraint::setSolveType | ( | agx::Constraint::SolveType | solveType | ) |
Specify the solve type for this constraint.
Valid is DIRECT (default for non-iterative solvers), ITERATIVE or DIRECT_AND_ITERATIVE where DIRECT_AND_ITERATIVE means that this constraint will be solved both direct and iterative.
| solveType | - new solve type for this constraint |
|
inlineprotectedvirtual |
Definition at line 658 of file Constraint.h.
|
override |
|
overridevirtual |
|
protected |
Definition at line 677 of file Constraint.h.