Replies: 9 comments
-
I asked the developer of the btGeneric6DofSpring2Constraint for some comments, so hopefully he will reply here later. Although I haven't looked into the damping terms myself yet, here are some possible reasons for differences between analytical solution and btGeneric6DofSpring2Constraint:
It would be good to create a spring demo, based on btGeneric6DofSpring2Constraint (the older variant will be deprecated), and provide actual comparison numbers/graphs. |
Beta Was this translation helpful? Give feedback.
-
Hi, The equation in In here the c is the viscous damping coefficient. The btGeneric6DofSpring2Constraint uses this. You have to transform your resistance coefficient (Kappa) c = Kappa / (2 * m) However I think it is generally better to use the damping ratio (zeta), because in this case: c = zeta * (2 * sqrt(m * k)) As for the frequency that you wrote is correct: k = omega0 ^ 2 * m Please note that while the analytic equation is the perfect solution for the above differential equation, the Bullet can't use this because other forces and constraints have to be considered. You can always increase a precision by decreasing the delta t of the Bullet or play with the solver. (change it to Dijkstra, NNCG or increase the iteration count if it has) Let me know if it solves your problem. Best Regards: |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
You are welcome. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the help Gabor and for the report Ehsanizadi. Ehsanizadi, do you mind helping out with some code snippet for Bullet that can help re-creating that spring test case, as well as the values you entered for the analytic solution (used to create that graph)? |
Beta Was this translation helpful? Give feedback.
-
Not at all, Its a pleasure. In the above link, the friction calculation example is put in the "tiltPlaneTest" folder (since the friction test was simulated using a tilting plane) and the springSimulation folder contains the code I posted the results of that. For the above graph there are two cases, lets call them 'high damping' and 'low damping' cases, the chosen parameters are as listed below: High damping case:Bullet parameters
Analytical solution
Low damping case:Bullet parameters
Analytical solution
Apart from that, I did a small test on the effect of time step size on the accuracy of Bullet. Favorable accuracy can be achieved with tunning of the time step size: Thank you for developing this great engine! |
Beta Was this translation helpful? Give feedback.
-
Hi Ehsan, For the time steps: For a few special application for example in robotics it is not rare the 1000hz, but it can be usually realtime only with a very few objects and/or constraints. Above 100hz it is usually advised to use the double precision version. Best Regards |
Beta Was this translation helpful? Give feedback.
-
Hi Gabor, Yes indeed you are right. |
Beta Was this translation helpful? Give feedback.
-
There might be other issues with the spring in the btGeneric6DofSpring2Constraint |
Beta Was this translation helpful? Give feedback.
-
Hey all,
In a simulation I have to use a spring with damping. It is an engineering simulation, so I should take the correct value for damping.
As far as I understood there are two sort of spring definitions in Bullet:
btGeneric6DofSpringConstraint
andbtGeneric6DofSpring2Constraint
.The dampings used in both are different in the units. (for example for
btGeneric6DofSpringConstraint
if you take damping =1 means no damping, and forbtGeneric6DofSpring2Constraint
zero damping means no damping condition.)And surprisingly non of them don't seem to be in the units of N.s/m.
I looked through the code and found out that the damping parameter used in the original spring (
btGeneric6DofSpringConstraint
) code is just a factor that applied to introduce some loss of the resilient force of the spring:So, the unit of this damping should be something like [m/N] which is quite strange! (to me)
However, in the new spring code (
btGeneric6DofSpring2Constraint
) the damping ratio is multiplied directly to the current velocity of the oscillating object:This damping seems quite reasonable in algorithm and the unit seems to be [N.s/m], however, when I compare the behaviour of oscillation of a simple linear spring-mass system with the results of analytical solution, the behaviour is not quite in conformation.
For comparison you can simply model a spring and a mass at the end, and monitor the location of the object attached to the spring, and for the analytical solution you can easily refer to here. Note that the resistance coef. is damping and undamped angular frequency is the calculated by
sqrt(springStiffness/massOfOscillatingRigidBody)
.Can someone comment on this? What do you think about the units of damping in bullet?
How can I choose the exact amount of damping as I wish in Bullet?
Beta Was this translation helpful? Give feedback.
All reactions