Inverse Dynamics Robot demo questions

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Inverse Dynamics Robot demo questions

Postby Julio Jerez » Mon Dec 30, 2019 8:38 pm

but I do not go by those rules.
this is how I would resolve the kind of problem you describe.
imagine the model is standing on it two feet, and all the stability problems are resolved.
let us call this state idle.
In this state, the center of mass can be anywhere inside the support polygon an dthe model should not fall. again assuming the support polygon is stable.
Now let us say it is going to transition to stand on one foot.
if you take the step the way you said, yes will fall, but that's not how will work.

to make that transition the state machine makes a transition to an intermediate state.
The goal of this state if to displace the center of mass until it is in both support polygons,
the two feet support and the target foot support polygon.
as soon as that condition is met, the state signal itself to transition to the stance on one foot state.
if what have now idle and the stance working (which we see now although with noise)
the only part that is an unknown is the transition from state idle to one foot stance.
but this state is just the union of two states that are already working.
this has nothing to do with solver, the only thing the solver has to guarantee is that predicted position are reproduced with some degree of fidelity. and that I am confident is happing.

when the stance state start to swing the leg on any direction, the balance system will try to shift the center of mass atomically to try to keep it inside the support polygon.
how fast the reaction can be is something to be seen, but it is most certainly work within some limits we just need to find out what that limit is.
This is not different than a real person doing the same thing and losing the balance.

where is my beer?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Inverse Dynamics Robot demo questions

Postby JoeJ » Tue Dec 31, 2019 4:31 am

You'll get the beer if your complete ragdoll can do that swinging at 95% of the theoretical max speed - that's the best number i got. 8)
(It was not much of a difference if i used a 2 body inverted pendulum directly, or the full 20 bodies ragdoll. But the contact problem caused both setups to tip over after some random time. So i got lost in checking my math again and again, searching for a bug. Trying improvements. Nothing helped. Only after stabilizing the jumping contacts the problem was gone for the IP model, but at this point i already had messed up the ragdoll code completely somehow.)

Just move on, go through implementing two / single feet states. Later you will see this is not necessary, hehe :)
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Inverse Dynamics Robot demo questions

Postby Julio Jerez » Tue Dec 31, 2019 3:56 pm

well, I will continue testing my hypothesis and as along as new finding do not contradict my main premises, I will make eteh necessary adjustment go on.

I debugged the contact problem, and I found few things.

1-The contact cache, is responsable for the pops that I see some time.
basically the a contact cache needs a tolerance to be effective. I have it set to very small values.
less than 0.25 of a degree relative rotation and less than 1.0e-5 translation.
but even theses values are enough for the body to get some kind of shock wave, every time the contact cache releases and signal contact update.
This makes sence and is fixable, it is one of the problem with the idealization for ridibody physics.
basically ground forces generated but the collision act like an explosion when the reach the last body on the chain because the is not elasticity between joint to adsorve the transfer of momentum generated but impulses. to do a quick test I disabled the cache.

2-calculating contact each frame, it is better, the pop is gone but exposes the problem that I were suspecting before.
Hard contacts makes the foot body bounce of the ground even if is has zero coefficient of restitution.
to expose than, I traced the history one foot, tracing the contact point and the penetration.
here is a short list
    frame:1016 body:7
    pentration(0.000000) point(0.150456 0.004852 0.174279)
    frame:1036 body:7
    pentration(0.000000) point(0.100647 0.004212 -0.045972)
    pentration(0.000000) point(0.150502 0.004842 0.174060)
    pentration(0.000000) point(0.200647 0.004051 -0.045905)
    frame:1069 body:7
    pentration(0.000000) point(0.100568 0.004848 -0.045947)
    frame:1083 body:7
    pentration(0.000000) point(0.150690 0.004578 0.174249)
    pentration(0.000000) point(0.100656 0.004833 -0.045743)
    frame:1303 body:7
    pentration(0.000000) point(0.150847 0.004222 0.174272)
    frame:1313 body:7
    pentration(0.000000) point(0.150777 0.004203 0.174052)
    pentration(0.000000) point(0.100527 0.004055 -0.045891)
    pentration(0.000000) point(0.200527 0.004007 -0.046004)
    frame:1319 body:7
    pentration(0.000000) point(0.100407 0.004826 -0.045855)
    frame:1329 body:7
you can see that the foot is off the ground for almost 10 or so frames.
the penetration is always zero. what happen is that for those frames the foot net force point up by a minuscule value, whi is sufficient to make the collsion system report no contact.
here is a video that show what happen to the polygon, without contact cache.
https://youtu.be/JvmA3vABIFU

this confirm that it will never work with rigid hard contacts.
this needs a soft contact that has some kind of cushion on the floor, this way if the velocity point up by some small value, the contact is still valid if is not enought to clear the penetration. As it is now even a round off error positive up velocity is enought to report no collision.
I will add a material option to define contact stiffness, my hope it takes care of that.
basically is like a penalty contact, that needs some penetration to generate the reaction force.
I will work on that and see if the model gets better. them we continue from there.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Inverse Dynamics Robot demo questions

Postby Julio Jerez » Tue Dec 31, 2019 6:35 pm

al right, as a quick hack before doing anything a just a applied a large regularizer to the diagonal or the contact mass matrix, but the right side acceleration is still the same as for hard contact so I expect it to oscillate real bad, but the contact should be stable.
Guess what? the results are very encouraging. The noisy contacts are gone, it does not skip even a single one. Here is a small video of the results.
https://youtu.be/fJUAEV6llIE

you can see that the body rocks forward and backward as I expect a body to oscillating on a stiff spring no proper calibrated.
in fact it is behaving far better than I expected, I was expecting a higher frequency or even toppling.

here are few contact traces.
    frame:17986 body:7
    penetration(0.006332) point(0.150300 -0.006332 0.176712)
    penetration(0.004551) point(0.099961 -0.004551 -0.043203)
    penetration(0.004587) point(0.199961 -0.004587 -0.043357)
    frame:17987 body:7
    penetration(0.006250) point(0.150298 -0.006250 0.176687)
    penetration(0.004588) point(0.099960 -0.004588 -0.043230)
    penetration(0.004621) point(0.199960 -0.004621 -0.043384)
    frame:17988 body:7
    penetration(0.006168) point(0.150296 -0.006168 0.176662)
    penetration(0.004621) point(0.099957 -0.004621 -0.043255)
    penetration(0.004649) point(0.199957 -0.004649 -0.043409)
    frame:17989 body:7
    penetration(0.006087) point(0.150292 -0.006087 0.176639)
    penetration(0.004649) point(0.099953 -0.004649 -0.043279)
    penetration(0.004669) point(0.199953 -0.004669 -0.043433)
    frame:17990 body:7
    penetration(0.006008) point(0.150287 -0.006008 0.176617)
    penetration(0.004673) point(0.099949 -0.004673 -0.043302)
    penetration(0.004684) point(0.199949 -0.004684 -0.043456)
    frame:17991 body:7
    penetration(0.005931) point(0.150282 -0.005931 0.176597)
    penetration(0.004692) point(0.099944 -0.004692 -0.043323)
    penetration(0.004694) point(0.199944 -0.004694 -0.043476)
    frame:17992 body:7
    penetration(0.005857) point(0.150276 -0.005857 0.176578)
    penetration(0.004709) point(0.099938 -0.004709 -0.043342)
    penetration(0.004699) point(0.199938 -0.004699 -0.043496)
    frame:17993 body:7
    penetration(0.005788) point(0.150270 -0.005788 0.176561)
    penetration(0.004722) point(0.099932 -0.004722 -0.043360)
    penetration(0.004699) point(0.199932 -0.004699 -0.043513)
    frame:17994 body:7
    penetration(0.005722) point(0.150263 -0.005722 0.176545)
    penetration(0.004731) point(0.099926 -0.004731 -0.043376)
    penetration(0.004697) point(0.199926 -0.004697 -0.043529)
    frame:17995 body:7
    penetration(0.005661) point(0.150256 -0.005661 0.176531)
    penetration(0.004739) point(0.099920 -0.004739 -0.043390)
    penetration(0.004691) point(0.199920 -0.004691 -0.043543)
    frame:17996 body:7
    penetration(0.005603) point(0.150249 -0.005603 0.176519)
    penetration(0.004743) point(0.099913 -0.004743 -0.043403)
    penetration(0.004683) point(0.199913 -0.004683 -0.043555)
    frame:17997 body:7
    penetration(0.005551) point(0.150242 -0.005551 0.176508)
    penetration(0.004745) point(0.099907 -0.004745 -0.043414)
    penetration(0.004671) point(0.199906 -0.004671 -0.043566)
    frame:17998 body:7
    penetration(0.005502) point(0.150235 -0.005502 0.176499)
    penetration(0.004744) point(0.099900 -0.004744 -0.043424)
    penetration(0.004657) point(0.199900 -0.004657 -0.043576)
    frame:17999 body:7
    penetration(0.005458) point(0.150228 -0.005458 0.176491)
    penetration(0.004741) point(0.099893 -0.004741 -0.043432)
    penetration(0.004640) point(0.199893 -0.004640 -0.043584)
    frame:18000 body:7
    penetration(0.005417) point(0.150220 -0.005417 0.176484)
    penetration(0.004735) point(0.099886 -0.004735 -0.043438)
    penetration(0.004620) point(0.199886 -0.004620 -0.043590)
    frame:18001 body:7
    penetration(0.005380) point(0.150212 -0.005380 0.176480)
    penetration(0.004725) point(0.099879 -0.004725 -0.043443)
    penetration(0.004595) point(0.199878 -0.004595 -0.043594)
    frame:18002 body:7
it does not show any frame skipping, and you can see how the penetration, an dthe blue line in teh video show the normal force relatively smooth

Now I can proceed and add the code to make the make teh soft contact option with a critically damped contacts. this way the contact should minimize the oscillation and teh forces with be a lot smother still.

teh only part that concerned me is that is looks a very critical, if you look at the video the body rocks filly violent, for such a small change in contact penetration. form frame to frame the contact is changing approximately 1.0 millimeter, I do not know if the body motion comes from the ragdoll joints of from the foots. I need to check that out.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Inverse Dynamics Robot demo questions

Postby Julio Jerez » Wed Jan 01, 2020 1:54 am

Hey Joe where is my beer?
https://youtu.be/n3LCPWPxir4

now afte I formalize the soft contact so that I can be set as material option. my next step is to find out how fast the balancing action can be. now is no more than 0.3 millimeter per frame, that's too slow.
I think it can be way faster, but it needs and acceleration regulator so that the velocity increases but does not passes that foot friction.
but anyway this is just tweaks, you can see that is fairly robust, as long as teh green point is inside the support polygon, is recover the equilibrium.

this right away say that is we animate the yellow point (the center of the support polygon, basically the green point follow the yellow point plus some offset that comes from anything, a procedural animation or a keyframe animation. that's an idle State right there.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Inverse Dynamics Robot demo questions

Postby JoeJ » Wed Jan 01, 2020 3:29 am

Yeah, this look incredibly well :D
Somehow the contact problem was initially much worse for you than for me - i really did not spot it for months, although i had contact visualization.
So that soft contacts seems very nice general feature. Is there new API for this? You should throw in some API function names in your posts so people know where to look for... give me that soft contacts stuff too! :D

Julio Jerez wrote:my next step is to find out how fast the balancing action can be.

The beer comes closer... it's almost visible at the horizon...
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Inverse Dynamics Robot demo questions

Postby Julio Jerez » Wed Jan 01, 2020 12:41 pm

later today I will commit the change to expose tha option.
is will be function like
Code: Select all
void NewtonMaterialSetAsSoftContact (const NewtonMaterial* const material,
        dFloat relaxation, dFloat spring, dFloat damper);


thsi could be set form a collsion call back on the contact point. I could be also added to a default material for quick test, but sof contact is something for very special situations.

they work on penetration, so a collsion shape should be a lithe larger to make up for the penetration.
they are a mix of penalty and rigid body, part of teh force is calculate by teh rigid body solver, and part is make up by a implicit one dimension damper damper, on teh accelration side.
this mean that high impulse can make the body go on deep penetration. thsi could probably be limited so that when penetration pass some value is switches to hard until the penetration is resolve.
but you get the idea.

I have to make few change to the joint base class to support this functionality. whi is in the bilateral joints, but can no be configured.

anyway I will open a new thread thsi one is too long and old.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 12 guests

cron