Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sun Jun 25, 2017 6:36 pm 
Offline

Joined: Sun Jun 25, 2017 6:03 pm
Posts: 3
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?


Top
 Profile  
 
PostPosted: Mon Jul 31, 2017 6:21 pm 
Offline

Joined: Sun Jun 25, 2017 6:03 pm
Posts: 3
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):

Attachment:
Screenshot from 2017-07-31 19-59-15.png
Screenshot from 2017-07-31 19-59-15.png [ 22.16 KiB | Viewed 327 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.

Attachment:
Screenshot from 2017-07-31 19-58-36.png
Screenshot from 2017-07-31 19-58-36.png [ 26.75 KiB | Viewed 327 times ]


I found the corresponding code snippet in btGeneric6DofSpring2Constraint.cpp

Code:
      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:
   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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 24 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group