## Scaling the World for a 6-Dof Spring Damper

axdorferbua
Posts: 3
Joined: Sun Jun 25, 2017 6:03 pm

### Scaling the World for a 6-Dof Spring Damper

I am currently trying to scale up my setup (consisting of two rigid bodies connected by a btGeneric6DofSpring2Constraint) to fall within the suggested dimensions for a concise simulation.

In order to do so, I followed to the provided Wiki http://www.bulletphysics.org/mediawiki- ... _The_World.

I scaled all the linear properties and concerning the resulting forces, everything turned out physically consistent.
Note that I did not scale up the liner and angular stiffness and damping values.

However I encountered significant deviations concerning the spring-related torques resulting due to a angular spring offset. I guess that this issue arises due to the fact that the torques should be scaled (*scale^2) as well. However I do not see a way of scaling the internal torque representation of the btGeneric6DofSpring2Constraint. Should i simply scale up the angular spring stiffness and spring damping by a factor (*scale^2) or is there a better more elegant way to retrieve physically consistent results (forces, torques, motion) when trying to scale a world containing the btGeneric6DofSpring2Constraint?

axdorferbua
Posts: 3
Joined: Sun Jun 25, 2017 6:03 pm

### Re: Scaling the World for a 6-Dof Spring Damper

I was able to boil it down to the following:

For now, rotational stiffness and damping vales are chosen independent from the scale.

The stiffness itself does not alter the behavior of the system. The deviations are caused entirely by the damping part. An experiment with altering the scale and non-existent damping showed results independent from the scaling factor, just as desired (K_stiff = 20.0, K_damp = 0.0):
Screenshot from 2017-07-31 19-59-15.png (22.16 KiB) Viewed 807 times
However when repeating the same experiment with no stiffness and a positive damping factor, significant differences arise when scaling up. (K_stiff = 0.0, K_damp = 9.0): The image denotes the system responses for different scales.
Screenshot from 2017-07-31 19-58-36.png (26.75 KiB) Viewed 807 times
I found the corresponding code snippet in btGeneric6DofSpring2Constraint.cpp

Code: Select all

``````		btScalar fs = ks * error * dt;
btScalar fd = -kd * (vel) * (rotational ? -1 : 1) * dt;
btScalar f = (fs+fd);

info->m_constraintError[srow] = (vel + f * (rotational ? -1 : 1)) ;

btScalar minf = f < fd ? f : fd;
btScalar maxf = f < fd ? fd : f;

//printf("%.3lf\n",f);
if(!rotational)
{
info->m_lowerLimit[srow] = minf > 0 ? 0 : minf;
info->m_upperLimit[srow] = maxf < 0 ? 0 : maxf;
}
else
{
info->m_lowerLimit[srow] = -maxf > 0 ? 0 : -maxf;
info->m_upperLimit[srow] = -minf < 0 ? 0 : -minf;
}

info->cfm[srow] = cfm;
srow += info->rowskip;
++count;
}
``````

Interestingly if i comment out th if clause, everything just works fine, so I guess it all has to do with

Code: Select all

``````	btScalar minf = f < fd ? f : fd;
btScalar maxf = f < fd ? fd : f;
``````
and the lines thereafter. I'd be greatful for any kind of suggestion.