Joints stiffness

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Joints stiffness

Postby Sweenie » Fri Apr 22, 2016 4:19 pm

Awesome. :)

I've just got Newton up and running using Newton.dll instead. Rigid Bodies and couple of joints are done.
Now I'm gonna get the vehicle fixed. Most of the code is already done so it shouldn't take too long.

I got a bit surprised just a moment ago. I was running the Unity profiler while testing a scene with a couple of joints. Suddenly the computer rebooted and I thought I caused a serious crash. It turned out Windows 10 decided it was time to install some updates. :roll:
I Googled on it and it seems alot of people have problems with Windows 10 rebooting to install updates with no warning what so ever. I immediately disabled automatic updates. :evil:
Sweenie
 
Posts: 503
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Joints stiffness

Postby Julio Jerez » Fri Apr 22, 2016 4:40 pm

Sweenie wrote:I got a bit surprised just a moment ago. I was running the Unity profiler while testing a scene with a couple of joints. Suddenly the computer rebooted and I thought I caused a serious crash. It turned out Windows 10 decided it was time to install some updates. :roll:


I got that too at work, but is no big deal for me. any way how the performance was looking in unity?

I am goin to spend time this weekend getting setting all up in my system. see who far we can get.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Joints stiffness

Postby Sweenie » Fri Apr 22, 2016 7:14 pm

Performance is looking good. PhysX is a bit faster with large stacks but on the other hand Newton stacks are much more stable and goes to rest while PhysX stacks keeps swaying for a long time.

Mind though that I haven't changed any solver settings. I'm running the default Newton settings and Im sure the PhysX solver is running in some cheap mode.

One thing is funny though, you can't disable PhysX in Unity(it's always running) but in a empty scene with no physx rigidbodies whatsover, the PhysX update still consumes about 0.20 ms on my machine.

One sad thing is that Unity isn't thread safe. You can use multithreading but you cannot touch any GameObjects from other threads than the main thread.

It took me a while to realise why I couldn't use the Transform Callback(it kept crashing) to update the transforms of the models. It works if I enable DG_SIMULATE_THREADING in Newton but I'm not sure I want to do that.
Currently I let the Game Objects fetch their transforms from Newton instead and I suspect PhysX does something similar.

But we are just getting started. I know there is a lot of things that can be improved.
No point in optimizing until everything is in place. :)

I've created a GitHub repository and will push my project files to it tomorrow(It's past midnight here now). I will try to create some basic instructions on how to get it working as well.
My skills at c++ is mediocre so keep that in mind when you look at my code. :mrgreen:
Sweenie
 
Posts: 503
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Joints stiffness

Postby Julio Jerez » Fri Apr 22, 2016 7:33 pm

Performance is looking good. PhysX is a bit faster with large stacks but on the other hand Newton stacks are much more stable and goes to rest while PhysX stacks keeps swaying for a long time.
Mind though that I haven't changed any solver settings. I'm running the default Newton settings and Im sure the PhysX solver is running in some cheap mode.

No question about, Phyxs is fasters, this is not our claim, out claim is that we are doing better physics, and that requires more CPU investment. The people who want speed can continues using PhysX. and I expect that that will be the case. But I also believe that we will get some people as soon as the see the difference.

Sweenie wrote:It works if I enable DG_SIMULATE_THREADING in Newton but I'm not sure I want to do that.
Currently I let the Game Objects fetch their transforms from Newton instead and I suspect PhysX does something similar.

you can ado that for now to get it running, what we can do later is that crate a proxy transform with a double matrix, then the engine will se the transform in one matrix and read the transform for the other. The CNewton class does that, this way we can set the engine to run not only on it own tread but also asynchronous. for now just get what you can and will take a look as soon as I can, I cannot wait.

I've created a GitHub repository and will push my project files to it tomorrow(It's past midnight here now). I will try to create some basic instructions on how to get it working as well.
excellent! as you say this is just the beginning. :mrgreen:
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Joints stiffness

Postby Shaderman » Sat Apr 23, 2016 1:34 am

Julio Jerez wrote:you can ado that for now to get it running, what we can do later is that crate a proxy transform with a double matrix, then the engine will se the transform in one matrix and read the transform for the other. The CNewton class does that, this way we can set the engine to run not only on it own tread but also asynchronous.


Hi Julio,

is there an example on how to use that double matrix and async updates? If not, would you mind pointing out how to do it?

Thanks

Shaderman
Shaderman
 
Posts: 66
Joined: Tue Mar 08, 2016 2:51 am

Re: Joints stiffness

Postby Julio Jerez » Sat Apr 23, 2016 3:30 am

It is in class
class dNewtonBody: public dNewtonAlloc, public dNewtonTransformLerp

the dNewtonTransformLerp handle all smooth matrix interposition.

That class also has an atomic lock is use by the Engine of the Clint app each time the want to asset the transform.

The engine update the current and next transform form it own thread, and the client app read the matrix on an loop that iterate over all physics entities.
I am no sure if it is still good because I wrote it long time ago for early version of newton but since to one use it I do no maintain it.

we are probably have to write a new implementation for this plug in, so be patient and you can jut get what you need.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Joints stiffness

Postby Shaderman » Sun Apr 24, 2016 11:14 am

Thanks Julio,

it seems to work very well and performs about 15% better than my previous critical section code :)

I have a very simple test scene where 5 boxes spawn every second and fall down building a heap. I had stable 60 fps up to 960 boxes before, and after that change i see 60 fps with up to 1100 boxes. Fps go down slowly then, but it still feels smooth somehow due to Newton's mutli threading I guess.
If anyone cares, this is with 4 threads, "multi thread solver on single island" enabled and "solver model" set to adaptive.

ShiVa's integrated ODE (which has no multi threading btw) for comparision runs at 60 fps up to 420 boxes, followed by a massive fps drop.

I have to admit that I love Newton :mrgreen:
Shaderman
 
Posts: 66
Joined: Tue Mar 08, 2016 2:51 am

Re: Joints stiffness

Postby Julio Jerez » Sun Apr 24, 2016 2:00 pm

hey Sweenie after if fixed the tire collision bug and plugged the tire reaction torque to the driving train, the car now do natural 360 degrees burned out as pure emerging physical behaviors. Not tunning
It was always puzzled way the behavior was not emerging on a flat terrain. but throw that the effect is there is easy to complete the lateral stability regulator.

you see the effect just drive forward while turning to left of right, then after one or tow turn the car goin into perpetual driting with out losing control.

to see that it is in fact drifting open the menu option show normal forces, and see how the yellow arrow the show the vehicle velocity point to one direction while the rear tire velocity point to the same direction than the car but the front tire velocity point to the opposite. :mrgreen:
this is quite hard to achieved even for a bright period and now we can do it perpetually

you can see that the center yellow arrow oscillate a little, but this is normal, this is what a expert drive controls, drifting is a regime where the car lose constant mementum so the drive has to contacly accelerate, decelerate and adjust the steering in order to keep the side slip angle more or lest fixed. with a keyboard this is virtually impossible so the input are contact and side sleep oscillate.

However is where the lateral stability module come in, this module is a regulator that will keep the side slip angular fixed but adjusting the engine throttle and steering but a small amount.
This is no fake, almost all model cars today has those kind of controller they just do it for different objective. basically in most car the objective is not to drift, but super cars has option for drift.

In fact vehicle like the Bugatti, with be undrainable without the stability controller, not person can react fast enough to adjust teh control to the vehicle dynamic under so high power, so they do allow the assistance to be turn off. I saw that is top gear show.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Joints stiffness

Postby Julio Jerez » Mon Apr 25, 2016 1:00 am

I now added a monster truck,
I realizes that since a monster truck has all its tires exposed, each tire truck needs a discrete and continue collision, no just continue collision.
So I will add option tine has fenders, and is and use of full tire collision.

other than that for no having any truck settings, it feels quite good to me.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Joints stiffness

Postby JoeJ » Thu Apr 28, 2016 5:14 pm

Truck is nice, want more springy shock absorbers, 4WD and better camera :)

Running the Standart Joints demo, there is a problem now with the 20 bodies snake, it jitters and does not come to rest. Maybe related the the bug you mentioned recently, some 'kinetic' flag accidently with the same bit than another flag - i thought it was in this thread but seems i'm wrong.
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Joints stiffness

Postby Julio Jerez » Thu Apr 28, 2016 5:45 pm

It is 4wd.

I though that I fix that bug with the joint, but you are right I did no drag the tower to the floor.
I was surprised when I test that and it seemed to worked when it should not so I let alone.

I change the option so the Motor flag is no rested, this is doing the opposite.
I fix the Bug wo the contact, I nee to make sure the option does what was doing before. but without the but. Than for testing. I even put a label when I check it because I was no sure why it seemed to work when it should and I was right it was no working. :oops:
Never assume some is working but chance, chances are it is not.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Joints stiffness

Postby JoeJ » Fri Apr 29, 2016 1:23 am

Julio Jerez wrote:It is 4wd.

Oops. I've had one wheel in air and got stuck. Isn't that's what the klutch is good for?
I assume enabling the klutch locks the differentials to ensure all wheels turn in such a case.
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Joints stiffness

Postby Julio Jerez » Fri Apr 29, 2016 10:57 am

no, the clutch is what couple the engine to the transmission so that when it shift gears that mismatch in angular velocity between the engine and the axel is dissipated on the clutch friction.

this is what make the needle of the rpm deal change position when the car shift gear up or down.
at the moment is too weak for the engine power, but you can see it changing a lithe when it does change gear. It needs better calibarion.

what you mean is the sleep differential, the demo does no has interface for that yet.
This is what balance the torque among the tires.
at the movement I tried to implement a viscous slip differential. but that does not really work,
I found out that in real vehicle viscous slip differential are actually complex not easy to emulate with a single rigid joint.

I will probably go back to the old model of dry friction differential. Basically this is just like a normal differential but when the different in RPM between the two child bodies is larger that some fix value, they get lock and keeps the difference constant, those are easy to simulate but they require an extra joint, which is the reason I tried a simpler viscous model.

anyway, I am trying to add the heavy vehicle demo that show multi axel vehicles, and this in is exposing a bug in the suspension, I think.
That demo will also show how to add use complement like the tank turret and cannon. Maybe a firing shell mechanism too.

This weekend I will debug that bug, and maybe implement the dry friction differential,
and add the Tank demo.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Joints stiffness

Postby Julio Jerez » Fri Apr 29, 2016 4:52 pm

actually joe, debug this I found one hidden bug, that was causing the slip diffretitial not to work as I was expecting.
I was applying a joint tire constrain angle with a negative sign. this was creating a antagonist system where internal forces that cancel but the were too strong and generate instabilities.

That bug does not fixes the upper bump bug I was debug, but a bug is a bug is a bug is a bug.

Now if you drive the monster truck over the debris pieces, if a tire is lifted on the air, that tire will spin faster, but as it increases velocity the tire other tire with contact support will get a more torque and eventually will move out. :D

this may not be exactly how viscous slip differential works, but is a good approximation model for newton. I drove a lithe and so far seems ok.

I still need to find out a solution for when the tire hit the upper bumpers, I added a hack to separate the contact by adding a bounce velocity, but hat no the suction really.

the problem is that sine the spring dapper force an the stop re using the same row. It can no use both for different thong. Either I let the spring or I place the stop

the spring has the problem that if is can easy lit voile the stops if the vehicle hit an object really hard. The bounce stop, has the problem that stop the relative motion and sync ether is no spring force that tire does no bounce back.

I nee to figure out how to calculate the preside acceleration that represent bot the spring and the stop impulse. These are the thong that happen with approximation models, in a real car that does no happen because in a real car the suspension are rigid bodies which has three own independent degrees of freedom, here more than on dof is map to one coordinate.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Joints stiffness

Postby Julio Jerez » Sat Apr 30, 2016 6:34 pm

well is to hard or near impossible to calibrate a 8 ways differential for a heavy truck.
I will have to implement a dry friction some time in the future.

so for now like ms Vito said. We can Make equal length tire marks because posit traction or limited slip differential in Newton 3.14 only regular differential, sorry ms Vito.
https://www.youtube.com/watch?v=CFdJza0AbeA

It does not mean that regular differential aren't cool, they are giving the ability to drift as emerging behavior for the physics with out adding any extra vehicle lateral stability control.

Not I will add lateral stability and the after I complete the balancing ragdoll I will add the slip differential because it will be needed to Tank steering
Julio Jerez
Moderator
Moderator
 
Posts: 12426
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 2 guests

cron