Unstable Connected Joints

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: Unstable Connected Joints

Postby MeltingPlastic » Wed Jun 19, 2019 5:39 pm

Yes all the pieces are supposed to come to rest on the ground.

At about 0:24 minutes that's what I'm talking about. you can see that a pile of bodies suddenly sink into the ground.

I have not tested with lots of bodies in a while so Its hard to say.
MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm

Re: Unstable Connected Joints

Postby Julio Jerez » Thu Jun 20, 2019 9:35 am

yes I see the point were it happens in the video.

I cloned your project and I am getting two kind of errors
th efirst one is this

60>D:\TechGame\rbfx\Source\Tools\Editor\Tabs\Scene\SceneTab.cpp(915): error C2398: Element '1': conversion from 'double' to 'float' requires a narrowing conversion
60>D:\TechGame\rbfx\Source\Tools\Editor\Tabs\Scene\SceneTab.cpp(915): error C2398: Element '2': conversion from 'double' to 'float' requires a narrowing conversion
60>D:\TechGame\rbfx\Source\Tools\Editor\Tabs\Scene\SceneTab.cpp(1025): error C3538: in a declarator-list 'auto' must always deduce to the same type


the secund are theses.
61>d:\techgame\techgame\Piece.h(3): fatal error C1083: Cannot open include file: 'Urho3D/Urho3DAll.h': No such file or directory
61> TechGame.cpp
61>d:\techgame\techgame\TechGame.h(4): fatal error C1083: Cannot open include file: 'Urho3D/Urho3DAll.h': No such file or directory
61> main.cpp
61>d:\techgame\techgame\TechGame.h(4): fatal error C1083: Cannot open include file: 'Urho3D/Urho3DAll.h': No such file or directory
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unstable Connected Joints

Postby MeltingPlastic » Thu Jun 20, 2019 1:52 pm

hmm, try using the cmake variables defined in the reRunCmake.sh script. That sets DURHO3D_MONOLITHIC_HEADER=ON which should fix some errors.

Also I think you may need to use visual studio 2017. The rbfx project uses C++14 in some places.

I can just run the reRunCMake.sh script to get a build directory and solution generated.

I have made a branch called "Stable" that should always be buildable.
MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm

Re: Unstable Connected Joints

Postby Julio Jerez » Mon Jun 24, 2019 4:11 pm

hmm, try using the cmake variables defined in the reRunCmake.sh script. That sets DURHO3D_MONOLITHIC_HEADER=ON which should fix some errors.
How do I do this?

I have not done it yet I was try to apply some refactoring to the code to make it more tractable for GPU. I use too many double link list and map containers, which is fine for PC by for GPU will have to do extra passed to copy the date to lath arrays.
I started with contact container, but this is more for practice that for actual code.

but for example the is a graph in newton call master list, the is a ling list of buckets
the force me to make extra proxy copies even for the parallel solve on CPU.

This was fine for a sequential solve that work on islands of connected bodies but the concept of islands goes out of the window once you have massive parallel execution.
is just become a waste to time.
I though the cost would be marginal, by profiler indicate that building island is almost as expensive as the solver.
so at some point maybe for the next version the engine will be island less.

anyway I was looking that your videos and I remember I saw that when some of your long objects with odd inertia shapes spin on the ground the spins with the typical characteristic behavior of an integrator that conserve angular velocity not angular momentum.

In newton there is an option that you can set when you create you bodies that use the implicit integrator for in all cases.
NewtonBodySetGyroscopicTorque(body, 1);

this option allows bodies act like this:
https://www.youtube.com/watch?v=BCVQFoPO5qQ
https://www.youtube.com/watch?v=UlErvZoU7Q0

I think I mention that to you once by I am no sure if you are using the option, you can see the difference, for example when a long thing cylinder is spinning and toque the ground one end first,
and it start to wobble in a funning way, but should not do that it should fall flat.
and I believe I saw in some of your cylinders but now I do not see it now, did you change the video?
https://www.youtube.com/watch?v=q8CEkeJ ... e=youtu.be

in fact you can just set that option for all you shapes. it will be only marginally more expensive by.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unstable Connected Joints

Postby Julio Jerez » Tue Jun 25, 2019 6:16 am

I try to build x64 using vs 2017 bu I still get these erros

1>UrhoNewtonConversions.obj : error LNK2001: unresolved external symbol __imp_NewtonCreateBox
1>NewtonCollisionShapesDerived.obj : error LNK2019: unresolved external symbol __imp_NewtonCreateCone referenced in function "protected: virtual bool __cdecl Urho3D::NewtonCollisionShape_Cone::buildNewtonCollision(void)" (?buildNewtonCollision@NewtonCollisionShape_Cone@Urho3D@@MEAA_NXZ)
1>NewtonCollisionShapesDerived.obj : error LNK2019: unresolved external symbol __imp_NewtonCreateCapsule referenced in function "protected: virtual bool __cdecl Urho3D::NewtonCollisionShape_Capsule::buildNewtonCollision(void)" (?buildNewtonCollision@NewtonCollisionShape_Capsule@Urho3D@@MEAA_NXZ)
1>NewtonCollisionShapesDerived.obj : error LNK2019: unresolved external symbol __imp_NewtonCreateCylinder referenced in function "protected: virtual bool __cdecl Urho3D::NewtonCollisionShape_Cylinder::buildNewtonCollision(void)" (?buildNewtonCollision@NewtonCollisionShape_Cylinder@Urho3D@@MEAA_NXZ)

lots of these and also some of these

2>d:\techgame\techgame\techgame.h(4): fatal error C1083: Cannot open include file: 'Urho3D/Urho3DAll.h': No such file or directory
2>PieceManager.cpp
2>d:\techgame\techgame\piecemanager.h(2): fatal error C1083: Cannot open include file: 'Urho3D/Urho3DAll.h': No such file or directory
2>PiecePoint.cpp
2>d:\techgame\techgame\piecepoint.h(3): fatal error C1083: Cannot open include file: 'Urho3D/Urho3DAll.h': No such file or directory


I though you sent me an executable before that linked to the dll, but I do not find it
can you just send me that again,
I see this: https://drive.google.com/open?id=1-BX7y8_McJ62PefDoHykMc9XfyNREMw1

but that is the joint problem, I'd like to see what is up with the objects falling through the floor first.
and then check out the joint problem.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unstable Connected Joints

Postby MeltingPlastic » Wed Jun 26, 2019 11:30 am

Hi Julio,

I have made some changes since the posted video, namely the inertia's of all bodies should be better now after I made this commit in the wrapper code: https://github.com/TrevorCash/rbfx-newt ... #r34088499

There is a change results in a crash in NewtonCompoundCollisionEndAddRemove(..) that was introduced somewhere between commits 2a50b8236f131ee9fd6cb906b2f0a8b5c3f2ad04 and ba44ab69b9667d68c33a0f0fe504062519542f43 (current master) of the newton repo.

So I am not yet using the the latest newton master.


In Regards the the CMake variables. use can either just run the reRunCmake.sh script directly in the TechGame directory if you have MINGW64 or use CMake GUI just like you would with any other project. Just run it from the TechGame root directory and specify a 'build' directory. the Important one should be just turning off URHO3D_CSHARP, and turning on DURHO3D_MONOLITHIC_HEADER.

I'm not sure why you getting linker errors - but its possible that could from the DURHO3D_MONOLITHIC_HEADER variable being off.

By default it should biuld using newton dlls.
MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm

Re: Unstable Connected Joints

Postby MeltingPlastic » Wed Jun 26, 2019 12:07 pm

Also Yeah I Have the Gyroscopic Torque option available on all rigid bodies. I'll try turning that one on sometime too for an even better simulation.

Edit: I just turned it on by default going forward. I don't seem to see the rods spinning on end any more which is great

Double Edit: I am seeing more bouncy behavior though. When dropping the "C shaped" pieces they bounce around more before settling down when Gyroscopic Torque is turned on.
MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm

Re: Unstable Connected Joints

Postby Julio Jerez » Wed Jun 26, 2019 3:40 pm

shaped" pieces they bounce around more before settling down when Gyroscopic Torque is turned on.[/quote]
It is so true that if something has the change to go wrong it will go wrong.
This is actually good; I was expecting that to havens I did not think it was going to be that common.
the good knew is that I can be fix. I will try to recreated in the sand box so that I can fix it.
the first this I want of have is the Game running so that I can try it out.

So on this
In Regards the the CMake variables. use can either just run the reRunCmake.sh script directly in the TechGame directory if you have MINGW64 or use CMake GUI just like you would with any other project. Just run it from the TechGame root directory and specify a 'build' directory.

I do not have MINGGW64 installed, but I have CMake GUI, how do I run reRunCmake.sh there, I do no undernatd.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unstable Connected Joints

Postby MeltingPlastic » Wed Jun 26, 2019 7:03 pm

Hi Julio,

The script is just for conveniece to run cmake.

so you dont need to run the script. you can run cmake gui and just copy the parameters from the .sh script.
MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm

Re: Unstable Connected Joints

Postby Julio Jerez » Thu Jun 27, 2019 9:43 am

I found the options for making build the newton dlls, but I still can determine why is keep saying these errors
9>ManipulationTool.cpp
9>d:\techgame\techgame\manipulationtool.h(2): fatal error C1083: Cannot open include file: 'Urho3D/Urho3DAll.h': No such file or directory
9>NodeTools.cpp

...
9>d:\techgame\techgame\techgame.h(4): fatal error C1083: Cannot open include file: 'Urho3D/Urho3DAll.h': No such file or directory
9>Generating Code...
9>Done building project "TechGame.vcxproj" -- FAILED.
10>------ Skipped Build: Project: INSTALL, Configuration: Debug x64 ------
10>Project not selected to build for this solution configuration
========== Build: 8 succeeded, 1 failed, 48 up-to-date, 1 skipped ==========



those this mean I nee to download Urho3d separately? I searched for the file in the folder of you application and is no there. I see Urho3DAll.h.in but not Urho3DAll.h
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unstable Connected Joints

Postby Julio Jerez » Thu Jun 27, 2019 1:11 pm

MeltingPlastic
if you have time can you make a small video that show the difference with the problematic shapes
with gyro on and gyro off.
before fix this I like to see how off the effect is.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unstable Connected Joints

Postby MeltingPlastic » Sat Jun 29, 2019 9:36 pm

Hi Julio,

Here's a video with no gyro enabled:
https://youtu.be/oACI52LqLP4

Here's a video with gyro enabled:
https://youtu.be/yJeS3n5mYRc

Also here is a video of how I use cmake to setup the TechGame project. Once you build the visual studio solution you can see all the sub projects (Urho3D is included as well as the rbfx-newton plugin project). I was able to just click build at the very end of this video:
https://youtu.be/ZbfYr2p3J7Q

Also rbfx needs to be fully initialized (as a submodule) and rbfx-newton (as a submodule)


Trevor
MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm

Re: Unstable Connected Joints

Postby Julio Jerez » Sun Jun 30, 2019 3:24 pm

MeltingPlastic wrote:
Here's a video with gyro enabled:
https://youtu.be/yJeS3n5mYRc

Yes that look quite bad, if any one wanted a clear demonstration that impulse and forces are very two different thing, this is it.
Ironically older version of newton, has not problems with these cases because it had impulse solver separate from force solver.
It fits run an impulse pass with time step set to zero, solving the contact, then the force pass.

Many people had difficulties understanding a callback with time step equal zero, plus the silver was much slower.
So I removed in favor of converting impulse contact to acceleration by calculation the average Accel dividing by dt.
This work well to certain limits.
The cases when it work well are
If dt is not too small, when the difference in contact velocities is significantly large, that the acceleration is mush larger than the rest acceleration, and when there are not non liberal Accel like gyro.

This change was about five or six years ago, and lot has changed.
I learn a lot since them and I will keep that as one of the option to solve the problem.

First I will try a software inginiering solution which is detect the contacts that are on impulsee state and flag those as no gyro.
Of course this is not quite right because internal joints can still get velocity steps and act bad, but let us see if this does the trick first.

There are also other option.
For example we can unconditionally apply to one joint island. This is already done with zero joint island, the we can leave the gyro optional.
This seem a no brainier, and can go long way since most proplem are with individual thing bodies.
I think I will try this first.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unstable Connected Joints

Postby MeltingPlastic » Sun Jun 30, 2019 6:18 pm

That makes sense, in most cases the gyro forces are applicable to single bodies anyway.
MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm

Re: Unstable Connected Joints

Postby Julio Jerez » Mon Jul 01, 2019 10:49 am

Ok let us address this problem this week.
The solution of single out configuration with a single joint, as much as make sense I do not really like it.

Separating free bodies from constrained bodies, is not a hack or special case.
The order of integration is.

1 For each body add external forces
2 Calculate reaction forces
3 Add reaction forces to external forces
4 Integrate forces
5 integrate velocities

For free bodies step 2 generate zero force therefore it make sense to separate free bodies from connected bodies and skip step 2 and 3.

In the pass before the rk4 solver the was a step 0 which was run an impulse pass resolving the impulse
A fixing the velocities between joints.
The equation of impulse is has the same mass matrix than the equation for forces, but the right hand vector is quite different.

I them remove that from the solver, and instead try to convert impulse into acceleration, and that work well untill, as every thing each time you try to bend the laws of physics with common sense, it has a way to come back and bite you in the ass.

I think what I am going to do is the right thing.
I will bring back the impulse pass.
But this time will be different because originally there where call back with time step set to zero, and each joint had to deal with that.
Not there are function that can extract the right hand vector from the single call back.

This is a general solution, and we can start but implementing it in the small island solver. And that will handle almost 100% of all cituations.

I can't really find a mathematical justification for singling out arranges that has only one joint.
While the impulse pass aproach is a mathematically sound solution.

So I will do that this week.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

PreviousNext

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 7 guests

cron