Restitution value

Post Reply
Rnx
Posts: 2
Joined: Tue Jul 31, 2018 11:19 am

Restitution value

Post by Rnx »

Hi,

for a course at my university i need to do a physical simulation of a real experiment using the pybullet physics engine.
As I have already read on this forum, there seem to be trouble with the restitution values, but i couldn't find a solution.
As an example i have the following setup: A sphere with a specific restitution drops onto a plate with a restitution of 1.0.

Setting the restitution coefficient of the sphere to 1.0, i expect the sphere to bounce always back to the same height, but it bounces even higher every time.
Setting the restitution coefficient of the sphere < 1.0 i expect the following formula to be approximately correct: sqrt(bounce_height / height), but this also does not seem to apply.

Anyone have an idea what i can do or if bullet physics is not capable of my problem?

I also tried the suggestion to use "useSplitImpulse", but this option did not change anything.

Here is my test code:

Code: Select all

import pybullet as p
import time

sphereRestitution = 1.0
radius = 0.005

p.connect(p.GUI)
p.setPhysicsEngineParameter(useSplitImpulse=1)
p.setGravity(0, 0, -10)

colPlateId = p.createCollisionShape(p.GEOM_BOX, halfExtents=[0.30, 0.30, 0.05])
plateId = p.createMultiBody(baseMass=0, baseCollisionShapeIndex=colPlateId, baseVisualShapeIndex=-1, basePosition=[0,0,-0.05])
p.changeDynamics(colPlateId, -1, lateralFriction=1.0, spinningFriction=1.0, rollingFriction=1.0, linearDamping = 0, angularDamping = 0, restitution=1.0)

sphereColId = p.createCollisionShape(p.GEOM_SPHERE, radius=radius)
id = p.createMultiBody(baseMass=0.062, baseCollisionShapeIndex=sphereColId, baseVisualShapeIndex=-1, basePosition=[0,0.2,0.20])
p.changeDynamics(id, -1, lateralFriction=0.1, spinningFriction=0.1, rollingFriction=0.1,
                 linearDamping=0, angularDamping=0, restitution=sphereRestitution)

timestep = 0.002
p.setTimeStep(timestep)

while 1:
    p.stepSimulation()
    time.sleep(timestep)
Rnx
Posts: 2
Joined: Tue Jul 31, 2018 11:19 am

Re: Restitution value

Post by Rnx »

I calculated the restitution coefficient of this experiment with the formula and the matching linear function which describes the difference between the set restitution and observed restitution of the first bounce (all bounces have different calculated restitutions):
f(x) = 1.02042017 * x - 0.08793547
x is observed restitution
f(x) is set restitution

Using this formula to adjust the restitution coefficient for my sphere i get much better results in the comparison of my physical simulation and the real experiment. But i think that i should not need such an adjustment.
Attachments
Restitution.png
Restitution.png (32.09 KiB) Viewed 1708 times
Post Reply