[SOLVED] bouncing on joints = EXPLOSION

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: bouncing on joints = EXPLOSION

Postby blackbird_dream » Mon Apr 23, 2018 11:25 am

here I modify the FLT demo. I added 2 colliders at the fork's front.
The colliders are chassis' children and updated realtime in function of the mast configuration (tilt,lift,translate,expand):
https://youtu.be/jV-eDueNeXA
the wall impact is more realistic but this is just last resort unfortunately.
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: bouncing on joints = EXPLOSION

Postby Julio Jerez » Mon Apr 23, 2018 1:30 pm

JernejL wrote:If you mean the listener functions there is no pre-forcetorque callback function, i cannot find that.


no there is no pre-force callback, a listener has two callbacks, one call before physics and collsion and one called after physic an collision.
look at the exmapel in the sandbox
Code: Select all
DemoListenerBase::DemoListenerBase(DemoEntityManager* const scene, const char* const listenerName)
{
   NewtonWorld* const world = scene->GetNewton();
   void* const listener = NewtonWorldAddListener (world, listenerName, this);

   NewtonWorldListenerSetDestructorCallback (world, listener, Destroy);
   NewtonWorldListenerSetPreUpdateCallback (world, listener, PreUpdate);
   NewtonWorldListenerSetPostUpdateCallback (world, listener, PostUpdate);
   NewtonWorldListenerSetBodyDestroyCallback (world, listener, OnBodyDestroy);
}


you can set any of them of both.
The force an torque call back is a special function that does more than just get the forces. if check
for the state of the body, and if the body was teleported, or if is was sleep and, plus other things I do no remember. It is more than a listener.

a Lister is for grouping objects hat share similarity, say a vehicle manage, a player controller, triggers, etc. They provide function call that would nice with the engine.
for example in your case, if you plus all you vehicles is a listener, the in the predate you can iterate over all vehicles in the listener list and apply the same vehicle functionalism stuff using the rigid body and joint interface.
Lister can be use for other thing as well, but that a different issues.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: bouncing on joints = EXPLOSION

Postby Julio Jerez » Mon Apr 23, 2018 2:00 pm

Ok guys I spend the week end comparing 3.14 to 3.14 and I found tow serius bug.
the first one is thios

Code: Select all
   DG_INLINE dgBigVector(dgInt32 ix, dgInt32 iy, dgInt32 iz, dgInt32 iw)
   {
      dgInt64 x = ix;
      dgInt64 y = iy;
      dgInt64 z = iz;
      dgInt64 w = iw;
      m_typeLow = _mm_set_pd(*(dgFloat32*)&y, *(dgFloat32*)&x);
      m_typeHigh = _mm_set_pd(*(dgFloat32*)&w, *(dgFloat32*)&z);
   }


_mm_set_pd was suppose to set a 64 bit mask, but in 32 bit is make a 31 bit mask.
this introduced a subtle problem for the Collison system, because in 3.13 there where two versions of each relevant function one in float and one in double, but is 3.14 there is only one version and the double vector class is SSE2, when I compared results with 3.13 in some case the result were different
when there were suppose to be identical.
It is fix now but I forget to sync after I committed. I will do it tonight.

The second bug is with the solver for contact joints. IN 3.14 I was experimentation with SOR Gauss Sidel but that is a huge mistake if you are doing a fix number of iterations.
The reason is that for an SOR factor 1.3 the verify few iteration the error actually increases, because the values is an extrapolation the is suppose to reduce the residual of other valuable as the risk of increasing the residual of the current variable. since the correction is proportional to the residual the help a lot when the residual are already small. but for that you nee to do a unlimited number of passes because ether first passes you know the residual will go up. It is a classical overshooting problem.
It work grate for the joint solver, but is really bad for the contact solver, so I made the SOR 1.0 again.

I will commit these to fixed tonight, I am no sure if this is the reason for the crashed but this is a serious problem, so after I commit it tonight let us sync and see how it behaves.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: bouncing on joints = EXPLOSION

Postby blackbird_dream » Wed Apr 25, 2018 7:28 am

Thks for your work and the time passed on debugging.
I've uploaded the latest build (https://github.com/MADEAPPS/newton-dynamics/commit/ccc4f2dc1d9128e9216f99621041be475e849ab3)
It did not solve the issue.
See here the impact through the joint (huge and abnormal bounce) :
https://www.youtube.com/watch?v=c76UyksFStk
and here the impact onto the main body :
https://www.youtube.com/watch?v=QQBbRZiL-j4
correct bounce
see video comments for detailed description of the test

I'm not sure this is a Newton bug , maybe the Unity plugin is responsible for this

Maybe some informations of interest :
I'v tested the effect of different solver's parameters :
worker threads : no effect
solver iteration count : some effect (increasing it from 1 to 10 lower the immoderate bounce by 40%)
update rate : no effect (slow down the simulation but doesn't change the bounce magnitude)
nb of sub-steps : slight effect

One more remark ; the bounce brings the vehicle back beyond its initial position despite the forward force is constantly and permanently applied. Definitely that is not physical.
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: bouncing on joints = EXPLOSION

Postby blackbird_dream » Wed Apr 25, 2018 9:16 am

here is a test made by Dave with the latest build implmeented in his engine :
He switched the solvermode between 1, 4 or 8:
he got similar results as mine, too big bounces in comparaison with no joint :
https://youtu.be/sw3WF16JI_s
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: bouncing on joints = EXPLOSION

Postby Dave Gravel » Wed Apr 25, 2018 9:47 am

The last build for me is better and seen to have fix some problems.
I need to tests more but I can see a difference.

Thanks.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: bouncing on joints = EXPLOSION

Postby blackbird_dream » Wed Apr 25, 2018 9:57 am

config 1:
Image
here the test :
https://www.youtube.com/watch?v=QQBbRZiL-j4

config 2:
Image
https://www.youtube.com/watch?v=c76UyksFStk

But the 2 demos should behave exactly the same
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: bouncing on joints = EXPLOSION

Postby Julio Jerez » Wed Apr 25, 2018 2:12 pm

I suppose the second video is the one really bad. that some how show up in some of the latest version of 3.14

I am working on merging 3.13 and 3.14 to find out when the bug happens. I am sure I can probable ass some code changes and get it to work, but that will only hide a fundamental bug.

I am far alone in the merge process and I found some problematic bugs. I already merge the collision system, the low level math, and most the solver. a few more days and I will back on these issues.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: bouncing on joints = EXPLOSION

Postby blackbird_dream » Wed Apr 25, 2018 2:35 pm

yes. The second is not correct. The 1rst one is the true reference.
I am conscient that is a huge task for debugging such an engine. I am patient because I know what you are capable of.
I am sorry I can't help you.
My contribution is only raising some issues.
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: bouncing on joints = EXPLOSION

Postby blackbird_dream » Thu Apr 26, 2018 9:26 am

just for information, the same test performed with NGD 1.5 :

impact on CompoundCollision:
https://www.youtube.com/watch?v=H5pbiN-XWM8

impact on sliderjoint:
https://www.youtube.com/watch?v=H7ZSpEzfKG4
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: bouncing on joints = EXPLOSION

Postby Julio Jerez » Thu May 03, 2018 2:40 pm

I made good progress in merging 3.13 and 3.14, and I believe I found the major bug that was causing the problem.

I have no merge back into github yet, but I am right this will be the last weekend doing the merge and we will be back on schedule.
there were few minor bug and one very big one.

as soon as that is merged, I will gupdate the Unity plugin in and check what up with your demos.

Hey sweenie, here is a very challenging gyro demo


I tried to make that before and I could not get it to work, because I could no get a smooth primitive that can be clip and hollow it out.
moving the com does not works, because path of the trick is in the shape, as the body tunr the is a point when t he stem hi the ground but using a sphere prevent that form happing, and making the stem longer does not trigger the effect.
Tippe Tops has a narrow range of operation.

This time I will try by modeling the shape with a convex hull of high resolution and see if that works.
No guarantees it will by I have high hope.

This Sweenie is the graduation, is we get to works we can say the engine is a full simulator tah doe no cut corners.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: bouncing on joints = EXPLOSION

Postby Julio Jerez » Mon May 07, 2018 12:02 pm

Ok, I believe I now covered all the major differences with 3.13
It seem the bug with the joint came about when I took out the gyro derivatives from the joint classes.
I now made two changes.
1 the gyro derivatives are calculated by the solver, not by the joints. My change was a mistake because tread joint differently. Now is all consistent.
I got the contact fixed to match this change, and I will revisit the bilateral joint.
2 experimentally removed the angular velocity cap. This goes with the philosophy of moving toward more corretness, and leaving all the baby sisting to the end user.

With this change now all the rigid body forces are taking into account, centripel, coriolis, and gyro forces should all emerge natural from the simulation without major tweaks. Ok course extreme values are always problematic, but now those can be solve by shorter time step which we leave on the client app too.

There is not time step capping either.
In a way newton 3.14 is harder to use than previous version, but out justification is more simulation accuracy.

One the positive side newton 3.14 is way faster than 3.13 in some test this is up to 10 time faster. All the assumption I made were correct, the error I made was not coming the result with previous version to make sure error do not creep in unnoticed.

I am not going to update the unity plug in and see what is wrong.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: bouncing on joints = EXPLOSION

Postby Julio Jerez » Mon May 07, 2018 3:19 pm

I just fixed another bug.
Now a very subtle behavior that you really, really need to be a physic nerd to notice.
That the phitop behavior and the regular gyro top.

before it was doing the expected behavior but to 100%, I say maybe about 60 or 70% and that bothered me.

let start with the norm gyro top. The gyro top was expect to process in place.
but it was not doing that. now it does.
The explanation is that the contact produce a for and a toque to keep the but form interpretation.
the gyro torque counter the contact torque and the need torque is approximately zero.
The friction contact force generates a size torque that offset the processing center of rotation, but is the inertia is set such that the friction does no overcome the static friction, the the pivot should not move at all.
This is the first time Newton can recreate this behavior, because the gyro torque arte now unconditional part of eth solver and the integrator. before they where part of the integration only.

The phi Top, is one the seem to violates the law of physics, but is does not, when the oval is spinning the of the contact point is offset for the com, it generate a friction, the friction torque drain some angular some kinetic energy for the spinning body, because the but the total energy has to be conserved, therefore the cent of mass moves up.
it keep moving up until the whole body spin around an axis where the motion does no generate any torque. this is an incredibly remarkable result that goes beyond my highest expectation. :mrgreen:
I let physics girl explain


ok now to the elusive tippy top.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: bouncing on joints = EXPLOSION

Postby Julio Jerez » Mon May 07, 2018 5:23 pm

Ha an another emerging behavior is that the flywheel rise up, which at first I thought there was a bug because it seem to gain energy.
In reality the other demo was wrong.
we are use to see Gyro using actual bicycle wheels that processes for a while and the topple down because the high lose of angular momentum due to air drag,
If you use a heavy Gyro with little friction and you spinning it for a long time.
we will see that it in fact rises up. This is because in the ascent of friction the torque that makes the wheel process, also add angular velocity, therefore the processing axis is reduced in order to conserve angular momentum.
Her professor Michel van Biezen demonstrated with an real Gyro


I love this :mrgreen: :mrgreen: :mrgreen:
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: bouncing on joints = EXPLOSION

Postby Julio Jerez » Mon May 07, 2018 5:35 pm

blackbird_dream and David, what app are you using to test this?
I am now ready do debug the bug.
When I see the videos, my impression was that the was in Unity.

if this is not unity, can I have a Repro demo that link to the newton DLL so that I can debug it?
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 19 guests