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 Julio Jerez » Mon Sep 10, 2018 2:43 pm

ok try to make the repro,
but on this, and I believe I disused this before.
No, I don't think this was ever working, but I started to notice it recently, as I am performing full-length real time launches (small offset causes a small torque which, during long engine burn, becomes cumulative and very prominent). Not sure what you mean by "bad rows"...


bad rows in a linear system of equation is a row that make the soliton unstable.
basically a the system is linearizes and has the form

Y' = A * y + B * u

where A and B are positive semi finite matrix , you can determine the system stability be makin sure that the gienevalues of the matrix A are all positive an smallest the 1.0

when a system is unstable them matrix B is usually a diagonal matrix introduced to make sure that any rows with any potential larger the 1.0 engine value is made smaller that one.

but that is quiet technical, but is the job that people who design control system do all the time.

assuming the system is fine, what kind of control you have in the system? the way you test that is that you place you system in any steady stable trajectory and you apply some perturbation, if the system recover the it is stable and Seoul cope with any small misalignments.
if it does not recover the you nee to check if the system is unstable meaning is doe no have any equilibrium point, and is no is just a bad design. if is recovers the it mean you can add some control system. example of that are fling wing, and rockets, over steering race cars they are all unstable without a control system.

anyway can you make the repro, let us see what is wrong first.
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 10, 2018 2:46 pm

EDIT] LOL I just realized that you, dear sir, have included MishosRocketTest.cpp in your demosSandbox project. Not a big deal, although your users will wonder who Misho is and why it doesn't do anything, since the thrust interface is missing from the PhysicsUtils.cpp

about 1/3 of the demos are bug reports from one user or another, I try not to expose anything that is personal of intellectual property. but is hard to fix bugs without a way to reproduce them.
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 10, 2018 10:05 pm

Julio Jerez wrote:about 1/3 of the demos are bug reports from one user or another, I try not to expose anything that is personal of intellectual property. but is hard to fix bugs without a way to reproduce them.


Oh, I am not worried about IP at all, quite the opposite, I am glad I can contribute to polishing up the code. :mrgreen:
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 misho » Mon Sep 10, 2018 10:17 pm

Julio Jerez wrote:assuming the system is fine, what kind of control you have in the system?


If you're asking me if the system is stable, then yes, I don't see any instability in the motion. The rocket assembly is steadily climbing through the atmosphere without any instability. As far as the control system, I have a rocket thrust with vectoring capability (as in real rockets, the engines can gimbal in pitch and yaw directions) The rocket is penetrating through fluid (air), and I have a "restoring force" in place (the force that keeps rocket going through fluid with the least resistance, i.e. head on). If I introduce a disturbing, unbalanced force (as in, change the thrust vector to an off-longitudinal direction), the rocket will "fight" and try to get back to the path of least resistance, which is correct behavior. In space, where there is no fluid, it can go any direction it is "pushed", since there is no restoring force acting on it.

Julio Jerez wrote:anyway can you make the repro, let us see what is wrong first.


I now have the demo ready... as before, small changes to 3 files. I forgot, how did I send you the files first time around?
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 misho » Mon Sep 10, 2018 10:33 pm

Dave Gravel wrote:Maybe it don't have any relations with your problem but you can give it a try.
Try to set the body with zero NewtonBodySetLinearDamping and zero NewtonBodySetAngularDamping.
If you already use it, try without.


Thanks Dave! Interesting thought. I did try it, with linear and angular damping values of 0.2:

  • As I apply the torque, the offset increases
  • As I stop applying, and as the rotation slows down to zero (because it is dampened), the offset DECREASES, and ALMOST makes it back to 0 (but not quite)

I won't be able to use this because objects in space, set into rotation, keep rotating forever, they never slow down and stop (which is result of damping). But perhaps it can give Julio a better clue of what is going on...
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 » Tue Sep 11, 2018 8:46 am

just put the affected file in a .zip file and upload it to some free file transfer system.
I think google dropbox is good for that.
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 » Tue Sep 11, 2018 1:08 pm

Sounds good, here it is:

MishosHingeTest.zip

Install instructions - 3 cpp files:

MishoRocketTest.cpp: replace old file with this one. There is a new scene MishoHingeTest setup in there

PhysicsUtils.cpp: there are 2 sections demarked with "Misho added", basically added functionality around PhysicsApplyGravityForce. Add those in.

DemoentityManager.cpp: there are a few lines demarked with "Misho added" that basically add this demo to the demo menu, and make it default. Add those in.

Usage:

When you run the demo, you will see two cylinders, in ZERO G, large at the bottom, and small at the top. They are 60 and 10 long respectively, and the contact point is at the 0,0,0 coordinates. They are therefore 35 units apart, and perfectly aligned. They are joined by a "hard" hinge, with settings as described earlier in this post. Also, there should be a console window opened along with the main demo window.

If you press "P", in the console window you will see a bunch of lines with "Object distance" readout showing 0.0. I subtract 35 from the calculated distance (35 being a nominal distance) so only the "error" will show up in this readout. Effectively, "object distance" in this context is the physical separation between 2 objects, and since they are in contact and perfectly aligned, this distance is 0.0.

Next, press spacebar. This will give the bottom object a bit of torque in Z axis, and it will start to rotate CCW, and the attached top object along with it.

Press "P" again, You will observe that the distance between objects now has a positive value, therefore, the objects have separated, still being linked with a hard hinge. The more you rotate, the more of a separation is observed...
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 2:06 pm

I merge you demo, with the sandbox.

I copy the force and torque callback in you demo rather that modify the generic one that apply gravity.

the only thing left to do is go to each place that you crate a rigid body and override the force and torque callback, with yours.

can you sync and verify the merge is correct, before debug the problem?
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 2:28 pm

Hi! Ok, I took a quick look:

You decided to change MishosRocketTest() instead of using MishosHingeTest()... ok, but I'd prefer you didn't, because you missed one VERY important block of code, everything under:

// Lock these two bodies with a hard hinge...

Instead of editing MishosRocketTest(), why not rename it to MishosRocketTest_OLD(), and renaming MishosHingeTest() to MishosRocketTest() ? Far less prone to omissions :wink:

Let me know when you correct these, and set the force and torque callback please!

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 3:36 pm

I did not change either of the two test
void MishosRocketTest(DemoEntityManager* const scene) or
void MishosHingeTest(DemoEntityManager* const scene)

I simple pasted the force and torque call back at the top so that it does not affect other demos.
which of the two demo is the one I should debug? I presume MishosHingeTest

Is changed to MishosHingeTest now, is that ok?
if that is ok we can delete the old RocketTest, since is not needed.

once is all set I debug it later.
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 3:49 pm

Hm :?: Sorry I must be seeing things :roll:

Yes, MishosHingeTest(DemoEntityManager* const scene) is the scene to test...

BTW, I'm testing this with release_double.

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 5:19 pm

ok I commented out the old repro, and assigned the force and torque call back at the top of the file.
can you sync and try it, tell me if this is what you intended, and if it reproduces the bug?

when I hit the pace bar I do no see anything happening,
when I hit P I see some motion but I cant tell is this is expected of not, so far I see the while thong acting as a single body.
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 5:29 pm

OK, I'll give it a go.

To repro, you have to HOLD the spacebar to give the torque a chance to spin the object.

P is for reading the output (distance) value in the console window.
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 misho » Wed Sep 12, 2018 5:39 pm

Hi - ok, tried to build demo Sandbox, I have 4 unresolved externals in SingleBodyCar:

16> UserPlaneCollision.cpp
16>SingleBodyCar.obj : error LNK2001: unresolved external symbol "public: virtual class dVehicleChassis * __thiscall dVehicleManager::CreateSingleBodyVehicle(class NewtonCollision * const,class dMatrix const &,double,void (__cdecl*)(class NewtonBody const * const,double,int),double)" (?CreateSingleBodyVehicle@dVehicleManager@@UAEPAVdVehicleChassis@@QAVNewtonCollision@@ABVdMatrix@@NP6AXQBVNewtonBody@@NH@ZN@Z)
16>SingleBodyCar.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall dVehicleChassis::PreUpdate(double,int)" (?PreUpdate@dVehicleChassis@@MAEXNH@Z)
16>SingleBodyCar.obj : error LNK2001: unresolved external symbol "public: virtual class dVehicleChassis * __thiscall dVehicleManager::CreateSingleBodyVehicle(class NewtonBody * const,class dMatrix const &,void (__cdecl*)(class NewtonBody const * const,double,int),double)" (?CreateSingleBodyVehicle@dVehicleManager@@UAEPAVdVehicleChassis@@QAVNewtonBody@@ABVdMatrix@@P6AXQBV3@NH@ZN@Z)
16>dNewton.lib(dNewtonTransformLerp.obj) : error LNK2001: unresolved external symbol "public: class dQuaternion __thiscall dQuaternion::Slerp(class dQuaternion const &,float)const " (?Slerp@dQuaternion@@QBE?AV1@ABV1@M@Z)
16>../../Win32\demosSandBox.exe : fatal error LNK1120: 4 unresolved externals
========== Rebuild All: 15 succeeded, 1 failed, 0 skipped ==========
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:12 pm

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

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 14 guests