## unexpected behavior with Bullet engine

Report crashes, strange behaviour, or apparent bugs
lshachar
Posts: 17
Joined: 01 Aug 2015, 18:00

### unexpected behavior with Bullet engine

Hello!
I believe I found a bug in Bullet, or maybe in how bullet is handled in CoppeliaSim, and I would like to get your opinion before I go on and report it to the bullet devs.

I have this scene set up:

The right ‘assembly of shapes’ displays the correct behavior, while the left one displays the faulty behavior.
In either assemblies, the bottom cuboid is used as a sliding base with no friction. It has a minimal weight (0.2kg).
The top cuboid/box (hovering above the larger base) is used as a dynamic mass, weighing 1kg.
Both assemblies are pushed by an equal force of 5N, as shown in the image below:

The expected behavior for both assemblies – is for them to slide over the floor in the direction of the arrow.

However, the simulation actually begins when the mass of the left assembly is not centered:

Once the simulation is ran, the prismatic joint (in force/torque mode, and with an active PID control loop) quickly brings the mass to the center.
The 5N force is only introduced 3 seconds into the simulation.
While running using the bullet engine, the left assembly rotates around itself, instead of being pushed in a straight line, like the assembly on the right.
The problem goes away by using ODE or Newton physics engines. (I do have a slight issue with friction while using the Newton engine, but one can simply increase the introduced forces to 50N in the child scripts)

(This bug was trolling my work for several days now...)

Thank you for CoopeliaSim, a highly educational tool!

coppelia
Posts: 8531
Joined: 14 Dec 2012, 00:25

### Re: unexpected behavior with Bullet engine

Hello,

indeed, there is something funny happening with the Bullet engine. It seems that the point of attachment of the smaller cube on the prismatic joint has an influence on that. We already observed similar situations with the Bullet engine, and believe it is specific to that engine (since all physics engines are handled in an identical manner, internally). Since you apply the force at the center of mass of the lower cuboid, you could also use:

Code: Select all

sim.addForceAndTorque(handle,{5,0,0})
but this yields to exactly the same result. Btw, the two set-ups have not exactly the same friction coefficients. But that is not the reason for that strange behaviour.

Cheers

lshachar
Posts: 17
Joined: 01 Aug 2015, 18:00

### Re: unexpected behavior with Bullet engine

Thank you! in order to help the developers of bullet engine, would you be able to help me with their question,
They're asking: What C++ constraint is used in bullet when I used a prismatic joint in my CoppeliaSim model?
We need to know the C++ constraint type to reproduce: btHingeConstraint? btGeneric6DofConstraint? btGeneric6DofSpring2Constraint?
Much obliged

coppelia