Very small torques slow down to stop.

Moderators: Sascha Willems, Thomas

Very small torques slow down to stop.

Postby misho » Wed Oct 06, 2010 10:58 am

This is a re-post from the General forum, on Julio's request.

Problem: Setting very small torques on free-floating bodies (no gravity) with zero angular damping slows down the object to stop. The expected behaviour would be small but constant rotation.

Testing this is easy - set up your body like this (I'm using entity class from tutorials, just to easily visualize the bodies)

Code: Select all
   eStage2 = sceneManager->CreateEntity();
   eStage2->LoadMesh ("dumb.dat");
   eStage2->m_curPosition.m_x = 0.0f;
   eStage2->m_curPosition.m_y = 0.0f;
   eStage2->m_curPosition.m_z = -2.0f;
   eStage2->m_prevPosition = eStage2->m_curPosition;

   // add a body with a Convex hull shape
   shape = CreateNewtonBox (world, eStage2, 2);
   Stage2Body = CreateRigidBody (world, eStage2, shape, 20.0f);

   NewtonBodySetLinearDamping( Stage2Body, 0.00000000000f);

   dFloat angularDamp[3];
   angularDamp[0] = -0.0000000000000000000000000f;
   angularDamp[1] = -0.0000000000000000000000000f;
   angularDamp[2] = -0.0000000000000000000000000f;
   NewtonBodySetAngularDamping(Stage2Body, angularDamp);

   NewtonBodySetAutoSleep(Stage2Body,0);
   NewtonReleaseCollision (world, shape);


Then, in ApplyForceAndTorqueCallback,


Code: Select all
      dFloat Torques[3];

   Torques[0] = 0.0f;
   Torques[1] = 0.0f;
   Torques[2] = 0.0f;

   if(FKey)
      Torques[0] = 0.5f;
   if(GKey)
      Torques[0] = -0.5f;

   NewtonBodySetTorque(body, Torques);
   NewtonBodyGetOmega(body, mOmega);


FKey and GKey are booleans that are true when F and G keys are down. You can use them to apply torque to the object in + and - direction on x axis, effectively speeding up or slowing down rotation.
With this setup, you'll see that small omegas of less than 0.03 rps will "stop". Also, you'll notice that, if you just tap the F/G key and add very small torque, there will be a small Omega value displayed momentarily, and it will instantly go back to 0. I have the omega values displayed on screen:

Code: Select all
   Print (dVector (1.0f, 1.0f, 1.0f, 1.0f), 10, 124, "Omega: x = %5.8f", mOmega[0]);
   Print (dVector (1.0f, 1.0f, 1.0f, 1.0f), 10, 144, "Omega: y = %5.8f", mOmega[1]);
   Print (dVector (1.0f, 1.0f, 1.0f, 1.0f), 10, 164, "Omega: z = %5.8f", mOmega[2]);


Cheers,
Misho
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Very small torques slow down to stop.

Postby Julio Jerez » Mon Oct 18, 2010 10:42 am

Small omega on body with 'torque impulse' suddenly stop:
misho wrote:you'll see that small omegas of less than 0.03 rps will "stop"

viewtopic.php?f=9&t=6173

This is strange because in v2.23
cgpauli wrote:- if i enable auto-sleep: The body suddenly stops to rotate when omega gets smaller than about 0.0607868 rad/s.
- if i disable auto-sleep: The body keeps revolving at a constant omega of about 0.0607868 rad/s as soon as the body has slowed down to that value of omega .

Julio wrote:Ok I run this and you are right there is a bug in the integration when the damp is set to zero
and the force was lower that the minimum threshold. The solver was stopping applying the force as if the internal damp was still on,
but the damp was zero which lead tp the body moving a constant speed.
I fixed it, the force do not have to check if the damp is off, it needs to be applied all the time.

viewtopic.php?f=9&t=5964
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Very small torques slow down to stop.

Postby Julio Jerez » Mon Oct 18, 2010 11:26 am

Ok try this

http://www.newtondynamics.com/downloads/NewtonWin-2.25.rar
there are problems with the SDK and the asycronous physics update when changing demo form teh emnu, but if you take the DLL or library you the bug should be fixed.
I will fix such demo thing this week.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Very small torques slow down to stop.

Postby misho » Tue Oct 19, 2010 12:26 pm

Ok, I tried that (and I had to manually move some files) but I am getting a linker error on it...

Code: Select all
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)


Not exactly sure what these mean... Can you tell me what files I need to move where?

Misho
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Very small torques slow down to stop.

Postby Julio Jerez » Tue Oct 19, 2010 1:09 pm

are you sure that from newton?
there are no files by the name ti_inst in any of the newton libarries
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Very small torques slow down to stop.

Postby misho » Tue Oct 19, 2010 1:30 pm

Hmmm - my project settings are unchanged. I have a Newton directory:

C:\Users\me\Documents\Programming\Newton\NewtonWin-2.24

and now,

C:\Users\me\Documents\Programming\Newton\NewtonWin-2.25

Where I extracted the RAR archive you posted.

All I changed was the environment var, NEWTON_HOME, from

NEWTON_HOME = C:\Users\me\Documents\Programming\Newton\NewtonWin-2.24

to

NEWTON_HOME = C:\Users\me\Documents\Programming\Newton\NewtonWin-2.25

2.24 compiles ok. 2.25 gives me errors I posted... I am guessing this is because 2.25 is not an official build (as you mentioned, some components were missing), so perhaps I should wait till you have it officially out.

Misho
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Very small torques slow down to stop.

Postby Julio Jerez » Tue Oct 19, 2010 1:37 pm

But 2.25 as of this morning is an official build.
what library are you compiling?

make sure you have the correct runtime library setting in you project

startion with 2.25 all all libraries in teh SDK coem with all for runtime library
Multi-threaded (/MT)
Multi-threaded DLL (/MD)

that looks to me like you are using libray of the SDk wi th diffrent runtime. you jsu nee to find teh right setting for all your projects and all use the same
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Very small torques slow down to stop.

Postby Julio Jerez » Tue Oct 19, 2010 1:49 pm

In 2.24 an lower teh SDK libraries were only compiled with rubntime libetry lib_vs9_Mt an dther were in SDK folder
\NewtonWin-2.24\sdk\x32

starting with SDK 2.25 there are two versions: mt and md therefores you find them in folders
C:\temp\NewtonWin-2.25\sdk\x32\lib_vs9_md and C:\temp\NewtonWin-2.25\sdk\x32\lib_vs9_mt alone with the newton.lib static library
make sure you have the right ones.

are you using OgreNewt?
I submited a Patch to fix that by I am gessuing that it was not applied.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Very small torques slow down to stop.

Postby misho » Tue Oct 19, 2010 2:15 pm

Ok - re-installed 2.25 from scratch. The directory

C:\Users\me\Documents\Programming\Newton\NewtonWin-2.25\sdk\x32

Has NO files, and only 4 folders, compared to 8 in 2.24. Can you tell me what files I have to move and where?

no, not using OgreNewt (not sure what exactly that is :) )

Misho
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Very small torques slow down to stop.

Postby Julio Jerez » Tue Oct 19, 2010 2:21 pm

if you are using MT then
lib_vs9_mt
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Very small torques slow down to stop.

Postby misho » Tue Oct 19, 2010 2:51 pm

Ok - I got it. Compiled fine. I tested the problem and I can see the fix, just as you explained. The omega under 0.03 now slowly goes to 0. Given the math constraints, that's fine! I think you can close off this bug :D Thanks, Julio!

Misho
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am


Return to Solved bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron