Raising Accuracy Through Scaling Equations

Post Reply
Posts: 1
Joined: Wed Feb 12, 2020 12:08 pm

Raising Accuracy Through Scaling Equations

Post by Wagnr »


As mentioned, I wrote a code in Python with scaling equations to increase accuracy of results with Pybullet.

The paper I am using as a reference tells the following : "The scaling of a rigid body
simulation causes a particular effect on the dimension of time. The simulation of a scaled model
has a continuous time scaled run in pseudo real-time."

Where time_scaled = x * time and x is a given number.

I struggle to understand how I can use it in my code. I mean, a second will always be a second no matter what. How can I ''manipulate" time inside of pybullet itself ?

If someone has experience in scaling equations or an idea that could help me, I will be very thankful.

Thanks in advance
Posts: 1
Joined: Tue Jan 26, 2016 11:05 pm

Re: Raising Accuracy Through Scaling Equations

Post by DoubleIce »

How much more accurate do you think Pybullet could get?
User avatar
Posts: 649
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Raising Accuracy Through Scaling Equations

Post by drleviathan »

I think what that paper was talking about is: if you want to simulate very small things (few cm and smaller) accurately with Bullet... you can't just enable 64-bit floating point, use tiny shapes, and take small substeps. There are hard-coded numerical thresholds in Bullet's algorithms that limit its accuracy for very small distances. For example, Bullet's shapes use a collision boundary to speed up its GJK algorithm and it is safe to assume there are numerical thresholds therein tuned to work well for simulations of things on the order of meters.

So what you do is: scale your units such that 1m in the Bullet simulation is actually 1mm for the purposes of your simulation. If you have a 4mm sphere in your simulation you would actually instantiate a 4m sphere for Bullet. However, when you do this you probably also want to scale your units of time such that 1 second in the Bullet simulation (e.g. 1 second of pseudo time) is actually only 1msec (or something) in the real simulation.

When doing this I think things get a little tricky when it comes time to set friction, restitution, and damping coefficients. Although those parameters are kinda "normalized" in Bullet (typically range between 0 and 1 and represent a multiplicative fraction applied to forces/velocities during collision/integration) there are actually some time-dependency hiding in those values and if you want physical accuracy you would need to scale your friction down, restitution up, and probably set damping to zero. In other words: in pseudo time for "small simulations" there would be less friction and more conservation of energy per collision and per-substep of pseudo-time.
Post Reply