25 #ifndef BT_MULTIBODY_H    26 #define BT_MULTIBODY_H    36 #ifdef BT_USE_DOUBLE_PRECISION    37         #define btMultiBodyData btMultiBodyDoubleData    38         #define btMultiBodyDataName     "btMultiBodyDoubleData"    39         #define btMultiBodyLinkData btMultiBodyLinkDoubleData    40         #define btMultiBodyLinkDataName "btMultiBodyLinkDoubleData"    42         #define btMultiBodyData btMultiBodyFloatData    43         #define btMultiBodyDataName     "btMultiBodyFloatData"    44         #define btMultiBodyLinkData btMultiBodyLinkFloatData    45         #define btMultiBodyLinkDataName "btMultiBodyLinkFloatData"    46 #endif //BT_USE_DOUBLE_PRECISION    66                 bool canSleep, 
bool deprecatedMultiDof=
true);
    72         void setupFixed(
int linkIndex,
    77                                                    const btVector3 &parentComToThisPivotOffset,
    78                            const btVector3 &thisPivotToThisComOffset, 
bool deprecatedDisableParentCollision=
true);
    81         void setupPrismatic(
int i,
    87                                const btVector3 &parentComToThisPivotOffset,
    88                                                            const btVector3 &thisPivotToThisComOffset,
    89                                                            bool disableParentCollision);
    91     void setupRevolute(
int linkIndex,            
    97                        const btVector3 &parentComToThisPivotOffset,    
    98                        const btVector3 &thisPivotToThisComOffset,       
    99                                            bool disableParentCollision=
false);
   101         void setupSpherical(
int linkIndex,                                                                                      
   106                        const btVector3 &parentComToThisPivotOffset,                     
   107                        const btVector3 &thisPivotToThisComOffset,                               
   108                                            bool disableParentCollision=
false);          
   110         void setupPlanar(
int i,                                                                                 
   116                        const btVector3 &parentComToThisComOffset,                       
   117                                            bool disableParentCollision=
false);          
   121                 return m_links[index];
   126                 return m_links[index];
   132                 m_baseCollider = collider;
   136                 return m_baseCollider;
   140                 return m_baseCollider;
   148     int getParent(
int link_num) 
const;
   161     const btVector3 & getLinkInertia(
int i) 
const;
   180                 return btVector3(m_realBuf[3],m_realBuf[4],m_realBuf[5]); 
   211                 m_realBuf[3]=vel[0]; m_realBuf[4]=vel[1]; m_realBuf[5]=vel[2]; 
   219                 m_realBuf[0]=omega[0]; 
   220                 m_realBuf[1]=omega[1]; 
   221                 m_realBuf[2]=omega[2]; 
   232         btScalar * getJointVelMultiDof(
int i);
   233         btScalar * getJointPosMultiDof(
int i);
   235         const btScalar * getJointVelMultiDof(
int i) 
const ;
   236         const btScalar * getJointPosMultiDof(
int i) 
const ;
   238     void setJointPos(
int i, 
btScalar q);
   239     void setJointVel(
int i, 
btScalar qdot);
   240         void setJointPosMultiDof(
int i, 
btScalar *q);
   241     void setJointVelMultiDof(
int i, 
btScalar *qdot);    
   251                 return &m_realBuf[0]; 
   264     const btVector3 & getRVector(
int i) 
const;   
   290     void clearForcesAndTorques();
   291    void clearConstraintForces();
   293         void clearVelocities();
   300     void addLinkForce(
int i, 
const btVector3 &f);
   301     void addLinkTorque(
int i, 
const btVector3 &t);
   305                 m_baseConstraintForce += f;
   308     void addLinkConstraintForce(
int i, 
const btVector3 &f);
   309     void addLinkConstraintTorque(
int i, 
const btVector3 &t);
   312 void addJointTorque(
int i, 
btScalar Q);
   313         void addJointTorqueMultiDof(
int i, 
int dof, 
btScalar Q);
   314         void addJointTorqueMultiDof(
int i, 
const btScalar *Q);
   318     const btVector3 & getLinkForce(
int i) 
const;
   319     const btVector3 & getLinkTorque(
int i) 
const;
   320     btScalar getJointTorque(
int i) 
const;
   321         btScalar * getJointTorqueMultiDof(
int i);
   342         void computeAccelerationsArticulatedBodyAlgorithmMultiDof(
btScalar dt,
   346                         bool isConstraintPass=
false   354                         bool isConstraintPass=
false)
   356                 computeAccelerationsArticulatedBodyAlgorithmMultiDof(dt,scratch_r,scratch_v,scratch_m,isConstraintPass);
   372                 for (
int dof = 0; dof < 6 + getNumDofs(); ++dof)
   374                         m_deltaV[dof] += delta_vee[dof] * multiplier;
   379                 applyDeltaVeeMultiDof(&m_deltaV[0],1);
   381                 for (
int dof = 0; dof < 6 + getNumDofs(); ++dof)
   405                 for (
int dof = 0; dof < 6 + getNumDofs(); ++dof)
   407                         m_realBuf[dof] += delta_vee[dof] * multiplier;
   408                         btClamp(m_realBuf[dof],-m_maxCoordinateVelocity,m_maxCoordinateVelocity);
   436         void fillConstraintJacobianMultiDof(
int link,
   451                 m_canSleep = canSleep;
   462     void checkMotionAndSleepIfRequired(
btScalar timestep);
   481                 m_links.resize(numLinks);
   486                         return m_linearDamping;
   490                 m_linearDamping = damp;
   494                 return m_angularDamping;
   498                 m_angularDamping = damp;
   503                 return m_useGyroTerm;
   507                 m_useGyroTerm = useGyro;
   511                 return m_maxCoordinateVelocity ;
   515                 m_maxCoordinateVelocity = maxVel;
   520                 return m_maxAppliedImpulse;
   524                 m_maxAppliedImpulse = maxImp;
   528                 m_hasSelfCollision = hasSelfCollision;
   532                 return m_hasSelfCollision;
   536         void finalizeMultiDof();
   549                 __posUpdated = updated;
   555                 return m_internalNeedsJointFeedback;
   582         void solveImatrix(
const btVector3& rhs_top, 
const btVector3& rhs_bot, 
float result[6]) 
const;
   587                 int dofOffset = 0, cfgOffset = 0;
   588                 for(
int bidx = 0; bidx < m_links.size(); ++bidx)
   590                         m_links[bidx].m_dofOffset = dofOffset; m_links[bidx].m_cfgOffset = cfgOffset;
   591                         dofOffset += m_links[bidx].m_dofCount; cfgOffset += m_links[bidx].m_posVarCount;
 
void stepVelocitiesMultiDof(btScalar dt, btAlignedObjectArray< btScalar > &scratch_r, btAlignedObjectArray< btVector3 > &scratch_v, btAlignedObjectArray< btMatrix3x3 > &scratch_m, bool isConstraintPass=false)
stepVelocitiesMultiDof is deprecated, use computeAccelerationsArticulatedBodyAlgorithmMultiDof instea...
void setCanSleep(bool canSleep)
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
btAlignedObjectArray< btMultiBodyLinkCollider * > m_colliders
btAlignedObjectArray< btMatrix3x3 > m_matrixBuf
const btMultibodyLink & getLink(int index) const 
bool isUsingGlobalVelocities() const 
const btVector3 getBaseVel() const 
btMultiBodyLinkCollider * getBaseCollider()
void setNumLinks(int numLinks)
btMultiBodyLinkCollider * m_baseCollider
These spatial algebra classes are used for btMultiBody, see BulletDynamics/Featherstone. 
btVector3DoubleData m_jointAxisTop[6]
btScalar m_maxCoordinateVelocity
void addBaseTorque(const btVector3 &t)
virtual int calculateSerializeBufferSize() const 
btTransform getBaseWorldTransform() const 
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
btScalar getBaseMass() const 
btQuaternionDoubleData m_zeroRotParentToThis
btMatrix3x3 m_cachedInertiaLowerRight
btCollisionObjectFloatData * m_linkCollider
void setBaseCollider(btMultiBodyLinkCollider *collider)
bool internalNeedsJointFeedback() const 
void btClamp(T &a, const T &lb, const T &ub)
const btVector3 & getBaseTorque() const 
bool isPosUpdated() const 
btVector3 m_baseConstraintTorque
void applyDeltaVeeMultiDof(const btScalar *delta_vee, btScalar multiplier)
void setWorldToBaseRot(const btQuaternion &rot)
btQuaternion inverse(const btQuaternion &q)
Return the inverse of a quaternion. 
btScalar m_maxAppliedImpulse
const char * getBaseName() const 
btAlignedObjectArray< btScalar > m_deltaV
btScalar getMaxAppliedImpulse() const 
void setBaseVel(const btVector3 &vel)
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const 
fills the dataBuffer and returns the struct name (and 0 on failure) 
int getNumPosVars() const 
btMatrix3x3 m_cachedInertiaTopLeft
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
const btVector3 & getBaseInertia() const 
void setHasSelfCollision(bool hasSelfCollision)
void setMaxCoordinateVelocity(btScalar maxVel)
btTransformFloatData m_baseWorldTransform
void setUseGyroTerm(bool useGyro)
btMatrix3x3 m_cachedInertiaLowerLeft
void setCompanionId(int id)
void setBaseOmega(const btVector3 &omega)
bool hasFixedBase() const 
btMultibodyLink & getLink(int index)
btScalar getLinearDamping() const 
bool hasSelfCollision() const 
btQuaternionFloatData m_zeroRotParentToThis
btQuaternion inverse() const 
Return the inverse of this quaternion. 
btVector3FloatData m_baseInertia
void setAngularDamping(btScalar damp)
btVector3FloatData m_thisPivotToThisComOffset
btVector3DoubleData m_baseInertia
btVector3 m_baseConstraintForce
btVector3 can be used to represent 3D points and vectors. 
#define ATTRIBUTE_ALIGNED16(a)
bool m_internalNeedsJointFeedback
the m_needsJointFeedback gets updated/computed during the stepVelocitiesMultiDof and it for internal ...
void setLinearDamping(btScalar damp)
void addBaseForce(const btVector3 &f)
btAlignedObjectArray< btScalar > m_realBuf
void updateLinksDofOffsets()
void setMaxAppliedImpulse(btScalar maxImp)
btVector3 getBaseOmega() const 
btMultiBodyLinkFloatData * m_links
int getCompanionId() const 
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 
btScalar getAngularDamping() const 
btCollisionObjectDoubleData * m_linkCollider
void setBaseInertia(const btVector3 &inertia)
void applyDeltaVeeMultiDof2(const btScalar *delta_vee, btScalar multiplier)
btTransformDoubleData m_baseWorldTransform
void setPosUpdated(bool updated)
#define BT_DECLARE_ALIGNED_ALLOCATOR()
btVector3DoubleData m_parentComToThisComOffset
bool isUsingRK4Integration() const 
btAlignedObjectArray< btVector3 > m_vectorBuf
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
const btMultiBodyLinkCollider * getBaseCollider() const 
btVector3FloatData m_parentComToThisComOffset
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
const btQuaternion & getWorldToBaseRot() const 
void addBaseConstraintForce(const btVector3 &f)
void setBaseMass(btScalar mass)
btVector3FloatData m_linkInertia
const btVector3 & getBasePos() const 
const btVector3 & getBaseForce() const 
btAlignedObjectArray< btMultibodyLink > m_links
btVector3DoubleData m_linkInertia
void setBasePos(const btVector3 &pos)
btVector3DoubleData m_thisPivotToThisComOffset
void addBaseConstraintTorque(const btVector3 &t)
void useGlobalVelocities(bool use)
btMultiBodyLinkDoubleData * m_links
btCollisionObjectFloatData * m_baseCollider
btMatrix3x3 m_cachedInertiaTopRight
void useRK4Integration(bool use)
void setBaseWorldTransform(const btTransform &tr)
const btScalar * getVelocityVector() const 
void processDeltaVeeMultiDof2()
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btScalar m_angularDamping
bool getUseGyroTerm() const 
btVector3DoubleData m_jointAxisBottom[6]
btScalar getMaxCoordinateVelocity() const 
void setBaseName(const char *name)
memory of setBaseName needs to be manager by user 
btCollisionObjectDoubleData * m_baseCollider