soft contacts or restitution ?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

soft contacts or restitution ?

Postby blackbird_dream » Mon Jan 24, 2022 5:36 am

Hi all.
Question on theoretical aspects:
What is the difference between the 2 collision callback methods:
UserContactRestitution and HandleSoftContacts.
We observe there is a real difference with resulting behaviors, especially with respect to bouncing. My question is about theory and coding.
Thks beforehand.
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: soft contacts or restitution ?

Postby Julio Jerez » Mon Jan 24, 2022 1:41 pm

in the dynamics rigid bodies a contact is defined but two parameters that can be consider
input to the simulations
-the relative contact speed.
-the contact penetration.

they come from the geometry of the problem.
the relative contact speed is used in the empirical law of restitution.
and that is accordance coulomb restitution.

restistionSpeed = -(1 + resCoeffiecnet) * relSpeed

the secund, contact penetration, is handled heuristically because there are not equations in the literature for how to deal with that, but contact penetrations are inevitable.

the way newton deal with that is that is as follows.
there is a penetration ramp. like the graph below.
Untitled.png
Untitled.png (2.59 KiB) Viewed 11345 times


basically, when bodies interpenetrate, the joint add some momentum proportional to the penetration until certain limit. In that sense, conservation of moment is broken for a period of time.
there are some logic that compare the restitution speed and the penetration recovering, and only the max of the two is used. In general, for relatively high speed, this works really well because the restitution is larger than the penetration speed.

the problems happens when you get contacts that move a low speed, but they generate penetration, in this case the recovering speed is larger and that create jittering problems.
I had that problem when trying to make a self-balancing gait. I could not get the foot to rest stable.

I tried to add an option that instead of using a ramp, it was a step ramp, allowing for the bodies to have some penetration. I called soft contact, maybe not a good name, but that really never worked to my satisfaction.

the problem is that a food in the grown receive force that change very violent, so the contact also reacts with very violent change of momentum.

you can find that code in the Contact joint class.

I abandoned that idea, and in the new version of the engine I am trying a different approach,
the behavior is more stable, but I ran into some other issues that I have with the forward and invers dynamics that I have to resolve first.

to summarize, the concept of softy contacts does not exist in rigid body simulation, and what I tried to do was to dissipate the contact violent changes of momentum but let it the contact penetrated more than the skin thickness of the contact solver, but that did not really work because it actually brings much bigger problems.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: soft contacts or restitution ?

Postby blackbird_dream » Thu Jan 27, 2022 4:30 am

thks for the details.
In the post http://newtondynamics.com/forum/viewtopic.php?f=9&t=9655 you write the acceleration is proportional to the penetration, not the restitution/recovery velocity.
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: soft contacts or restitution ?

Postby Julio Jerez » Thu Jan 27, 2022 5:21 am

Well yes, but only during the ramp stage.
Making an acceleration proportional to the penetration will make it a spring. That would be in corrent

The velocity is proportional to the penetration only in the ramp transition.
But the solver take an acceleration, so it is the time derivative of that ramp. Which is the difference of that speed and the velocity of the contact.

This is approximated, after that velocity is calculated.
The acceleration pass to the solve is

Acceleration = ( recovery speed- contact velocity)/ timestep

So in the ramp stage there is a spring acceleration, but in the flat part of the ramp the acceleration is zero.

This why you see that in deep penetration objects resolve penetration at a constant speed.

That is the closer I can come up to minimizing violation of conservation of momentum.

The contacts add a minimal amount of momentum but is a fix amount.
Doing some other way, result is unwanted jitter comming from that spring effect, some engines has to deal with by relaxing the left side of the equation with what they call Cmd or something like that, but in linear algebra that's called regularization, its just means scaling the diagonal of the matrix on the left side and adding penetration penalty proportional to the penetration on the right side.
To me, it is a moronic solution created by a front runner dude named Bourgante, but in mediocre academia the incorrecness of approach has never been questioned.

To me it just does not work, but it is just wrong because treats contacts as a spring damper system.
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 45 guests