The impulse-Momentum theorem(conservation of momentum) is broked in btMultibody

Post Reply
rullec
Posts: 1
Joined: Fri Dec 06, 2019 12:44 pm

The impulse-Momentum theorem(conservation of momentum) is broked in btMultibody

Post by rullec »

Hi all,

I am using bullet as a physics enignee in my application.But when I try to verify the impulse-momentum law for btMultibody, the expriment result shows that, the applied impulse is significantly different from the change of system momentum.

Question Description
Briefly, I create a btMultibody with 3 links, disable all friction coeff, simulating it along with adding joint torque on the first spherical joint, then compare the linear momentum changes with external gravity impulse.In my opinion, The linear momentum of this btMultibody should reply on nothing except the impulse given bt gravity, which means:
The changes of system linear momentum = the impulse given by the gravity.

The following minimum reproduce code is based on examples/MultiBody/MultiDofDemo.cpp. I only changed a little in it. If you guys kindly paste all the following code stuffs in MultiDofDemo.cpp then run it, hope you can get the same result.

The experiment result
These following lines is the output of the repro code.

Code: Select all

b3Printf: old momentum -17.42704, -0.55479, 6.60006
b3Printf: new momentum -20.20674, -0.38032, 7.95865
b3Printf: gravity impulse 0.00000, -0.03000, 0.00000
b3Printf: momentum changes -2.77970, 0.17447, 1.35859
b3Printf: relative error = 10335.655%
which means:
t time sys momentum(old momentum) = -17.42704, -0.55479, 6.60006
t+1 time sys momentum(new momentum) = -20.20674, -0.38032, 7.95865
the change of sys moment (new - old) = -2.77970, 0.17447, 1.35859
impulse given by the gravity = 0.00000, -0.03000, 0.00000
relative error....etc

So maybe we can see the impulse-momentum theorem has been broken.

The repro code
The following minimum reproduce code (attachement MultiDofDemo_verify.cpp) is based on examples/MultiBody/MultiDofDemo.cpp. It has only minor changes compared with the original MultiDofDemo.cpp. I hope it won't disturb you.

Btw, for the simplicity of this repro code, I am also trying to implement it again in pybullet. but hasn't been finished yet.

ANY suggestion is welcome!
Attachments
MultiDofDemo_verify.cpp
(17.98 KiB) Downloaded 260 times
Post Reply