[Solved] Using bullet to simulate a loop structure

Post Reply
IresomPCH
Posts: 18
Joined: Tue Sep 24, 2013 12:29 pm

[Solved] Using bullet to simulate a loop structure

Post by IresomPCH »

Hello,

I'm currently useing Bullet engine (BulletSharp version) to build a simulator.
And I'm try to build a loop struct (a 4 bar linkage) as shown in this picture:
4BarLinkage.png
4BarLinkage.png (152.06 KiB) Viewed 7235 times
(Cube: ridigBody; Cylinder: HingeConstraint )

However, the structure always blow up after the simulation begins...

If those joints are free to rotate, the structure can exist for a relatively long time, but somehow distort and reassemble and blows up.
If one joint is motorized (the others are free), then the structure blows up right after 1~2 seconds.

The parameters used are:
simulation freguency interpoleTime@1000Hz, internalTime@60Hz using stepSimulation(interpoleTime);
MLCP Dantzig solver
Joint movable range = -20~20 degree
Joint overrideIteration = 120
RigidBody mass = 2.0kg

Note: The blue cube in the picture is a 6DOF constraint locking two rigidBodies.
I tried remove them, but it has no effect.

Does the solver have limitation on loop sturcture? Or some parameters must be specified?
I've built other articulated structures(no loop inside), and they works fine using this solver.
Any ideas? Thanks~



-------------------------------------------------------------------------------------------------------
Update:

The problem is solved using double precision version of BulletPhysics~
Last edited by IresomPCH on Thu May 14, 2015 5:57 am, edited 3 times in total.
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Using bullet to construct loop structure

Post by drleviathan »

First thing to try is to reduce the size the simulation substeps -- 1/120th of a second or smaller. It sounds like you're doing a physical simulation rather than a real-time game -- if so then you could probably step even smaller and not worry too much if your simulation doesn't run real-time. I've heard reports that some constraints actually go unstable at too small of timesteps so there may be a limit to how low you can go.

Alternatively, you could use a custom verlet relaxation step in the simulation. It would be nice and stable. In fact, the algorithm tends to introduce implicit energy damping so if you don't mind a bit of friction in your joints it should work fine for you.
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Using bullet to construct loop structure

Post by Basroil »

I think the main question here is how much torque are you allowing, if it blows up with minimal (~50Nm for that if each is about a meter long) torque as your limit there's definitely something strange going on. If you don't set a limit you will have explosions due to dynamic linking (just tiny errors will make huge forces), but with reasonable maximum torque limits you shouldn't have too many issues (though secondary axis errors might come into play)

Also check to make sure that the explosion is "real" and not just when it switches to sequential impulse after it failed to find a solution with Dantzig. I actually had a similar issue where things would explode the frame after the solver switched to sequential impulse backup, and it wasn't fun to find that error.
IresomPCH
Posts: 18
Joined: Tue Sep 24, 2013 12:29 pm

Re: Using bullet to construct loop structure

Post by IresomPCH »

@drleviathan:
The simulation is @1000Hz :D
And I'm using

@Basroil:
I use the default setting for the joint except OverrideNumSolverIterations, Range limits...
It seems under this structure, the Dantzig solver is hard to find a stable solution.
Once it explode, the solver fall back to SI solver and never go back. :shock:
The structure really "exploded" seeing that the graphic is drawn according to the transform matrix of those objects, and they jumped around everywhere...


Anyway, after using the double precision version, the simulation is quite stable without changing any parameters.
It seems to solve the problem. :lol:
Post Reply