Problems When Upgrading to Latest Version

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Problems When Upgrading to Latest Version

Postby Bill » Tue Apr 25, 2017 12:34 pm

Hello,

For the last couple of years, I've been using an older version of Newton that I built about two years ago or so. When using this version in my code, a call to NewtonWorldGetVersion() returns 313.

I'm trying right now to upgrade to the newest version of Newton, but I'm having all kinds of trouble. I suspect I'm doing something wrong, or maybe I'm using an instable version or something.

The version I'm trying to use is from the latest commit to github. The commit was from 20 days ago and has a commit ID of be3d31735d2afe25ba1db0b44853eb80a0601e84.

I'm able to build and run the demosSandbox project (using VS2015), but none of the examples behave correctly. For example, in the coefficient of friction demo, the blocks just sit on the ramp without sliding. And, in the coefficient of restitution example, the balls just hover in space without falling.

I'm similarly having a lot of problems getting my own code to work properly with this newest version of Newton. For example, I set an object's mass to a non-zero number, and then later on, it somehow is set back to 0.

I guess I don't know if my troubles are caused by intentional interface / functionality differences that were introduced into Newton recently, or if I'm just using an unstable dev version of the engine. My troubles with the demoSandbox makes me think it might be the latter.

I guess the bottom line is that I really don't know how I should proceed here. Any help would be appreciated. Should I not be trying to use this latest commit? Is there a stable branch or tag or commit or anything like that which I should instead be using?
Bill
 
Posts: 22
Joined: Mon Oct 27, 2014 9:40 am

Re: Problems When Upgrading to Latest Version

Postby Shaderman » Tue Apr 25, 2017 12:43 pm

There's currently no gravity in the sandbox, see viewtopic.php?p=60564#p60564
Shaderman
 
Posts: 66
Joined: Tue Mar 08, 2016 2:51 am

Re: Problems When Upgrading to Latest Version

Postby Julio Jerez » Tue Apr 25, 2017 12:45 pm

oh I see, I checked in a part of an experiment, there should be nothing wrong.
open file ..\applications\demosSandbox\sdkDemos\toolBox\PhysicsUtils.h
and re-enable the gravity.
#define DEMO_GRAVITY -10.0f
//#define DEMO_GRAVITY -0.0f

or you can sync again I fixed it

I am not sure what this is
For example, I set an object's mass to a non-zero number, and then later on, it somehow is set back to 0.

but try the demos and see if they work first.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Problems When Upgrading to Latest Version

Postby Bill » Tue Apr 25, 2017 1:47 pm

Julio / Shaderman,

Thanks a lot for the fast help. I think my problems are mostly sorted out now. When I saw that the demos weren't working on my end, it made me start doubting everything I was doing! The demos work great now. I then quickly found a bug in my own code that was causing my mass to get reset to 0.

Is there a thread or resource somewhere that summarizes the key differences between 3.13 and 3.14?

For example, I had NewtonSetFrictionModel(world_, 0); in my old code, but it looks like that particular function is gone in 3.14.

Also, I noticed that the damping seems really strong in 3.14 compared to 3.13. Maybe there's just some problem with my code, though. For example, linear damping of 0.01 and 0.00 are completely different in 3.14, whereas in 3.13 I couldn't even tell a difference between 0.01 and 0.00. Is that to be expected?
Bill
 
Posts: 22
Joined: Mon Oct 27, 2014 9:40 am

Re: Problems When Upgrading to Latest Version

Postby Julio Jerez » Tue Apr 25, 2017 5:28 pm

Ha glad you are getting going.
There are big differences between 3.13 and 3.14 but the are most focus on correctness and they do not have much to do with interface.

In the case of Friction model, that function only applied to the exact solver model. basically what function did was as follow. When using exact solver, the solver is a black box were you set inputs and you get a solutions. Because of that to calculate friction it requires to passes, one to calculate normal forces and another to calculate friction forces and recalculate normal forces together.
The Iterative mode do not required that because it can use normal forces as it iterates over each force point.

Newton 3.13 has the exact solver disabled for contacts and joint friction so that function was not doing anything. Newton 3.14 extended the exact solver to solve all joints including friction, but since joint friction is specified by the joint definitions, it does not requires friction model so the function is not longer needed.

The other change in 3.14 is the way contact points are calculated by the collision system.
In 3.13 an lower they were all computed in the local space of one of two shapes. This is very accurate
but is complex when adding scaling and all stuff newton can do with shapes.

In 3.14 the collision is now calculated in a local space common to both shape, this is little less numerically stabled, but it is way simpler and easier to maintain and debug.
I also added steps to deal with numeral instability so the collision system is in fact more accurate and reliable than 3.13 however if I added the same correction to 3.13 them it would improve as well, so this is not unique feature to 3.14.
There are other little things here and there like better integration. for example Gyroscope forces are now implicit and the only way to disable is by setting spherical inertia.

other than that, that is all.
The main thing in 3.14 is that all joints are exact unless specified otherwise by the joint creation and that's a really big feature.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Problems When Upgrading to Latest Version

Postby Julio Jerez » Tue Apr 25, 2017 5:33 pm

I noticed that the damping seems really strong in 3.14 compared to 3.13. Maybe there's just some problem with my code, though. For example, linear damping of 0.01 and 0.00 are completely different in 3.14, whereas in 3.13 I couldn't even tell a difference between 0.01 and 0.00. Is that to be expected?


There was a change of the way implicit damping is calculated, but the was long time ago and it was related to simulation rate, the equation is the same.
Damping should be very similar between 3.13 and 3.14, if not then that's a bug that should be checked out. Maybe you can make a test to reproduce it.

For the most part in newton I always set damping to zero and let the force and torque callback take care of it. In fact this is a legacy feature than some time I consider to do away with since is has been a source of lot of confusion but I keep it to make up for numerical integration errors.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 15 guests

cron