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

Bullet Collision Detection & Physics Library

btMultiBodyMLCPConstraintSolver.h
Go to the documentation of this file.
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2018 Google Inc. http://bulletphysics.org
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. 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.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16#ifndef BT_MULTIBODY_MLCP_CONSTRAINT_SOLVER_H
17#define BT_MULTIBODY_MLCP_CONSTRAINT_SOLVER_H
18
19#include "LinearMath/btMatrixX.h"
20#include "LinearMath/btThreads.h"
21#include "BulletDynamics/Featherstone/btMultiBodyConstraintSolver.h"
22
23class btMLCPSolverInterface;
24class btMultiBody;
25
26 class btMultiBodyMLCPConstraintSolver : public btMultiBodyConstraintSolver
27{
28protected:
31
33 btMatrixXu m_A;
34
36 btVectorXu m_b;
37
39 btVectorXu m_x;
40
42 btVectorXu m_lo;
43
45 btVectorXu m_hi;
46
48
52
54 btVectorXu m_bSplit;
55
57 btVectorXu m_xSplit;
58
60
63
65 btMatrixXu m_multiBodyA;
66
68 btVectorXu m_multiBodyB;
69
71 btVectorXu m_multiBodyX;
72
74 btVectorXu m_multiBodyLo;
75
77 btVectorXu m_multiBodyHi;
78
80
87 btAlignedObjectArray<int> m_limitDependencies;
88
95 btAlignedObjectArray<int> m_multiBodyLimitDependencies;
96
98 btAlignedObjectArray<btSolverConstraint*> m_allConstraintPtrArray;
99
101 btAlignedObjectArray<btMultiBodySolverConstraint*> m_multiBodyAllConstraintPtrArray;
102
104 btMLCPSolverInterface* m_solver;
105
107 int m_fallback;
108
115
117 btMatrixXu m_scratchJ3;
118
120 btMatrixXu m_scratchJInvM3;
121
123 btAlignedObjectArray<int> m_scratchOfs;
124
126
128 virtual void createMLCPFast(const btContactSolverInfo& infoGlobal);
129
131 void createMLCPFastRigidBody(const btContactSolverInfo& infoGlobal);
132
134 void createMLCPFastMultiBody(const btContactSolverInfo& infoGlobal);
135
137 virtual bool solveMLCP(const btContactSolverInfo& infoGlobal);
138
139 // Documentation inherited
140 btScalar solveGroupCacheFriendlySetup(
141 btCollisionObject** bodies,
142 int numBodies,
143 btPersistentManifold** manifoldPtr,
144 int numManifolds,
145 btTypedConstraint** constraints,
146 int numConstraints,
147 const btContactSolverInfo& infoGlobal,
148 btIDebugDraw* debugDrawer) BT_OVERRIDE;
149
150 // Documentation inherited
151 btScalar solveGroupCacheFriendlyIterations(
152 btCollisionObject** bodies,
153 int numBodies,
154 btPersistentManifold** manifoldPtr,
155 int numManifolds,
156 btTypedConstraint** constraints,
157 int numConstraints,
158 const btContactSolverInfo& infoGlobal,
159 btIDebugDraw* debugDrawer) ;
160
161public:
162 BT_DECLARE_ALIGNED_ALLOCATOR()
163
164
168 explicit btMultiBodyMLCPConstraintSolver(btMLCPSolverInterface* solver);
169
171 virtual ~btMultiBodyMLCPConstraintSolver();
172
174 void setMLCPSolver(btMLCPSolverInterface* solver);
175
178 int getNumFallbacks() const;
179
181 void setNumFallbacks(int num);
182
184 virtual btConstraintSolverType getSolverType() const;
185};
186
187#endif // BT_MULTIBODY_MLCP_CONSTRAINT_SOLVER_H
btConstraintSolverType
btConstraintSolverType
btConstraintSolver provides solver interface
Definition btConstraintSolver.h:33
btMatrixX.h
btMatrixXu
#define btMatrixXu
Definition btMatrixX.h:529
btVectorXu
#define btVectorXu
Definition btMatrixX.h:528
btMultiBodyConstraintSolver.h
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition btScalar.h:314
btThreads.h
BT_OVERRIDE
#define BT_OVERRIDE
Definition btThreads.h:26
btAlignedObjectArray
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
Definition btAlignedObjectArray.h:46
btCollisionObject
btCollisionObject can be used to manage collision detection objects.
Definition btCollisionObject.h:51
btIDebugDraw
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations.
Definition btIDebugDraw.h:27
btMLCPSolverInterface
original version written by Erwin Coumans, October 2013
Definition btMLCPSolverInterface.h:23
btMultiBodyConstraintSolver
Definition btMultiBodyConstraintSolver.h:30
btMultiBodyConstraintSolver::BT_DECLARE_ALIGNED_ALLOCATOR
BT_DECLARE_ALIGNED_ALLOCATOR()
btMultiBodyMLCPConstraintSolver::m_scratchJ3
btMatrixXu m_scratchJ3
Cache variable for constraint Jacobian matrix.
Definition btMultiBodyMLCPConstraintSolver.h:117
btMultiBodyMLCPConstraintSolver::m_multiBodyLimitDependencies
btAlignedObjectArray< int > m_multiBodyLimitDependencies
Indices of normal contact constraint associated with frictional contact constraint for multibodies.
Definition btMultiBodyMLCPConstraintSolver.h:95
btMultiBodyMLCPConstraintSolver::solveGroupCacheFriendlySetup
btScalar solveGroupCacheFriendlySetup(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer) BT_OVERRIDE
Definition btMultiBodyMLCPConstraintSolver.cpp:691
btMultiBodyMLCPConstraintSolver::m_xSplit
btVectorXu m_xSplit
Split impulse cache vector corresponding to m_x.
Definition btMultiBodyMLCPConstraintSolver.h:57
btMultiBodyMLCPConstraintSolver::m_b
btVectorXu m_b
b vector in the MLCP formulation.
Definition btMultiBodyMLCPConstraintSolver.h:36
btMultiBodyMLCPConstraintSolver::m_multiBodyAllConstraintPtrArray
btAlignedObjectArray< btMultiBodySolverConstraint * > m_multiBodyAllConstraintPtrArray
Array of all the multibody constraints.
Definition btMultiBodyMLCPConstraintSolver.h:101
btMultiBodyMLCPConstraintSolver::m_solver
btMLCPSolverInterface * m_solver
MLCP solver.
Definition btMultiBodyMLCPConstraintSolver.h:104
btMultiBodyMLCPConstraintSolver::getNumFallbacks
int getNumFallbacks() const
Returns the number of fallbacks of using btSequentialImpulseConstraintSolver, which happens when the ...
Definition btMultiBodyMLCPConstraintSolver.cpp:953
btMultiBodyMLCPConstraintSolver::setNumFallbacks
void setNumFallbacks(int num)
Sets the number of fallbacks. This function may be used to reset the number to zero.
Definition btMultiBodyMLCPConstraintSolver.cpp:958
btMultiBodyMLCPConstraintSolver::solveGroupCacheFriendlyIterations
btScalar solveGroupCacheFriendlyIterations(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer)
Definition btMultiBodyMLCPConstraintSolver.cpp:846
btMultiBodyMLCPConstraintSolver::m_lo
btVectorXu m_lo
Lower bound of constraint impulse, m_x.
Definition btMultiBodyMLCPConstraintSolver.h:42
btMultiBodyMLCPConstraintSolver::m_A
btMatrixXu m_A
A matrix in the MLCP formulation.
Definition btMultiBodyMLCPConstraintSolver.h:33
btMultiBodyMLCPConstraintSolver::btMultiBodyMLCPConstraintSolver
btMultiBodyMLCPConstraintSolver(btMLCPSolverInterface *solver)
Constructor.
Definition btMultiBodyMLCPConstraintSolver.cpp:937
btMultiBodyMLCPConstraintSolver::m_fallback
int m_fallback
Count of fallbacks of using btSequentialImpulseConstraintSolver, which happens when the MLCP solver f...
Definition btMultiBodyMLCPConstraintSolver.h:107
btMultiBodyMLCPConstraintSolver::m_multiBodyA
btMatrixXu m_multiBodyA
A matrix in the MLCP formulation.
Definition btMultiBodyMLCPConstraintSolver.h:65
btMultiBodyMLCPConstraintSolver::m_limitDependencies
btAlignedObjectArray< int > m_limitDependencies
Indices of normal contact constraint associated with frictional contact constraint for rigid bodies.
Definition btMultiBodyMLCPConstraintSolver.h:87
btMultiBodyMLCPConstraintSolver::m_bSplit
btVectorXu m_bSplit
Split impulse Cache vector corresponding to m_b.
Definition btMultiBodyMLCPConstraintSolver.h:54
btMultiBodyMLCPConstraintSolver::setMLCPSolver
void setMLCPSolver(btMLCPSolverInterface *solver)
Sets MLCP solver. Assumed it's not null.
Definition btMultiBodyMLCPConstraintSolver.cpp:948
btMultiBodyMLCPConstraintSolver::m_scratchOfs
btAlignedObjectArray< int > m_scratchOfs
Cache variable for offsets.
Definition btMultiBodyMLCPConstraintSolver.h:123
btMultiBodyMLCPConstraintSolver::createMLCPFastRigidBody
void createMLCPFastRigidBody(const btContactSolverInfo &infoGlobal)
Constructs MLCP terms for constraints of two rigid bodies.
Definition btMultiBodyMLCPConstraintSolver.cpp:242
btMultiBodyMLCPConstraintSolver::m_hi
btVectorXu m_hi
Upper bound of constraint impulse, m_x.
Definition btMultiBodyMLCPConstraintSolver.h:45
btMultiBodyMLCPConstraintSolver::solveMLCP
virtual bool solveMLCP(const btContactSolverInfo &infoGlobal)
Solves MLCP and returns the success.
Definition btMultiBodyMLCPConstraintSolver.cpp:657
btMultiBodyMLCPConstraintSolver::m_x
btVectorXu m_x
Constraint impulse, which is an output of MLCP solving.
Definition btMultiBodyMLCPConstraintSolver.h:39
btMultiBodyMLCPConstraintSolver::m_multiBodyLo
btVectorXu m_multiBodyLo
Lower bound of constraint impulse, m_x.
Definition btMultiBodyMLCPConstraintSolver.h:74
btMultiBodyMLCPConstraintSolver::createMLCPFast
virtual void createMLCPFast(const btContactSolverInfo &infoGlobal)
Constructs MLCP terms, which are m_A, m_b, m_lo, and m_hi.
Definition btMultiBodyMLCPConstraintSolver.cpp:236
btMultiBodyMLCPConstraintSolver::m_allConstraintPtrArray
btAlignedObjectArray< btSolverConstraint * > m_allConstraintPtrArray
Array of all the rigid body constraints.
Definition btMultiBodyMLCPConstraintSolver.h:98
btMultiBodyMLCPConstraintSolver::m_scratchJInvM3
btMatrixXu m_scratchJInvM3
Cache variable for constraint Jacobian times inverse mass matrix.
Definition btMultiBodyMLCPConstraintSolver.h:120
btMultiBodyMLCPConstraintSolver::m_multiBodyX
btVectorXu m_multiBodyX
Constraint impulse, which is an output of MLCP solving.
Definition btMultiBodyMLCPConstraintSolver.h:71
btMultiBodyMLCPConstraintSolver::createMLCPFastMultiBody
void createMLCPFastMultiBody(const btContactSolverInfo &infoGlobal)
Constructs MLCP terms for constraints of two multi-bodies or one rigid body and one multibody.
Definition btMultiBodyMLCPConstraintSolver.cpp:556
btMultiBodyMLCPConstraintSolver::m_multiBodyHi
btVectorXu m_multiBodyHi
Upper bound of constraint impulse, m_x.
Definition btMultiBodyMLCPConstraintSolver.h:77
btMultiBodyMLCPConstraintSolver::getSolverType
virtual btConstraintSolverType getSolverType() const
Returns the constraint solver type.
Definition btMultiBodyMLCPConstraintSolver.cpp:963
btMultiBodyMLCPConstraintSolver::m_multiBodyB
btVectorXu m_multiBodyB
b vector in the MLCP formulation.
Definition btMultiBodyMLCPConstraintSolver.h:68
btMultiBody
Definition btMultiBody.h:51
btPersistentManifold
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
Definition btPersistentManifold.h:65
btTypedConstraint
TypedConstraint is the baseclass for Bullet constraints and vehicles.
Definition btTypedConstraint.h:76
btContactSolverInfo
Definition btContactSolverInfo.h:76