Bullet Collision Detection & Physics Library
btMultiBody.h
Go to the documentation of this file.
1/*
2 * PURPOSE:
3 * Class representing an articulated rigid body. Stores the body's
4 * current state, allows forces and torques to be set, handles
5 * timestepping and implements Featherstone's algorithm.
6 *
7 * COPYRIGHT:
8 * Copyright (C) Stephen Thompson, <stephen@solarflare.org.uk>, 2011-2013
9 * Portions written By Erwin Coumans: connection to LCP solver, various multibody constraints, replacing Eigen math library by Bullet LinearMath and a dedicated 6x6 matrix inverse (solveImatrix)
10 * Portions written By Jakub Stepien: support for multi-DOF constraints, introduction of spatial algebra and several other improvements
11
12 This software is provided 'as-is', without any express or implied warranty.
13 In no event will the authors be held liable for any damages arising from the use of this software.
14 Permission is granted to anyone to use this software for any purpose,
15 including commercial applications, and to alter it and redistribute it freely,
16 subject to the following restrictions:
17
18 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
19 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
20 3. This notice may not be removed or altered from any source distribution.
21
22 */
23
24#ifndef BT_MULTIBODY_H
25#define BT_MULTIBODY_H
26
27#include "LinearMath/btScalar.h"
32
34#ifdef BT_USE_DOUBLE_PRECISION
35#define btMultiBodyData btMultiBodyDoubleData
36#define btMultiBodyDataName "btMultiBodyDoubleData"
37#define btMultiBodyLinkData btMultiBodyLinkDoubleData
38#define btMultiBodyLinkDataName "btMultiBodyLinkDoubleData"
39#else
40#define btMultiBodyData btMultiBodyFloatData
41#define btMultiBodyDataName "btMultiBodyFloatData"
42#define btMultiBodyLinkData btMultiBodyLinkFloatData
43#define btMultiBodyLinkDataName "btMultiBodyLinkFloatData"
44#endif //BT_USE_DOUBLE_PRECISION
45
46#include "btMultiBodyLink.h"
48
51{
52public:
54
55 //
56 // initialization
57 //
58
59 btMultiBody(int n_links, // NOT including the base
60 btScalar mass, // mass of base
61 const btVector3 &inertia, // inertia of base, in base frame; assumed diagonal
62 bool fixedBase, // whether the base is fixed (true) or can move (false)
63 bool canSleep, bool deprecatedMultiDof = true);
64
65 virtual ~btMultiBody();
66
67 //note: fixed link collision with parent is always disabled
68 void setupFixed(int i, //linkIndex
70 const btVector3 &inertia,
71 int parent,
75
76 void setupPrismatic(int i,
78 const btVector3 &inertia,
79 int parent,
81 const btVector3 &jointAxis,
85
86 void setupRevolute(int i, // 0 to num_links-1
88 const btVector3 &inertia,
89 int parentIndex,
90 const btQuaternion &rotParentToThis, // rotate points in parent frame to this frame, when q = 0
91 const btVector3 &jointAxis, // in my frame
92 const btVector3 &parentComToThisPivotOffset, // vector from parent COM to joint axis, in PARENT frame
93 const btVector3 &thisPivotToThisComOffset, // vector from joint axis to my COM, in MY frame
94 bool disableParentCollision = false);
95
96 void setupSpherical(int i, // linkIndex, 0 to num_links-1
98 const btVector3 &inertia,
99 int parent,
100 const btQuaternion &rotParentToThis, // rotate points in parent frame to this frame, when q = 0
101 const btVector3 &parentComToThisPivotOffset, // vector from parent COM to joint axis, in PARENT frame
102 const btVector3 &thisPivotToThisComOffset, // vector from joint axis to my COM, in MY frame
103 bool disableParentCollision = false);
104
105 void setupPlanar(int i, // 0 to num_links-1
107 const btVector3 &inertia,
108 int parent,
109 const btQuaternion &rotParentToThis, // rotate points in parent frame to this frame, when q = 0
110 const btVector3 &rotationAxis,
111 const btVector3 &parentComToThisComOffset, // vector from parent COM to this COM, in PARENT frame
112 bool disableParentCollision = false);
113
114 const btMultibodyLink &getLink(int index) const
115 {
116 return m_links[index];
117 }
118
120 {
121 return m_links[index];
122 }
123
124 void setBaseCollider(btMultiBodyLinkCollider * collider) //collider can be NULL to disable collision for the base
125 {
126 m_baseCollider = collider;
127 }
129 {
130 return m_baseCollider;
131 }
133 {
134 return m_baseCollider;
135 }
136
138 {
139 if (index >= 0 && index < getNumLinks())
140 {
141 return getLink(index).m_collider;
142 }
143 return 0;
144 }
145
147 {
148 if (index >= 0 && index < getNumLinks())
149 {
150 return getLink(index).m_collider;
151 }
152 return 0;
153 }
154
155 //
156 // get parent
157 // input: link num from 0 to num_links-1
158 // output: link num from 0 to num_links-1, OR -1 to mean the base.
159 //
160 int getParent(int link_num) const;
161
162 //
163 // get number of m_links, masses, moments of inertia
164 //
165
166 int getNumLinks() const { return m_links.size(); }
167 int getNumDofs() const { return m_dofCount; }
168 int getNumPosVars() const { return m_posVarCnt; }
169 btScalar getBaseMass() const { return m_baseMass; }
170 const btVector3 &getBaseInertia() const { return m_baseInertia; }
171 btScalar getLinkMass(int i) const;
172 const btVector3 &getLinkInertia(int i) const;
173
174 //
175 // change mass (incomplete: can only change base mass and inertia at present)
176 //
177
178 void setBaseMass(btScalar mass) { m_baseMass = mass; }
179 void setBaseInertia(const btVector3 &inertia) { m_baseInertia = inertia; }
180
181 //
182 // get/set pos/vel/rot/omega for the base link
183 //
184
185 const btVector3 &getBasePos() const
186 {
187 return m_basePos;
188 } // in world frame
189 const btVector3 getBaseVel() const
190 {
191 return btVector3(m_realBuf[3], m_realBuf[4], m_realBuf[5]);
192 } // in world frame
194 {
195 return m_baseQuat;
196 }
197
199 {
200 return m_basePos_interpolate;
201 } // in world frame
203 {
204 return m_baseQuat_interpolate;
205 }
206
207 // rotates world vectors into base frame
208 btVector3 getBaseOmega() const { return btVector3(m_realBuf[0], m_realBuf[1], m_realBuf[2]); } // in world frame
209
211 {
212 m_basePos = pos;
213 m_basePos_interpolate = pos;
214 }
215
217 {
218 setBasePos(tr.getOrigin());
219 setWorldToBaseRot(tr.getRotation().inverse());
220 }
221
223 {
225 tr.setOrigin(getBasePos());
226 tr.setRotation(getWorldToBaseRot().inverse());
227 return tr;
228 }
229
231 {
232 m_realBuf[3] = vel[0];
233 m_realBuf[4] = vel[1];
234 m_realBuf[5] = vel[2];
235 }
237 {
238 m_baseQuat = rot; //m_baseQuat asumed to ba alias!?
239 m_baseQuat_interpolate = rot;
240 }
242 {
243 m_realBuf[0] = omega[0];
244 m_realBuf[1] = omega[1];
245 m_realBuf[2] = omega[2];
246 }
247
248 //
249 // get/set pos/vel for child m_links (i = 0 to num_links-1)
250 //
251
252 btScalar getJointPos(int i) const;
253 btScalar getJointVel(int i) const;
254
255 btScalar *getJointVelMultiDof(int i);
256 btScalar *getJointPosMultiDof(int i);
257
258 const btScalar *getJointVelMultiDof(int i) const;
259 const btScalar *getJointPosMultiDof(int i) const;
260
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);
267
268 //
269 // direct access to velocities as a vector of 6 + num_links elements.
270 // (omega first, then v, then joint velocities.)
271 //
273 {
274 return &m_realBuf[0];
275 }
276
278 {
279 return &m_deltaV[0];
280 }
281
283 {
284 return &m_splitV[0];
285 }
286 /* btScalar * getVelocityVector()
287 {
288 return &real_buf[0];
289 }
290 */
291
292 //
293 // get the frames of reference (positions and orientations) of the child m_links
294 // (i = 0 to num_links-1)
295 //
296
297 const btVector3 &getRVector(int i) const; // vector from COM(parent(i)) to COM(i), in frame i's coords
298 const btQuaternion &getParentToLocalRot(int i) const; // rotates vectors in frame parent(i) to vectors in frame i.
299 const btVector3 &getInterpolateRVector(int i) const; // vector from COM(parent(i)) to COM(i), in frame i's coords
300 const btQuaternion &getInterpolateParentToLocalRot(int i) const; // rotates vectors in frame parent(i) to vectors in frame i.
301
302 //
303 // transform vectors in local frame of link i to world frame (or vice versa)
304 //
305 btVector3 localPosToWorld(int i, const btVector3 &local_pos) const;
306 btVector3 localDirToWorld(int i, const btVector3 &local_dir) const;
307 btVector3 worldPosToLocal(int i, const btVector3 &world_pos) const;
308 btVector3 worldDirToLocal(int i, const btVector3 &world_dir) const;
309
310 //
311 // transform a frame in local coordinate to a frame in world coordinate
312 //
313 btMatrix3x3 localFrameToWorld(int i, const btMatrix3x3 &local_frame) const;
314
315
316 //
317 // set external forces and torques. Note all external forces/torques are given in the WORLD frame.
318 //
319
320 void clearForcesAndTorques();
321 void clearConstraintForces();
322
323 void clearVelocities();
324
325 void addBaseForce(const btVector3 &f)
326 {
327 m_baseForce += f;
328 }
329 void addBaseTorque(const btVector3 &t) { m_baseTorque += t; }
330 void addLinkForce(int i, const btVector3 &f);
331 void addLinkTorque(int i, const btVector3 &t);
332
334 {
335 m_baseConstraintForce += f;
336 }
337 void addBaseConstraintTorque(const btVector3 &t) { m_baseConstraintTorque += t; }
338 void addLinkConstraintForce(int i, const btVector3 &f);
339 void addLinkConstraintTorque(int i, const btVector3 &t);
340
341 void addJointTorque(int i, btScalar Q);
342 void addJointTorqueMultiDof(int i, int dof, btScalar Q);
343 void addJointTorqueMultiDof(int i, const btScalar *Q);
344
345 const btVector3 &getBaseForce() const { return m_baseForce; }
346 const btVector3 &getBaseTorque() const { return m_baseTorque; }
347 const btVector3 &getLinkForce(int i) const;
348 const btVector3 &getLinkTorque(int i) const;
349 btScalar getJointTorque(int i) const;
350 btScalar *getJointTorqueMultiDof(int i);
351
352 //
353 // dynamics routines.
354 //
355
356 // timestep the velocities (given the external forces/torques set using addBaseForce etc).
357 // also sets up caches for calcAccelerationDeltas.
358 //
359 // Note: the caller must provide three vectors which are used as
360 // temporary scratch space. The idea here is to reduce dynamic
361 // memory allocation: the same scratch vectors can be re-used
362 // again and again for different Multibodies, instead of each
363 // btMultiBody allocating (and then deallocating) their own
364 // individual scratch buffers. This gives a considerable speed
365 // improvement, at least on Windows (where dynamic memory
366 // allocation appears to be fairly slow).
367 //
368
369 void computeAccelerationsArticulatedBodyAlgorithmMultiDof(btScalar dt,
373 bool isConstraintPass,
376 );
377
379 //void stepVelocitiesMultiDof(btScalar dt,
380 // btAlignedObjectArray<btScalar> & scratch_r,
381 // btAlignedObjectArray<btVector3> & scratch_v,
382 // btAlignedObjectArray<btMatrix3x3> & scratch_m,
383 // bool isConstraintPass = false)
384 //{
385 // computeAccelerationsArticulatedBodyAlgorithmMultiDof(dt, scratch_r, scratch_v, scratch_m, isConstraintPass, false, false);
386 //}
387
388 // calcAccelerationDeltasMultiDof
389 // input: force vector (in same format as jacobian, i.e.:
390 // 3 torque values, 3 force values, num_links joint torque values)
391 // output: 3 omegadot values, 3 vdot values, num_links q_double_dot values
392 // (existing contents of output array are replaced)
393 // calcAccelerationDeltasMultiDof must have been called first.
394 void calcAccelerationDeltasMultiDof(const btScalar *force, btScalar *output,
396 btAlignedObjectArray<btVector3> &scratch_v) const;
397
399 {
400 for (int dof = 0; dof < 6 + getNumDofs(); ++dof)
401 {
402 m_deltaV[dof] += delta_vee[dof] * multiplier;
403 }
404 }
406 {
407 for (int dof = 0; dof < 6 + getNumDofs(); ++dof)
408 {
409 m_splitV[dof] += delta_vee[dof] * multiplier;
410 }
411 }
413 {
414 applyDeltaVeeMultiDof(&m_splitV[0], 1);
415 }
417 {
418 applyDeltaVeeMultiDof(&m_splitV[0], -1);
419
420 for (int dof = 0; dof < 6 + getNumDofs(); ++dof)
421 {
422 m_splitV[dof] = 0.f;
423 }
424 }
426 {
427 applyDeltaVeeMultiDof(&m_deltaV[0], 1);
428
429 for (int dof = 0; dof < 6 + getNumDofs(); ++dof)
430 {
431 m_deltaV[dof] = 0.f;
432 }
433 }
434
436 {
437 //for (int dof = 0; dof < 6 + getNumDofs(); ++dof)
438 // printf("%.4f ", delta_vee[dof]*multiplier);
439 //printf("\n");
440
441 //btScalar sum = 0;
442 //for (int dof = 0; dof < 6 + getNumDofs(); ++dof)
443 //{
444 // sum += delta_vee[dof]*multiplier*delta_vee[dof]*multiplier;
445 //}
446 //btScalar l = btSqrt(sum);
447
448 //if (l>m_maxAppliedImpulse)
449 //{
450 // multiplier *= m_maxAppliedImpulse/l;
451 //}
452
453 for (int dof = 0; dof < 6 + getNumDofs(); ++dof)
454 {
455 m_realBuf[dof] += delta_vee[dof] * multiplier;
456 btClamp(m_realBuf[dof], -m_maxCoordinateVelocity, m_maxCoordinateVelocity);
457 }
458 }
459
460 // timestep the positions (given current velocities).
461 void stepPositionsMultiDof(btScalar dt, btScalar *pq = 0, btScalar *pqd = 0);
462
463 // predict the positions
464 void predictPositionsMultiDof(btScalar dt);
465
466 //
467 // contacts
468 //
469
470 // This routine fills out a contact constraint jacobian for this body.
471 // the 'normal' supplied must be -n for body1 or +n for body2 of the contact.
472 // 'normal' & 'contact_point' are both given in world coordinates.
473
476 const btVector3 &normal,
477 btScalar *jac,
480 btAlignedObjectArray<btMatrix3x3> &scratch_m) const { fillConstraintJacobianMultiDof(link, contact_point, btVector3(0, 0, 0), normal, jac, scratch_r, scratch_v, scratch_m); }
481
482 //a more general version of fillContactJacobianMultiDof which does not assume..
483 //.. that the constraint in question is contact or, to be more precise, constrains linear velocity only
484 void fillConstraintJacobianMultiDof(int link,
486 const btVector3 &normal_ang,
487 const btVector3 &normal_lin,
488 btScalar *jac,
491 btAlignedObjectArray<btMatrix3x3> &scratch_m) const;
492
493 //
494 // sleeping
495 //
497 {
498 if (m_canWakeup)
499 {
500 m_canSleep = canSleep;
501 }
502 }
503
504 bool getCanSleep() const
505 {
506 return m_canSleep;
507 }
508
509 bool getCanWakeup() const
510 {
511 return m_canWakeup;
512 }
513
515 {
516 m_canWakeup = canWakeup;
517 }
518 bool isAwake() const { return m_awake; }
519 void wakeUp();
520 void goToSleep();
521 void checkMotionAndSleepIfRequired(btScalar timestep);
522
523 bool hasFixedBase() const
524 {
525 return m_fixedBase;
526 }
527
529 {
530 m_fixedBase = fixedBase;
531 }
532
533 int getCompanionId() const
534 {
535 return m_companionId;
536 }
537 void setCompanionId(int id)
538 {
539 //printf("for %p setCompanionId(%d)\n",this, id);
540 m_companionId = id;
541 }
542
543 void setNumLinks(int numLinks) //careful: when changing the number of m_links, make sure to re-initialize or update existing m_links
544 {
545 m_links.resize(numLinks);
546 }
547
549 {
550 return m_linearDamping;
551 }
553 {
554 m_linearDamping = damp;
555 }
557 {
558 return m_angularDamping;
559 }
561 {
562 m_angularDamping = damp;
563 }
564
565 bool getUseGyroTerm() const
566 {
567 return m_useGyroTerm;
568 }
570 {
571 m_useGyroTerm = useGyro;
572 }
574 {
575 return m_maxCoordinateVelocity;
576 }
578 {
579 m_maxCoordinateVelocity = maxVel;
580 }
581
583 {
584 return m_maxAppliedImpulse;
585 }
587 {
588 m_maxAppliedImpulse = maxImp;
589 }
590 void setHasSelfCollision(bool hasSelfCollision)
591 {
592 m_hasSelfCollision = hasSelfCollision;
593 }
594 bool hasSelfCollision() const
595 {
596 return m_hasSelfCollision;
597 }
598
599 void finalizeMultiDof();
600
601 void useRK4Integration(bool use) { m_useRK4 = use; }
602 bool isUsingRK4Integration() const { return m_useRK4; }
603 void useGlobalVelocities(bool use) { m_useGlobalVelocities = use; }
604 bool isUsingGlobalVelocities() const { return m_useGlobalVelocities; }
605
606 bool isPosUpdated() const
607 {
608 return __posUpdated;
609 }
611 {
612 __posUpdated = updated;
613 }
614
615 //internalNeedsJointFeedback is for internal use only
617 {
618 return m_internalNeedsJointFeedback;
619 }
621
622 void compTreeLinkVelocities(btVector3 * omega, btVector3 * vel) const;
623
625 void updateCollisionObjectInterpolationWorldTransforms(btAlignedObjectArray<btQuaternion> & world_to_local, btAlignedObjectArray<btVector3> & local_origin);
626
627 virtual int calculateSerializeBufferSize() const;
628
630 virtual const char *serialize(void *dataBuffer, class btSerializer *serializer) const;
631
632 const char *getBaseName() const
633 {
634 return m_baseName;
635 }
637 void setBaseName(const char *name)
638 {
639 m_baseName = name;
640 }
641
643 void *getUserPointer() const
644 {
645 return m_userObjectPointer;
646 }
647
648 int getUserIndex() const
649 {
650 return m_userIndex;
651 }
652
653 int getUserIndex2() const
654 {
655 return m_userIndex2;
656 }
659 {
661 }
662
664 void setUserIndex(int index)
665 {
666 m_userIndex = index;
667 }
668
669 void setUserIndex2(int index)
670 {
671 m_userIndex2 = index;
672 }
673
674 static void spatialTransform(const btMatrix3x3 &rotation_matrix, // rotates vectors in 'from' frame to vectors in 'to' frame
675 const btVector3 &displacement, // vector from origin of 'from' frame to origin of 'to' frame, in 'to' coordinates
676 const btVector3 &top_in, // top part of input vector
677 const btVector3 &bottom_in, // bottom part of input vector
678 btVector3 &top_out, // top part of output vector
679 btVector3 &bottom_out); // bottom part of output vector
680
681
682
683private:
684 btMultiBody(const btMultiBody &); // not implemented
685 void operator=(const btMultiBody &); // not implemented
686
687 void solveImatrix(const btVector3 &rhs_top, const btVector3 &rhs_bot, btScalar result[6]) const;
688 void solveImatrix(const btSpatialForceVector &rhs, btSpatialMotionVector &result) const;
689
691 {
692 int dofOffset = 0, cfgOffset = 0;
693 for (int bidx = 0; bidx < m_links.size(); ++bidx)
694 {
695 m_links[bidx].m_dofOffset = dofOffset;
696 m_links[bidx].m_cfgOffset = cfgOffset;
697 dofOffset += m_links[bidx].m_dofCount;
698 cfgOffset += m_links[bidx].m_posVarCount;
699 }
700 }
701
702 void mulMatrix(btScalar * pA, btScalar * pB, int rowsA, int colsA, int rowsB, int colsB, btScalar *pC) const;
703
704private:
706 const char *m_baseName; //memory needs to be manager by user!
707
708 btVector3 m_basePos; // position of COM of base (world frame)
709 btVector3 m_basePos_interpolate; // position of interpolated COM of base (world frame)
710 btQuaternion m_baseQuat; // rotates world points into base frame
712
713 btScalar m_baseMass; // mass of the base
714 btVector3 m_baseInertia; // inertia of the base (in local frame; diagonal)
715
716 btVector3 m_baseForce; // external force applied to base. World frame.
717 btVector3 m_baseTorque; // external torque applied to base. World frame.
718
719 btVector3 m_baseConstraintForce; // external force applied to base. World frame.
720 btVector3 m_baseConstraintTorque; // external torque applied to base. World frame.
721
722 btAlignedObjectArray<btMultibodyLink> m_links; // array of m_links, excluding the base. index from 0 to num_links-1.
723
724 //
725 // realBuf:
726 // offset size array
727 // 0 6 + num_links v (base_omega; base_vel; joint_vels) MULTIDOF [sysdof x sysdof for D matrices (TOO MUCH!) + pos_delta which is sys-cfg sized]
728 // 6+num_links num_links D
729 //
730 // vectorBuf:
731 // offset size array
732 // 0 num_links h_top
733 // num_links num_links h_bottom
734 //
735 // matrixBuf:
736 // offset size array
737 // 0 num_links+1 rot_from_parent
738 //
744
750
752
753 // Sleep parameters.
758
762
770
772 int m_dofCount, m_posVarCnt;
773
774 bool m_useRK4, m_useGlobalVelocities;
775 //for global velocities, see 8.3.2B Proposed resolution in Jakub Stepien PhD Thesis
776 //https://drive.google.com/file/d/0Bz3vEa19XOYGNWdZWGpMdUdqVmZ5ZVBOaEh4ZnpNaUxxZFNV/view?usp=sharing
777
780};
781
783{
789
790 btVector3DoubleData m_linkInertia; // inertia of the base (in local frame; diagonal)
795
799
802 double m_jointPos[7];
803 double m_jointVel[6];
804 double m_jointTorque[6];
805
812
817};
818
820{
826 btVector3FloatData m_linkInertia; // inertia of the base (in local frame; diagonal)
831
836
837 float m_jointPos[7];
838 float m_jointVel[6];
847
852};
853
856{
861 btVector3DoubleData m_baseInertia; // inertia of the base (in local frame; diagonal)
864 char m_padding[4];
865
869};
870
873{
878
879 btVector3FloatData m_baseInertia; // inertia of the base (in local frame; diagonal)
882
886};
887
888#endif
void btClamp(T &a, const T &lb, const T &ub)
Definition btMinMax.h:57
const T & btMax(const T &a, const T &b)
Definition btMinMax.h:27
#define output
btQuaternion inverse(const btQuaternion &q)
Return the inverse of a quaternion.
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition btScalar.h:314
#define ATTRIBUTE_ALIGNED16(a)
Definition btScalar.h:99
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
void * m_userObjectPointer
users can point to their objects, m_userPointer is not used by Bullet, see setUserPointer/getUserPoin...
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
Definition btMatrix3x3.h:50
virtual int calculateSerializeBufferSize() const
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
btScalar m_maxCoordinateVelocity
bool __posUpdated
void useRK4Integration(bool use)
void setMaxCoordinateVelocity(btScalar maxVel)
bool m_useGyroTerm
const btVector3 & getInterpolateBasePos() const
void setMaxAppliedImpulse(btScalar maxImp)
void applyDeltaSplitVeeMultiDof(const btScalar *delta_vee, btScalar multiplier)
bool isAwake() const
btAlignedObjectArray< btMultibodyLink > m_links
btAlignedObjectArray< btMatrix3x3 > m_matrixBuf
btMultiBodyLinkCollider * m_baseCollider
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
bool getUseGyroTerm() const
const btVector3 & getBasePos() const
bool getCanWakeup() const
void setCanSleep(bool canSleep)
void setUseGyroTerm(bool useGyro)
int getCompanionId() const
btScalar getAngularDamping() const
int getUserIndex2() const
btVector3 m_basePos_interpolate
btVector3 m_baseInertia
btAlignedObjectArray< btVector3 > m_vectorBuf
btVector3 m_baseForce
void addBaseConstraintForce(const btVector3 &f)
btScalar m_maxAppliedImpulse
void setBaseMass(btScalar mass)
void setBaseInertia(const btVector3 &inertia)
btScalar m_angularDamping
const btScalar * getDeltaVelocityVector() const
btQuaternion m_baseQuat
void setHasSelfCollision(bool hasSelfCollision)
btVector3 m_basePos
void * m_userObjectPointer
void setLinearDamping(btScalar damp)
const btMultiBodyLinkCollider * getLinkCollider(int index) const
const char * m_baseName
bool hasSelfCollision() const
void setUserIndex2(int index)
void setBaseVel(const btVector3 &vel)
btMatrix3x3 m_cachedInertiaLowerRight
void setBaseOmega(const btVector3 &omega)
void addBaseTorque(const btVector3 &t)
void useGlobalVelocities(bool use)
btMultiBodyLinkCollider * getLinkCollider(int index)
int getNumLinks() const
btScalar m_baseMass
bool m_hasSelfCollision
BT_DECLARE_ALIGNED_ALLOCATOR()
btAlignedObjectArray< btScalar > m_realBuf
btVector3 m_baseConstraintTorque
void operator=(const btMultiBody &)
void setBaseName(const char *name)
memory of setBaseName needs to be manager by user
const btMultibodyLink & getLink(int index) const
btVector3 getBaseOmega() const
btQuaternion m_baseQuat_interpolate
bool getCanSleep() const
int getNumDofs() const
void setBasePos(const btVector3 &pos)
const btVector3 & getBaseTorque() const
bool m_useGlobalVelocities
bool isUsingGlobalVelocities() const
btMatrix3x3 m_cachedInertiaLowerLeft
void addSplitV()
void * getUserPointer() const
users can point to their objects, userPointer is not used by Bullet
btVector3 m_baseTorque
void setAngularDamping(btScalar damp)
const char * getBaseName() const
btScalar m_linearDamping
int getUserIndex() const
bool hasFixedBase() const
const btVector3 & getBaseForce() const
void setUserPointer(void *userPointer)
users can point to their objects, userPointer is not used by Bullet
const btQuaternion & getInterpolateWorldToBaseRot() const
void processDeltaVeeMultiDof2()
void setPosUpdated(bool updated)
btScalar getMaxAppliedImpulse() const
btMatrix3x3 m_cachedInertiaTopLeft
bool isUsingRK4Integration() const
bool m_cachedInertiaValid
const btMultiBodyLinkCollider * getBaseCollider() const
bool internalNeedsJointFeedback() const
const btScalar * getSplitVelocityVector() const
void setNumLinks(int numLinks)
btTransform getBaseWorldTransform() const
btScalar getLinearDamping() const
void setCanWakeup(bool canWakeup)
btScalar m_sleepTimer
btMatrix3x3 m_cachedInertiaTopRight
btScalar getBaseMass() const
void setFixedBase(bool fixedBase)
btScalar getMaxCoordinateVelocity() const
btAlignedObjectArray< btScalar > m_deltaV
int getNumPosVars() const
void updateLinksDofOffsets()
void addBaseConstraintTorque(const btVector3 &t)
void substractSplitV()
bool isPosUpdated() const
bool m_internalNeedsJointFeedback
the m_needsJointFeedback gets updated/computed during the stepVelocitiesMultiDof and it for internal ...
btAlignedObjectArray< btScalar > m_splitV
const btVector3 & getBaseInertia() const
const btQuaternion & getWorldToBaseRot() const
btVector3 m_baseConstraintForce
void setWorldToBaseRot(const btQuaternion &rot)
void setCompanionId(int id)
btMultiBody(const btMultiBody &)
btMultibodyLink & getLink(int index)
btMultiBodyLinkCollider * getBaseCollider()
void applyDeltaVeeMultiDof(const btScalar *delta_vee, btScalar multiplier)
const btVector3 getBaseVel() const
void addBaseForce(const btVector3 &f)
void applyDeltaVeeMultiDof2(const btScalar *delta_vee, btScalar multiplier)
void setUserIndex(int index)
users can point to their objects, userPointer is not used by Bullet
const btScalar * getVelocityVector() const
void setBaseCollider(btMultiBodyLinkCollider *collider)
void setBaseWorldTransform(const btTransform &tr)
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition btTransform.h:30
void setOrigin(const btVector3 &origin)
Set the translational element.
btVector3 can be used to represent 3D points and vectors.
Definition btVector3.h:82
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btVector3DoubleData m_baseWorldPosition
btVector3DoubleData m_baseInertia
btVector3DoubleData m_baseLinearVelocity
btCollisionObjectDoubleData * m_baseCollider
btVector3DoubleData m_baseAngularVelocity
btQuaternionDoubleData m_baseWorldOrientation
btMultiBodyLinkDoubleData * m_links
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btCollisionObjectFloatData * m_baseCollider
btQuaternionFloatData m_baseWorldOrientation
btVector3FloatData m_baseInertia
btVector3FloatData m_baseAngularVelocity
btVector3FloatData m_baseLinearVelocity
btMultiBodyLinkFloatData * m_links
btVector3FloatData m_baseWorldPosition
btQuaternionDoubleData m_zeroRotParentToThis
btVector3DoubleData m_absFrameLocVelocityBottom
btCollisionObjectDoubleData * m_linkCollider
btVector3DoubleData m_jointAxisBottom[6]
btVector3DoubleData m_thisPivotToThisComOffset
btVector3DoubleData m_absFrameTotVelocityTop
btVector3DoubleData m_parentComToThisPivotOffset
btVector3DoubleData m_jointAxisTop[6]
btVector3DoubleData m_absFrameTotVelocityBottom
btVector3DoubleData m_absFrameLocVelocityTop
btVector3DoubleData m_linkInertia
btCollisionObjectFloatData * m_linkCollider
btVector3FloatData m_absFrameLocVelocityTop
btQuaternionFloatData m_zeroRotParentToThis
btVector3FloatData m_absFrameTotVelocityBottom
btVector3FloatData m_jointAxisBottom[6]
btVector3FloatData m_parentComToThisPivotOffset
btVector3FloatData m_absFrameLocVelocityBottom
btVector3FloatData m_linkInertia
btVector3FloatData m_thisPivotToThisComOffset
btVector3FloatData m_absFrameTotVelocityTop
btVector3FloatData m_jointAxisTop[6]
These spatial algebra classes are used for btMultiBody, see BulletDynamics/Featherstone.