AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
agx::GenericConstraintData Class Reference

Constraint data used with GenericElementaryConstraint containing data such as; constraint violation, constraint velocity and bounds. More...

#include <GenericConstraintData.h>

Public Types

using BoundsVector = VectorPOD< RangeReal >
 

Public Member Functions

 GenericConstraintData ()
 Construct given number of rows in the elementary constraint.
 
GenericConstraintBodyData * getBodyData (const RigidBody *rb) const
 Access body related data, such as the Jacobian, for a given body rb.
 
GenericConstraintBodyData * getBodyDataAt (size_t index) const
 Access body related data, such as the Jacobian, for a given body index index.
 
const BoundsVector & getBounds () const
 
Bool getIsImpacting () const
 
const RealVector & getVelocity () const
 
const RealVector & getViolation () const
 
void prepare (UInt numRows, const ConstraintRigidBodyContainer &bodies)
 Resets all values to default.
 
void setBound (UInt row, RangeReal range)
 Assign bound for given row in the elementary constraint.
 
void setIsImpacting (Bool isImpacting)
 Assign impacting state of the elementary constraint.
 
void setVelocity (UInt row, Real velocity)
 Assign velocity for given row in the elementary constraint.
 
void setViolation (UInt row, Real violation)
 Assign violation for given row in the elementary constraint.
 

Detailed Description

Constraint data used with GenericElementaryConstraint containing data such as; constraint violation, constraint velocity and bounds.

Definition at line 69 of file GenericConstraintData.h.

Member Typedef Documentation

◆ BoundsVector

Constructor & Destructor Documentation

◆ GenericConstraintData()

agx::GenericConstraintData::GenericConstraintData ( )

Construct given number of rows in the elementary constraint.

Member Function Documentation

◆ getBodyData()

GenericConstraintBodyData * agx::GenericConstraintData::getBodyData ( const RigidBody *  rb) const

Access body related data, such as the Jacobian, for a given body rb.

Parameters
rb- rigid body to access data for, rb == nullptr will return valid but the data is ignored
Returns
body data (such as the Jacobian) for the given instance rb

◆ getBodyDataAt()

GenericConstraintBodyData * agx::GenericConstraintData::getBodyDataAt ( size_t  index) const

Access body related data, such as the Jacobian, for a given body index index.

For an ordinary binary constraint with a transformed attachment pair, it's then possible to do:

a1: agx.Attachment = self.getAttachmentPair().getAttachment1()
a2: agx.Attachment = self.getAttachmentPair().getAttachment2()
rb1_data: agx.GenericConstraintBodyData = constraintData.getBodyDataAt(0)
rb2_data: agx.GenericConstraintBodyData = constraintData.getBodyDataAt(1)
v1 = a1.get(agx.Attachment.N)
v2 = a2.get(agx.Attachment.N)
rb1_data.setJacobian(0, agx.Vec3(), v1)
rb2_data.setJacobian(0, agx.Vec3(), -v2)
Parameters
index- rigid body index to access data for
Returns
body data (such as the Jacobian) for the given index index

◆ getBounds()

const BoundsVector & agx::GenericConstraintData::getBounds ( ) const
Returns
the bounds

◆ getIsImpacting()

Bool agx::GenericConstraintData::getIsImpacting ( ) const
Returns
true if the elementary constraint is impacting, otherwise false

◆ getVelocity()

const RealVector & agx::GenericConstraintData::getVelocity ( ) const
Returns
the velocities

◆ getViolation()

const RealVector & agx::GenericConstraintData::getViolation ( ) const
Returns
the violations

◆ prepare()

void agx::GenericConstraintData::prepare ( UInt  numRows,
const ConstraintRigidBodyContainer &  bodies 
)

Resets all values to default.

◆ setBound()

void agx::GenericConstraintData::setBound ( UInt  row,
RangeReal  range 
)

Assign bound for given row in the elementary constraint.

Note
The bound given by the user has already been assigned when the GenericElementaryConstraint receives its callback.
Parameters
row- elementary constraint row
range- elementary constraint bound

◆ setIsImpacting()

void agx::GenericConstraintData::setIsImpacting ( Bool  isImpacting)

Assign impacting state of the elementary constraint.

Default: false.

Parameters
isImpacting- true if the elementary constraint is impacting, otherwise false

◆ setVelocity()

void agx::GenericConstraintData::setVelocity ( UInt  row,
Real  velocity 
)

Assign velocity for given row in the elementary constraint.

Parameters
row- elementary constraint row
velocity- elementary constraint velocity

◆ setViolation()

void agx::GenericConstraintData::setViolation ( UInt  row,
Real  violation 
)

Assign violation for given row in the elementary constraint.

Parameters
row- elementary constraint row
violation- elementary constraint violation

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