Bullet Collision Detection & Physics Library
|
Go to the documentation of this file.
24 #ifndef BT_MULTIBODY_H
25 #define BT_MULTIBODY_H
34 #ifdef BT_USE_DOUBLE_PRECISION
35 #define btMultiBodyData btMultiBodyDoubleData
36 #define btMultiBodyDataName "btMultiBodyDoubleData"
37 #define btMultiBodyLinkData btMultiBodyLinkDoubleData
38 #define btMultiBodyLinkDataName "btMultiBodyLinkDoubleData"
40 #define btMultiBodyData btMultiBodyFloatData
41 #define btMultiBodyDataName "btMultiBodyFloatData"
42 #define btMultiBodyLinkData btMultiBodyLinkFloatData
43 #define btMultiBodyLinkDataName "btMultiBodyLinkFloatData"
44 #endif //BT_USE_DOUBLE_PRECISION
63 bool canSleep,
bool deprecatedMultiDof =
true);
68 void setupFixed(
int i,
73 const btVector3 &parentComToThisPivotOffset,
74 const btVector3 &thisPivotToThisComOffset,
bool deprecatedDisableParentCollision =
true);
76 void setupPrismatic(
int i,
82 const btVector3 &parentComToThisPivotOffset,
83 const btVector3 &thisPivotToThisComOffset,
84 bool disableParentCollision);
86 void setupRevolute(
int i,
92 const btVector3 &parentComToThisPivotOffset,
93 const btVector3 &thisPivotToThisComOffset,
94 bool disableParentCollision =
false);
96 void setupSpherical(
int i,
101 const btVector3 &parentComToThisPivotOffset,
102 const btVector3 &thisPivotToThisComOffset,
103 bool disableParentCollision =
false);
105 void setupPlanar(
int i,
111 const btVector3 &parentComToThisComOffset,
112 bool disableParentCollision =
false);
116 return m_links[index];
121 return m_links[index];
126 m_baseCollider = collider;
130 return m_baseCollider;
134 return m_baseCollider;
139 if (index >= 0 && index < getNumLinks())
141 return getLink(index).m_collider;
148 if (index >= 0 && index < getNumLinks())
150 return getLink(index).m_collider;
160 int getParent(
int link_num)
const;
172 const btVector3 &getLinkInertia(
int i)
const;
191 return btVector3(m_realBuf[3], m_realBuf[4], m_realBuf[5]);
200 return m_basePos_interpolate;
204 return m_baseQuat_interpolate;
213 m_basePos_interpolate = pos;
232 m_realBuf[3] = vel[0];
233 m_realBuf[4] = vel[1];
234 m_realBuf[5] = vel[2];
239 m_baseQuat_interpolate = rot;
243 m_realBuf[0] = omega[0];
244 m_realBuf[1] = omega[1];
245 m_realBuf[2] = omega[2];
255 btScalar *getJointVelMultiDof(
int i);
256 btScalar *getJointPosMultiDof(
int i);
258 const btScalar *getJointVelMultiDof(
int i)
const;
259 const btScalar *getJointPosMultiDof(
int i)
const;
261 void setJointPos(
int i,
btScalar q);
262 void setJointVel(
int i,
btScalar qdot);
263 void setJointPosMultiDof(
int i,
const double *q);
264 void setJointVelMultiDof(
int i,
const double *qdot);
265 void setJointPosMultiDof(
int i,
const float *q);
266 void setJointVelMultiDof(
int i,
const float *qdot);
274 return &m_realBuf[0];
292 const btVector3 &getRVector(
int i)
const;
294 const btVector3 &getInterpolateRVector(
int i)
const;
295 const btQuaternion &getInterpolateParentToLocalRot(
int i)
const;
322 void clearForcesAndTorques();
323 void clearConstraintForces();
325 void clearVelocities();
332 void addLinkForce(
int i,
const btVector3 &f);
333 void addLinkTorque(
int i,
const btVector3 &t);
337 m_baseConstraintForce += f;
340 void addLinkConstraintForce(
int i,
const btVector3 &f);
341 void addLinkConstraintTorque(
int i,
const btVector3 &t);
343 void addJointTorque(
int i,
btScalar Q);
344 void addJointTorqueMultiDof(
int i,
int dof,
btScalar Q);
345 void addJointTorqueMultiDof(
int i,
const btScalar *Q);
349 const btVector3 &getLinkForce(
int i)
const;
350 const btVector3 &getLinkTorque(
int i)
const;
351 btScalar getJointTorque(
int i)
const;
352 btScalar *getJointTorqueMultiDof(
int i);
371 void computeAccelerationsArticulatedBodyAlgorithmMultiDof(
btScalar dt,
375 bool isConstraintPass,
376 bool jointFeedbackInWorldSpace,
377 bool jointFeedbackInJointFrame
402 for (
int dof = 0; dof < 6 + getNumDofs(); ++dof)
404 m_deltaV[dof] += delta_vee[dof] * multiplier;
409 applyDeltaVeeMultiDof(&m_deltaV[0], 1);
411 for (
int dof = 0; dof < 6 + getNumDofs(); ++dof)
435 for (
int dof = 0; dof < 6 + getNumDofs(); ++dof)
437 m_realBuf[dof] += delta_vee[dof] * multiplier;
438 btClamp(m_realBuf[dof], -m_maxCoordinateVelocity, m_maxCoordinateVelocity);
446 void predictPositionsMultiDof(
btScalar dt);
466 void fillConstraintJacobianMultiDof(
int link,
482 m_canSleep = canSleep;
498 m_canWakeup = canWakeup;
503 void checkMotionAndSleepIfRequired(
btScalar timestep);
512 m_fixedBase = fixedBase;
527 m_links.resize(numLinks);
532 return m_linearDamping;
536 m_linearDamping = damp;
540 return m_angularDamping;
544 m_angularDamping = damp;
549 return m_useGyroTerm;
553 m_useGyroTerm = useGyro;
557 return m_maxCoordinateVelocity;
561 m_maxCoordinateVelocity = maxVel;
566 return m_maxAppliedImpulse;
570 m_maxAppliedImpulse = maxImp;
574 m_hasSelfCollision = hasSelfCollision;
578 return m_hasSelfCollision;
581 void finalizeMultiDof();
594 __posUpdated = updated;
600 return m_internalNeedsJointFeedback;
656 static void spatialTransform(
const btMatrix3x3 &rotation_matrix,
674 int dofOffset = 0, cfgOffset = 0;
675 for (
int bidx = 0; bidx < m_links.size(); ++bidx)
677 m_links[bidx].m_dofOffset = dofOffset;
678 m_links[bidx].m_cfgOffset = cfgOffset;
679 dofOffset += m_links[bidx].m_dofCount;
680 cfgOffset += m_links[bidx].m_posVarCount;
void setBaseMass(btScalar mass)
const btVector3 getBaseVel() const
void setBaseName(const char *name)
memory of setBaseName needs to be manager by user
btScalar getLinearDamping() const
void addBaseConstraintTorque(const btVector3 &t)
void * getUserPointer() const
users can point to their objects, userPointer is not used by Bullet
btMultiBodyLinkFloatData * m_links
bool isUsingGlobalVelocities() const
These spatial algebra classes are used for btMultiBody, see BulletDynamics/Featherstone.
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
int getCompanionId() const
void processDeltaVeeMultiDof2()
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
bool internalNeedsJointFeedback() const
btVector3DoubleData m_parentComToThisPivotOffset
btVector3 m_baseConstraintTorque
void setWorldToBaseRot(const btQuaternion &rot)
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btVector3FloatData m_absFrameTotVelocityBottom
const btQuaternion & getWorldToBaseRot() const
btQuaternion inverse() const
Return the inverse of this quaternion.
btVector3DoubleData m_linkInertia
btVector3FloatData m_absFrameLocVelocityTop
bool isPosUpdated() const
btVector3DoubleData m_absFrameTotVelocityTop
btAlignedObjectArray< btMatrix3x3 > m_matrixBuf
const char * getBaseName() const
btQuaternionDoubleData m_baseWorldOrientation
btMultiBodyLinkCollider * getBaseCollider()
void setNumLinks(int numLinks)
btMultiBodyLinkCollider * m_baseCollider
btScalar getAngularDamping() const
btAlignedObjectArray< btScalar > m_deltaV
bool getCanWakeup() const
btScalar getMaxCoordinateVelocity() const
btQuaternion inverse(const btQuaternion &q)
Return the inverse of a quaternion.
btMatrix3x3 m_cachedInertiaLowerRight
btTransform getBaseWorldTransform() const
const btScalar * getDeltaVelocityVector() const
btVector3FloatData m_jointAxisBottom[6]
bool isUsingRK4Integration() const
void setBaseVel(const btVector3 &vel)
btVector3FloatData m_baseAngularVelocity
btScalar m_maxCoordinateVelocity
void addBaseTorque(const btVector3 &t)
btVector3FloatData m_jointAxisTop[6]
void applyDeltaVeeMultiDof(const btScalar *delta_vee, btScalar multiplier)
bool m_cachedInertiaValid
void setUserIndex(int index)
users can point to their objects, userPointer is not used by Bullet
void setBaseCollider(btMultiBodyLinkCollider *collider)
btScalar getMaxAppliedImpulse() const
bool getUseGyroTerm() const
void btClamp(T &a, const T &lb, const T &ub)
btVector3DoubleData m_absFrameLocVelocityBottom
btCollisionObjectFloatData * m_linkCollider
btVector3DoubleData m_absFrameLocVelocityTop
btQuaternionFloatData m_baseWorldOrientation
const btMultiBodyLinkCollider * getLinkCollider(int index) const
void setFixedBase(bool fixedBase)
btMultibodyLink & getLink(int index)
btVector3 m_baseConstraintForce
btVector3FloatData m_absFrameTotVelocityTop
bool m_internalNeedsJointFeedback
the m_needsJointFeedback gets updated/computed during the stepVelocitiesMultiDof and it for internal ...
btScalar m_maxAppliedImpulse
const btVector3 & getBaseInertia() const
void setLinearDamping(btScalar damp)
btVector3 getBaseOmega() const
bool hasFixedBase() const
void setCanWakeup(bool canWakeup)
virtual int calculateSerializeBufferSize() const
void addBaseForce(const btVector3 &f)
bool hasSelfCollision() const
btMatrix3x3 m_cachedInertiaLowerLeft
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
btScalar getBaseMass() const
void setBaseOmega(const btVector3 &omega)
btVector3DoubleData m_jointAxisBottom[6]
btVector3DoubleData m_baseLinearVelocity
btQuaternionDoubleData m_zeroRotParentToThis
btVector3FloatData m_absFrameLocVelocityBottom
btMatrix3x3 m_cachedInertiaTopLeft
btQuaternionFloatData m_zeroRotParentToThis
#define BT_DECLARE_ALIGNED_ALLOCATOR()
btVector3 m_basePos_interpolate
const btMultibodyLink & getLink(int index) const
btQuaternion m_baseQuat_interpolate
btVector3 can be used to represent 3D points and vectors.
btVector3DoubleData m_absFrameTotVelocityBottom
void setHasSelfCollision(bool hasSelfCollision)
int getNumPosVars() const
const btQuaternion & getInterpolateWorldToBaseRot() const
void setMaxCoordinateVelocity(btScalar maxVel)
btVector3DoubleData m_baseInertia
double m_jointMaxVelocity
btVector3FloatData m_parentComToThisPivotOffset
void setUseGyroTerm(bool useGyro)
void updateLinksDofOffsets()
void setCompanionId(int id)
#define ATTRIBUTE_ALIGNED16(a)
btVector3DoubleData m_baseWorldPosition
void setPosUpdated(bool updated)
void * m_userObjectPointer
void fillContactJacobianMultiDof(int link, const btVector3 &contact_point, const btVector3 &normal, btScalar *jac, btAlignedObjectArray< btScalar > &scratch_r, btAlignedObjectArray< btVector3 > &scratch_v, btAlignedObjectArray< btMatrix3x3 > &scratch_m) const
const btVector3 & getInterpolateBasePos() const
void setMaxAppliedImpulse(btScalar maxImp)
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
void setAngularDamping(btScalar damp)
btVector3DoubleData m_thisPivotToThisComOffset
void setUserPointer(void *userPointer)
users can point to their objects, userPointer is not used by Bullet
btAlignedObjectArray< btVector3 > m_vectorBuf
btVector3FloatData m_baseInertia
const btScalar * getVelocityVector() const
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btMatrix3x3 m_cachedInertiaTopRight
btVector3FloatData m_thisPivotToThisComOffset
btVector3FloatData m_linkInertia
void setBaseInertia(const btVector3 &inertia)
void applyDeltaVeeMultiDof2(const btScalar *delta_vee, btScalar multiplier)
btAlignedObjectArray< btScalar > m_realBuf
void addBaseConstraintForce(const btVector3 &f)
btScalar m_angularDamping
const btVector3 & getBaseForce() const
btVector3FloatData m_baseWorldPosition
void setUserIndex2(int index)
void useGlobalVelocities(bool use)
void * m_userObjectPointer
users can point to their objects, m_userPointer is not used by Bullet, see setUserPointer/getUserPoin...
btVector3FloatData m_baseLinearVelocity
void setCanSleep(bool canSleep)
void useRK4Integration(bool use)
const btVector3 & getBasePos() const
btCollisionObjectDoubleData * m_baseCollider
btCollisionObjectDoubleData * m_linkCollider
btVector3DoubleData m_baseAngularVelocity
const btMultiBodyLinkCollider * getBaseCollider() const
const btVector3 & getBaseTorque() const
btAlignedObjectArray< btMultibodyLink > m_links
void setBasePos(const btVector3 &pos)
btMultiBodyLinkCollider * getLinkCollider(int index)
btMultiBodyLinkDoubleData * m_links
int getUserIndex2() const
btVector3DoubleData m_jointAxisTop[6]
btCollisionObjectFloatData * m_baseCollider
void setBaseWorldTransform(const btTransform &tr)