2
\$\begingroup\$

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-1.5.8/index.php?title=Scaling_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?

EDIT: I was able to boil it down to the following:

The 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):. ]

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.

enter image description here

I found the corresponding code snippet in

        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, the scaling works just fine if the if clause is commented out. Any sugestions why this happens?

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.