Rigid CustomHinge

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Rigid CustomHinge

Postby misho » Sat May 27, 2017 4:01 am

I have a case where I am connecting 2 or more objects using CustomHinge, with the following parameters:
Code: Select all
pHinge = new dCustomHinge(mSourceMatrix, sourceEnt->nBody, targetEnt->nBody);
pHinge->EnableLimits(true);
pHinge->SetLimits(0.0, 0.0);


While this is working fine, and the objects are rigidly attached, I am noticing that, while before attaching, both objects had absolutely no rotations (omegas) around their axis, and as soon as I link them using the above hinge, they are introduced to a minute amount of rotations: (this structure is orbiting Earth at orbital velocities and altitudes)
Image

These rotations get progressively worse and the whole structure starts to wobble and shimmy.

If I break the link (detach the objects), the omegas freeze at a value they were at when they were detached. I can zero out the omegas and they stay there, until I re-attach the objects, at which point the omegas start to increase again.

Any idea what I am doing wrong?

A while ago at one point I was asking similar questions, and Julio suggested that I should collect them into a skeleton for a more stable structure. I did that and it was marginally better, but since I upgraded to the newest build, I noticed that the skeleton implementation has changed drastically and now it seems to be implemented internally (or at least there are no examples in the sandbox).

Also, there was suggestion that, rather than linking the bodies, I should collect them into a compound collision. However, I am unsure if such a structure carries over mass/inertia properties of bodies associated with collisions so that the whole structure is assembled with the correct collective mass/MOI. I peeked into ArticulatedJoints demo but the vehicles are rather complex and not quite what I need.

I would prefer to keep the NewtonBody + RigidHinge set up that I have right now because it seems more intuitive to me (and I've been working with it for a while) but it needs to be stable, rigid, and still. Any idea how to accomplish that?
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Rigid CustomHinge

Postby Julio Jerez » Sat May 27, 2017 9:30 am

the rotation is actually quite low, so low that in any simulation that will be considered an actual zero.
there are few thong that could be done.
one been using a rigid compound collision, but you do not want that.

My guess is that this residual angular velocity is noise on the joint penalty that this is produced not but the joint solver but by the integration process.

the penalty acceleration is proportional to the separation and the relative velocity, but the error
there is so small that not matter how large the proportionality of correct is, it can not zero the error.
these constant are hard coded, and they are quiet sensitive.
#define DG_VEL_DAMP (dgFloat32(100.0f))
#define DG_POS_DAMP (dgFloat32(1500.0f))

if this the case, maybe the solution is to make a joint that measure the error and change them in a call back.

Can you serialize a scene with the two objects jointed and then try it in the sand box, then send them to me for debug? maybe I can see what could be done.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Rigid CustomHinge

Postby misho » Sat May 27, 2017 1:42 pm

Hi Julio,

If by serialisation you mean isolating my setup and creating a simple scene that will compile in a sandbox framework, sure, I can do that! I use double precision so you will have to work with VS_2010 version.

BTW, in the current lib version (or, at least early April when I downloaded mine), gravity was set to zero:

#define DEMO_GRAVITY -0.0f

This might confuse some newcomers :mrgreen:
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Rigid CustomHinge

Postby Julio Jerez » Sat May 27, 2017 2:41 pm

no you call function SerializeToFile ("filename.bin");
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Rigid CustomHinge

Postby misho » Sat May 27, 2017 4:04 pm

Julio Jerez wrote:no you call function SerializeToFile ("filename.bin");


Sounds good - here it is.

I used
Code: Select all
NewtonSerializeToFile(scene->GetNewton(), "OrbitalScene.bin", NULL, NULL);
Not sure what the last two parameters are for (I guess to isolate a particular body), let me know if this doesn't work. I tested it on my end and it works fine, except camera seems not to be the part of serialisation, so it is in the default position/direction.
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Rigid CustomHinge

Postby misho » Mon May 29, 2017 4:37 pm

Hi Julio, have you had a chance to look at the bin file?

I found a solution to something else I noticed, but I didn't bring it up here before checking if it was something I was doing - and it was :mrgreen:

I've noticed that when I construct orbital structures from components (newton bodies with collisions), sometimes I "jam" a component that is actually slightly too large to fit into a predesignated point, and it bumps into surrounding objects. The objects get linked nonetheless, and (staying linked) they are constantly in contact, perhaps even overlapping each other, and this introduces large random oscillations in the structure.

Is there a method that notifies me instantaneously of this interference so I can prevent the linking?
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Rigid CustomHinge

Postby Julio Jerez » Thu Jun 01, 2017 2:07 pm

Oh, Loaded and I run fine, but I did not have time to step in. lot stuff happen with me now.
I will check it tonight.
I believe I think what happen but I need to verified.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Rigid CustomHinge

Postby misho » Thu Jun 01, 2017 5:14 pm

Thanks!

if it helps a little, I did a bit of further experimenting, and the serialised scene I sent you does indeed have no omegas if I let it alone.

If I "wiggle" it a bit, it has omegas that, as I steady the structure (by repeatedly clicking on the object so as to "grab" it in effect), slowly diminish and zero out (WITH AutoSleep ON),

Or, they diminish to zero but much more slowly with AutoSleep OFF.

So - I thought, it may be the force (which is OFF for this setup, so completely zero gravity)... so Instead of implementing gravitational radial force vector and spinning this object at constant orbital velocity in sthe serialised scene, I turned gravity OFF in my space simulator. Result: the objects were indeed at complete zero omegas.

So, my guessplanation :mrgreen: is, as the two bodies are in orbit, they both occupy slightly different point in space, and since the only 2 identical orbits are the ones at the exact same location and time, the two bodies will always have slightly different velocities (since they have slightly different locations), and, being linked, they will constantly "tug and wrestle" through the rigid joint, and perhaps, that's where the slight omegas are manifesting.

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


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 15 guests