Bullet Collision Detection & Physics Library: btMultiBody.h Source File

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"
28 #include "LinearMath/btVector3.h"
29 #include "LinearMath/btQuaternion.h"
30 #include "LinearMath/btMatrix3x3.h"
31 #include "LinearMath/btAlignedObjectArray.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"
47 class btMultiBodyLinkCollider;
48
49 ATTRIBUTE_ALIGNED16(class)
50 btMultiBody
51 {
52 public:
53 BT_DECLARE_ALIGNED_ALLOCATOR();
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
69 btScalar mass,
70 const btVector3 &inertia,
71 int parent,
72 const btQuaternion &rotParentToThis,
73 const btVector3 &parentComToThisPivotOffset,
74 const btVector3 &thisPivotToThisComOffset, bool deprecatedDisableParentCollision = true);
75
76 void setupPrismatic(int i,
77 btScalar mass,
78 const btVector3 &inertia,
79 int parent,
80 const btQuaternion &rotParentToThis,
81 const btVector3 &jointAxis,
82 const btVector3 &parentComToThisPivotOffset,
83 const btVector3 &thisPivotToThisComOffset,
84 bool disableParentCollision);
85
86 void setupRevolute(int i, // 0 to num_links-1
87 btScalar mass,
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
97 btScalar mass,
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
106 btScalar mass,
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
119 btMultibodyLink &getLink(int index)
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 }
128 const btMultiBodyLinkCollider *getBaseCollider() const
129 {
130 return m_baseCollider;
131 }
132 btMultiBodyLinkCollider *getBaseCollider()
133 {
134 return m_baseCollider;
135 }
136
137 const btMultiBodyLinkCollider *getLinkCollider(int index) const
138 {
139 if (index >= 0 && index < getNumLinks())
140 {
141 return getLink(index).m_collider;
142 }
143 return 0;
144 }
145
146 btMultiBodyLinkCollider *getLinkCollider(int index)
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
193 const btQuaternion &getWorldToBaseRot() const
194 {
195 return m_baseQuat;
196 }
197
198 const btVector3 &getInterpolateBasePos() const
199 {
200 return m_basePos_interpolate;
201 } // in world frame
202 const btQuaternion &getInterpolateWorldToBaseRot() const
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
210 void setBasePos(const btVector3 &pos)
211 {
212 m_basePos = pos;
213 if(!isBaseKinematic())
214 m_basePos_interpolate = pos;
215 }
216
217 void setInterpolateBasePos(const btVector3 &pos)
218 {
219 m_basePos_interpolate = pos;
220 }
221
222 void setBaseWorldTransform(const btTransform &tr)
223 {
224 setBasePos(tr.getOrigin());
225 setWorldToBaseRot(tr.getRotation().inverse());
226 }
227
228 btTransform getBaseWorldTransform() const
229 {
230 btTransform tr;
231 tr.setOrigin(getBasePos());
232 tr.setRotation(getWorldToBaseRot().inverse());
233 return tr;
234 }
235
236 void setInterpolateBaseWorldTransform(const btTransform &tr)
237 {
238 setInterpolateBasePos(tr.getOrigin());
239 setInterpolateWorldToBaseRot(tr.getRotation().inverse());
240 }
241
242 btTransform getInterpolateBaseWorldTransform() const
243 {
244 btTransform tr;
245 tr.setOrigin(getInterpolateBasePos());
246 tr.setRotation(getInterpolateWorldToBaseRot().inverse());
247 return tr;
248 }
249
250 void setBaseVel(const btVector3 &vel)
251 {
252 m_realBuf[3] = vel[0];
253 m_realBuf[4] = vel[1];
254 m_realBuf[5] = vel[2];
255 }
256
257 void setWorldToBaseRot(const btQuaternion &rot)
258 {
259 m_baseQuat = rot; //m_baseQuat asumed to ba alias!?
260 if(!isBaseKinematic())
261 m_baseQuat_interpolate = rot;
262 }
263
264 void setInterpolateWorldToBaseRot(const btQuaternion &rot)
265 {
266 m_baseQuat_interpolate = rot;
267 }
268
269 void setBaseOmega(const btVector3 &omega)
270 {
271 m_realBuf[0] = omega[0];
272 m_realBuf[1] = omega[1];
273 m_realBuf[2] = omega[2];
274 }
275
276 void saveKinematicState(btScalar timeStep);
277
278 //
279 // get/set pos/vel for child m_links (i = 0 to num_links-1)
280 //
281
282 btScalar getJointPos(int i) const;
283 btScalar getJointVel(int i) const;
284
285 btScalar *getJointVelMultiDof(int i);
286 btScalar *getJointPosMultiDof(int i);
287
288 const btScalar *getJointVelMultiDof(int i) const;
289 const btScalar *getJointPosMultiDof(int i) const;
290
291 void setJointPos(int i, btScalar q);
292 void setJointVel(int i, btScalar qdot);
293 void setJointPosMultiDof(int i, const double *q);
294 void setJointVelMultiDof(int i, const double *qdot);
295 void setJointPosMultiDof(int i, const float *q);
296 void setJointVelMultiDof(int i, const float *qdot);
297
298 //
299 // direct access to velocities as a vector of 6 + num_links elements.
300 // (omega first, then v, then joint velocities.)
301 //
302 const btScalar *getVelocityVector() const
303 {
304 return &m_realBuf[0];
305 }
306
307 const btScalar *getDeltaVelocityVector() const
308 {
309 return &m_deltaV[0];
310 }
311
312 const btScalar *getSplitVelocityVector() const
313 {
314 return &m_splitV[0];
315 }
316 /* btScalar * getVelocityVector()
317 {
318 return &real_buf[0];
319 }
320 */
321
322 //
323 // get the frames of reference (positions and orientations) of the child m_links
324 // (i = 0 to num_links-1)
325 //
326
327 const btVector3 &getRVector(int i) const; // vector from COM(parent(i)) to COM(i), in frame i's coords
328 const btQuaternion &getParentToLocalRot(int i) const; // rotates vectors in frame parent(i) to vectors in frame i.
329 const btVector3 &getInterpolateRVector(int i) const; // vector from COM(parent(i)) to COM(i), in frame i's coords
330 const btQuaternion &getInterpolateParentToLocalRot(int i) const; // rotates vectors in frame parent(i) to vectors in frame i.
331
332 //
333 // transform vectors in local frame of link i to world frame (or vice versa)
334 //
335 btVector3 localPosToWorld(int i, const btVector3 &local_pos) const;
336 btVector3 localDirToWorld(int i, const btVector3 &local_dir) const;
337 btVector3 worldPosToLocal(int i, const btVector3 &world_pos) const;
338 btVector3 worldDirToLocal(int i, const btVector3 &world_dir) const;
339
340 //
341 // transform a frame in local coordinate to a frame in world coordinate
342 //
343 btMatrix3x3 localFrameToWorld(int i, const btMatrix3x3 &local_frame) const;
344
345
346 //
347 // set external forces and torques. Note all external forces/torques are given in the WORLD frame.
348 //
349
350 void clearForcesAndTorques();
351 void clearConstraintForces();
352
353 void clearVelocities();
354
355 void addBaseForce(const btVector3 &f)
356 {
357 m_baseForce += f;
358 }
359 void addBaseTorque(const btVector3 &t) { m_baseTorque += t; }
360 void addLinkForce(int i, const btVector3 &f);
361 void addLinkTorque(int i, const btVector3 &t);
362
363 void addBaseConstraintForce(const btVector3 &f)
364 {
365 m_baseConstraintForce += f;
366 }
367 void addBaseConstraintTorque(const btVector3 &t) { m_baseConstraintTorque += t; }
368 void addLinkConstraintForce(int i, const btVector3 &f);
369 void addLinkConstraintTorque(int i, const btVector3 &t);
370
371 void addJointTorque(int i, btScalar Q);
372 void addJointTorqueMultiDof(int i, int dof, btScalar Q);
373 void addJointTorqueMultiDof(int i, const btScalar *Q);
374
375 const btVector3 &getBaseForce() const { return m_baseForce; }
376 const btVector3 &getBaseTorque() const { return m_baseTorque; }
377 const btVector3 &getLinkForce(int i) const;
378 const btVector3 &getLinkTorque(int i) const;
379 btScalar getJointTorque(int i) const;
380 btScalar *getJointTorqueMultiDof(int i);
381
382 //
383 // dynamics routines.
384 //
385
386 // timestep the velocities (given the external forces/torques set using addBaseForce etc).
387 // also sets up caches for calcAccelerationDeltas.
388 //
389 // Note: the caller must provide three vectors which are used as
390 // temporary scratch space. The idea here is to reduce dynamic
391 // memory allocation: the same scratch vectors can be re-used
392 // again and again for different Multibodies, instead of each
393 // btMultiBody allocating (and then deallocating) their own
394 // individual scratch buffers. This gives a considerable speed
395 // improvement, at least on Windows (where dynamic memory
396 // allocation appears to be fairly slow).
397 //
398
399 void computeAccelerationsArticulatedBodyAlgorithmMultiDof(btScalar dt,
400 btAlignedObjectArray<btScalar> & scratch_r,
401 btAlignedObjectArray<btVector3> & scratch_v,
402 btAlignedObjectArray<btMatrix3x3> & scratch_m,
403 bool isConstraintPass,
404 bool jointFeedbackInWorldSpace,
405 bool jointFeedbackInJointFrame
406 );
407
409 //void stepVelocitiesMultiDof(btScalar dt,
410 // btAlignedObjectArray<btScalar> & scratch_r,
411 // btAlignedObjectArray<btVector3> & scratch_v,
412 // btAlignedObjectArray<btMatrix3x3> & scratch_m,
413 // bool isConstraintPass = false)
414 //{
415 // computeAccelerationsArticulatedBodyAlgorithmMultiDof(dt, scratch_r, scratch_v, scratch_m, isConstraintPass, false, false);
416 //}
417
418 // calcAccelerationDeltasMultiDof
419 // input: force vector (in same format as jacobian, i.e.:
420 // 3 torque values, 3 force values, num_links joint torque values)
421 // output: 3 omegadot values, 3 vdot values, num_links q_double_dot values
422 // (existing contents of output array are replaced)
423 // calcAccelerationDeltasMultiDof must have been called first.
424 void calcAccelerationDeltasMultiDof(const btScalar *force, btScalar *output,
425 btAlignedObjectArray<btScalar> &scratch_r,
426 btAlignedObjectArray<btVector3> &scratch_v) const;
427
428 void applyDeltaVeeMultiDof2(const btScalar *delta_vee, btScalar multiplier)
429 {
430 for (int dof = 0; dof < 6 + getNumDofs(); ++dof)
431 {
432 m_deltaV[dof] += delta_vee[dof] * multiplier;
433 }
434 }
435 void applyDeltaSplitVeeMultiDof(const btScalar *delta_vee, btScalar multiplier)
436 {
437 for (int dof = 0; dof < 6 + getNumDofs(); ++dof)
438 {
439 m_splitV[dof] += delta_vee[dof] * multiplier;
440 }
441 }
442 void addSplitV()
443 {
444 applyDeltaVeeMultiDof(&m_splitV[0], 1);
445 }
446 void substractSplitV()
447 {
448 applyDeltaVeeMultiDof(&m_splitV[0], -1);
449
450 for (int dof = 0; dof < 6 + getNumDofs(); ++dof)
451 {
452 m_splitV[dof] = 0.f;
453 }
454 }
455 void processDeltaVeeMultiDof2()
456 {
457 applyDeltaVeeMultiDof(&m_deltaV[0], 1);
458
459 for (int dof = 0; dof < 6 + getNumDofs(); ++dof)
460 {
461 m_deltaV[dof] = 0.f;
462 }
463 }
464
465 void applyDeltaVeeMultiDof(const btScalar *delta_vee, btScalar multiplier)
466 {
467 //for (int dof = 0; dof < 6 + getNumDofs(); ++dof)
468 // printf("%.4f ", delta_vee[dof]*multiplier);
469 //printf("\n");
470
471 //btScalar sum = 0;
472 //for (int dof = 0; dof < 6 + getNumDofs(); ++dof)
473 //{
474 // sum += delta_vee[dof]*multiplier*delta_vee[dof]*multiplier;
475 //}
476 //btScalar l = btSqrt(sum);
477
478 //if (l>m_maxAppliedImpulse)
479 //{
480 // multiplier *= m_maxAppliedImpulse/l;
481 //}
482
483 for (int dof = 0; dof < 6 + getNumDofs(); ++dof)
484 {
485 m_realBuf[dof] += delta_vee[dof] * multiplier;
486 btClamp(m_realBuf[dof], -m_maxCoordinateVelocity, m_maxCoordinateVelocity);
487 }
488 }
489
490 // timestep the positions (given current velocities).
491 void stepPositionsMultiDof(btScalar dt, btScalar *pq = 0, btScalar *pqd = 0);
492
493 // predict the positions
494 void predictPositionsMultiDof(btScalar dt);
495
496 //
497 // contacts
498 //
499
500 // This routine fills out a contact constraint jacobian for this body.
501 // the 'normal' supplied must be -n for body1 or +n for body2 of the contact.
502 // 'normal' & 'contact_point' are both given in world coordinates.
503
504 void fillContactJacobianMultiDof(int link,
505 const btVector3 &contact_point,
506 const btVector3 &normal,
507 btScalar *jac,
508 btAlignedObjectArray<btScalar> &scratch_r,
509 btAlignedObjectArray<btVector3> &scratch_v,
510 btAlignedObjectArray<btMatrix3x3> &scratch_m) const { fillConstraintJacobianMultiDof(link, contact_point, btVector3(0, 0, 0), normal, jac, scratch_r, scratch_v, scratch_m); }
511
512 //a more general version of fillContactJacobianMultiDof which does not assume..
513 //.. that the constraint in question is contact or, to be more precise, constrains linear velocity only
514 void fillConstraintJacobianMultiDof(int link,
515 const btVector3 &contact_point,
516 const btVector3 &normal_ang,
517 const btVector3 &normal_lin,
518 btScalar *jac,
519 btAlignedObjectArray<btScalar> &scratch_r,
520 btAlignedObjectArray<btVector3> &scratch_v,
521 btAlignedObjectArray<btMatrix3x3> &scratch_m) const;
522
523 //
524 // sleeping
525 //
526 void setCanSleep(bool canSleep)
527 {
528 if (m_canWakeup)
529 {
530 m_canSleep = canSleep;
531 }
532 }
533
534 bool getCanSleep() const
535 {
536 return m_canSleep;
537 }
538
539 bool getCanWakeup() const
540 {
541 return m_canWakeup;
542 }
543
544 void setCanWakeup(bool canWakeup)
545 {
546 m_canWakeup = canWakeup;
547 }
548 bool isAwake() const { return m_awake; }
549 void wakeUp();
550 void goToSleep();
551 void checkMotionAndSleepIfRequired(btScalar timestep);
552
553 bool hasFixedBase() const;
554
555 bool isBaseKinematic() const;
556
557 bool isBaseStaticOrKinematic() const;
558
559 // set the dynamic type in the base's collision flags.
560 void setBaseDynamicType(int dynamicType);
561
562 void setFixedBase(bool fixedBase)
563 {
564 m_fixedBase = fixedBase;
565 if(m_fixedBase)
566 setBaseDynamicType(btCollisionObject::CF_STATIC_OBJECT);
567 else
568 setBaseDynamicType(btCollisionObject::CF_DYNAMIC_OBJECT);
569 }
570
571 int getCompanionId() const
572 {
573 return m_companionId;
574 }
575 void setCompanionId(int id)
576 {
577 //printf("for %p setCompanionId(%d)\n",this, id);
578 m_companionId = id;
579 }
580
581 void setNumLinks(int numLinks) //careful: when changing the number of m_links, make sure to re-initialize or update existing m_links
582 {
583 m_links.resize(numLinks);
584 }
585
586 btScalar getLinearDamping() const
587 {
588 return m_linearDamping;
589 }
590 void setLinearDamping(btScalar damp)
591 {
592 m_linearDamping = damp;
593 }
594 btScalar getAngularDamping() const
595 {
596 return m_angularDamping;
597 }
598 void setAngularDamping(btScalar damp)
599 {
600 m_angularDamping = damp;
601 }
602
603 bool getUseGyroTerm() const
604 {
605 return m_useGyroTerm;
606 }
607 void setUseGyroTerm(bool useGyro)
608 {
609 m_useGyroTerm = useGyro;
610 }
611 btScalar getMaxCoordinateVelocity() const
612 {
613 return m_maxCoordinateVelocity;
614 }
615 void setMaxCoordinateVelocity(btScalar maxVel)
616 {
617 m_maxCoordinateVelocity = maxVel;
618 }
619
620 btScalar getMaxAppliedImpulse() const
621 {
622 return m_maxAppliedImpulse;
623 }
624 void setMaxAppliedImpulse(btScalar maxImp)
625 {
626 m_maxAppliedImpulse = maxImp;
627 }
628 void setHasSelfCollision(bool hasSelfCollision)
629 {
630 m_hasSelfCollision = hasSelfCollision;
631 }
632 bool hasSelfCollision() const
633 {
634 return m_hasSelfCollision;
635 }
636
637 void finalizeMultiDof();
638
639 void useRK4Integration(bool use) { m_useRK4 = use; }
640 bool isUsingRK4Integration() const { return m_useRK4; }
641 void useGlobalVelocities(bool use) { m_useGlobalVelocities = use; }
642 bool isUsingGlobalVelocities() const { return m_useGlobalVelocities; }
643
644 bool isPosUpdated() const
645 {
646 return __posUpdated;
647 }
648 void setPosUpdated(bool updated)
649 {
650 __posUpdated = updated;
651 }
652
653 //internalNeedsJointFeedback is for internal use only
654 bool internalNeedsJointFeedback() const
655 {
656 return m_internalNeedsJointFeedback;
657 }
658 void forwardKinematics(btAlignedObjectArray<btQuaternion>& world_to_local, btAlignedObjectArray<btVector3> & local_origin);
659
660 void compTreeLinkVelocities(btVector3 * omega, btVector3 * vel) const;
661
662 void updateCollisionObjectWorldTransforms(btAlignedObjectArray<btQuaternion> & world_to_local, btAlignedObjectArray<btVector3> & local_origin);
663 void updateCollisionObjectInterpolationWorldTransforms(btAlignedObjectArray<btQuaternion> & world_to_local, btAlignedObjectArray<btVector3> & local_origin);
664
665 virtual int calculateSerializeBufferSize() const;
666
668 virtual const char *serialize(void *dataBuffer, class btSerializer *serializer) const;
669
670 const char *getBaseName() const
671 {
672 return m_baseName;
673 }
675 void setBaseName(const char *name)
676 {
677 m_baseName = name;
678 }
679
681 void *getUserPointer() const
682 {
683 return m_userObjectPointer;
684 }
685
686 int getUserIndex() const
687 {
688 return m_userIndex;
689 }
690
691 int getUserIndex2() const
692 {
693 return m_userIndex2;
694 }
696 void setUserPointer(void *userPointer)
697 {
698 m_userObjectPointer = userPointer;
699 }
700
702 void setUserIndex(int index)
703 {
704 m_userIndex = index;
705 }
706
707 void setUserIndex2(int index)
708 {
709 m_userIndex2 = index;
710 }
711
712 static void spatialTransform(const btMatrix3x3 &rotation_matrix, // rotates vectors in 'from' frame to vectors in 'to' frame
713 const btVector3 &displacement, // vector from origin of 'from' frame to origin of 'to' frame, in 'to' coordinates
714 const btVector3 &top_in, // top part of input vector
715 const btVector3 &bottom_in, // bottom part of input vector
716 btVector3 &top_out, // top part of output vector
717 btVector3 &bottom_out); // bottom part of output vector
718
719 void setLinkDynamicType(const int i, int type);
720
721 bool isLinkStaticOrKinematic(const int i) const;
722
723 bool isLinkKinematic(const int i) const;
724
725 bool isLinkAndAllAncestorsStaticOrKinematic(const int i) const;
726
727 bool isLinkAndAllAncestorsKinematic(const int i) const;
728
729 private:
730 btMultiBody(const btMultiBody &); // not implemented
731 void operator=(const btMultiBody &); // not implemented
732
733 void solveImatrix(const btVector3 &rhs_top, const btVector3 &rhs_bot, btScalar result[6]) const;
734 void solveImatrix(const btSpatialForceVector &rhs, btSpatialMotionVector &result) const;
735
736 void updateLinksDofOffsets()
737 {
738 int dofOffset = 0, cfgOffset = 0;
739 for (int bidx = 0; bidx < m_links.size(); ++bidx)
740 {
741 m_links[bidx].m_dofOffset = dofOffset;
742 m_links[bidx].m_cfgOffset = cfgOffset;
743 dofOffset += m_links[bidx].m_dofCount;
744 cfgOffset += m_links[bidx].m_posVarCount;
745 }
746 }
747
748 void mulMatrix(btScalar * pA, btScalar * pB, int rowsA, int colsA, int rowsB, int colsB, btScalar *pC) const;
749
750 private:
751 btMultiBodyLinkCollider *m_baseCollider; //can be NULL
752 const char *m_baseName; //memory needs to be manager by user!
753
754 btVector3 m_basePos; // position of COM of base (world frame)
755 btVector3 m_basePos_interpolate; // position of interpolated COM of base (world frame)
756 btQuaternion m_baseQuat; // rotates world points into base frame
757 btQuaternion m_baseQuat_interpolate;
758
759 btScalar m_baseMass; // mass of the base
760 btVector3 m_baseInertia; // inertia of the base (in local frame; diagonal)
761
762 btVector3 m_baseForce; // external force applied to base. World frame.
763 btVector3 m_baseTorque; // external torque applied to base. World frame.
764
765 btVector3 m_baseConstraintForce; // external force applied to base. World frame.
766 btVector3 m_baseConstraintTorque; // external torque applied to base. World frame.
767
768 btAlignedObjectArray<btMultibodyLink> m_links; // array of m_links, excluding the base. index from 0 to num_links-1.
769
770 //
771 // realBuf:
772 // offset size array
773 // 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]
774 // 6+num_links num_links D
775 //
776 // vectorBuf:
777 // offset size array
778 // 0 num_links h_top
779 // num_links num_links h_bottom
780 //
781 // matrixBuf:
782 // offset size array
783 // 0 num_links+1 rot_from_parent
784 //
785 btAlignedObjectArray<btScalar> m_splitV;
786 btAlignedObjectArray<btScalar> m_deltaV;
787 btAlignedObjectArray<btScalar> m_realBuf;
788 btAlignedObjectArray<btVector3> m_vectorBuf;
789 btAlignedObjectArray<btMatrix3x3> m_matrixBuf;
790
791 btMatrix3x3 m_cachedInertiaTopLeft;
792 btMatrix3x3 m_cachedInertiaTopRight;
793 btMatrix3x3 m_cachedInertiaLowerLeft;
794 btMatrix3x3 m_cachedInertiaLowerRight;
795 bool m_cachedInertiaValid;
796
797 bool m_fixedBase;
798
799 // Sleep parameters.
800 bool m_awake;
801 bool m_canSleep;
802 bool m_canWakeup;
803 btScalar m_sleepTimer;
804
805 void *m_userObjectPointer;
806 int m_userIndex2;
807 int m_userIndex;
808
809 int m_companionId;
810 btScalar m_linearDamping;
811 btScalar m_angularDamping;
812 bool m_useGyroTerm;
813 btScalar m_maxAppliedImpulse;
814 btScalar m_maxCoordinateVelocity;
815 bool m_hasSelfCollision;
816
817 bool __posUpdated;
818 int m_dofCount, m_posVarCnt;
819
820 bool m_useRK4, m_useGlobalVelocities;
821 //for global velocities, see 8.3.2B Proposed resolution in Jakub Stepien PhD Thesis
822 //https://drive.google.com/file/d/0Bz3vEa19XOYGNWdZWGpMdUdqVmZ5ZVBOaEh4ZnpNaUxxZFNV/view?usp=sharing
823
825 bool m_internalNeedsJointFeedback;
826
827 //If enabled, calculate the velocity based on kinematic transform changes. Currently only implemented for the base.
828 bool m_kinematic_calculate_velocity;
829 };
830
831 struct btMultiBodyLinkDoubleData
832 {
833 btQuaternionDoubleData m_zeroRotParentToThis;
834 btVector3DoubleData m_parentComToThisPivotOffset;
835 btVector3DoubleData m_thisPivotToThisComOffset;
836 btVector3DoubleData m_jointAxisTop[6];
837 btVector3DoubleData m_jointAxisBottom[6];
838
839 btVector3DoubleData m_linkInertia; // inertia of the base (in local frame; diagonal)
840 btVector3DoubleData m_absFrameTotVelocityTop;
841 btVector3DoubleData m_absFrameTotVelocityBottom;
842 btVector3DoubleData m_absFrameLocVelocityTop;
843 btVector3DoubleData m_absFrameLocVelocityBottom;
844
845 double m_linkMass;
846 int m_parentIndex;
847 int m_jointType;
848
849 int m_dofCount;
850 int m_posVarCount;
851 double m_jointPos[7];
852 double m_jointVel[6];
853 double m_jointTorque[6];
854
855 double m_jointDamping;
856 double m_jointFriction;
857 double m_jointLowerLimit;
858 double m_jointUpperLimit;
859 double m_jointMaxForce;
860 double m_jointMaxVelocity;
861
862 char *m_linkName;
863 char *m_jointName;
864 btCollisionObjectDoubleData *m_linkCollider;
865 char *m_paddingPtr;
866 };
867
868 struct btMultiBodyLinkFloatData
869 {
870 btQuaternionFloatData m_zeroRotParentToThis;
871 btVector3FloatData m_parentComToThisPivotOffset;
872 btVector3FloatData m_thisPivotToThisComOffset;
873 btVector3FloatData m_jointAxisTop[6];
874 btVector3FloatData m_jointAxisBottom[6];
875 btVector3FloatData m_linkInertia; // inertia of the base (in local frame; diagonal)
876 btVector3FloatData m_absFrameTotVelocityTop;
877 btVector3FloatData m_absFrameTotVelocityBottom;
878 btVector3FloatData m_absFrameLocVelocityTop;
879 btVector3FloatData m_absFrameLocVelocityBottom;
880
881 int m_dofCount;
882 float m_linkMass;
883 int m_parentIndex;
884 int m_jointType;
885
886 float m_jointPos[7];
887 float m_jointVel[6];
888 float m_jointTorque[6];
889 int m_posVarCount;
890 float m_jointDamping;
891 float m_jointFriction;
892 float m_jointLowerLimit;
893 float m_jointUpperLimit;
894 float m_jointMaxForce;
895 float m_jointMaxVelocity;
896
897 char *m_linkName;
898 char *m_jointName;
899 btCollisionObjectFloatData *m_linkCollider;
900 char *m_paddingPtr;
901 };
902
904 struct btMultiBodyDoubleData
905 {
906 btVector3DoubleData m_baseWorldPosition;
907 btQuaternionDoubleData m_baseWorldOrientation;
908 btVector3DoubleData m_baseLinearVelocity;
909 btVector3DoubleData m_baseAngularVelocity;
910 btVector3DoubleData m_baseInertia; // inertia of the base (in local frame; diagonal)
911 double m_baseMass;
912 int m_numLinks;
913 char m_padding[4];
914
915 char *m_baseName;
916 btMultiBodyLinkDoubleData *m_links;
917 btCollisionObjectDoubleData *m_baseCollider;
918 };
919
921 struct btMultiBodyFloatData
922 {
923 btVector3FloatData m_baseWorldPosition;
924 btQuaternionFloatData m_baseWorldOrientation;
925 btVector3FloatData m_baseLinearVelocity;
926 btVector3FloatData m_baseAngularVelocity;
927
928 btVector3FloatData m_baseInertia; // inertia of the base (in local frame; diagonal)
929 float m_baseMass;
930 int m_numLinks;
931
932 char *m_baseName;
933 btMultiBodyLinkFloatData *m_links;
934 btCollisionObjectFloatData *m_baseCollider;
935 };
936
937 #endif
btMultiBody::m_awake
bool m_awake
Definition: btMultiBody.h:800
btMultiBody::setBaseMass
void setBaseMass(btScalar mass)
Definition: btMultiBody.h:178
btCollisionObject::m_userIndex
int m_userIndex
Definition: btCollisionObject.h:102
btMultiBody::getBaseVel
const btVector3 getBaseVel() const
Definition: btMultiBody.h:189
btMultiBody::setBaseName
void setBaseName(const char *name)
memory of setBaseName needs to be manager by user
Definition: btMultiBody.h:675
btMultiBody::getLinearDamping
btScalar getLinearDamping() const
Definition: btMultiBody.h:586
btMultiBody::btMultiBody
btMultiBody(const btMultiBody &)
btMultiBody::addBaseConstraintTorque
void addBaseConstraintTorque(const btVector3 &t)
Definition: btMultiBody.h:367
btMultiBodyLinkFloatData::m_jointMaxVelocity
float m_jointMaxVelocity
Definition: btMultiBody.h:895
btMultiBody::getUserPointer
void * getUserPointer() const
users can point to their objects, userPointer is not used by Bullet
Definition: btMultiBody.h:681
btMultiBody::getUserIndex
int getUserIndex() const
Definition: btMultiBody.h:686
btMultiBodyLinkDoubleData::m_posVarCount
int m_posVarCount
Definition: btMultiBody.h:850
btMultiBodyDoubleData::m_baseName
char * m_baseName
Definition: btMultiBody.h:915
btTransform::getRotation
btQuaternion getRotation() const
Return a quaternion representing the rotation.
Definition: btTransform.h:118
btMultiBodyFloatData::m_links
btMultiBodyLinkFloatData * m_links
Definition: btMultiBody.h:933
btMultiBody::isUsingGlobalVelocities
bool isUsingGlobalVelocities() const
Definition: btMultiBody.h:642
btSpatialForceVector
These spatial algebra classes are used for btMultiBody, see BulletDynamics/Featherstone.
Definition: btSpatialAlgebra.h:24
btQuaternion
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
Definition: btQuaternion.h:50
btMultiBody::getCompanionId
int getCompanionId() const
Definition: btMultiBody.h:571
btMultiBody::processDeltaVeeMultiDof2
void processDeltaVeeMultiDof2()
Definition: btMultiBody.h:455
btMultiBody::m_useGyroTerm
bool m_useGyroTerm
Definition: btMultiBody.h:812
btMultiBodyLinkFloatData::m_jointVel
float m_jointVel[6]
Definition: btMultiBody.h:887
btMultiBody::BT_DECLARE_ALIGNED_ALLOCATOR
BT_DECLARE_ALIGNED_ALLOCATOR()
btMultiBody::getNumLinks
int getNumLinks() const
Definition: btMultiBody.h:166
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
btMultiBodyFloatData::m_baseName
char * m_baseName
Definition: btMultiBody.h:932
btMultiBody::m_baseForce
btVector3 m_baseForce
Definition: btMultiBody.h:762
btMultiBody::m_canSleep
bool m_canSleep
Definition: btMultiBody.h:801
btMultiBody::internalNeedsJointFeedback
bool internalNeedsJointFeedback() const
Definition: btMultiBody.h:654
btMultiBodyLinkDoubleData::m_parentComToThisPivotOffset
btVector3DoubleData m_parentComToThisPivotOffset
Definition: btMultiBody.h:834
btMultiBody::m_baseConstraintTorque
btVector3 m_baseConstraintTorque
Definition: btMultiBody.h:766
btMultiBody::setWorldToBaseRot
void setWorldToBaseRot(const btQuaternion &rot)
Definition: btMultiBody.h:257
btCollisionObjectDoubleData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btCollisionObject.h:615
btCollisionObjectFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btCollisionObject.h:650
btMultiBodyLinkFloatData::m_absFrameTotVelocityBottom
btVector3FloatData m_absFrameTotVelocityBottom
Definition: btMultiBody.h:877
btMultiBody::getWorldToBaseRot
const btQuaternion & getWorldToBaseRot() const
Definition: btMultiBody.h:193
btQuaternion::inverse
btQuaternion inverse() const
Return the inverse of this quaternion.
Definition: btQuaternion.h:497
btMultiBodyLinkDoubleData
Definition: btMultiBody.h:832
btMultiBody::m_fixedBase
bool m_fixedBase
Definition: btMultiBody.h:797
btMultiBodyLinkDoubleData::m_jointTorque
double m_jointTorque[6]
Definition: btMultiBody.h:853
btMultiBodyLinkDoubleData::m_linkInertia
btVector3DoubleData m_linkInertia
Definition: btMultiBody.h:839
btMultiBodyLinkFloatData::m_absFrameLocVelocityTop
btVector3FloatData m_absFrameLocVelocityTop
Definition: btMultiBody.h:878
btQuaternionFloatData
Definition: btQuaternion.h:967
btMultiBodyLinkDoubleData::m_dofCount
int m_dofCount
Definition: btMultiBody.h:849
btMultiBody::isPosUpdated
bool isPosUpdated() const
Definition: btMultiBody.h:644
btMultiBodyLinkDoubleData::m_absFrameTotVelocityTop
btVector3DoubleData m_absFrameTotVelocityTop
Definition: btMultiBody.h:840
btMultiBody::m_matrixBuf
btAlignedObjectArray< btMatrix3x3 > m_matrixBuf
Definition: btMultiBody.h:789
btMultiBodyFloatData::m_baseMass
float m_baseMass
Definition: btMultiBody.h:929
btMultiBodyLinkDoubleData::m_jointLowerLimit
double m_jointLowerLimit
Definition: btMultiBody.h:857
btMultiBody::getBaseName
const char * getBaseName() const
Definition: btMultiBody.h:670
btMultiBodyDoubleData::m_baseWorldOrientation
btQuaternionDoubleData m_baseWorldOrientation
Definition: btMultiBody.h:907
btCollisionObject::CF_DYNAMIC_OBJECT
@ CF_DYNAMIC_OBJECT
Definition: btCollisionObject.h:130
btQuaternionDoubleData
Definition: btQuaternion.h:972
btMultiBody::getBaseCollider
btMultiBodyLinkCollider * getBaseCollider()
Definition: btMultiBody.h:132
btMultiBody::setNumLinks
void setNumLinks(int numLinks)
Definition: btMultiBody.h:581
btMatrix3x3.h
btMultiBody::m_useRK4
bool m_useRK4
Definition: btMultiBody.h:820
btMultiBody::m_baseCollider
btMultiBodyLinkCollider * m_baseCollider
Definition: btMultiBody.h:751
btMultiBodyLinkDoubleData::m_jointFriction
double m_jointFriction
Definition: btMultiBody.h:856
btMultiBody::getAngularDamping
btScalar getAngularDamping() const
Definition: btMultiBody.h:594
btMultiBody::m_deltaV
btAlignedObjectArray< btScalar > m_deltaV
Definition: btMultiBody.h:786
btMultiBody::getCanWakeup
bool getCanWakeup() const
Definition: btMultiBody.h:539
btMultiBody::getMaxCoordinateVelocity
btScalar getMaxCoordinateVelocity() const
Definition: btMultiBody.h:611
inverse
btQuaternion inverse(const btQuaternion &q)
Return the inverse of a quaternion.
Definition: btQuaternion.h:909
btMultiBody::m_canWakeup
bool m_canWakeup
Definition: btMultiBody.h:802
btMultiBody::m_userIndex2
int m_userIndex2
Definition: btMultiBody.h:806
btScalar.h
btMultiBody::m_cachedInertiaLowerRight
btMatrix3x3 m_cachedInertiaLowerRight
Definition: btMultiBody.h:794
btMultiBody::getBaseWorldTransform
btTransform getBaseWorldTransform() const
Definition: btMultiBody.h:228
btMultiBody::getDeltaVelocityVector
const btScalar * getDeltaVelocityVector() const
Definition: btMultiBody.h:307
btMultiBodyLinkFloatData::m_jointAxisBottom
btVector3FloatData m_jointAxisBottom[6]
Definition: btMultiBody.h:874
btMultiBodyLinkDoubleData::m_linkMass
double m_linkMass
Definition: btMultiBody.h:845
btMultiBody::isUsingRK4Integration
bool isUsingRK4Integration() const
Definition: btMultiBody.h:640
btMultiBody::setBaseVel
void setBaseVel(const btVector3 &vel)
Definition: btMultiBody.h:250
btMultiBodyFloatData::m_baseAngularVelocity
btVector3FloatData m_baseAngularVelocity
Definition: btMultiBody.h:926
btMultiBody::m_maxCoordinateVelocity
btScalar m_maxCoordinateVelocity
Definition: btMultiBody.h:814
btMultiBodyLinkFloatData::m_jointName
char * m_jointName
Definition: btMultiBody.h:898
btVector3FloatData
Definition: btVector3.h:1282
btMultiBody::addBaseTorque
void addBaseTorque(const btVector3 &t)
Definition: btMultiBody.h:359
btMultiBodyLinkFloatData::m_jointUpperLimit
float m_jointUpperLimit
Definition: btMultiBody.h:893
btMultiBodyLinkFloatData::m_jointAxisTop
btVector3FloatData m_jointAxisTop[6]
Definition: btMultiBody.h:873
btMultiBody::getCanSleep
bool getCanSleep() const
Definition: btMultiBody.h:534
btMultiBody::applyDeltaVeeMultiDof
void applyDeltaVeeMultiDof(const btScalar *delta_vee, btScalar multiplier)
Definition: btMultiBody.h:465
btMultiBodyLinkFloatData::m_jointMaxForce
float m_jointMaxForce
Definition: btMultiBody.h:894
btMultiBody::m_cachedInertiaValid
bool m_cachedInertiaValid
Definition: btMultiBody.h:795
btVector3.h
btMultiBody::setInterpolateBasePos
void setInterpolateBasePos(const btVector3 &pos)
Definition: btMultiBody.h:217
btMultiBodyDoubleData::m_baseMass
double m_baseMass
Definition: btMultiBody.h:911
btMultiBody::m_sleepTimer
btScalar m_sleepTimer
Definition: btMultiBody.h:803
btMultiBody::setUserIndex
void setUserIndex(int index)
users can point to their objects, userPointer is not used by Bullet
Definition: btMultiBody.h:702
btMultiBody::setBaseCollider
void setBaseCollider(btMultiBodyLinkCollider *collider)
Definition: btMultiBody.h:124
btVector3DoubleData
Definition: btVector3.h:1287
btMultiBody::getMaxAppliedImpulse
btScalar getMaxAppliedImpulse() const
Definition: btMultiBody.h:620
btMultiBody::getUseGyroTerm
bool getUseGyroTerm() const
Definition: btMultiBody.h:603
btMultiBodyLinkFloatData
Definition: btMultiBody.h:869
btClamp
void btClamp(T &a, const T &lb, const T &ub)
Definition: btMinMax.h:57
btMultiBodyLinkDoubleData::m_absFrameLocVelocityBottom
btVector3DoubleData m_absFrameLocVelocityBottom
Definition: btMultiBody.h:843
btMultiBodyLinkFloatData::m_linkCollider
btCollisionObjectFloatData * m_linkCollider
Definition: btMultiBody.h:899
btMultiBodyLinkDoubleData::m_absFrameLocVelocityTop
btVector3DoubleData m_absFrameLocVelocityTop
Definition: btMultiBody.h:842
btMultiBodyFloatData::m_baseWorldOrientation
btQuaternionFloatData m_baseWorldOrientation
Definition: btMultiBody.h:924
btMultiBody::getLinkCollider
const btMultiBodyLinkCollider * getLinkCollider(int index) const
Definition: btMultiBody.h:137
btMultiBody::setFixedBase
void setFixedBase(bool fixedBase)
Definition: btMultiBody.h:562
btMultiBody::getLink
btMultibodyLink & getLink(int index)
Definition: btMultiBody.h:119
btMultiBody::m_baseConstraintForce
btVector3 m_baseConstraintForce
Definition: btMultiBody.h:765
btMultiBodyLinkFloatData::m_absFrameTotVelocityTop
btVector3FloatData m_absFrameTotVelocityTop
Definition: btMultiBody.h:876
btMultiBody::m_companionId
int m_companionId
Definition: btMultiBody.h:809
btMultiBodyLinkDoubleData::m_jointMaxForce
double m_jointMaxForce
Definition: btMultiBody.h:859
btMultiBody::getNumDofs
int getNumDofs() const
Definition: btMultiBody.h:167
btTransform::setRotation
void setRotation(const btQuaternion &q)
Set the rotational element by btQuaternion.
Definition: btTransform.h:160
btMultiBody::m_internalNeedsJointFeedback
bool m_internalNeedsJointFeedback
the m_needsJointFeedback gets updated/computed during the stepVelocitiesMultiDof and it for internal ...
Definition: btMultiBody.h:825
btMultiBody::m_maxAppliedImpulse
btScalar m_maxAppliedImpulse
Definition: btMultiBody.h:813
btMultiBody::getBaseInertia
const btVector3 & getBaseInertia() const
Definition: btMultiBody.h:170
btMultiBody::setLinearDamping
void setLinearDamping(btScalar damp)
Definition: btMultiBody.h:590
btMultiBody::getBaseOmega
btVector3 getBaseOmega() const
Definition: btMultiBody.h:208
btMultiBody::setCanWakeup
void setCanWakeup(bool canWakeup)
Definition: btMultiBody.h:544
btMultiBodyLinkCollider::calculateSerializeBufferSize
virtual int calculateSerializeBufferSize() const
Definition: btMultiBodyLinkCollider.h:176
btMultiBody::addBaseForce
void addBaseForce(const btVector3 &f)
Definition: btMultiBody.h:355
btMultiBody::isAwake
bool isAwake() const
Definition: btMultiBody.h:548
btMultiBody::hasSelfCollision
bool hasSelfCollision() const
Definition: btMultiBody.h:632
btMultiBody::applyDeltaSplitVeeMultiDof
void applyDeltaSplitVeeMultiDof(const btScalar *delta_vee, btScalar multiplier)
Definition: btMultiBody.h:435
btMultiBody::m_cachedInertiaLowerLeft
btMatrix3x3 m_cachedInertiaLowerLeft
Definition: btMultiBody.h:793
btMatrix3x3
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
Definition: btMatrix3x3.h:50
btMultiBody::getBaseMass
btScalar getBaseMass() const
Definition: btMultiBody.h:169
btMultiBodyLinkFloatData::m_posVarCount
int m_posVarCount
Definition: btMultiBody.h:889
btMultiBody::m_baseTorque
btVector3 m_baseTorque
Definition: btMultiBody.h:763
btMultiBody::setBaseOmega
void setBaseOmega(const btVector3 &omega)
Definition: btMultiBody.h:269
btMultiBody::addSplitV
void addSplitV()
Definition: btMultiBody.h:442
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:30
btMultiBodyLinkCollider
Definition: btMultiBodyLinkCollider.h:33
btQuaternion.h
btMultiBodyLinkDoubleData::m_jointAxisBottom
btVector3DoubleData m_jointAxisBottom[6]
Definition: btMultiBody.h:837
btMultiBodyDoubleData::m_baseLinearVelocity
btVector3DoubleData m_baseLinearVelocity
Definition: btMultiBody.h:908
btMultiBodyLinkDoubleData::m_zeroRotParentToThis
btQuaternionDoubleData m_zeroRotParentToThis
Definition: btMultiBody.h:833
btMultiBodyLinkFloatData::m_absFrameLocVelocityBottom
btVector3FloatData m_absFrameLocVelocityBottom
Definition: btMultiBody.h:879
btMultiBodyLinkFloatData::m_parentIndex
int m_parentIndex
Definition: btMultiBody.h:883
btMultiBody::getInterpolateBaseWorldTransform
btTransform getInterpolateBaseWorldTransform() const
Definition: btMultiBody.h:242
btMultiBody::m_cachedInertiaTopLeft
btMatrix3x3 m_cachedInertiaTopLeft
Definition: btMultiBody.h:791
btMultiBodyLinkFloatData::m_zeroRotParentToThis
btQuaternionFloatData m_zeroRotParentToThis
Definition: btMultiBody.h:870
btMultiBodyLinkFloatData::m_jointDamping
float m_jointDamping
Definition: btMultiBody.h:890
btMultiBodyLinkDoubleData::m_jointUpperLimit
double m_jointUpperLimit
Definition: btMultiBody.h:858
btMultiBody::m_basePos_interpolate
btVector3 m_basePos_interpolate
Definition: btMultiBody.h:755
btMultiBody::getLink
const btMultibodyLink & getLink(int index) const
Definition: btMultiBody.h:114
btMultiBody::m_baseQuat_interpolate
btQuaternion m_baseQuat_interpolate
Definition: btMultiBody.h:757
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:82
btMultiBody::m_splitV
btAlignedObjectArray< btScalar > m_splitV
Definition: btMultiBody.h:785
btMultiBodyLinkDoubleData::m_absFrameTotVelocityBottom
btVector3DoubleData m_absFrameTotVelocityBottom
Definition: btMultiBody.h:841
btMultiBodyDoubleData::m_numLinks
int m_numLinks
Definition: btMultiBody.h:912
btMultiBody::setHasSelfCollision
void setHasSelfCollision(bool hasSelfCollision)
Definition: btMultiBody.h:628
btMultiBody::getNumPosVars
int getNumPosVars() const
Definition: btMultiBody.h:168
btMultiBody::getInterpolateWorldToBaseRot
const btQuaternion & getInterpolateWorldToBaseRot() const
Definition: btMultiBody.h:202
btMultiBody::setMaxCoordinateVelocity
void setMaxCoordinateVelocity(btScalar maxVel)
Definition: btMultiBody.h:615
btMultiBodyDoubleData::m_baseInertia
btVector3DoubleData m_baseInertia
Definition: btMultiBody.h:910
btMultiBody::m_baseName
const char * m_baseName
Definition: btMultiBody.h:752
btTransform::getOrigin
btVector3 & getOrigin()
Return the origin vector translation.
Definition: btTransform.h:113
btMultiBody
Definition: btMultiBody.h:51
btMultiBodyLinkFloatData::m_dofCount
int m_dofCount
Definition: btMultiBody.h:881
btMultiBodyLinkFloatData::m_linkName
char * m_linkName
Definition: btMultiBody.h:897
btMultiBodyLinkDoubleData::m_jointMaxVelocity
double m_jointMaxVelocity
Definition: btMultiBody.h:860
btCollisionObject::CF_STATIC_OBJECT
@ CF_STATIC_OBJECT
Definition: btCollisionObject.h:131
btMultiBody::m_posVarCnt
int m_posVarCnt
Definition: btMultiBody.h:818
btMultiBodyLinkDoubleData::m_jointVel
double m_jointVel[6]
Definition: btMultiBody.h:852
btMultiBodyLinkFloatData::m_parentComToThisPivotOffset
btVector3FloatData m_parentComToThisPivotOffset
Definition: btMultiBody.h:871
btMultiBody::setUseGyroTerm
void setUseGyroTerm(bool useGyro)
Definition: btMultiBody.h:607
btMultiBody::m_baseQuat
btQuaternion m_baseQuat
Definition: btMultiBody.h:756
btMultiBody::updateLinksDofOffsets
void updateLinksDofOffsets()
Definition: btMultiBody.h:736
btMultiBody::setCompanionId
void setCompanionId(int id)
Definition: btMultiBody.h:575
ATTRIBUTE_ALIGNED16
#define ATTRIBUTE_ALIGNED16(a)
Definition: btScalar.h:99
btMultiBodyDoubleData::m_baseWorldPosition
btVector3DoubleData m_baseWorldPosition
Definition: btMultiBody.h:906
btMultiBody::m_hasSelfCollision
bool m_hasSelfCollision
Definition: btMultiBody.h:815
btMultiBody::m_basePos
btVector3 m_basePos
Definition: btMultiBody.h:754
btMultiBodyLinkFloatData::m_jointTorque
float m_jointTorque[6]
Definition: btMultiBody.h:888
btMultiBodyLink.h
output
#define output
btAlignedObjectArray< btScalar >
btMultiBodyLinkFloatData::m_linkMass
float m_linkMass
Definition: btMultiBody.h:882
btMultiBody::setInterpolateBaseWorldTransform
void setInterpolateBaseWorldTransform(const btTransform &tr)
Definition: btMultiBody.h:236
btMultiBodyLinkDoubleData::m_linkName
char * m_linkName
Definition: btMultiBody.h:862
btMultiBodyLinkDoubleData::m_jointType
int m_jointType
Definition: btMultiBody.h:847
btSerializer
Definition: btSerializer.h:66
btMultiBody::setPosUpdated
void setPosUpdated(bool updated)
Definition: btMultiBody.h:648
btMultiBody::operator=
void operator=(const btMultiBody &)
btMultiBody::m_userObjectPointer
void * m_userObjectPointer
Definition: btMultiBody.h:805
btMultiBody::fillContactJacobianMultiDof
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
Definition: btMultiBody.h:504
btMultiBody::getInterpolateBasePos
const btVector3 & getInterpolateBasePos() const
Definition: btMultiBody.h:198
btMultiBodyDoubleData::m_padding
char m_padding[4]
Definition: btMultiBody.h:913
btMultiBody::setMaxAppliedImpulse
void setMaxAppliedImpulse(btScalar maxImp)
Definition: btMultiBody.h:624
btMultiBodyLinkCollider::serialize
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
Definition: btMultiBodyLinkCollider.h:181
btMultibodyLink
Definition: btMultiBodyLink.h:48
btSpatialMotionVector
Definition: btSpatialAlgebra.h:95
btMultiBodyLinkFloatData::m_jointLowerLimit
float m_jointLowerLimit
Definition: btMultiBody.h:892
btMultiBodyDoubleData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btMultiBody.h:905
btMultiBody::setAngularDamping
void setAngularDamping(btScalar damp)
Definition: btMultiBody.h:598
btMultiBodyLinkDoubleData::m_jointPos
double m_jointPos[7]
Definition: btMultiBody.h:851
btMultiBodyLinkDoubleData::m_thisPivotToThisComOffset
btVector3DoubleData m_thisPivotToThisComOffset
Definition: btMultiBody.h:835
btMultiBody::setUserPointer
void setUserPointer(void *userPointer)
users can point to their objects, userPointer is not used by Bullet
Definition: btMultiBody.h:696
btMultiBody::m_vectorBuf
btAlignedObjectArray< btVector3 > m_vectorBuf
Definition: btMultiBody.h:788
btMultiBodyFloatData::m_baseInertia
btVector3FloatData m_baseInertia
Definition: btMultiBody.h:928
btMultiBody::getVelocityVector
const btScalar * getVelocityVector() const
Definition: btMultiBody.h:302
btMultiBodyFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
Definition: btMultiBody.h:922
btMultiBody::m_cachedInertiaTopRight
btMatrix3x3 m_cachedInertiaTopRight
Definition: btMultiBody.h:792
btMultiBodyFloatData::m_numLinks
int m_numLinks
Definition: btMultiBody.h:930
btMultiBodyLinkFloatData::m_thisPivotToThisComOffset
btVector3FloatData m_thisPivotToThisComOffset
Definition: btMultiBody.h:872
btMultiBody::m_baseInertia
btVector3 m_baseInertia
Definition: btMultiBody.h:760
btMultiBodyLinkFloatData::m_linkInertia
btVector3FloatData m_linkInertia
Definition: btMultiBody.h:875
btMultiBody::setBaseInertia
void setBaseInertia(const btVector3 &inertia)
Definition: btMultiBody.h:179
btMultiBody::setInterpolateWorldToBaseRot
void setInterpolateWorldToBaseRot(const btQuaternion &rot)
Definition: btMultiBody.h:264
btMultiBody::applyDeltaVeeMultiDof2
void applyDeltaVeeMultiDof2(const btScalar *delta_vee, btScalar multiplier)
Definition: btMultiBody.h:428
btMultiBody::m_realBuf
btAlignedObjectArray< btScalar > m_realBuf
Definition: btMultiBody.h:787
btMultiBody::addBaseConstraintForce
void addBaseConstraintForce(const btVector3 &f)
Definition: btMultiBody.h:363
btMultiBody::m_angularDamping
btScalar m_angularDamping
Definition: btMultiBody.h:811
btMultiBody::getBaseForce
const btVector3 & getBaseForce() const
Definition: btMultiBody.h:375
btMultiBodyFloatData::m_baseWorldPosition
btVector3FloatData m_baseWorldPosition
Definition: btMultiBody.h:923
btMultiBody::__posUpdated
bool __posUpdated
Definition: btMultiBody.h:817
btAlignedObjectArray.h
btMultiBodyLinkDoubleData::m_parentIndex
int m_parentIndex
Definition: btMultiBody.h:846
btMultiBody::m_userIndex
int m_userIndex
Definition: btMultiBody.h:807
btMultiBody::m_kinematic_calculate_velocity
bool m_kinematic_calculate_velocity
Definition: btMultiBody.h:828
btMultiBody::getSplitVelocityVector
const btScalar * getSplitVelocityVector() const
Definition: btMultiBody.h:312
btMultiBody::setUserIndex2
void setUserIndex2(int index)
Definition: btMultiBody.h:707
btMultiBody::m_linearDamping
btScalar m_linearDamping
Definition: btMultiBody.h:810
btMultiBody::useGlobalVelocities
void useGlobalVelocities(bool use)
Definition: btMultiBody.h:641
btCollisionObject::m_userObjectPointer
void * m_userObjectPointer
users can point to their objects, m_userPointer is not used by Bullet, see setUserPointer/getUserPoin...
Definition: btCollisionObject.h:98
btMultiBodyLinkDoubleData::m_paddingPtr
char * m_paddingPtr
Definition: btMultiBody.h:865
btMultiBodyFloatData::m_baseLinearVelocity
btVector3FloatData m_baseLinearVelocity
Definition: btMultiBody.h:925
btMultiBody::setCanSleep
void setCanSleep(bool canSleep)
Definition: btMultiBody.h:526
btMultiBodyLinkFloatData::m_paddingPtr
char * m_paddingPtr
Definition: btMultiBody.h:900
btMultiBodyLinkFloatData::m_jointType
int m_jointType
Definition: btMultiBody.h:884
btMultiBody::useRK4Integration
void useRK4Integration(bool use)
Definition: btMultiBody.h:639
btMultiBodyLinkFloatData::m_jointFriction
float m_jointFriction
Definition: btMultiBody.h:891
btMultiBody::getBasePos
const btVector3 & getBasePos() const
Definition: btMultiBody.h:185
btMultiBody::substractSplitV
void substractSplitV()
Definition: btMultiBody.h:446
btMultiBodyDoubleData::m_baseCollider
btCollisionObjectDoubleData * m_baseCollider
Definition: btMultiBody.h:917
btMultiBodyLinkDoubleData::m_jointName
char * m_jointName
Definition: btMultiBody.h:863
btTransform::setOrigin
void setOrigin(const btVector3 &origin)
Set the translational element.
Definition: btTransform.h:146
btMultiBodyLinkDoubleData::m_jointDamping
double m_jointDamping
Definition: btMultiBody.h:855
btMultiBodyLinkDoubleData::m_linkCollider
btCollisionObjectDoubleData * m_linkCollider
Definition: btMultiBody.h:864
btMultiBodyDoubleData::m_baseAngularVelocity
btVector3DoubleData m_baseAngularVelocity
Definition: btMultiBody.h:909
btMultiBody::getBaseCollider
const btMultiBodyLinkCollider * getBaseCollider() const
Definition: btMultiBody.h:128
btMultiBody::getBaseTorque
const btVector3 & getBaseTorque() const
Definition: btMultiBody.h:376
btMultiBody::m_links
btAlignedObjectArray< btMultibodyLink > m_links
Definition: btMultiBody.h:768
btMultiBody::setBasePos
void setBasePos(const btVector3 &pos)
Definition: btMultiBody.h:210
btMultiBody::m_baseMass
btScalar m_baseMass
Definition: btMultiBody.h:759
btMultiBody::getLinkCollider
btMultiBodyLinkCollider * getLinkCollider(int index)
Definition: btMultiBody.h:146
btMultiBodyDoubleData::m_links
btMultiBodyLinkDoubleData * m_links
Definition: btMultiBody.h:916
btMultiBody::getUserIndex2
int getUserIndex2() const
Definition: btMultiBody.h:691
btCollisionObject::m_companionId
int m_companionId
Definition: btCollisionObject.h:79
btMultiBodyLinkFloatData::m_jointPos
float m_jointPos[7]
Definition: btMultiBody.h:886
btCollisionObject::m_userIndex2
int m_userIndex2
Definition: btCollisionObject.h:100
btMultiBodyLinkDoubleData::m_jointAxisTop
btVector3DoubleData m_jointAxisTop[6]
Definition: btMultiBody.h:836
btMultiBodyFloatData::m_baseCollider
btCollisionObjectFloatData * m_baseCollider
Definition: btMultiBody.h:934
btMultiBody::setBaseWorldTransform
void setBaseWorldTransform(const btTransform &tr)
Definition: btMultiBody.h:222