Assertion failed in btSequentialImpulseConstraintSolver

wittmeis
Posts: 4
Joined: Tue Nov 30, 2010 10:14 am

Assertion failed in btSequentialImpulseConstraintSolver

Post by wittmeis »

Hi,

I wanted to update our robotics simulation software today from a custom (slightly modified) Bullet-2.78 version to the newest Bullet-2.80 (r2531).

The application compiles but as soon as I want to step the btDiscreteDynamicsWorld I get an assertion failed error in btSequentialImpulseConstraintSolver. I checked, the identical assertion also exists in 2.78. What changed from 2.78 to 2.80?
Here is the error message:
bullet-2.80-rev2531/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp:872: virtual btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCollisionObject**, int, btPersistentManifold**, int, btTypedConstraint**, int, const btContactSolverInfo&, btIDebugDraw*, btStackAlloc*): Assertion `info2.rowskip*sizeof(btScalar)== sizeof(btSolverConstraint)' failed.
And here is the stack backtrace:
#0 0x00132416 in __kernel_vsyscall ()
#1 0x010511ef in raise () from /lib/i386-linux-gnu/libc.so.6
#2 0x01054835 in abort () from /lib/i386-linux-gnu/libc.so.6
#3 0x0104a095 in ?? () from /lib/i386-linux-gnu/libc.so.6
#4 0x0104a147 in __assert_fail () from /lib/i386-linux-gnu/libc.so.6
#5 0x04b36542 in btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup (this=0x8996ea0, bodies=0xb110a710, numBodies=2, manifoldPtr=0x0, numManifolds=0, constraints=0xb110a730, numConstraints=2, infoGlobal=...,
debugDrawer=0x0, stackAlloc=0x893e020) at /home/wittmeis/downloads/bullet-2.80-rev2531/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp:872
#6 0x04b37acb in btSequentialImpulseConstraintSolver::solveGroup (this=0x8996ea0, bodies=0xb110a710, numBodies=2, manifoldPtr=0x0, numManifolds=0, constraints=0xb110a730, numConstraints=2, infoGlobal=..., debugDrawer=0x0,
stackAlloc=0x893e020) at /home/wittmeis/downloads/bullet-2.80-rev2531/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp:1249
#7 0x04b426af in InplaceSolverIslandCallback::processConstraints (this=0x8581c90) at /home/wittmeis/downloads/bullet-2.80-rev2531/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:202
#8 0x04b3ec31 in btDiscreteDynamicsWorld::solveConstraints (this=0x8598f00, solverInfo=...) at /home/wittmeis/downloads/bullet-2.80-rev2531/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:731
#9 0x04b3e17a in btDiscreteDynamicsWorld::internalSingleStepSimulation (this=0x8598f00, timeStep=0.001) at /home/wittmeis/downloads/bullet-2.80-rev2531/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:505
#10 0x04b3e00a in btDiscreteDynamicsWorld::stepSimulation (this=0x8598f00, timeStep=0.0017210905207321048, maxSubSteps=7, fixedTimeStep=0.001)
Any help is appreciated!

Thanks!!
wittmeis
Posts: 4
Joined: Tue Nov 30, 2010 10:14 am

Re: Assertion failed in btSequentialImpulseConstraintSolver

Post by wittmeis »

Hi,

I digged deeper and I found that the reason seems to be that we use double precision. When double precision is turned on, the size of btConstraintSolver is 268 bytes and of btScalar 8 bytes. Hence, the info2.rowSkip becomes 33.5 (line 870 of btSequentialImpulseConstraintSolver.cpp) and the assertion in line 872 fails.

If double precision is off, btConstraintSolver is 140 bytes and btScalar 4 bytes. Therefore, rowSkip is 35 and the assertion does not fail.

So maybe there is something wrong with the 64bit alignment of the members of btConstraintSolver????


Any help appreciated!
morrishazy
Posts: 2
Joined: Tue Sep 04, 2012 6:06 pm

Re: Assertion failed in btSequentialImpulseConstraintSolver

Post by morrishazy »

I had the same issue on Linux, but not on Windows and after reading your post I noticed some unions of the btSolverConstraint class had paddings and some didn't. The assertion disappeared after adding union padding for all members, which type was not btScalar.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Assertion failed in btSequentialImpulseConstraintSolver

Post by Erwin Coumans »

Latest trunk should fix this assert, can you check it?
https://code.google.com/p/bullet/source/detail?r=2553

If not, please file a new issue in the issue tracker at http://bullet.googlecode.com
Thanks!
morrishazy
Posts: 2
Joined: Tue Sep 04, 2012 6:06 pm

Re: Assertion failed in btSequentialImpulseConstraintSolver

Post by morrishazy »

Seems to work fine now