Continuous Collision crash after Newton 2.36 to 3.04 upgrade

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: Continuous Collision crash after Newton 2.36 to 3.04 upg

Postby Julio Jerez » Mon Apr 08, 2013 1:16 pm

ok I just pasted that code in the demo and I see the explosion right away.
It explodes even when only two box are place in the world, what is weird is that, I do not get any assert or anything.

I also see that it is the CCD that causes to crash; I suspect there is still a bug in the calculation of the derivatives, and I think what know where it is. I will verify that tonight.

Thanks for the reproduction demo
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Continuous Collision crash after Newton 2.36 to 3.04 upg

Postby Julio Jerez » Tue Apr 09, 2013 8:42 am

all right Joe the derivative for CCD are all correct now, try again please.


now if we can find a way to reproduce the case were the assert happen in the collision, the I think the system will be very robust.
In the test I saw it happen once, the problem is that since the collision is an initial condition problem, when the bug happen, the chances that happen again by call the same function again is very small.

The assert should not crash not, basically this happen when tow convex shape touch each other, at zero penetration.
when the happen the function that calculation distance terminate with a tetrahedron, but if the tetrahedron is degenerated the what the function that calculate penetration can fail.
Many time is does recover but there are pathological case.
I need to add a replay mode to that demo so that when the bug happen, we can run it again a make happens again the exact same way.
but the first thin we have to do is make a test that can generate the assert more frequent.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Continuous Collision crash after Newton 2.36 to 3.04 upg

Postby JoeJ » Tue Apr 09, 2013 11:08 am

In my app it's very easy to get the assert in CalculateAngularDerivative (You did not mean the Minchovski one ?)
See code below to reproduce in sandbox.
It happens each time i pick up a body and touch the floor with it.
If i disable the assert, single bodies don't go wrong but performance drops (debug), but ragdoll does a usual (visible) explosion.

I hope you can avoid the work of a recording debugger :)
I did that once - it was powerful but i failed to keep it working when project grew bigger.


Code: Select all
#elif 1

   // provoke assert in CalculateAngularDerivative

   NewtonBody* body = BuildBox (scene, 1.0f, dVector(0,3,0), dVector (4,4,4));
   CustomKinematicController *kj = new CustomKinematicController(body, dVector (0,3,0));
   kj->SetMaxLinearFriction (1000);
   kj->SetTargetPosit (dVector (0,0,0));
   NewtonBodySetContinuousCollisionMode (body, 1);
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Continuous Collision crash after Newton 2.36 to 3.04 upg

Postby Julio Jerez » Tue Apr 09, 2013 11:20 am

JoeJ wrote:If i disable the assert, single bodies don't go wrong but performance drops (debug), but ragdoll does a usual (visible) explosion.[/code]

are you saying that the previous code, the change of 5 boxes is still exploding?
I checked in a solution for that, please try sync and try again, it should not explode.

I was talking about the assert in the minkousky function.
I also pasted the last script and that one has an assert on the angular partial derivative, I put an assert there to check when it occur, I removed and check it in now
please sync again and see if works now.


about the replay, yes I know it is hard to make a reliable replay, I do it for some hard to find bug or hard to debug features,
but I do no mean replay as a feature, just a debug hack.
I added to the Vehicle and the Player, and it is very useful for debugging.

The pick joint is more difficult because the keystruck is collected at Main window time, therefore I will have to change the loop a bit.
If can do it, if I know that I can reproduce that Minkosky bug on a simples scene.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Continuous Collision crash after Newton 2.36 to 3.04 upg

Postby JoeJ » Tue Apr 09, 2013 11:39 am

I did the sync, but i'll do again and delete old stuff to be sure.
I did not talk about the 5 boxes, but my own app.
The exploding ragdoll makes me worry - that did not happen before, i'll do mor testing...

Meanwhile i got template to provoke the Minchovski bug.
It should happen after 1 second, when 2nd. box should come to rest.

Code: Select all
#elif 1

   // provoke Minchovski assert

   NewtonBody* body = BuildBox (scene, 1.0f, dVector(0,2,0), dVector (4,4,4));
   NewtonBodySetContinuousCollisionMode (body, 1);
   body = BuildBox (scene, 1.0f, dVector(0,8,3.995f), dVector (4,4,4));
   dVector t (0.0f, 0.1f, 5.0f);
   NewtonBodySetOmega (body, (const float*)&t.m_x);
   NewtonBodySetContinuousCollisionMode (body, 1);

User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Continuous Collision crash after Newton 2.36 to 3.04 upg

Postby Julio Jerez » Tue Apr 09, 2013 11:53 am

awesome I pasted the code and the assert happen every time.
I can debug with this, I am late for work now, I do it tomorrow

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

Re: Continuous Collision crash after Newton 2.36 to 3.04 upg

Postby JoeJ » Tue Apr 09, 2013 12:05 pm

After syncing again the issue remains. It's clear that CCD affects joined bodies very badly and leads to explosions (no asserts).
I'll try to modify the snake template to reproduce that...
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Continuous Collision crash after Newton 2.36 to 3.04 upg

Postby Julio Jerez » Tue Apr 09, 2013 12:18 pm

you said you have your own joints, you need to detect if the in the callback if timestep is zero.
if it is zero, the places you use the invTimeStep will generate an explosion.

Basically for an impulsive iteration you need to override any powered joint with the relative velocity.
do no try to align the different in positions.

If you do not find it, maybe now that you underneath the sanbox code a lithe better, do you thing you can add a ragdoll demo, as a new demo that expose this bug,
and I add that as one of the demos.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Continuous Collision crash after Newton 2.36 to 3.04 upg

Postby Julio Jerez » Tue Apr 09, 2013 1:34 pm

I was running the set of conecetd bixes in debug, and I see what you mean about the peroformece hit when CCd is on, one an array of articulated bodies.
I think that one solution is to add what I has in core 2.00 whi is that CCD is dynamics, besacially is will only keeps in if the island has a potencial for penetration.
For example this case is obvius that teh bodes will not tunel, thererefore a simpel test on teh ilnad can be execited to see if CCD is needed.
I will see into that after we get all these bug fixed.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Continuous Collision crash after Newton 2.36 to 3.04 upg

Postby JoeJ » Tue Apr 09, 2013 3:32 pm

you said you have your own joints, you need to detect if the in the callback if timestep is zero.
if it is zero, the places you use the invTimeStep will generate an explosion.


I've already done that and disabled powering, also the pick is force based.
Maybe there's something wrong with my ball socket / limit joints (no timestep used there)... actually i don't have a clue.
I may ask later for what do you mean with 'do no try to align the different in positions.' - seems unrelated at the moment.

I started to replicate in sandbox now and came up with another Minkovski case -
I think it's not as useful, but code below if you need.

Julio Jerez wrote:do you thing you can add a ragdoll demo, as a new demo that expose this bug

You mean powered? That's some work and requires balancing 'keeping some of my secrets' vs. 'show your engines possibilities'.
I thaught about it and remembered how impressed i was when i saw the spider video some guy posted on your forum.
Spider requires only very simple AI for movement so the demo keeps small, while showing all necessary stuff to setup powered ragdoll physics.
Something cool should be added to show that's not just some kind of procedural animation. I have some ideas...
I'd also need to add powered cone twist and hinge to joint lib, and that remembers me about something.
The deal i offer you is: You do the powered rotation joint, and i'll do the demo... What do you say?




Code: Select all

// noot so good Minkovski example
   dVector p (0,30,-12);
   NewtonBody* body[2] = {0, BuildBox (scene, 1.0f, p, dVector (4,4,4))};
   NewtonBodySetContinuousCollisionMode (body[1], 1);

      CustomKinematicController *kj = new CustomKinematicController(body[1], p);
   kj->SetMaxLinearFriction (1000);
   kj->SetTargetPosit (dVector (0,5,0));
   NewtonBodySetContinuousCollisionMode (body[1], 1);

   for (int i=0; i<4; i++)
   {
      p[1] += 6;
      body[i&1] = BuildBox (scene, 1.0f, p, dVector (4,4,4));
      NewtonBodySetContinuousCollisionMode (body[i&1], 1);
      dMatrix matrix (GetIdentityMatrix());
      matrix.m_posit = p + dVector(0,-3,0);
      new CustomBallAndSocket (matrix, body[!(i&1)], body[i&1]);
   }
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Continuous Collision crash after Newton 2.36 to 3.04 upg

Postby Julio Jerez » Tue Apr 09, 2013 5:08 pm

Ok, let me fix those collsion bug wi the mink stuff.
The I can make a ragdoll demo with using the newer power joint using small angular approximation version of the 6dof joint
then from ether let us see hwo we can find that explosion bug.

does the system explode when you do not enable CCD?
if it does not then set to no CCD until we get the Minkosky bugs fixed.


I do not thonk I'd seem the balacing ragdoll runnig, do you have videos?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Continuous Collision crash after Newton 2.36 to 3.04 upg

Postby JoeJ » Tue Apr 09, 2013 5:37 pm

Ignore the explosion for now - they don't happen if CCD is off, but also they don't happen in sandbox.
I've disabled everything except the point to point constraint in my app.
Actually i set multiple joints to one parent body in sandbox. I don't have idea what else could be different.
Doing so i found another Minkovski. It's different so maybe iteresting, but note that i accidently create lots of bodies penetrating each other.

Code: Select all
// provoke another kind of Minkovski

   dVector center (0,30,-12);
   NewtonBody* parentBody = BuildBox (scene, 1.0f, center, dVector (4,4,4));
   NewtonBodySetContinuousCollisionMode (parentBody, 1);

      for (float a = 0.0f; a<3.14; a+=0.2)
   {
      NewtonBody* body[2] = {0, parentBody};
      dVector dir (cos(a), 0, sin(a));
      dVector p = center;
      for (int i=0; i<4; i++)
      {
         p += dir.Scale(5.0f);
         body[i&1] = BuildBox (scene, 1.0f, p, dVector (4,4,4));
         NewtonBodySetContinuousCollisionMode (body[i&1], 1);
         dMatrix matrix (GetIdentityMatrix());
         matrix.m_posit = p;
         new CustomBallAndSocket (matrix, body[!(i&1)], body[i&1]);
      }
   }


The walking ragdoll is still not done (Last months i worked on Realtime Global Illum. - i always do differnt thing for a while when got stuck somewhere)
Making the ragdoll balancing on only one foot is difficult problem.
The penetration problem also has bad impact on that.
I've figerued out i need to do more work with hips than with ankles and this should enable some progress.
I'm still sure that walking is not difficult when this works... running then is another question :)
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Continuous Collision crash after Newton 2.36 to 3.04 upg

Postby JoeJ » Tue Apr 09, 2013 5:48 pm

One more... have fun!
But even with such a complex setup no explosion.


Code: Select all
   // provoke 3rd. kind of Minkovski

   dVector center (0,30,-12);
   NewtonBody* parentBody = BuildBox (scene, 1.0f, center, dVector (4,4,4));
   NewtonBodySetContinuousCollisionMode (parentBody, 1);

      for (float a = 0.0f; a<3.14*2; a+=1.0)
   {
      NewtonBody* body[2] = {0, parentBody};
      dVector dir (cos(a), 0, sin(a));
      dVector p = center;
      for (int i=0; i<2; i++)
      {
         p += dir.Scale(5.0f);
         body[i&1] = BuildBox (scene, 1.0f, p, dVector (4,4,4));
         NewtonBodySetContinuousCollisionMode (body[i&1], 1);
         dMatrix matrix (GetIdentityMatrix());
         matrix.m_posit = p;
         new CustomBallAndSocket (matrix, body[!(i&1)], body[i&1]);

         dVector t (0.0f, 0.1f, 5.0f);
         NewtonBodySetOmega (body[i&1], (const float*)&t.m_x);
      }
   }
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Continuous Collision crash after Newton 2.36 to 3.04 upg

Postby Julio Jerez » Thu Apr 11, 2013 12:40 pm

Ok Joe, those three demos exposed very, very important bugs, Thanks for that
I fixed them all and I believe it is much more robust now.
The last two test you will see the normal jitter caused by the demo being a non sensical contraction.
Basically the ball and socket set some bodies to be is perpetual deep penetration.
But other than that it passes all three demos with no explosions.

Sync and try again please.

If this is now stable let us move to the ragdoll with powered joints.

edit: sync again there was one more bug
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Continuous Collision crash after Newton 2.36 to 3.04 upg

Postby JoeJ » Thu Apr 11, 2013 5:22 pm

Looks very good!
No more asserts.
Nothing goes wrong*
In release mode same FPS with or without CCD.

* I finally figured out what causes the ragdoll explosion - it's powering.
At some point i copy pasted your kinemaitc joint over mine and accidently commented out my checkbox branch to disable the joint interaction model.
Thus there was some powering even if i turned it off for ragdoll - this causes explosion.
I modified the kine joint so that it returns after the linear rows are set -> no more explosion.
So, (maybe just angular) powering in combination with CCD leads to explosions, even if no other joints are involved, f. ex:
A passive box rests on floor, i pick up another box using joint, and if i push it against the resting box, it flys away with too much speed.
Without CCD this case is fine.

I don't think this is a problem for anyone at the moment.
Interesting is that i was not able to reproduce something like this in sandbox, even when involving kinematic joint.
I can try again If you want.

Also interesting: Because i was so clueless about the explosions, i switched to Newton 2.36 to compare.
There, with CCD on, explosion happened as soon as the ragdoll fell on floor.
(Also the penetration problem is not worse in Nweton 3)


I have the Impression Newton 3 is no more alpha state but ready for production now, as CCD works better than ever :)
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

PreviousNext

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 8 guests

cron