Bullet Collision Detection & Physics Library: btGeneric6DofSpringConstraint Class Reference

Bullet Collision Detection & Physics Library

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
btGeneric6DofSpringConstraint Class Reference

Generic 6 DOF constraint that allows to set spring motors to any translational and rotational DOF. More...

`#include <btGeneric6DofSpringConstraint.h>`

Inheritance diagram for btGeneric6DofSpringConstraint:
[legend]
Collaboration diagram for btGeneric6DofSpringConstraint:
[legend]

## Public Member Functions
| BT_DECLARE_ALIGNED_ALLOCATOR ()
| btGeneric6DofSpringConstraint (btRigidBody &rbA, btRigidBody &rbB, const btTransform &frameInA, const btTransform &frameInB, bool useLinearReferenceFrameA)
| btGeneric6DofSpringConstraint (btRigidBody &rbB, const btTransform &frameInB, bool useLinearReferenceFrameB)
void | enableSpring (int index, bool onOff)
void | setStiffness (int index, btScalar stiffness)
void | setDamping (int index, btScalar damping)
void | setEquilibriumPoint ()
void | setEquilibriumPoint (int index)
void | setEquilibriumPoint (int index, btScalar val)
bool | isSpringEnabled (int index) const
btScalar | getStiffness (int index) const
btScalar | getDamping (int index) const
btScalar | getEquilibriumPoint (int index) const
virtual void | setAxis (const btVector3 &axis1, const btVector3 &axis2)
virtual void | getInfo2 (btConstraintInfo2 *info)
| internal method used by the constraint solver, don't use them directly More...
virtual int | calculateSerializeBufferSize () const
virtual const char * | serialize (void *dataBuffer, btSerializer *serializer) const
| fills the dataBuffer and returns the struct name (and 0 on failure) More...
Public Member Functions inherited from btGeneric6DofConstraint
| BT_DECLARE_ALIGNED_ALLOCATOR ()
| btGeneric6DofConstraint (btRigidBody &rbA, btRigidBody &rbB, const btTransform &frameInA, const btTransform &frameInB, bool useLinearReferenceFrameA)
| btGeneric6DofConstraint (btRigidBody &rbB, const btTransform &frameInB, bool useLinearReferenceFrameB)
void | calculateTransforms (const btTransform &transA, const btTransform &transB)
| Calcs global transform of the offsets. More...
void | calculateTransforms ()
const btTransform & | getCalculatedTransformA () const
| Gets the global transform of the offset for body A. More...
const btTransform & | getCalculatedTransformB () const
| Gets the global transform of the offset for body B. More...
const btTransform & | getFrameOffsetA () const
const btTransform & | getFrameOffsetB () const
btTransform & | getFrameOffsetA ()
btTransform & | getFrameOffsetB ()
virtual void | buildJacobian ()
| performs Jacobian calculation, and also calculates angle differences and axis More...
virtual void | getInfo1 (btConstraintInfo1 *info)
| internal method used by the constraint solver, don't use them directly More...
void | getInfo1NonVirtual (btConstraintInfo1 *info)
virtual void | getInfo2 (btConstraintInfo2 *info)
| internal method used by the constraint solver, don't use them directly More...
void | getInfo2NonVirtual (btConstraintInfo2 *info, const btTransform &transA, const btTransform &transB, const btVector3 &linVelA, const btVector3 &linVelB, const btVector3 &angVelA, const btVector3 &angVelB)
void | updateRHS (btScalar timeStep)
btVector3 | getAxis (int axis_index) const
| Get the rotation axis in global coordinates. More...
btScalar | getAngle (int axis_index) const
| Get the relative Euler angle. More...
btScalar | getRelativePivotPosition (int axis_index) const
| Get the relative position of the constraint pivot. More...
void | setFrames (const btTransform &frameA, const btTransform &frameB)
bool | testAngularLimitMotor (int axis_index)
| Test angular limit. More...
void | setLinearLowerLimit (const btVector3 &linearLower)
void | getLinearLowerLimit (btVector3 &linearLower) const
void | setLinearUpperLimit (const btVector3 &linearUpper)
void | getLinearUpperLimit (btVector3 &linearUpper) const
void | setAngularLowerLimit (const btVector3 &angularLower)
void | getAngularLowerLimit (btVector3 &angularLower) const
void | setAngularUpperLimit (const btVector3 &angularUpper)
void | getAngularUpperLimit (btVector3 &angularUpper) const
btRotationalLimitMotor * | getRotationalLimitMotor (int index)
| Retrieves the angular limit informacion. More...
btTranslationalLimitMotor * | getTranslationalLimitMotor ()
| Retrieves the limit informacion. More...
void | setLimit (int axis, btScalar lo, btScalar hi)
bool | isLimited (int limitIndex) const
| Test limit. More...
virtual void | calcAnchorPos (void)
int | get_limit_motor_info2 (btRotationalLimitMotor *limot, const btTransform &transA, const btTransform &transB, const btVector3 &linVelA, const btVector3 &linVelB, const btVector3 &angVelA, const btVector3 &angVelB, btConstraintInfo2 *info, int row, btVector3 &ax1, int rotational, int rotAllowed=false)
bool | getUseFrameOffset () const
void | setUseFrameOffset (bool frameOffsetOnOff)
bool | getUseLinearReferenceFrameA () const
void | setUseLinearReferenceFrameA (bool linearReferenceFrameA)
virtual void | setParam (int num, btScalar value, int axis=-1)
| override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5). More...
virtual btScalar | getParam (int num, int axis=-1) const
| return the local value of parameter More...
void | setAxis (const btVector3 &axis1, const btVector3 &axis2)
virtual int | getFlags () const
virtual int | calculateSerializeBufferSize () const
virtual const char * | serialize (void *dataBuffer, btSerializer *serializer) const
| fills the dataBuffer and returns the struct name (and 0 on failure) More...
Public Member Functions inherited from btTypedConstraint
| BT_DECLARE_ALIGNED_ALLOCATOR ()
virtual | ~btTypedConstraint ()
| btTypedConstraint (btTypedConstraintType type, btRigidBody &rbA)
| btTypedConstraint (btTypedConstraintType type, btRigidBody &rbA, btRigidBody &rbB)
int | getOverrideNumSolverIterations () const
void | setOverrideNumSolverIterations (int overideNumIterations)
| override the number of constraint solver iterations used to solve this constraint -1 will use the default number of iterations, as specified in SolverInfo.m_numIterations More...
virtual void | buildJacobian ()
| internal method used by the constraint solver, don't use them directly More...
virtual void | setupSolverConstraint (btConstraintArray &ca, int solverBodyA, int solverBodyB, btScalar timeStep)
| internal method used by the constraint solver, don't use them directly More...
virtual void | getInfo1 (btConstraintInfo1 *info)=0
| internal method used by the constraint solver, don't use them directly More...
virtual void | getInfo2 (btConstraintInfo2 *info)=0
| internal method used by the constraint solver, don't use them directly More...
void | internalSetAppliedImpulse (btScalar appliedImpulse)
| internal method used by the constraint solver, don't use them directly More...
btScalar | internalGetAppliedImpulse ()
| internal method used by the constraint solver, don't use them directly More...
btScalar | getBreakingImpulseThreshold () const
void | setBreakingImpulseThreshold (btScalar threshold)
bool | isEnabled () const
void | setEnabled (bool enabled)
virtual void | solveConstraintObsolete (btSolverBody &, btSolverBody &, btScalar)
| internal method used by the constraint solver, don't use them directly More...
const btRigidBody & | getRigidBodyA () const
const btRigidBody & | getRigidBodyB () const
btRigidBody & | getRigidBodyA ()
btRigidBody & | getRigidBodyB ()
int | getUserConstraintType () const
void | setUserConstraintType (int userConstraintType)
void | setUserConstraintId (int uid)
int | getUserConstraintId () const
void | setUserConstraintPtr (void *ptr)
void * | getUserConstraintPtr ()
void | setJointFeedback (btJointFeedback *jointFeedback)
const btJointFeedback * | getJointFeedback () const
btJointFeedback * | getJointFeedback ()
int | getUid () const
bool | needsFeedback () const
void | enableFeedback (bool needsFeedback)
| enableFeedback will allow to read the applied linear and angular impulse use getAppliedImpulse, getAppliedLinearImpulse and getAppliedAngularImpulse to read feedback information More...
btScalar | getAppliedImpulse () const
| getAppliedImpulse is an estimated total applied impulse. More...
btTypedConstraintType | getConstraintType () const
void | setDbgDrawSize (btScalar dbgDrawSize)
btScalar | getDbgDrawSize ()
virtual void | setParam (int num, btScalar value, int axis=-1)=0
| override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5). More...
virtual btScalar | getParam (int num, int axis=-1) const =0
| return the local value of parameter More...
virtual int | calculateSerializeBufferSize () const
virtual const char * | serialize (void *dataBuffer, btSerializer *serializer) const
| fills the dataBuffer and returns the struct name (and 0 on failure) More...
Public Member Functions inherited from btTypedObject
| btTypedObject (int objectType)
int | getObjectType () const

## Protected Member Functions
void | init ()
void | internalUpdateSprings (btConstraintInfo2 *info)
Protected Member Functions inherited from btGeneric6DofConstraint
btGeneric6DofConstraint & | operator= (btGeneric6DofConstraint &other)
int | setAngularLimits (btConstraintInfo2 *info, int row_offset, const btTransform &transA, const btTransform &transB, const btVector3 &linVelA, const btVector3 &linVelB, const btVector3 &angVelA, const btVector3 &angVelB)
int | setLinearLimits (btConstraintInfo2 *info, int row, const btTransform &transA, const btTransform &transB, const btVector3 &linVelA, const btVector3 &linVelB, const btVector3 &angVelA, const btVector3 &angVelB)
void | buildLinearJacobian (btJacobianEntry &jacLinear, const btVector3 &normalWorld, const btVector3 &pivotAInW, const btVector3 &pivotBInW)
void | buildAngularJacobian (btJacobianEntry &jacAngular, const btVector3 &jointAxisW)
void | calculateLinearInfo ()
void | calculateAngleInfo ()
| calcs the euler angles between the two bodies. More...
Protected Member Functions inherited from btTypedConstraint
btScalar | getMotorFactor (btScalar pos, btScalar lowLim, btScalar uppLim, btScalar vel, btScalar timeFact)
| internal method used by the constraint solver, don't use them directly More...

## Protected Attributes
bool | m_springEnabled [6]
btScalar | m_equilibriumPoint [6]
btScalar | m_springStiffness [6]
btScalar | m_springDamping [6]
Protected Attributes inherited from btGeneric6DofConstraint
btTransform | m_frameInA
| relative_frames More...
btTransform | m_frameInB
| the constraint space w.r.t body B More...
btJacobianEntry | m_jacLinear [3]
| Jacobians. More...
btJacobianEntry | m_jacAng [3]
| 3 orthogonal angular constraints More...
btTranslationalLimitMotor | m_linearLimits
| Linear_Limit_parameters. More...
btRotationalLimitMotor | m_angularLimits [3]
| hinge_parameters More...
btScalar | m_timeStep
| temporal variables More...
btTransform | m_calculatedTransformA
btTransform | m_calculatedTransformB
btVector3 | m_calculatedAxisAngleDiff
btVector3 | m_calculatedAxis [3]
btVector3 | m_calculatedLinearDiff
btScalar | m_factA
btScalar | m_factB
bool | m_hasStaticBody
btVector3 | m_AnchorPos
bool | m_useLinearReferenceFrameA
bool | m_useOffsetForConstraintFrame
int | m_flags
Protected Attributes inherited from btTypedConstraint
btRigidBody & | m_rbA
btRigidBody & | m_rbB
btScalar | m_appliedImpulse
btScalar | m_dbgDrawSize
btJointFeedback * | m_jointFeedback

## Additional Inherited Members
Static Public Member Functions inherited from btTypedConstraint
static btRigidBody & | getFixedBody ()
Public Attributes inherited from btGeneric6DofConstraint
bool | m_useSolveConstraintObsolete
| for backwards compatibility during the transition to 'getInfo/getInfo2' More...
Public Attributes inherited from btTypedObject
int | m_objectType

## Detailed Description

Generic 6 DOF constraint that allows to set spring motors to any translational and rotational DOF.

DOF index used in enableSpring() and setStiffness() means: 0 : translation X 1 : translation Y 2 : translation Z 3 : rotation X (3rd Euler rotational around new position of X axis, range [-PI+epsilon, PI-epsilon] ) 4 : rotation Y (2nd Euler rotational around new position of Y axis, range [-PI/2+epsilon, PI/2-epsilon] ) 5 : rotation Z (1st Euler rotational around Z axis, range [-PI+epsilon, PI-epsilon] )

Definition at line 41 of file btGeneric6DofSpringConstraint.h.

## Constructor & Destructor Documentation

## ◆ btGeneric6DofSpringConstraint() [1/2]

btGeneric6DofSpringConstraint::btGeneric6DofSpringConstraint | ( | btRigidBody & | rbA,
|  | btRigidBody & | rbB,
|  | const btTransform & | frameInA,
|  | const btTransform & | frameInB,
|  | bool | useLinearReferenceFrameA
| ) |  |

Definition at line 20 of file btGeneric6DofSpringConstraint.cpp.

## ◆ btGeneric6DofSpringConstraint() [2/2]

btGeneric6DofSpringConstraint::btGeneric6DofSpringConstraint | ( | btRigidBody & | rbB,
|  | const btTransform & | frameInB,
|  | bool | useLinearReferenceFrameB
| ) |  |

Definition at line 26 of file btGeneric6DofSpringConstraint.cpp.

## Member Function Documentation

## ◆ BT_DECLARE_ALIGNED_ALLOCATOR()

btGeneric6DofSpringConstraint::BT_DECLARE_ALIGNED_ALLOCATOR | ( |  | ) |

## ◆ calculateSerializeBufferSize()

int btGeneric6DofSpringConstraint::calculateSerializeBufferSize | ( |  | ) | const
| inlinevirtual

Reimplemented from btGeneric6DofConstraint.

Definition at line 113 of file btGeneric6DofSpringConstraint.h.

## ◆ enableSpring()

void btGeneric6DofSpringConstraint::enableSpring | ( | int | index,
|  | bool | onOff
| ) |  |

Definition at line 45 of file btGeneric6DofSpringConstraint.cpp.

## ◆ getDamping()

btScalar btGeneric6DofSpringConstraint::getDamping | ( | int | index | ) | const
| inline

Definition at line 74 of file btGeneric6DofSpringConstraint.h.

## ◆ getEquilibriumPoint()

btScalar btGeneric6DofSpringConstraint::getEquilibriumPoint | ( | int | index | ) | const
| inline

Definition at line 79 of file btGeneric6DofSpringConstraint.h.

## ◆ getInfo2()

void btGeneric6DofSpringConstraint::getInfo2 | ( | btConstraintInfo2 * | info | ) |
| virtual

internal method used by the constraint solver, don't use them directly

Reimplemented from btGeneric6DofConstraint.

Definition at line 143 of file btGeneric6DofSpringConstraint.cpp.

## ◆ getStiffness()

btScalar btGeneric6DofSpringConstraint::getStiffness | ( | int | index | ) | const
| inline

Definition at line 69 of file btGeneric6DofSpringConstraint.h.

## ◆ init()

void btGeneric6DofSpringConstraint::init | ( |  | ) |
| protected

Definition at line 32 of file btGeneric6DofSpringConstraint.cpp.

## ◆ internalUpdateSprings()

void btGeneric6DofSpringConstraint::internalUpdateSprings | ( | btConstraintInfo2 * | info | ) |
| protected

Definition at line 106 of file btGeneric6DofSpringConstraint.cpp.

## ◆ isSpringEnabled()

bool btGeneric6DofSpringConstraint::isSpringEnabled | ( | int | index | ) | const
| inline

Definition at line 64 of file btGeneric6DofSpringConstraint.h.

## ◆ serialize()

const char * btGeneric6DofSpringConstraint::serialize | ( | void * | dataBuffer,
|  | btSerializer * | serializer
| ) |  | const
| inlinevirtual

fills the dataBuffer and returns the struct name (and 0 on failure)

Reimplemented from btGeneric6DofConstraint.

Definition at line 119 of file btGeneric6DofSpringConstraint.h.

## ◆ setAxis()

void btGeneric6DofSpringConstraint::setAxis | ( | const btVector3 & | axis1,
|  | const btVector3 & | axis2
| ) |  |
| virtual

Definition at line 152 of file btGeneric6DofSpringConstraint.cpp.

## ◆ setDamping()

void btGeneric6DofSpringConstraint::setDamping | ( | int | index,
|  | btScalar | damping
| ) |  |

Definition at line 65 of file btGeneric6DofSpringConstraint.cpp.

## ◆ setEquilibriumPoint() [1/3]

void btGeneric6DofSpringConstraint::setEquilibriumPoint | ( |  | ) |

Definition at line 71 of file btGeneric6DofSpringConstraint.cpp.

## ◆ setEquilibriumPoint() [2/3]

void btGeneric6DofSpringConstraint::setEquilibriumPoint | ( | int | index | ) |

Definition at line 86 of file btGeneric6DofSpringConstraint.cpp.

## ◆ setEquilibriumPoint() [3/3]

void btGeneric6DofSpringConstraint::setEquilibriumPoint | ( | int | index,
|  | btScalar | val
| ) |  |

Definition at line 100 of file btGeneric6DofSpringConstraint.cpp.

## ◆ setStiffness()

void btGeneric6DofSpringConstraint::setStiffness | ( | int | index,
|  | btScalar | stiffness
| ) |  |

Definition at line 59 of file btGeneric6DofSpringConstraint.cpp.

## Member Data Documentation

## ◆ m_equilibriumPoint

btScalar btGeneric6DofSpringConstraint::m_equilibriumPoint[6]
| protected

Definition at line 46 of file btGeneric6DofSpringConstraint.h.

## ◆ m_springDamping

btScalar btGeneric6DofSpringConstraint::m_springDamping[6]
| protected

Definition at line 48 of file btGeneric6DofSpringConstraint.h.

## ◆ m_springEnabled

bool btGeneric6DofSpringConstraint::m_springEnabled[6]
| protected

Definition at line 45 of file btGeneric6DofSpringConstraint.h.

## ◆ m_springStiffness

btScalar btGeneric6DofSpringConstraint::m_springStiffness[6]
| protected

Definition at line 47 of file btGeneric6DofSpringConstraint.h.

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

- btGeneric6DofSpringConstraint.h
- btGeneric6DofSpringConstraint.cpp