Development of self balancing biped with inverse Dynamics

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Development of self balancing biped with inverse Dynamic

Postby JoeJ » Wed Feb 12, 2020 12:16 pm

Sounds more you understand what i meant :) smelling the beer... :mrgreen:

Yeah, thinking about this single point is the right way to think about it. If we call this point Center Of Pressure, and we have ability to control its position, balancing becomes easy.
I did it by controlling ankle torque. But we could also just generate a virtual contact directly and ignore real feet contacts. This would be easy and precise, and if done right still no cheating.
(I considered this a plan B if problems, or as a LOD soluition at the distance - could be extended to procedural animation replacement for real physics at distance characters, etc.)

I your last posts i was wondering a bit why you pay so much attention to foot orientation and contacts.
Because i did not have to do this, and i had balancing ragdoll on two moving and rotating platforms non the less.
I only have this old video where they move very slowly, but worked also with much higher speed:

If you look at the feet, you see they do not care a lot about alignment, orientation even goes out of place sometimes.
But that's no big issue - it only changes the shape of the support polygon.
It is only important to control the single point that puts pressure from COM to ground.
We can do this with ankle torque and left / right foot pressure, and it does not even matter if the point is between the feet or in air.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Development of self balancing biped with inverse Dynamic

Postby Julio Jerez » Thu Feb 13, 2020 5:13 pm

ok Joe I am change the design, the leg control will not control the feel orientation.
Instead the feed will have it own joint that essentially will be kind of a sticky rolling Resistance joint using a down hinge joint with dry friction.
it will be this friction that that will make i possible for the model to be archive it balance

this reduce the legs to be 4 degree of freedom as opposed to 6 that was before.
then each feet now will have it own independent 2 dof that will can be control bu poses of by the environment. basically a pose will try to control the foot when on air, by the contact points will override the orient-ion when the hit an obstacle. The override action is natural because fhe dry friction. I like the method much better

I start the change but is broken now because the referent for calculation the support point is no long the same, but you can see that the model now rolls around it feet.
I will work on this this weekend.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Development of self balancing biped with inverse Dynamic

Postby Julio Jerez » Thu Aug 05, 2021 11:36 am

Late, but I have not forgotten about this.

It turned out the soft contact idea was not good.
I learned few things from that and the pass fail experiments.

It seems there are two methods for doing this.
The first one and the one almost every one does, but that I would never ever try because I believe it just wrong.
This basically is, connecting the limb and having them have a free dof, them each free dof is control by applying joint torques using PID.
I think this is wrong in so many levels that is hard to cover them all. I will just mention two cases.
The first is that using PID to calculate torques is extremely sensitive to parameters, like mass, inertia, external forces, etc.
The other is that calculating the joint torque for one joint is the equivalent of placing the value on the main diagonal of a linear system and calculating the bodies angular accelerations. This extremely wrong because ignore the coupling with the other limbs. So I would never do that.

The other method, and the one I prefer is using joint motors to calculate precise angular accelerations.
At first this seemed to be a great solution, and it actually worked in very simple test.
But after trying more practical cases, I discover that having a solid rigid articulation is really bad when reacting to external forces and impulses.
One case is the foot hitting the floor.
This generate strong impulses that propagate all thought the body.
This is not just a bug that can be fixed by tweaking parameters or by creating a bone headed ideas like the soft contact. This is a fundamental flaw that can't be fix.

I will explain why the is such a fundamental flaw.
Imagine a rigid box that fall from some high over a floor

At the moment the box hit the ground, the reaction forces are added to the gravity and the net acceleration of that box will be zero or pointing up. This is quite fine.

Now let us connect few boxes with rigid joints, and let the drop from the same high.
The same process happens, the box at the bottom get the impulse and its acceleration point up, the second box also get the impulse from the first box and it's net acceleration also points up, and so on until the top box get a pointing up acceleration.
This would be right if it was what we want to simulate.

But if the box stack was and organic articulation that is not what we expect. What is expected is that the first box receive the impact. thsi box store part of teh energy and the rest is transferred to teh othe joints.
But it does not transfer all the impulse to the next since that box has some elasticity, and will dissipate some kinetic energy. So the result should be a gradual wave that transfer the motion to the top but until the bounce impulse dissipate.

In a nut shelve the articulation should be rigid but with some elasticity.
Notice that this is not the same as having an iterative solvers that does not calculate the correct torque, we still want the correct solver but the elasticity should be calculated with precision.
Basically this is what a pid joint does.
Essentially what we need is a semi rigid articulated body.

I am setting that now and trying again.
So far the results are promising but I have been wrong before, failing to anticipate unseen problems.
So let use see.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Development of self balancing biped with inverse Dynamic

Postby JoeJ » Thu Aug 05, 2021 6:32 pm

Yeah, makes perfect sense. Making only the contact soft and somewhat elastic is not really a solution.

I noticed this problem of rigidity when moving from the older, non exact joints to the new ones. It was like 'wow, super accurate, but now it's actually a bit too stiff' :) It took me quite some effort to make it work, but i was not really sure if the better joints are indeed better for my application in practice.

Recently i was thinking to use Newton for offline destruction simulations. So having a large number of bodies, each having joints to it's neighbors. Ofc. this won't work if we aim for stiff and rigid behavior, so i thought i would try a joint inspired from my fluid simulator, which has a good fracture model in some materials. The particles have a 3x3 matrix, called elastic deformation gradient, which describes how space is contracting or expanding around them. I used this for effects like e.g. making the top surface contracting but the matter below expanding, both doing so parallel to the mass gradient (surface normal), so the surface tears apart and peels itself off like old paint.
I think if i learn some more about this, i could use similar practices for Newton joints.

So maybe, while working on some elasticity, you can reuse this to progress on destruction / fracture things as well. :D
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Development of self balancing biped with inverse Dynamic

Postby Julio Jerez » Thu Aug 05, 2021 7:19 pm

JoeJ wrote:I noticed this problem of rigidity when moving from the older, non exact joints to the new ones. It was like 'wow, super accurate, but now it's actually a bit too stiff' :) It took me quite some effort to make it work, but i was not really sure if the better joints are indeed better for my application in practice.

oh but we do not want to work bad unreliable joints, that's like trying to extra useful information from random noise.
We found this because the joints are good enough to expose that flaw in the methodology but the solution can not be going bad to the even more wrong method.
to me, the solution is to find the right answer.

By implementing and set of PID joints, we can now have a large range of stiffness control.
and the good part of this is that the PID dof are independent of the limits dof.

so like you mentioned, I can very much ignore the joints limit, there are only there for the joint to work on the legal work space.
that was a huge problem with 3.xx where the PID and the limit where the same dof, so in can only have one or the other at any time step. Now newton 4 can make joints with spring and limit at the same time so when one object hit a limit, it will stop but the joint DOF will have the potential energy stored to recover as soon as the limit is not there.

And example of that is a vehicle suspension. In the pass I have to do two solver passes, one to get the springs accelerations and from that calculate the forces and torques of each spring so that they can be applied as external forces.
now the spring and the limit are part of the joint and the solver figure out the answer.
the incredible part is that this seems far more robust than I though it was going to be.

now this new functionality, it is one of the missing part for the active balancing character since motors are on 100% of the time, not only that, they can be as stiff as we want them to be.
It is remarkable.

In the code that is check in. I set up a model with the upper part set to stiff PID joints.
The lower part are inverse dynamics joint and the foot the effectors.
with just that simple set up, when I let the character drop, it states up without doing anything at all.
the foot land they do teh natural bounce, the flex the legs, but by teh time the wave reach the hip is almost attenuated. so the hip just slow down. and it take few frame for the system to reach the equilibrium. (I had try to reproduce that for so long, and now is comes out natural :mrgreen: )

this was nearly impossible before since the body parts where all getting the jerky reaction each time any body part got a collision with the ground. all the body parts where getting the same reaction. but now since part of the energy is stored in teh joint dof. Only part of the total energy gets transferred to the other body parts. To me this model is more close to real life.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Development of self balancing biped with inverse Dynamic

Postby Julio Jerez » Fri Aug 06, 2021 1:59 pm

I now added the very first test of teh respond of teh forward Dynamics PD joint.
I just have the player bending the forward arms 60 degrees to the front and teh reaction is very good.
actually far better that what I expected. It is quite impressive.

you can play with the model and smack him around and is is as if he wants to do push up, but teh impressive thing is that there is not controller applied yet.
doing all the manipulation wit the mouse control and he still react very plausibly natural.

It may seems soft, but in reality is far stronger than a human would be. The reason it seems soft with he mouse interaction is that the forces applied by the mouse will actually tear apart the arm or the leg of a human.

now the next step is to implement the pose controller, which will be based of the inverted pendulum and optimizing the center of mass. So let us see hwo that goes.
the cool part is that this seem to be heading in teh direction that is can support key frame or motion capture data animations. :shock: :D :mrgreen:
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Development of self balancing biped with inverse Dynamic

Postby JoeJ » Sat Aug 07, 2021 3:52 pm

Did the download next day after the talk but tried only now. Feels good and natural! :)
I'm confused. Didn't you say you don't want PIDs? But tried still and it did just work?
Anyway, looks good. I also liked the stacks demo. The sleep state propagates nicely. Bodies behave somehow connected, behavior is almost fluidy. Also the destruction stuff is nice. Probably the first things i'll use after being done with my terrain simulation stuff...

Looks like there was lots of progress on the engine :D
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Development of self balancing biped with inverse Dynamic

Postby Julio Jerez » Sat Aug 07, 2021 4:18 pm

yes, the progress is all of the wisdom accumulated over the years that because of the C interface made so hard to implement. ther has also been some new improvement that is difficult to remember the detail but you can see the result.

in the DIP, what I mean is I will no use PID to calculate external torques between tow bodies and applied then as if they where not connected to the bodies, that is just wrong and I am appalled at how in academia I see that use over and over.

what I am using is a PID joint, the joint the desired target error position and calculate a desire accelration of the form

Code: Select all
error = Os - O;
memory = memory + ki * error * dt;
a = ks * error + memory + kd * v

here Os is the desire angle or position.
O id the current position or orientation.

ks = spring const
ki = integration constant
ks = damper contact
v = joint velocity


here the accelration become the joint accelration and the solver determine teh precise force or torque that need to applied to each of the connected bodies.
but this force is very different that the adhoc method, and the good thong is that of and application need to get that feed back I onel need to read it form the joint after the update.

so in my method the force is a dependent variable and teh acceleration is the input variable. while in teh other method the force is an input variable as you will knwo it only take a small perturbation of teh system for that value to go bananas.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Development of self balancing biped with inverse Dynamic

Postby JoeJ » Sat Aug 07, 2021 6:17 pm

I think i get it, thanks. Sounds good.
Some form of elasticity always was kind of missing before. :)

What's your state on the fracture? I think you mentioned some problems a while back.
Does the whole model destruct into all pieces, or can there be a form of damage propagation so it splits only in two parts for example?
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Development of self balancing biped with inverse Dynamic

Postby Julio Jerez » Sat Aug 07, 2021 6:43 pm

I have some ideas, but they needed some funtionality to be in place.

For the partial destruction it need a connectivity graph that determine the part that are going to be activate by and impact.
For that it need a disjoint set, which is there.
It also needed the compound. Which is also there.
Finally for handling are relatively large set of pieces is also need a gou solver. This many not be as important, so I can continue without if whe impose the max volume or an max number of piece that could be detach.

I commented out the structure destruction until I get those
Bother them a switch to vehicle and character.

In newton 1.5 I hade this going but is was not very good or practical because the frame where calculated used boolean, not they are much better using voronoi.

Anyway it will be after I get some result with the biped character.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Development of self balancing biped with inverse Dynamic

Postby Julio Jerez » Sat Aug 07, 2021 9:45 pm

Joe yo uhave to check this out dude.
I just throw a quick hack of moving the legs using walk cycle based on sin wave.

is does not lift the feet, just drags them, I did not expect this to work at all.
Guess what the result are far better than my expectations.

there is not COM optimization at all. so it should just flops .

but I learned that if I removed the upper body parts, the com is low enough that is does not flops.
as I start adding the upper body parts, the com goes up, so as it moves the legs, the internal body reaction makes the com comes outside the support polygon and flops.
but the respond is quite positive.

what this means is that now I can add the Inverted Pendulum for com optimization and the character you state up at all time as a long as the com is supported.
notice that this does not need project of any kind,

check it out, and you can try enabling the upper body parts
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Development of self balancing biped with inverse Dynamic

Postby Julio Jerez » Sun Aug 08, 2021 1:43 pm

I now have the class that generate a very robotic walk but the moment it lift a leg, the center of mass lean to that direction and the foot is always hitting the ground.
this is because ther is not hip sway, so this like a good start point to do the balancing of teh center of mass. you can see that when the foot moves back still has contacts wit the ground and the friction is one.

ther are some video in biomechanics for getting pointe of how to move the effectors like this
https://www.youtube.com/watch?v=UiICACfwKag

those are good for learning how to make the controller.
regardless the walk cycle should generate a bitter post. right now is onle a two d animation on the sagittal plane of the character.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Development of self balancing biped with inverse Dynamic

Postby Julio Jerez » Sun Aug 08, 2021 7:47 pm

Now it comes the big problems.

I added the idle pose. And when the only parts are the lower body, it is very stable.
This make sense since the center of mass is so low.

When adding the upper body parts, it is a different story.
It still stay balanced, which is remarkable since it is passive.

Buy any slight motion gives lots of momentum to the upper body and loses its equilibrium and flops.
The controller is going to take into account the kinetic energy.
This is not as eassy as it sounds since there are not assistance of any kind, only the joints actuators.
So this is going to be a challenge.

But I first have to add some visual feedback to make sense of what I see.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Development of self balancing biped with inverse Dynamic

Postby Julio Jerez » Mon Aug 09, 2021 6:48 pm

feu, it is back not making sence again.

I added visualization to show the support point, that is the point that point to teh center of the polygon form by the contact points.
and now as you can see is is quite off, this is what explain the is flops.

In the pass I was actually computing the center of the convex polygon form by the contacts. but that introduces lots of churning, I am now using the center on mass of the effects in contact with the floor.

since the effector will be aligned to maximize the ground contact them that point is a good representations of the point inside the support polygon.

this leand to a nice algorithm which is.

make the array of the center of mas of each effector in contact wit the ground.
if the contact count is zero, the is no balance
if contact count is one, it is standing on one effector.
if contact is three is supported by a triangle, (good for fall and standing)
if contact is four or more is supported by the convex hull (good for quadrupeds and other types of creatures)

for nwo I am assuming tow foot contacts. and I am glad the debug code make sence.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Development of self balancing biped with inverse Dynamic

Postby Julio Jerez » Tue Aug 10, 2021 3:17 pm

ok just to make sure I am no making teh same mistake I did in 3.xx.
I am drawing the support polygon again.

it is the yellow polygon made of the feet contacts.
you can see how noise it really is, using teh center of that polygon as the target to when the center of mass should go, is what causes all that churning.

but is we use the center of mass of teh bodies that generate those contacts, we knwo that the center will be inside the support polygon and will will no move each time a contact changes.
That mistake was what led me to that erroneous idea of making soft contacts.

Thsi seem to be far more robust method
Julio Jerez
Moderator
Moderator
 
Posts: 12249
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 14 guests

cron