I think we can also do something else. I refuse to accept that this is the end of the story.
I found the problem but what I meant is that is outside of the Newton strategy to deal with it,
It needs a different approach and I believe we can do much better that what we do now.
In newton the joint and the contact are made such that the constraint error is resolved in such a way that the error is reduced by adding a penalty force that moves the two bodies as a contact velocity.
basically add a fix extra velocity based potential energy.
This has worked well if you have a good constraint solver and a poor velocity integrator like Newton has.
What many physics engines do is that the add what is called Burgante penalty, some other use the so call mixed constraint solver and some others do two solver passes one for force and one for position error. All three of these approached are quite horrible to the point that I do not even consider doing a position correction pass a physical based solution and why I have refuse to use those methods for years.
This is why I also say that engine like Physx and Havoc and all the others are not really physic engines they are collision system with a mix of poor dynamics and poor inverse kinematic (position correction is in fact a special case of Holonomic inverse kinematics).
What this mean is inverse kinematic when the number of variable is equal to the number of degree of freedom.
The problem with the Newton method of reducing the errors by adding a constant velocity is that it breaks down if the integration is not capable of reducing there error faster than what the dynamics of system the can generates. This is what I had forgotten and why I am having such a difficult time tuning the vehicle made of pure rigid bodies.
It had worked so far because I always assumed that when two joints violate constraint, the solver will clip the excessive forces and after that these forces will not be there anymore, example of this are contacts and joint that move a relatively low speed.
however if you have cases where the excessive force come out of the integrator itself, then the error becomes a positive feedback and is beyond what the method can solve.
however now that I have identified the error, I believe the solution is adding the option to have elastic constraint rows behave as a stiff spring damping system.
Joe as I mentioned before to you, basically this is the equivalent of making the constraint equation
- Code: Select all
f * trans(a) = transp (Fe) + transp (J) * lambda
J dot a + ks * lamda = kc * constraintError
instead of
- Code: Select all
f * trans(a) = transp (Fe) + transp (J) * lambda
J dot a = ConstraiontVelocityError * (constantvelocity)
As you can see in my method, the second system, the velocity error is reduced at a fix rate, you can test that by polling to joints and see how the come back together at a constant speed.
The way I arrived at that solution was by using a Langragian Formulation of two separated system
one is a contact point that constraint only one degree of freedom to be fixed to both bodies.
the second constraint one angular degree of freedom to be fixed to both bodies.
then differential equation that you get is used for the linear and angular rows.
I derived that about 15 years ago long before I made Newton public and now I need to refresh myself my memory again because the Lagrangian equation that you get you need to do some interpretation to get the meaning of the turns.
BTW this is why Newton also handles Coriolis and Gyroscopic forces naturally, they all come out for the Lagrangian derivation which is based of the Kenetic Energy and Virtual potential energy in the close system. No other engine that I know can handle that because either they simply use a penalty that clip the error or use a spring damper.
In Newton what I decided was that I will add a fixed extra amount of a Velocity Based Potential Energy to the Lagrangian and derive the equations of motion along that degree of freedom.
Since Velocity based potential energy are negative, they drain a fix amount of energy from the system, and as long as that amount is larger that what Numerical error can add to the system, them the solution is unconditionally stable. This has worked so well for many problems.
In the first equation you can see what is going on, the masses are artificially relaxed, so the diagonal will be larger that is really is so the calculated force will be smaller that what is needed to maintain the constraint. On the right side you it does not consider velocity or acceleration, instead is uses the position error and a penalty constant, this in fact is a acceleration base spring.
What I do not like about that is that the system to find an equilibrium point it requires a error.
Bu the error can be arbitrarily small at the expense of high frequencies instability, all in all is a bad system, but a right tool for the right problem I guess.
you can make by comparing the dimension of a spring and what at the term is
for a spring F = -Ks * x
therefore Ks = f / x -> [kg / sec ^ 2]
for the constraint the right side is the acceleration error so we have
a = - ks * x
ks = a / x -> [ 1 / sec ^ 2]
similarly the added tum to the left side must be a damper units because the unit are not a damper because for a damper we have
F = - Kc * V
therefore Kc = F / V -> [Kg / s]
but we know that Lambda has units of forces. therefore the penalty must have using is
inv (mass) * lambda + kc * lambda = a
the dimensional analyst yield that
inv (mass) * lambda + kc * lambda -> K must have units of [1/ kg]
basically is artificially increase the inverse mass ration of seen by the constraint
What I can do now that I know that for extreme systems like the one in the videos,
I can formulate another Langragian using, both a spring and a velocity based potential energy, and
from there derive a new set of equations that can added using the newton function
NewtonUserJointSetRowSpringDamperAcceleration which is already there.
I am working on getting that feature in because I am having a difficult time with the vehicle model and tire moving a high angular velocity while the mass ratios is also extreme.