Hard joint gets an offset over time

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Hard joint gets an offset over time

Postby misho » Wed Sep 12, 2018 6:31 pm

Ok - I mentioned before I work with release_double...

release_double has linker errors as before

Debug/Release compile fine.

I tested the MishosHingeTest on Release and yes, it is performing as I designed it.

To repro:
first, press P and check out the console window: Object Distance: 0.00000
Hold SPACE down for a while, let the bottom object rotate CCW
Press P and check out the console window: Object Distance: 0.00314

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

Re: Hard joint gets an offset over time

Postby Julio Jerez » Wed Sep 12, 2018 6:58 pm

ok try again.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hard joint gets an offset over time

Postby misho » Wed Sep 12, 2018 7:56 pm

Julio Jerez wrote:ok try again.


Ok, great, release_double working!

I tested the MishosHingeTest on release_double and yes, it is performing as I designed it, with the bug reproduced as follows:

first, press P and check out the console window: Object Distance: 0.00000
Hold SPACE down for a while, let the bottom object rotate CCW
Press P again and check out the console window: Object Distance: 0.00314 (or some other value)

There shouldn't be any value to Object Distance, if the hinge was perfectly rigid.

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

Re: Hard joint gets an offset over time

Postby Julio Jerez » Thu Sep 13, 2018 10:35 am

ah I see, when I do what you say I see the tow body drifting yes,
I do not even have to apply the thrusters, if I pick them with the mouse, the drift distant is quite large to be a rounding error.

I see what the problem is, but I do not have time now, I will do this weekend.

One thing I tell you you can't expect that error to be a absolute zero, that's not what a physics simulation promise. what the physics promise is the error to be within some tolerance but that tolerance can't be zero.

there are lot's of non linear procceses involved in the simulation: linear integrator, interactive matrix solver, penalties to reduce error, and discrete time step, and more.
therefore the expectation of zero error, is not reasonable.

But what I see here is definitlly a problem, I do not think is a bug, a bug that big would show in many oeth places already, I think is incorrect settings, but I will find out.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hard joint gets an offset over time

Postby misho » Thu Sep 13, 2018 11:07 am

Julio Jerez wrote:One thing I tell you you can't expect that error to be a absolute zero, that's not what a physics simulation promise. what the physics promise is the error to be within some tolerance but that tolerance can't be zero.

there are lot's of non linear procceses involved in the simulation: linear integrator, interactive matrix solver, penalties to reduce error, and discrete time step, and more.
therefore the expectation of zero error, is not reasonable.


That's perfectly fine - I don't expect zero error, in fact, a slight imperfection adds to the realism in many aspects, so I am quite fine with that.

Julio Jerez wrote:But what I see here is definitlly a problem, I do not think is a bug, a bug that big would show in many oeth places already, I think is incorrect settings, but I will find out.


That's great, I'm looking forward to finding out what it was and having it fixed. At the moment, I do have a function that re-sets all the distances of connected objects to the original positions, and it works quite well, I would just prefer if it was, obviously, adressed within the engine itself. Wouldn't it be possible to implement something similar in the solver/iterator? Basically, at every cycle (or user-definable number of cycles) look up the original positions of the hinged objects and re-set them to that value?

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

Re: Hard joint gets an offset over time

Postby Julio Jerez » Thu Sep 13, 2018 11:15 am

I assume only the core body is support to have the force and torque.
if so, I set teh force and torque call back to the Palylod body to NULL,
that was I can add some debug trace to the force and trque callback. since it will be call onle for one body.

what is so strragne is that the error seem to build up and never get reduced, I have as high as 1.5
and and never go back to a small value, it is as teh joint has a memory.

anyway I will add some changes, to debug better. mainly transfor teh pasion to loca space and see if teh bug is local to one axis.

but that's all the time I have this morning, I will continue tomorrow.
Please keep syncing to let me knwo if I am doing something incorrect according to your project.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hard joint gets an offset over time

Postby misho » Thu Sep 13, 2018 11:25 am

Julio Jerez wrote:I assume only the core body is support to have the force and torque.
if so, I set teh force and torque call back to the Palylod body to NULL,
that was I can add some debug trace to the force and trque callback. since it will be call onle for one body.


No! Every body has forces acting on it. For example, when going through the atmosphere, all parts of the rocket experience drag and restoring torque (if the velocity isn't the same as the longitudinal axis of the body). Also, in my simulator, the core rocket body also has solid rocket boosters attached to it, using the same hard hinges, and they provide A LOT of thrust. Check out the video of my simulator here:

SLS Launch

You will see 3 bodies (rocket core and solid rocket boosters) attached together, each having thrust. They separate at 2:32...

Julio Jerez wrote:what is so strragne is that the error seem to build up and never get reduced, I have as high as 1.5
and and never go back to a small value, it is as teh joint has a memory.


This may give you a clue: Take a look at my post in this thread from Mon Sep 10, 2018 9:33 pm. Basically, when NewtonBodySetLinearDamping and NewtonBodySetAngularDamping are non-zero, the error DOES diminish, very close, but not quite, to zero.

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

Re: Hard joint gets an offset over time

Postby Julio Jerez » Thu Sep 13, 2018 2:05 pm

misho wrote:No! Every body has forces acting on it. For example, when going through the atmosphere, all parts of the rocket experience drag and restoring torque (if the velocity isn't the same as the longitudinal axis of the body). Also, in my simulator, the core rocket body also has solid rocket boosters attached to it, using the same hard hinges, and they provide A LOT of thrust.


Yes I know that, I meant for the purpose of this test, the torque is applied to one of the two bodies.
also I believe I know why this happens, this was working about 6 maybe 8 month ago before
I decided to remove the explicitly calculation of the centripetal acceleration in favor of the time derivative of the Jacobians, there was a bug and I commented out the change but never restored the old code. This is actually a good test case to get that back in the code.

I believe I can get it fix some time today.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hard joint gets an offset over time

Postby misho » Thu Sep 13, 2018 2:19 pm

Excellent, that's great to hear!!

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

Re: Hard joint gets an offset over time

Postby Julio Jerez » Fri Sep 14, 2018 12:09 pm

I played a little this morning, but unfortunately it was not what I thought was going to be.
this goes way back and need to be fixed.

I will work on it this weekend.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hard joint gets an offset over time

Postby Julio Jerez » Fri Sep 14, 2018 2:44 pm

I made some simplification so that I can calculate the results and some fix point.
and compared with the simulation result. and I can see a serious flaw.

mainly I
replaced the shapes with spheres, this make for diagonal inertial matrices,
set the masses to 1. this make a kinematic problem and I applied an initial linear and angular velocity.
replace the hinge with ball and socket, few dof to debug
no torque.

these conditions still reproduce the bug, but now I can write the equation in a piece of paper and get the expected result with a calculator.

and I am frailly alarmed the expected velocity that should deflect the payload body should be
about 14.5 m/s but the solver is calculating 0.56

v(0.000000 0.000000 175.000000)
v(0.000008 -0.569325 175.000000)

the value should be
v(0.000000 0.000000 175.000000)
v(0.000008 -14.569325 175.000000)

Both value seem odd, so I will check the math on paper and the go over and see where is going wrong, at some point I added this bug and went unnoticed.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hard joint gets an offset over time

Postby Julio Jerez » Mon Sep 17, 2018 10:12 am

I did not do anything this weekend.
I am lokkinmg at this and this is a series problem, I am going to revisit all the joints.

I see many thing comment out for long time ago but I do no even remember why I did that
but something seem wrong from some time.
so I will go over from the top and see what is wrong.

This is a good test case.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hard joint gets an offset over time

Postby misho » Mon Sep 17, 2018 1:33 pm

I was just about to ask if you made any progress.
Thank you Julio - Hopefully you can find the solution to this.

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

Re: Hard joint gets an offset over time

Postby Julio Jerez » Mon Sep 17, 2018 2:27 pm

it is going to take a few days to get this working, because I have to comment out all the variables in class dgRightHandSide and start revisiting all the place where they are used.

I have being adding and reusing variable for different supposes for many years and is time the are all re written to have a current meaning. There are even variables with e different names but that seem to serve the same functions,
I have to start with the most basic functionality and go over one it is all working again.

there will be some asserts
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hard joint gets an offset over time

Postby misho » Mon Sep 17, 2018 2:35 pm

No problem, this is not a show stopper, as I said, I have a "remedy" (a fn that periodically re-aligns all joints), but I would sure like to have this working properly, and I am glad you are seriously addressing this.

So, no rush, I can certainly work on other things. Once you're done, we'll hopefully have an ever more awesome physics engine!

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

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 15 guests