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 » Wed Jan 03, 2018 10:40 am

ok now we have better curve.
the curve is degree 1 (linear) and you can see it has a discontinuity when is in the air, but I believe that make it act even nicer, this can be fixed either but adding more control points or by making second degree. The ride is almost perfectly smooth, maybe too smooth. 8) :D :) :o :shock:
walkcycle1.png
walkcycle1.png (14.56 KiB) Viewed 4427 times


please check it out again.

I was expecting that each time the leg changes direction, that would add a notizable effect on the motion of the body, but is in fact negligible we may even do so calibration so teh the joint are not so strong. This show how flexible the system is.
Remember also that we can tweak then without affecting too much the effect on other like it would be the case using spring, damped and pid, this is how the curve look now.

ok now to the final tunings friction, restitution, and turn rate.
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Inverse Dynamics Robot demo questions

Postby Julio Jerez » Wed Jan 03, 2018 12:02 pm

I added 10 walker to see the performance, and I am getting
5.8 ms with one thread
3.7 with two thread
3.1 with four thread and
3.0 with eight or more thread and

I would expect that thread yielding to be better than that you can see that as more thread ad added the gain is less and less.
there has to be some overheard bug in the way teh task are dispatched.

for 3.15 I will write a standalone fame capture thread profiler, similar to telemetry. something does no seem right there.
anyway that's a different problem but performance seem a concern.
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Inverse Dynamics Robot demo questions

Postby JoeJ » Wed Jan 03, 2018 12:34 pm

Cycle looks perfect now.

Did the perf test too with 10 robots on old i7 930 (seperated so thy don't collide):

9.7ms one thread
5.3 - 2
3.8 - 4 or 8

(Not that bad - i may keep my machine another 10 years until they manage to double performance :roll: )

Edit: repeating the test so legs collide with both neighbouring robots, timings do not change significantly - good work! :)
User avatar
JoeJ
 
Posts: 1160
Joined: Tue Dec 21, 2010 6:18 pm

Re: Inverse Dynamics Robot demo questions

Postby Julio Jerez » Wed Jan 03, 2018 12:54 pm

Yes I agree, is not really that bad considering that visual studio profiler says it is taking longer to render than in the physics, my concern was the diminishing gain with the thread doubling seems to get worse as the core count double.

It believe the is a blocking problem when the task are dispatched. Your timing is more close to what it expect for a doubling of the thread count.

Any way, I already have the solve modification that will convert the system matrix to one that is in fact twice larger but with condition number that will approach one. This Wil make it possible that load per theards is at the joint level instead of what it is now, island level.
This modification will make that it will not slow down when many collide, plus will allow unlimited cores.

This is for Newton 3.15
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Inverse Dynamics Robot demo questions

Postby Julio Jerez » Wed Jan 03, 2018 12:59 pm

Shall we move to the biped demo
now?
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Inverse Dynamics Robot demo questions

Postby JoeJ » Wed Jan 03, 2018 1:25 pm

Julio Jerez wrote:Shall we move to the biped demo
now?


Yep - destroy my doupts, please! :mrgreen:


What machine do you have?

Personally and surprisingly i always get an almost 4x speedup using my simple job system, but so far i only used it for huge workloads so synchronization is rare in relation and has no effect.

I assume if an algorithm requires a lot of sync getting those ideal numbers becomes impossible and all we can do is to design for least possible synchronization?

Edit: With sync i mean spawning or joining threads, but if worker threads keep alive all the time this problem goes away so my point is pointless.
Inside the job system the only kind of sync i use is to wait on atomic values until more work is available or a dependency-barrier has passed. I don't use things like mutexes or semaphores and don't even know why i would need them. (I am a CPU multi threading noob.)

If i look at your numbers, this reminds me about using OpenMP. I've got disappointing results very often and mostly there was no obvious reason.
User avatar
JoeJ
 
Posts: 1160
Joined: Tue Dec 21, 2010 6:18 pm

Re: Inverse Dynamics Robot demo questions

Postby JoeJ » Sun Dec 29, 2019 5:04 pm

... looks good :D
User avatar
JoeJ
 
Posts: 1160
Joined: Tue Dec 21, 2010 6:18 pm

Re: Inverse Dynamics Robot demo questions

Postby Julio Jerez » Sun Dec 29, 2019 5:35 pm

Yes I recently resume the biped self balancing demo.

I figured out how to incorporate the inverse Dynamics with the joint solver by making closed kinematic loops.
It works remakbly well as long as the system are well defined.
Most last demos are using this method, making robot is a routine procedure.

I am now trying the self balancing demo with Dave.
It is a really early stage but the preliminary results seem very promising.

I found unexpected results and plenty confirmations of my hypothesis.
Among the unexpected result, it seem that internal joint torque, do not really have to be as strong as I though the had to be.
I found that once you make them stronger than twice the value needed to support the body weight, the model act funny.
After the fact this makes sense, if you think about.
A normal human can not really lift more than twice it own weight, plus it has two legs.
In additions, the legs are much lighter than the rest of the body. This slowed a person to quickly make fast limb reaction with out affecting the rest of the body too much. But these finding aren't so obvious until you actually put a model together.

If you check the last commit, you can see a model that try to moves his center of mass to align with the projection over the support polygon firmed by the foot contacts.

One of the challenge I am facing now is that the support polyon is too noisy. As the com move to the center of the polygon, the topology tend to change making the model to self adjust perpetually.

It kind of look cool but is not desired,
I am now tryin to add the foot alignment so that the face the floor average normal, maybe this will help.

But by the end the feet needs some kind of soft contact. This is a contact that allows some penetration, so the the shape the form is more stable.
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Inverse Dynamics Robot demo questions

Postby JoeJ » Mon Dec 30, 2019 4:40 am

Yeah, soft feet contacts is also what i thought in the end, after realizing all my issues with loosing balance came from unstable contact positions. What worked for me was to position the contacts manually to the corners of the feet, so this could be a workaround for you too. It might be even necessary additionally to having soft contacts.

In your demo, it seems all you do is pushing the feet a bit down, aligning with the com, and you get stable balance very easily. I see the potential here, because for me this already was very difficult, requiring a complete understanding of inverted pendulum dynamics and control. Though, i always had full upper body which makes balancing harder, but i guess your solver would handle this as well.

Still, in the end you might face the same problem when the motion requires unstable balance. A contact that goes from the edge of the foot to its center only for one frame is enough to cause tipping over, if you plan your motion to be close at the edge of what is physically possible. It seems regular human motion is often pretty close the that edge, and risky, because com is so high and support area is so small.

Additionally, placing feet contacts manually would allow to cheat. You could place the contact outside of the foot. Even if successfull this might be a necessary option for action games, where realism is not always the goal, or game design is more important.
So manual contact placement is an interesting / better alternative to using external forces: Just place the contact at Instaneous Capture Point (which is easy to calculate), and your guy will never tip over - much easier than calculating a minimal external force, and it will behave as realistic as possible.

... said all this already, but some time has passed :)

Do you plan animation playback, something like setting a target pose for the whole body?
This could be the interface for me to use your method. You remember i require control over the ragdoll com, which is not directly given by having control only over end effectors. But i realize i could do it indirectly by setting such a pose.
User avatar
JoeJ
 
Posts: 1160
Joined: Tue Dec 21, 2010 6:18 pm

Re: Inverse Dynamics Robot demo questions

Postby Julio Jerez » Mon Dec 30, 2019 8:50 am

Yes those are all valid observations.

Remember this is just one controller who's target goal is to keep the projection of center of mass of mass over the center of the support polygon aligned.

This controller will return failure should any of the condition you mention happened and a state machine transition to another controll is triggered.

In the case you mention some recover state the takes into account the velocity of the com, the closest foot to the point where the com leaves the support polygon can be used to initialized the recovering state.
The goal of this state is to move one feet to a point where the target footplant will enlarge the support polgygon, but this controller is not longer assuming static equilibrium.

For now I need to stabilize the support polygon which is too noisy.

And yes you have the right idea, besically you are talking of a user defined collision callback which the engine supports.

But before that I need to add the foot alignment to the balance controller, basically one reason that contribute to the support polygon be so noisy, is that each time the body moves so slightly it triggers a recalculation of contacts, is that slignt motion that comes back with a different set of contacts.
If you think about this also happens to a human foot, but because organic feet are surround but skin and flesh they act as soft contacts.
To emulate that, two parts are needed
1 the foot controll that keep the foot alignment with the ground, by counteracting the motion.
2 user defined contact calculator, that could use different approaches. I was thinking using three spheres, two at each back corner of the box and one at the middle of the front, and casting them down against the ground. This will generate reliable contact points as the roundness of the sphere will mimic the small flesh moment.

Finally yes the plan is to extract key poses from key frame anymation and use them as target motion of different states.
These target poses can bet modified by splines control points. But that's only one mode, other modes could be full synthesis on motion by fitting spline segments to effector trajectory.
Once we can feed position and velocities to end effectors and have them solved correctly without having to worry about feed back, many strategies can be implemented.
No need for dreaded PD controller, the solver always calculates exact joint torques.
Basically joint torque are the feedback, not the inputs to the system. This is what is completely new and unique to this system.

This was the ideas I have from few year, but has taking several try to get working. My claim is that this system is more comparable to real biological systems that the methods use by academia that to my knowledge are all based on calculations joints torque as input to the system.
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Inverse Dynamics Robot demo questions

Postby Julio Jerez » Mon Dec 30, 2019 9:59 am

As the upper body, you are right it can make the balance more sensitive, but my guess is that not as much as you think.
To make provision for that a placed that upper body box as a counter weight to represent the rest of the upper body.

In the demo the upper box is set to weight half of the total body. So the weight is accounted for.
The Dynamics of a swing arm is not, but this is where biomechanical principles come handy, for example when a human swing and arm forward, it also swing the other arm in the opposite direction along with some small upper body counter rotations.
And other stuff like that, but we can worry about that when I get there, for now my main focus is the stabilization of the foot contacts.
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Inverse Dynamics Robot demo questions

Postby JoeJ » Mon Dec 30, 2019 2:35 pm

Julio Jerez wrote:These target poses can bet modified by splines control points. But that's only one mode, other modes could be full synthesis on motion by fitting spline segments to effector trajectory.


Guess that's the interesting part finally for the users.
My motivation here is 1. Get rid of all animation, because that belongs to movies, not games :twisted: , and 2. Get rid of it because that's no option for one man made games :)

Best case for me would be to care only about this input and generating all motion procedurally. Having control over each individual body might not be necessary, but if i'm limited to effectors, then i would need something like feet, hands, hip and head at least, likely also elbows, knees, torso - so ability to place 'internal' effectors.
Saying this because i'm unsure if you try to match animation only by following end effectors, which i doubt would work (especially for what i have in mind, but also not for animation matching).

Also, with procedural motion in mind, giving target positions, or even just target joint angular velocities would be better than full trajectory paths. Central idea of my work is to avoid planning ahead of time whenever possible. This works for constrained motion like the one legged hopper which is like running, but it does not work well for underconstrained motion like walking (which requires a bit of a state machine at least it seems). Only thing that requires constant planning ahead is balancing itself, and efficient balancing requires high level control over total com, which may be beyond the objectives you can get from biometrics, eventually.

But just to give some early feedback. We will see how everything comes together...
If we disagree at some detail, and i would be right, you will see that yourself when facing a certain problem. Same if it's the other way around, so i do not worry.


Ok, i'll go back to my boring geometry preprocessing work. What's cool here is, even i only wanted to generate necessary data for my GI stuff, now as all starts to work i realize i can get a powerful game editor from this work. Very powerful - guess i can get high quality results with orders of magnitude less manual work than seen from something like UE. So that one man made game might become a thing, and walking ragdolls is the final missing piece.

Soon we'll look down to 'industry standards', hahaha :twisted:
User avatar
JoeJ
 
Posts: 1160
Joined: Tue Dec 21, 2010 6:18 pm

Re: Inverse Dynamics Robot demo questions

Postby Julio Jerez » Mon Dec 30, 2019 4:23 pm

you got the best intention my friend, allow me to retort
https://www.youtube.com/watch?v=eg8-dii9Ma0
I could not resist :mrgreen: :mrgreen:
you still thinking the old way my friend. we do agree in that procedural generation of poses is
the primary goal, but part of my claim is that procedural generate poses are define by the geometry of the model and the constraints of the environment, the proble that happen with animation and blending is that they are no played back in the same environment. but there is nothing wrong with getting poses for a motion capture to get the style and adapt it is using physically based approaches, of course I have not seem thsi done satisfactory by any body so far, but we are getting ahead of our self.
I also claim is that we only need the effectors, not need to ever control any intermediate limb in between an effector and it reference point.
I know is a big claim and as we make progress, you are right new finding may me change my hypothesis.

anyway I know did part one of my strategy for stabilize the support polygon.
It did not solve the problem but is did what I expect to do, discretize the construction of the polygon.

if you run the demo you will see that now the support polygon only has some many shapes than can form. in fact I nwo claim that balancing in one foot should be perfect, without out any need to massage the contacts as long as the com fall inside the triangle form by teh contact points, regardless of the values of the forces at the contact points.

this now open the door to a new controller. The single foot stance controller.
we can call this one the idle stance controller and we have a two state machine that is you lift one foot, is witch to the single stance and vise verse. but I an do doing that now.

I am now adding the foot alignment, the is a control with a controll, that when teh foot is in contact is check the normal of the foot and there are three possibility.
1-thre point contact no alignment.
2-tow points contact for a line, and a the controller calculate a correction to alone the line to teh direction of the their contact to force state 1.
3-single contact, try to make a rotation to the state 2, and you get the idea.
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Inverse Dynamics Robot demo questions

Postby Julio Jerez » Mon Dec 30, 2019 4:49 pm

ok here is a fail prediction, balancing in one foot.

I does works, you can see in the video.
https://youtu.be/KUK0T1PaGw8
but without any adjustment the foot actually loses contacts, you can see this because of the flickering of the blue lines that represent the forces at the contact points.
I am very surprised the controller keeps the model balanced at all with the such noisy contacts

This demonstrates that we both are wrong in some, I am wrong because I expected the single foot to be more stable. and you were wrong when you say that keeping balance is so hard that losing a single contact for one frame is enough to topple the model down.

I will debug this to see if there is some error before start adding any compensation, because this should be absolutely stable. So stable the whole system should go to sleep in one frame as soon as teh CG aligns with the center of the support polygon.

I suspect what is it, basically the hard contacts are so stringent that any slight motion reports not collision, so it is screaming for a sort contact that let the sphere be is some perpetual penetration.
I am calling this a soft contact.
but I could be wrong there too, so I will step and debug before working on that.
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Inverse Dynamics Robot demo questions

Postby JoeJ » Mon Dec 30, 2019 7:47 pm

Julio Jerez wrote:This demonstrates that we both are wrong in some, I am wrong because I expected the single foot to be more stable. and you were wrong when you say that keeping balance is so hard that losing a single contact for one frame is enough to topple the model down.


No, that's not what i mean when i talk about balance. My point is 'efficient' balance. I had balancing ragdoll on one foot, holding the second one up in the air, on a moving and rotating platform - and that was before you made the stiffer joints.

So what i mean with efficient balance is best described with this test setup:
Ragdoll stands straight, keeping both feet in place, making a step is not allowed.
Then make the ragdoll swing left and right in a periodic cycle.
And you set the target as placing the com of the ragdoll almost above the edge of the support area on both sides.
Try to make the ragdoll swing as fast as possible. And also do it yourself - depending on how wide the feet are apart, one swing should take a second or so.

I think that's the ultimate test. It requires to plan the full motion ahead, and how the system changes.
In fact, the more you come towards the edge, the less torque you can apply to break before tipping over. That means you need to start breaking in time, and if you miss the moment, you will tip over and only a step can prevent this.
The equations become a system of position dependent acceleration, where position means ankle nagle, and acceleration means ankle torque. The equation is hard, but closed form analytical. It's possible to calculate much time a swing will take, and from that you can determinate how 'efficient' your robot is able to act. That's what i mean.
This also implies there often is no state machine necessary, because you can predict the future and current possibility of action just from the current state of the system itself. It tells you where and when to place the next step etc, all without a need for a state machine that keeps track of itself using a form of memory.

And this is where my doubts come from - i doubt your solver is that smart to know this. But without it, no realistic motion, or at least no most efficient motion is possible, because humans act constantly in this 'most risky, but efficent' mode. Otherwise we would move like that Sony robot. I'm 100% sure Boston Dynamics uses exact that equation, and it is this one thing that makes them the only ones who get it right.

You will soon see yourself!
Julio Jerez wrote:I know is a big claim and as we make progress, you are right new finding may me change my hypothesis.

Yep, you will need to extend it. Let's bet a beer. We'll drink it when we meet in person, you know, while looking way doooown... :mrgreen: :mrgreen: :mrgreen:
User avatar
JoeJ
 
Posts: 1160
Joined: Tue Dec 21, 2010 6:18 pm

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests

cron