How to fix failing Assert in multiply2_p8r

Post Reply
kiter
Posts: 4
Joined: Tue Nov 25, 2014 9:10 am

How to fix failing Assert in multiply2_p8r

Post by kiter »

Hi,

I'm using Bullet as an external library. In debug mode the following assert fails the first time btDiscreteDynamicsWorld::stepSimulation() is called because numRows and numRowsOther are both 0 :

Code: Select all

void multiply2_p8r (const btScalar *B, const btScalar *C,  int numRows,  int numRowsOther, int row, int col)
{
    btAssert (numRows>0 && numRowsOther>0 && B && C);

Code: Select all

>	sim_1_0d.dll!btMatrixX<double>::multiply2_p8r()  Line 387 + 0x34 bytes	C++
 	sim_1_0d.dll!btMLCPSolver::createMLCPFast(void (char *, char *, char *) infoGlobal)  Line 418	C++
 	sim_1_0d.dll!btMLCPSolver::solveGroupCacheFriendlySetup()  Line 113 + 0x13 bytes	C++
 	sim_1_0d.dll!btSequentialImpulseConstraintSolver::solveGroup()  Line 1725 + 0x2f bytes	C++
 	sim_1_0d.dll!InplaceSolverIslandCallback::processConstraints()  Line 191 + 0x5c bytes	C++
 	sim_1_0d.dll!btDiscreteDynamicsWorld::solveConstraints()  Line 731	C++
 	sim_1_0d.dll!btDiscreteDynamicsWorld::internalSingleStepSimulation()  Line 502 + 0x1b bytes	C++
 	sim_1_0d.dll!btDiscreteDynamicsWorld::stepSimulation()  Line 452 + 0x1b bytes	C++
This assert fails when I add a hinge constraint to a body that is already connected to one other body with a slider constraint and one other body with a hinge constraint.

Does anybody have any idea what may be the cause of this? In release it seems to work fine.

I am not familiar with this part of the code at all. This is line that causes the variables to be 0:

Code: Select all

void btMLCPSolver::createMLCPFast(const btContactSolverInfo& infoGlobal)
{
    ......
    // compute diagonal blocks of m_A
    ....
    const unsigned int infom =  row__ < m_tmpSolverNonContactConstraintPool.size() ? m_tmpConstraintSizesPool[jj].m_numConstraintRows : numContactRows; 
since row__ =10, m_tmpSolverNonContactConstraintPool.size()=14, m_tmpConstraintSizesPool[jj].m_numConstraintRows is returned

infom (0) is then passed to multiplyAdd2_p8r as 3rd and 4th argument causing the assert to fail.

I have no idea what could cause m_tmpConstraintSizesPool[2].m_numConstraintRows to be 0. And if this is actually a problem.

Any help would be greatly appreciated.

Thanks!

Iman
kiter
Posts: 4
Joined: Tue Nov 25, 2014 9:10 am

Re: How to fix failing Assert in multiply2_p8r

Post by kiter »

I managed to avoid the assert by enabling the motors before the first step is made.

Apparently a btGeneric6DofConstraint has its m_numConstraintRows by default set to 0 but m_numConstraintRows is increased by 1 for every linear limit that needs to apply a force or angular limit that needs to apply a torque. For the last check to be positive, the motor needs to be enabled.
For me the assert was called when adding a second hinge constraint in the scene. So even though in other cases m_numConstraintRows of the btGeneric6DofConstraint was zero, it did not call the assert in those cases. So I'm not truly understanding what went wrong and why, but at least things are working :-)
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: How to fix failing Assert in multiply2_p8r

Post by Erwin Coumans »

It looks like you found a bug. I'll file it in the issue tracker so it gets fixed (eventually).

https://github.com/bulletphysics/bullet3/issues/333

Thanks for reporting!
Erwin
Post Reply