Commit Graph

143 Commits

Author SHA1 Message Date
Lunkhound
6d2c7b9aba constraint solver: fix bug in getOrInitSolverBody (threadsafe case only) for kinematic objects 2016-12-19 21:31:38 -08:00
Erwin Coumans
379a852f93 fix compile issues 2016-12-16 18:43:21 -08:00
Erwin Coumans
8ff1e55166 disable VERBOSE_RESIDUAL_PRINTF 2016-12-16 18:12:33 -08:00
Erwin Coumans
dcd02a1e15 add option to terminate PGS constraint solvers based on a least square residual threshold
(for example solverInfo().m_leastSquaresResidualThreshold = 1e-7 and use large m_numSolverIterations
disable sphere-sphere contact cache, it is buggy (some contact point stay in the cache, when sphere penetrates more than total margins)
tweak some gpu demo settings
2016-12-16 18:09:52 -08:00
Lunkhound
2f4ec4f8c9 collisionObject: renamed uniqueId to worldArrayIndex; removed linear search in removeCollisionObject 2016-11-12 12:41:55 -08:00
Lunkhound
1c3686ca51 MultiThreaded Demo:
- fixing various race conditions throughout (usage of static vars, etc)
 - addition of a few lightweight mutexes (which are compiled out by default)
 - slight code rearrangement in discreteDynamicsWorld to facilitate multithreading
 - PoolAllocator::allocate() can now be called when pool is full without
     crashing (null pointer returned)
 - PoolAllocator allocate and freeMemory, are OPTIONALLY threadsafe
     (default is un-threadsafe)
 - CollisionDispatcher no longer checks if the pool allocator is full
     before calling allocate(), instead it just calls allocate() and
     checks if the return is null -- this avoids a race condition
 - SequentialImpulseConstraintSolver OPTIONALLY uses different logic in
     getOrInitSolverBody() to avoid a race condition with kinematic bodies
 - addition of 2 classes which together allow simulation islands to be run
   in parallel:
    - btSimulationIslandManagerMt
    - btDiscreteDynamicsWorldMt
 - MultiThreadedDemo example in the example browser demonstrating use of
   OpenMP, Microsoft PPL, and Intel TBB
 - use multithreading for other demos
 - benchmark demo: add parallel raycasting
2016-10-30 12:47:27 -07:00
Erwin Coumans
567b003654 separate spinning and rolling friction coefficients, exposed in URDF as spinning_friction / m_rolling_friction
improvements in VR demo, add grasper etc.
2016-09-16 00:57:00 +01:00
Erwin Coumans
ecd814c9c5 export contact friction/damping through URDF and API
convert from contact friction/damping to cfm/erp
btCollisionObject::setContactFrictionAndDamping
2016-09-02 16:40:56 -07:00
Erwin Coumans
e98fca1e5e implement pybullet.getContactPointData(), two optional object unique ids as filter
returns a pylist of contact points. Each point has the following data:

	0     int m_contactFlags;//unused for now
         1     int m_bodyUniqueIdA;
         2     int m_bodyUniqueIdB;
         3     int m_linkIndexA;
         4     int m_linkIndexB;
         5-6-7     double m_positionOnAInWS[3];//contact point location on object A, in world space coordinates
         8-9-10     double m_positionOnBInWS[3];//contact point location on object A, in world space coordinates
         11-12-13     double m_contactNormalOnBInWS[3];//the separating contact normal, pointing from object B towards object A
         14     double m_contactDistance;//negative number is penetration, positive is distance.

         15    double m_normalForce;
2016-09-01 18:28:39 -07:00
erwin coumans
6c9bfce975 Support btMultiBody soft contact using ERP and CFM. Also support custom relaxation parameter to allow successive over relaxation.
Added demos for rigid and multi body soft (compliant) contact.
Will also add simplified Hertz compliant contact, by dynamically modifying the ERP/CFM to mimic a non-linear spring.
Note that btManifoldPoint is growing too big, we need to implement proper contact constraints derived from btTypedConstraint.
2016-02-22 18:40:00 -08:00
erwin coumans
645a88176d Enable softness for btRigidBody contacts. This is implemented by some value (CFM, constraint force mixing) to the main diagonal of A.
CFM for contacts use world CFM value by default, and can override with custom CFM value using the
BT_CONTACT_FLAG_HAS_CONTACT_CFM stored in m_contactPointFlags.
Boolean m_lateralFrictionInitialized is replaced 'BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED' flag stored in int m_contactPointFlags in btManifoldPoint.
Enable successive over-relaxation parameter (SOR) for contacts. btMLCPSolver uses global CFM.
In one of the next commits, contact softness will be enabled btMultiBody contacts.
Also need to review use of CFM in btMLCPSolvers (only world CFM is used at the moment)
2016-01-22 17:43:36 -08:00
erwin coumans
cba140431e prepare to add ForkLiftDemo in App_AllBullet2Demos
rename Ewert/Catto to World/Body for implicit coriolis forces
2015-03-27 11:59:22 -07:00
Erwin Coumans
9931dd9684 remove Cooper implicit (it was just for comparison, it is buggy)
add btMatrix3x3::solve33, thanks to Erin Catto, and added safety against division by zero
2015-03-25 19:33:02 -07:00
Erwin Coumans
0a04a745dd added Erin Catto's 'local' implicit coriolis/gyroscopic force, next to 'Ewert', Cooper, explicit and none
Configured the gyroscopic demo to show the Dzhanibekov effect
see also https://www.youtube.com/watch?v=L2o9eBl_Gzw
2015-03-24 23:16:45 -07:00
erwin coumans
1e13454511 Added experimental implicit gyroscopic force implementation, one by Michael Ewert, and another by Cooper (from OpenDE)
Will also add Erin Catto's local implicit version from the GDC 2015 tutorial
Added demo for btGeneric6DofSpring2Constraint, thanks to Gabor Puhr
Add gfxBridge.autogenerateGraphicsObjects method for Bullet 2 demos in new framework (need to implement all Bullet 2 collision shape types...)
Use 1,1,1 for local scaling in btStaticPlaneShape
2015-03-24 15:55:05 -07:00
Erwin Coumans
af5883c6e8 remove a lot of warnings (more todo in demos and serialization code) 2014-08-22 10:29:05 -07:00
Erwin Coumans
e279aed08f re-enable the fix for broken friction in Clang (got accidently undone in a recent commit)
fix OSX build
2014-05-03 10:11:49 -07:00
erwincoumans
0e1a77047c fix Linux build 2014-05-03 02:50:09 -07:00
Erwin Coumans
66ab2a2022 fix OSX build 2014-05-03 08:48:46 -07:00
erwincoumans
0b6d1af1d4 Only enable SSE4 for Visual Studio 2012 or later (_MSC_FULL_VER >= 170050727), it breaks the build for Visual Studio 2010
Add additional constructor for btMultiBodyJointMotor
2014-05-01 22:23:37 -07:00
Erwin Coumans
0e1b90d708 Added SSE4/FMA optimized constraint row solver implementation for btSequentialImpulseConstraintSolver,
thanks to Vladimir Bondarev (https://github.com/VladimirBondarev/bullet3/tree/c25d)
2014-05-01 17:13:50 -07:00
Erwin Coumans
907ac49892 work-around what appears to be a bug in Clang 3.4. Todo: create a small repro case for Clang/LLVM or see if they already fixed it. 2014-04-29 11:44:52 -07:00
erwin.coumans@gmail.com
439ab03940 fix Mac OSX build (there is no such member called e.m128_f32[0] 2013-11-03 19:55:08 +00:00
erwin.coumans@gmail.com
644d01d231 added the btNNCGConstraintSolver, based on the paper "Nonsmooth Nonlinear Conjugate Gradient Method for interactive
contact force problems". The solver needs a lot of iterations, before the quality goes up (~ 1000)
Thanks to Gabor PUHR for the contribution!
Improved the btLemkeSolver.
Remove the sparse optimizations from the btMatrixX.h, replace it with explicit call to rowComputeNonZeroElements (only used in the btSolveProjectedGaussSeidel), it was likely slowing things down, without being useful.
Re-enable SIMD in the solver (was accidently disabled in Bullet 2.82 release)
2013-10-31 06:17:08 +00:00
erwin.coumans
1a2c3c0ee9 Added a Lemke MLCP solver, extracted from the MBSim project, and re-licensed under the zlib license
with permission of the original author. 
The Lemke implementation is not fully working yet:
1) we need to convert the lo-high LCP problem into a problem without the lo/high
2) we need to sort out the remaining instabilities, and report a failure if the max loopcount is reached etc.
We replaced the fmatvec library with our own LinearMath/btMatrixX.h, and STL std::vector with btAlignedObjectArray

Removed some warnings/potential issues: use fuzzyZero instead of isZero, and some warnings, 
related to this issue 756
2013-10-26 18:45:25 +00:00
erwin.coumans@gmail.com
a21480c8ca Attempt to fix "Regression in friction and damping behaviour" , see issue 752
Thanks to Sergej Reich for the report and narrowing down the breaking revision!
2013-10-22 09:26:08 +00:00
erwin.coumans@gmail.com
1ca0493dc4 Build full A matrix and b vector for a MLCP solver interface, to explore Lemke, Dantzig, Newton and other MLCP solvers. The A matrix contains sparsity information.
Added a PGS solver that uses the sparsity of the A matrix, just for testing (the equivalent sequential impulse solver is much faster, not having to allocate the big matrices)
2013-10-20 17:38:14 +00:00
erwin.coumans
f02dd51597 Added a first version of a Featherstone multi body implementation.
The original version was written by Stephen Thompson.
I replaced Eigen math by Bullet LinearMath, and added a dedicated 6x6 matrix solver. 
Also I integrated support for collisions/contact constraints between btMultiBody and btRigidBody, and de-activation support.
See Demos/FeatherstoneMultiBodyDemo/Win32FeatherstoneMultiBodyDemo.cpp for example usage.
There is currently only support for contact constraints for btMultiBody. 
Next on the list will be adding support for joint limit constraint for btMultiBody. 
The implementation is still experimental/untested, the quality will improve in upcoming Bullet releases.
2013-10-01 22:50:31 +00:00
erwincoumans
7f29aebaa4 fix broken force feedback in constraint solver, thanks to John Hsu for the report 2013-08-21 23:00:17 +00:00
erwin.coumans@gmail.com
542c53fb30 Don't pass along unused btStackAlloc everywhere. The API change might user code (derived classes with the old virtual method are not called anymore) 2013-05-08 22:45:35 +00:00
erwin.coumans@gmail.com
329b9a1e3c Avoid collision response between non-dynamic bodies, introduced in a recent commit.
Fixes Issue 711 https://code.google.com/p/bullet/issues/detail?id=711
Thanks to Sergej Reich.
2013-05-08 21:07:35 +00:00
erwin.coumans
1d4a5d950d Usually m_contactNormal2 == -m_contactNormal1, but not always, so
use a separate contactNormal1/contactNormal2 for each body in btSolverConstraint.

Thanks to Richard McDaniel for the patch.
2012-12-12 23:21:51 +00:00
erwin.coumans
6be2689f01 add joint feedback (applied force and applied torque for a constraint) 2012-10-05 05:37:12 +00:00
erwin.coumans
cfb609f9d1 tweak CcdPhysicsDemo
remove wrong cp.m_lateralFrictionInitialized = false;
See http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?p=28851#p28851
2012-09-29 01:52:27 +00:00
erwin.coumans
60bf599246 perform GrahamScanConvexHull2D around an arbitrary oriented 2D plane in 3D, to fix some convex hull face merging problems
add compound shape support to BulletXmlWorldImporter and fix some compile issue under Debian (hopefully)
object picking change in the demos: create a ball-socket picking constraint when holding shift while mouse dragging, otherwise a fixed (6dof) constraint
add assert in constraint solver, when both objects have their inertia tensor rows set to zero
btPolyhedralContactClipping: add edge-edge contact point in  findSeparatingAxis (similar to the default GJK case)
2012-09-28 07:14:48 +00:00
erwin.coumans
182c3034de fixes in btBulletXmlWorldImporter, and add premake4 support for the related demo 2012-09-22 05:27:35 +00:00
erwin.coumans
214579ec60 Allow btBulletWorldImporter to convert/export a .bullet file to XML
Add first version of btBulletXmlWorldImporter, still incomplete but it can read some files
Fix false assert in btSequentialImpulseConstraintSolver
2012-09-21 22:47:11 +00:00
erwin.coumans
7494463be8 reset the companion Id back to -1, because of a bug related to kinematic objects
Thanks to Francois for the report. See Issue 652
2012-09-20 11:32:27 +00:00
erwin.coumans
5bba00dea4 improve control over rolling friction, use the same m_rollingFriction for both linear factor and absolute clamping value. 2012-09-20 04:18:29 +00:00
erwin.coumans
59a29b1859 fix kinematic objects, see Issue 652
add m_rollingFriction to btRigidBody::btRigidBodyConstructionInfo
2012-09-20 03:32:52 +00:00
erwin.coumans
22fb7d5c1e improve rolling friction using anisotropic direction, to avoid resting in an instable position
(for implicit capsule, cylinder and cone shape)
See Bullet/Demos/RollingFrictionDemo for an example
2012-09-16 17:01:25 +00:00
erwin.coumans
7eebb79ced implemented rolling friction, using a contact constraint. Useful to get rolling spheres to rest, even on a slightly sloped plane.
See http://www.youtube.com/watch?v=RV7sBAsKu4M and Bullet/Demos/RollingFrictionDemo
Fixes in FractureDemo (mouse picking constraint needs to be removed, otherwise constraint solver crashes/asserts)
2012-09-15 06:52:17 +00:00
erwin.coumans
54744b6ab9 added gyroscopic force option for btRigidBody, body->setFlags(BT_ENABLE_GYROPSCOPIC_FORCE);
Note that it can easily introduce instability at regular (60Hertz) simulation steps so it is generally best to not use the option.
If needed, use a very small internal step, such as 1000 Hertz (world->stepSimulation(dt,100,1./1000.f); or stepSimulation(1./1000.,0);
2012-09-14 21:39:48 +00:00
erwin.coumans
8c56528a79 Avoid using restitution for ccd motion clamping. Restitution for fast moving objects should be handled by btDiscreteDynamicsWorld::createPredictiveContacts
(make sure to merge islands based on those predictive contacts too, added some check in the solver)
This fixes Issue 356.
Use same solver settings for AllBulletDemos
Make sure to embed the setCcdSweptSphereRadius inside the actual collision shape (for shoot box)
2012-09-11 03:12:32 +00:00
erwin.coumans
3b83428a7f Applied polar decomposition patch. Fixes Issue 621. Thanks to Christian for the report, Joshua for the fix, Dongsoo for checking the fix.
Applied picking cloth patch. Fixes Issue 646. Thanks to Dongsoo.
Applied patch Softbody updateConstraints. Fixes Issue 503. Thanks to Dave Bruce Phillips and Dongsoo.
Fix various warnigns under Mac OSX.
2012-09-09 17:22:30 +00:00
erwin.coumans
b69c6ac3f5 fix padding in btSolverConstraint, see Issue 650
fix some warnings
2012-09-08 19:21:14 +00:00
erwin.coumans
196aa20329 add m_splitImpulseTurnErp solver setting, initialized to 0.1: more stable recovery from deeper penetrations by reducing the angular effect (if split impulse is enabled)
Set it to 1.0 to disable the effect.
removed broken/not maintained heightfield fluid demo
add some API methods to btPersistentManifold
2012-09-03 04:38:08 +00:00
erwin.coumans
84b1774dda improve handling of restitution by using the velocity (linear/angular) before applying forces: this is done by re-introducing the btSolverBody and only apply the forces to solver body, and use the original rigid body velocity for restitution computation.
warmstarting for contact points was broken, fix in btPersistentManifold
enable split impulse by default (at the cost of some performance)
add  the option for zero-length friction (instead of recomputing friction directions using btPlaneSpace), use the solver mode flag SOLVER_ALLOW_ZERO_LENGTH_FRICTION_DIRECTIONS
precompute lateral friction directions (in btManifoldResult)
remove the mConstraintRow[3] from btManifoldPoint, it just took a lot of memory with no benefits: fixed it in btParallelConstraintSolver
2012-08-31 19:46:24 +00:00
erwin.coumans
73b217fb07 Apple contribution for OSX SSE and iOS NEON optimizations unit tests, thanks to Jordan Hubbard, Ian Ollmann and Hristo Hristov.
For OSX:
cd build
./premake_osx xcode4
for iOS:
cd build
./ios_build.sh
./ios_run.sh

Also integrated the branches/StackAllocation to make it easier to multi-thread collision detection in the near future. It avoids changing the btCollisionObject while performing collision detection.

As this is a large patch, some stuff might be temporarily broken, I'll keep an eye out on issues.
2012-06-07 00:56:30 +00:00
erwin.coumans
710954d772 Constraints can override their own number of solver iterations (either more or less than the default) or leave it default (-1)
Bump version to 2.80
2012-03-03 03:07:18 +00:00