Spring-loaded mechanism

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Spring-loaded mechanism

Postby Julio Jerez » Sun Jan 06, 2019 1:02 pm

I posted the fix, teh demo look very jerky even with double, but that's because is really far away.
I guess you graphics system does take care of that.

aside of the jerky motion, the fix seem to work,
key 1 release teh capsule
key 2 release the with the fix is capsule covers

and they work in any order.
Julio Jerez
Moderator
Moderator
 
Posts: 10954
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Spring-loaded mechanism

Postby misho » Sun Jan 06, 2019 2:50 pm

Julio Jerez wrote:I posted the fix, teh demo look very jerky even with double, but that's because is really far away.
I guess you graphics system does take care of that.


Yeah - I don't understand that. Before, when I used demoSandbox, I remember building with "_double" and it fixed the jerkiness. :?:

Julio Jerez wrote:aside of the jerky motion, the fix seem to work,
key 1 release teh capsule
key 2 release the with the fix is capsule covers

and they work in any order.


Sounds good - I will check out the fix ASAP. BTW - I do not use NewtonUpdateAsync(), and quite honestly, I don't understand how multi-threading works. I just call NewtonUpdate(g_world, timestep); on every cycle of my event loop.
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Re: Spring-loaded mechanism

Postby Julio Jerez » Sun Jan 06, 2019 3:41 pm

It has nothing to do with multithreaded or asycnronus updates.
Objects can't be deleted from a call back unless it the post update callback.

You can do it after the newton update returns, but doing in the post update callback, is better.

For example you may want to run at two sub steps, and your simulation improve by a factor of four, and you do not have to make any other considerations.
Julio Jerez
Moderator
Moderator
 
Posts: 10954
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Spring-loaded mechanism

Postby misho » Sun Jan 06, 2019 3:47 pm

misho wrote:The thing is, I don't see the jerkiness in my sim.

If is fine in you app then we do not need to worry about.
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Re: Spring-loaded mechanism

Postby Julio Jerez » Sun Jan 06, 2019 4:19 pm

Upps, I tried to quote that phrase , but instead of quoting I clicked edit, and delete you post.
Sorry about that.

Anyway did you get the impulse going?
If not try edit the demo and reproduce it there.
Julio Jerez
Moderator
Moderator
 
Posts: 10954
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Spring-loaded mechanism

Postby misho » Sun Jan 06, 2019 4:32 pm

Julio Jerez wrote:Upps, I tried to quote that phrase , but instead of quoting I clicked edit, and delete you post.
Sorry about that.


LOL no biggie, here it is again, it let me go back to when I was writing it:

misho wrote:
Julio Jerez wrote:I posted the fix, teh demo look very jerky even with double, but that's because is really far away.
I guess you graphics system does take care of that.


Yeah - I don't understand that. Before, when I used demoSandbox, I remember building with "_double" and it fixed the jerkiness. :?: .


Okay - I am REALLY concerned about this. My graphics system does not take care of anything - it simply puts objects where Newton tells it. The thing is, I don't see the jerkiness in my sim.

I am certain that this jerkiness was fixed previously in demoSandbox. The double should be more than enough to deal with "far" offset value of 6371000.0f. If this is set to 0.0f (so that everything is close to origin), everything is smooth.

Something is not right with this. Can you please take a closer look into it?

Other than that, the demo works well - I will implement the changes needed to properly "break" the hinge. Thanks!

Julio Jerez wrote:Anyway did you get the impulse going?
If not try edit the demo and reproduce it there.


Not yet. I tried again last night, and no movement whatsoever. I reverted back to NewtonBodyAddImpulse() which works well enough, and made myself a note to get back to it. I'll give it a go as soon as I implement the destroy hinge changes. Thanks!
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Re: Spring-loaded mechanism

Postby misho » Sun Jan 06, 2019 5:50 pm

misho wrote:
misho wrote:The thing is, I don't see the jerkiness in my sim.

If is fine in you app then we do not need to worry about.


I was just checking _NEWTON_USE_DOUBLE settings... I came across this and I'm a bit confused: :roll:

dMathDefines.h:
Code: Select all
#ifndef dFloat
   #ifdef _NEWTON_USE_DOUBLE
      typedef double dFloat;
   #else
      typedef float dFloat;
   #endif
#endif


Newton.h:
Code: Select all
#ifndef dFloat
   #ifdef _NEWTON_USE_DOUBLE
      #define dFloat double
   #else
      #define dFloat float
   #endif
#endif


what does this do?
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Re: Spring-loaded mechanism

Postby Julio Jerez » Sun Jan 06, 2019 6:08 pm

but why do you worry about that? that's some rendering graphic issue,
it has nothing to do with physics. all the calculation are in double when building in double.
Julio Jerez
Moderator
Moderator
 
Posts: 10954
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Spring-loaded mechanism

Postby misho » Sun Jan 06, 2019 6:11 pm

Julio Jerez wrote:but why do you worry about that? that's some rendering graphic issue,
it has nothing to do with physics. all the calculation are in double when building in double.


Oh - okay! If it is the graphics side of demoSandbox, then all good! :wink:
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Re: Spring-loaded mechanism

Postby misho » Tue Jan 08, 2019 4:12 am

Julio Jerez wrote:Anyway did you get the impulse going?
If not try edit the demo and reproduce it there.


I got it going last night. Here is where the "problem" was: Basically, the only diff I found between the two functions was the magnitude of the parameters:

Code: Select all
NewtonBodyAddImpulse(body, &LinearImpulse[0], &dvOffset[0], timediff);
NewtonBodyApplyImpulsePair(body, &LinearImpulse[0], &AngularImpulse[0], timediff);


To make it work with NewtonBodyApplyImpulsePair(), I had to scale up the LinearImpulse by a factor of 100, and scale up the AngularImpulse by a factor of a 1000 to get similar results (I used AngularImpulse values for dvOffset parameters, so I shouldn't be comparing the results for spins as they are implemented differently). Obviously, the parameters passed in are different - one probably takes mass into account, and the other doesn't... or something like that? :roll:
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron