Sleep Bug [3.14] (2016-02-15 build) [FIXED]

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Sleep Bug [3.14] (2016-02-15 build) [FIXED]

Postby Stucuk » Thu Feb 18, 2016 12:59 am

When using Stacks i have found a situation where the top cubes of the stack don't wake up when those under them have moved.

I am using the Solver Model with 4 as with 1 to 3 the stack falls apart. With it set to 0 it looks right. Above 4 gives the same results as 4 with cubes floating. There are 1,000 cubes in the scene each with a mass of 0.1 and a -9.8 gravity applied. Everything else uses the default settings (Materials/etc).

They use the following distribution:
Code: Select all
for L := 0 to High(FCubes) do
       if (((L div 5) mod 5)*3-6 = 0) or (((L mod 5)*3-6) = 0) then
       FCubes[L] := MakeCube(Vector3fMake(((L div 5) mod 5)*1-2,(L div 25)*4-4+200, (L mod 5)*1-2))
       else
       FCubes[L] := MakeCube(Vector3fMake(((L div 5) mod 5)*3-6,(L div 25)*1-4, (L mod 5)*3-6));


User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Sleep Bug [3.14] (2016-02-15 build)

Postby Julio Jerez » Thu Feb 18, 2016 8:25 am

wow, that's really bad, I have being making changes to the place where sleep is check.
but I did no thing I check that in.

basically the change I made is that apply force no longer change the sleep state of the body.
this is because vehicle, apply force form a listener and that cause the vehicle to keep awaked all the time.
Please open up file dgBroadphase and see if you have function: SleepingStateKernel
that is the new code that does eh checking, It looks as if has a bad bug, and think the island is sleeping.
I will add that scrip you posted to the box stacking demo to test the code, that's a real bad bug.
thank for the report.

is that list piece of code sniped all that I need to reproduce that scene?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Sleep Bug [3.14] (2016-02-15 build)

Postby Julio Jerez » Thu Feb 18, 2016 9:27 am

please give more information how to recreate that scene, this is a big bug, and I do not see what could cause it.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Sleep Bug [3.14] (2016-02-15 build)

Postby Stucuk » Thu Feb 18, 2016 10:11 am

The quote is code directly from the app i made which sets the positions of all the cubes.

With the following app you can see it in action, press 1 to view the right scene.
- O3_2016-02-18.rar

(Esc closes app. Mouse + WSAD to move camera. 1-5 for the scene, Q turns on/off wireframe, L picks new colours for the lights)

The following is the other bits of newton code:
Code: Select all
procedure TExample06.MakeWorld;
var
 FMatId     : Integer;
begin
 FWorld := NewtonCreate;

 NewtonSetSolverModel(FWorld,4);
 FMatId := NewtonMaterialGetDefaultGroupID(FWorld);
 NewtonMaterialSetCollisionCallback(FWorld, FMatId, FMatId, @NewtonOnAABBOverlap, @GenericContactProcess);
end;


Code: Select all
procedure TExample06.CreateFloor;
var
 Collision : NewtonCollision;
 M : TMatrix;
begin
 Collision := NewtonCreateBox(FWorld,1000,1,1000,0,@IdentityHmgMatrix);
 M := CreateTranslationMatrix(Vector3fMake(0,-5,0));
 FloorBody := NewtonCreateDynamicBody(FWorld,Collision,@M);
 NewtonBodySetMassProperties(FloorBody,0,Collision);
 NewtonBodySetMaterialGroupID(FloorBody,NewtonMaterialGetDefaultGroupID(FWorld));
 NewtonDestroyCollision(Collision);
end;


Code: Select all
function TExample06.MakeCube(Pos : TVertex) : TDN_Cube;
begin
 // TDN_Cube.Create(World, Mass, Size, Matrix)
 Result := TDN_Cube.Create(FWorld,0.1,Vector3fMake(1,1,1),CreateTranslationMatrix(Pos));
 Result.CreateNewton;
end;


Code: Select all
procedure TDN_Cube.CreateNewton;
var
 Collision : NewtonCollision;
 M         : TMatrix;
begin
 M := IdentityHmgMatrix;
 Collision := NewtonCreateBox(FWorld,FSize.X,FSize.Y,FSize.Z,0,@M);
  CreateBody(Collision);
 NewtonDestroyCollision(Collision);
end;

procedure TDN_Object.CreateBody(Collision : NewtonCollision);
begin
 FBody := NewtonCreateDynamicBody(FWorld,Collision,@FMatrix);
 NewtonBodySetUserData(FBody,Self);
 
 NewtonBodySetMassProperties(FBody, FMass, Collision);
 NewtonBodySetMaterialGroupID(FBody, FMatID);

 NewtonBodySetForceAndTorqueCallback(FBody,@NewtonApplyForceAndTorque);
 NewtonBodySetTransformCallback(FBody,@NewtonSetTransform);
end;

procedure TDN_Object.ApplyForceAndTorque(timestep : dFloat; threadIndex : Integer);
var
 F : TVertex;
begin
 if FMass = 0 then Exit;
 
 F := Vector3fMake(0,-9.8*FMass,0);
 NewtonBodyAddForce(FBody,@F);
end;


P.S div means integer division with mod being modular (In-case you don't know the pascal syntax).
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Sleep Bug [3.14] (2016-02-15 build)

Postby Julio Jerez » Thu Feb 18, 2016 10:16 am

With the following app you can see it in action, press 1 to view the right scene.
- O3_2016-02-18.rar


this is even better, I can debug the dll form there, only one problem, It is full screen with excluse mouse, so I can no take control of the screen of the mouse after I launch it, is the a widow mode?
I do see the bug I can not step out to attach the debugger after I launch.

also make so that is run the demo one at launch
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Sleep Bug [3.14] (2016-02-15 build)

Postby Stucuk » Thu Feb 18, 2016 10:19 am

Julio Jerez wrote:Please open up file dgBroadphase and see if you have function: SleepingStateKernel
that is the new code that does eh checking, It looks as if has a bad bug, and think the island is sleeping.


That is in the code i downloaded from GitHub.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Sleep Bug [3.14] (2016-02-15 build)

Postby Julio Jerez » Thu Feb 18, 2016 10:21 am

I mean you application O3_2016-02-18.rar

it take full control of the mouse, and do not let me attach the debugger form visual studio.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Sleep Bug [3.14] (2016-02-15 build)

Postby Julio Jerez » Thu Feb 18, 2016 10:34 am

Oh wait a minute, I think I checked code with a bug, when compared wit my local version I had that change made, but I did no check in because I was make other vehicle changed.
I committed now please sync and try again before I start debug you app.

I am no sure if this fixed the bug, probably not, it is just so that we are using the same version of newton.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Sleep Bug [3.14] (2016-02-15 build)

Postby Stucuk » Thu Feb 18, 2016 10:34 am

I know what you mean, i was just responding to your previous question.

- O3_2016-02-18b.rar

Pressing R will reset the scene.

There will be no mouse when the mouse is over its window but it won't take over the mouse. It will also only use up 1/4th of the screen now (Its a borderless window, you can't move it but you can put things in front of it).

EDIT: Saw your post after posting this. I will re-download and build the dll.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Sleep Bug [3.14] (2016-02-15 build)

Postby Julio Jerez » Thu Feb 18, 2016 10:38 am

you said this
With the following app you can see it in action, press 1 to view the right scene.
- O3_2016-02-18.rar


that is the application that reproduced the bug, I can debug the Newton dll there if the application does no take control of the mouse. basically I can tap out and attach the debugger and them I can set break point in the newton DLL.
but is not possible if the mouse is looked to the application. also we need the same DLL,


this is why I ask you to sync and build the latter Newton from Github and if the mouse can be unlocked.
I this there is a windows key code for that by I do no remember.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Sleep Bug [3.14] (2016-02-15 build)

Postby Stucuk » Thu Feb 18, 2016 10:43 am

I just posted a new version in the previous post (It has a b at the end).
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Sleep Bug [3.14] (2016-02-15 build)

Postby Stucuk » Thu Feb 18, 2016 11:15 am

Following uses the latest GitHub code. Though it runs the same as before.

- O3_2016-02-18c.rar
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Sleep Bug [3.14] (2016-02-15 build)

Postby Julio Jerez » Thu Feb 18, 2016 11:27 am

excellent, let me see what is wrong there.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Sleep Bug [3.14] (2016-02-15 build)

Postby Julio Jerez » Thu Feb 18, 2016 12:34 pm

Is not what I though it was, It seem it broke some where before that, but I have to go to work now.
I will continue tonight.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Sleep Bug [3.14] (2016-02-15 build)

Postby Julio Jerez » Thu Feb 18, 2016 1:29 pm

Ok I narrow down but is no fixed yet, the good new is that is not what I did lately.
I will fix tonight, thanks for testing this, this bug I might have introduce a while back and not one saw it.
what you are seeing in the result of 3.14 which is more stable and try to keep the stack up, but for some reason the island is no notified when the bottom is pulled out.
as I go further back in time I see that the bug does no show up because the stack never go to sleep before the falling object hit the so they are already alive.
it should be easy to fix as soon I add the code to identify the moment is happens.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Next

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 5 guests

cron