btGeneric6DofSpringConstraint damping

Post Reply
NaN
Posts: 9
Joined: Thu Mar 04, 2010 6:55 pm

btGeneric6DofSpringConstraint damping

Post by NaN »

Hi,

What kind of friction model is used by the btGeneric6DofSpringConstraint? The code doesn't look like it is viscous. I haven't been able to figure out any relation to the viscous damping coefficient or damping rate(damped harmonic oscillator). Is it possible to modify btGeneric6DofSpringConstraint::internalUpdateSprings() to support viscous friction?

Does it make sense to calculate erp, cfm according to spring constant, damping coefficient to simulate spring/damping? What are the equations for the erp, cfm in bullets case?
http://bulletphysics.org/Bullet/phpBB3/ ... f=4&t=2503
http://opende.sourceforge.net/wiki/inde ... oncepts%29

I am quite a noob regarding constraint solvers so any tips are highly appreciated!
User avatar
jarno
Posts: 57
Joined: Tue Mar 16, 2010 1:42 am

Re: btGeneric6DofSpringConstraint damping

Post by jarno »

I was about to ask a very similar question. Just what is the physics behind the spring damping coefficient in the 6Dof constraint?

For one thing it is misnamed, given that setting it to 1 gives no damping and 0 is fully damped. I usually end up setting it to a very small value (like 0.001), so it seems to be more like the reciprocal of some sort of damping coefficient.

---JvdL---
NaN
Posts: 9
Joined: Thu Mar 04, 2010 6:55 pm

Re: btGeneric6DofSpringConstraint damping

Post by NaN »

Assuming that Bullets constraint implementation is based on the one from ODE:
http://opende.sourceforge.net/wiki/inde ... parameters

For the btGeneric6DofSpringConstraint this means that for damping = 0 we have Coloumb friction (m_targetVelocity = 0). The maximum friction force is proportional to spring force in this case.

Code: Select all

// get current position of constraint
btScalar currPos = m_calculatedLinearDiff[i];
// calculate difference
btScalar delta = currPos - m_equilibriumPoint[i];
// spring force is (delta * m_stiffness) according to Hooke's Law
btScalar force = delta * m_springStiffness[i];
btScalar velFactor = info->fps * m_springDamping[i] / btScalar(info->m_numIterations);
m_linearLimits.m_targetVelocity[i] =  velFactor * force;
m_linearLimits.m_maxMotorForce[i] =  btFabs(force) / info->fps;
What bugs me is that the target velocity is calculated from spring displacement relative to equilibrium only, not taking current velocity into account.
There is the next problem. Assuming no damping(m_springDamping = 1) => target velocity = force * 1/dt * 1/iterations. Is target velocity a velocity?
ProfessionalUser
Posts: 14
Joined: Fri Oct 14, 2011 12:10 am

Re: btGeneric6DofSpringConstraint damping

Post by ProfessionalUser »

jarno wrote:
For one thing it is misnamed, given that setting it to 1 gives no damping and 0 is fully damped. I usually end up setting it to a very small value (like 0.001), so it seems to be more like the reciprocal of some sort of damping coefficient.

---JvdL---
+1
Post Reply