Constraint error (gap)

yamasaki
Posts: 7
Joined: Mon Apr 01, 2013 2:32 am

Constraint error (gap)

Post by yamasaki »

Hi.

I want to connect two rigid bodies with btPoint2PointConstraint.
At a glance it works fine, but they aren't constrained at pivot accurately. There is little error (gap).

In accordance with previous post, I tried the followings.
1. set ERP to 0.8. (CFM is 0)
2. increase the number of constraint solver iterations.

Code: Select all

constraint->setOverrideNumSolverIterations(1000);
3. use a small INTERNAL simulation substep (run at 1000 Hertz).

Code: Select all

btScalar simulationSubStep = 1.f/1000.f;
world->stepSimulation(actualDeltaTime, 100, simulationSubStep);
Although it has improved the problem, it's not solved perfectly. There is still little error.
I want to know, this error is unavoidable, or my usage of constraint solver is wrong?

Thanks in advance.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Constraint error (gap)

Post by Erwin Coumans »

Bullet is using an iterative constraint solver and it only converges towards a solution.
So there is usually some remaining error indeed.

Are you using large mass ratios? A object with large mass attached to a chain of constraints with small masses can easily become unstable, with no convergence.
Making the masses more similar, or increasing the inertia tensor might reduce the constraint error.
yamasaki
Posts: 7
Joined: Mon Apr 01, 2013 2:32 am

Re: Constraint error (gap)

Post by yamasaki »

Thanks for your reply.
I got what I wanted to know.

>Are you using large mass ratios?
No, I don't.
The masses of each rigid bodies are same value (1.0).
With improvement, the constraint error is very small now.
So, I should accept the remaining error.