Let us talk about a smart self balancing ragdoll

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Let us talk about a smart self balancing ragdoll

Postby Julio Jerez » Mon Apr 25, 2016 1:45 pm

Ok this week I am starting a feature that I want for a long time but that needed lot of prerequisite engine features.
Now I believe we have all we need to make a smart Player controller to be able to unifies:
adapt animation key framing, react to its environment and synthetized animation from poses or script, and have user controllable behaviors all in one combo.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Let us talk abput a smart self balancing Ragdoll

Postby JoeJ » Wed Apr 27, 2016 2:05 am

I like the final comment on this thread: http://www.gamedev.net/topic/678122-simulating-human-with-rigid-body-joints/
There's also a link to a paper with measurements on body part masses / inertia.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Let us talk abput a smart self balancing Ragdoll

Postby JoeJ » Wed Apr 27, 2016 2:21 am

I'd like to hear what others think, are you guys intersted in using simulated characters, do you believe in the idea?

I ask because i've got the impression that most devs are quite resistant and full of doupts, 'uncanny valley', 'just animation is easier' and so on.

On the other hand, gamers reactions about Natural Motions work is very positive and they want to see more of this.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Let us talk abput a smart self balancing Ragdoll

Postby Sweenie » Wed Apr 27, 2016 2:36 am

Are you kidding me?

Animations give me nightmares.
I've spent hours and hours in Blender following "simple" animation tutorials but it beats me every time.

I've also spent countless hours trying to implement some kind of self balancing ragdoll. My last(failed) attempt was some kind of a string puppet controller. Haha, that didn't go so well.

I've also attempted procedural animation, but I * at this kind of math so didn't turn out so well either.
http://blog.wolfire.com/2014/05/GDC-201 ... tion-Video

So for now I stick with vehicles, they only have rolling wheels. That I can handle. :lol:

'just animation is easier'

I don't think any small team or solo developer would ever say that.
A developer with 10 professional animation artists in the team might say that though. :wink:
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Let us talk abput a smart self balancing Ragdoll

Postby Julio Jerez » Wed Apr 27, 2016 7:52 am

JoeJ wrote:I'd like to hear what others think, are you guys intersted in using simulated characters, do you believe in the idea?
I ask because i've got the impression that most devs are quite resistant and full of doupts, 'uncanny valley', 'just animation is easier' and so on.
On the other hand, gamers reactions about Natural Motions work is very positive and they want to see more of this.


This will be simulation and animation all the same, my claim is that simulation and animation are two different manifestation of the same thing. and you unified the together if you know how.

there are a lot of pseudo expect out there with strong opinion toward one side the other,
the truth is that if you can get a state vector (but the I mean the position, or orientation) of an array of a articulate bodes, for a set of external forces, joint torques, and of joint velocities and bodies velocities, the you can ado the inverse. that is what constrained optimization is all about.

The general approach of this is that the body will be jut a ragdoll. that will be controlled by the engine. there will be not powerf joint on the rag dog doll free degree of freedom.

the controller will be a series of sub controller that will control desired objectives.

These objectives will be anything we want, but he have to have a transfer to convert the objective to the eterne force and toque applied to the body.
what I mean by a transfer function is the matrix that you get by t Appling change rule of total and parcial derivative to the objects. so the will convert for example a desire position to a joint torque and muscle torque.

I give tow examples.
1- the self balancing controller.
this will be a controller that will use the inverted pendulum to try to maintain a body part, (the hip) as close as inside the supporting plane of the contact feet contact point.

we know the equation of the inverted pendulum , but w do no know how to make that the body par follow the trajectory, whoever very we can make a joint that is attached to the hip and the joint is responsible to apply the force and torque to make that body part meet the objective.

two thing can happen, the force and torque required are too strong and brake the maximum joint
torque the articulated body, or the are sufficient.
If they are suffocated then the controller place this value in the state vector,
if the required resulting torque exceeded the that maxim muscle torque, the controller signal that the control violated and a state machine switch the control state. In the case it could be that the controller move to take a step.
what this does is that is change the support ion polygon. and that corresponding control does the same an so on.

let us say we only have that controller (which is the fist one that I will write)
and another control why objective is the keep the joint angle with is some minimum and maxim value.
each controller will have a set joint on which it operate.

the operation is as this.
The Character will have an array of active controllers, (in the case the self balancing and the fix joint angle)

the code will iterates over the controllers list each controlled will place the desired goal in the state vector, converting input (external torque, desired velocity, desired position, desire trajectory)
and convert the to the input to the constrain solver (maximum joint torque, and joint acceleration)

the constrain solver will solve the case and produce the set of external forces that need to be applied to the ragdoll as external forces. and the simulation moves to the next step.


so now let us see how that simple system with only tow controller
1-Keep joint angles with it some limits,
2-keep balance the pelvis using a invite pendulum

Imagine we have a animation or a series key frame poses.
the joint angle get a new target joint angle for the pose.

and the controller try to interpolate the joint angle for the one is has to the desired one.
for this we apply any interpolation rule we want, linear, spline base, of even dampers spring
there are many biomechanics rule we can use for this.

The inverted pendulum controller will try to keep the balance.
and a set for force and acceleration will be calculated.

now imagine the player find an obstacle,
the house keeping active a controller which goal is to move the hand so that the player protect the head.

now we have three controller active on the player. the firs tow do what the do, and the new violate there goal, the third one add to the goals
and the solver fond the solation that satisfice all goals

as along as the solve find a solution that satisfice all goals, the player do not controller change state.
and the force and torque are applied to all bodies

is any control goal is broken, that in mean that some other controller need to be activated,

for example say the protect head fail because the head get a contact.
if we do no have anything we simple do nothing.

but let us say we late dice to make the head reaction better and we write a head reaction controller, that can either a pose for some key frame, or maybe just a procedural heard ratio.

now the we activate the head reaction and the player will do the head reaction alone with all other controller goal.

so basically the way the use control the played is by using a state machine that activate and dative these controllers.
as you can see the key frames is just the input to one of the controller.

do you get the idea.?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Let us talk abput a smart self balancing Ragdoll

Postby JoeJ » Wed Apr 27, 2016 9:20 am

Julio Jerez wrote:what I mean by a transfer function is the matrix that you get by t Appling change rule of total and parcial derivative to the objects. so the will convert for example a desire position to a joint torque and muscle torque.


Probably i'm most intersted in this part as a better replacement for powerd joints.

You say the result has to be applied as external forces, but i assume those forces are calculated so that it's guaranteed they could be the result of only the ragdolls muscles, and it's impossible to get something wrong like strings on a puppet?

What is possible input for this process?
A pose by defining all relative joint rotations?
A pose by defining some relative joint rotations, and letting other joints unconstrained (e.g. for a dangling arm)
I assume world space positions make no sense as input, correct?
Does this solver take contacts into account, or only the ragdoll?


At the moment i assume i'll mix my stuff with yours. It's maybe unlikely i'll use your objectives state machine (already having something similar). It would be nice if you design as modular as possible.

Eventually you can implement the skelton modular too (animals, human walking on it's hands etc. - i made the mistake of hardcoding a regular human and underestimated the work necessary to change this later on).
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Let us talk abput a smart self balancing Ragdoll

Postby Julio Jerez » Wed Apr 27, 2016 11:13 am

I do not kwon when the idea that you can not apply force came from.
who say the skeleton of a article animal only apply muscle torque? that is simple incorrect.

Imagine the force of gravity, the force of gravity applies to all bodies.

the body calculate the reaction forces to maintain the Degree of freedon, but the bone in the Skelton calculate all the reaction forces so that body does no dismember.

what the solver does Is that it calculate the precise muscle force or torque to counter act the external forces. but the way muscle work is by apply tension using electrical impulse, so in the en even muscle apply forces.

if our case we will be happy for calculation the toque needed by a partial degree of freedom, but we will also calculate the reaction forces needed but the other bilateral degree of freedom require to maintain the body on the desired motion.

Now if the body can calculate muscle torque to balance gravity, why can't is calculate other muscle torque to balance other forces.
imagine you want to walk. It is easy to imagine a force the push you forward. and let t each body part calculate what it now how.

the force the push you forward is and imaginary force the we use to calculate the required muzcle torque needed by each joint. and we apply those torque to the body.

Numerically this is called the change of rule of partial derivatives. you have a know quantity, and the method tells you how all other variable relate to that quantities.

so all we nee is a way to put all those forces in one vector, all the desire angle is other vector and all the limit on another vector. The this matrix of derivative (also called the hessian matrix)(https://en.wikipedia.org/wiki/Hessian_matrix)
realates the uncommon forces to and the derides know accelerations.

then the reason you get is all of the forces and torque that apply to the body.
we could ignore all the one that form the force that a real Skelton generate and only apply the toque the free degree of freedom but we do not need to, the sum of all forces and all torque can be applied as external forces to each body just the same way we apply gravity).

imagine you have an animation, you cn aconver all the key frame to a series of joint angle and by using quaterionon you can play the animation, this is what animation do.
by you can also take those angle and set the as acceleration for the for the joint free degree of freedom and the solve will calculate the force and queue. both those method work, but the to not mix with each other.
the is because one system do on thing not the other. what I am proposing is a method that take both the unknown and the known quantities and use the to solve the optimization problem.
The solution will have and array of only forces and torque that are applied as external forces to the physic engine.

The way people has done this is but using PD to convert forces to joint torque, and that some how work but is never stable. what I envision will calculate the precise muscle torque to match the desire input forces or input acceleration or input velocity. no PD involve.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Let us talk abput a smart self balancing Ragdoll

Postby Julio Jerez » Wed Apr 27, 2016 11:58 am

JoeJ wrote:You say the result has to be applied as external forces, but i assume those forces are calculated so that it's guaranteed they could be the result of only the ragdolls muscles, and it's impossible to get something wrong like strings on a puppet?


the skeleton free degrees of freedom will prevent the body look like a string on a puppet.
The beauty of having the ability to math to poses is that if the pose are plausible the visual appeal of all the in between are also plausible. we get the constraint optimization solve to enforce that. So no I do no expect any weird stuff.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Let us talk abput a smart self balancing Ragdoll

Postby Julio Jerez » Wed Apr 27, 2016 1:54 pm

Joe I read the post you made in GameDev.net and the discussion with hone the self audited expect there MrRowl

This and the Moderation I for his name, is one of the dishonest dude that back in the really day of Newton and ODE and the others collude with the Adrian Boing to delivery set up Newton to fail the text so that he can say his Library was too better that Newton.

He was and the Moderator start to bash and ban for the forum any one who say that the have a good experience with a better experience with Newton all because at that time newton was close source.
The even accuse me of plagiarizing ODE, what we all know who the plagiarizer on these fell are.

H even though that he crack pot moronic shock propagation way was a better Law of Physics than was Newton was using.
The people are nothing but selt appointed engine evaluators and sheer leaders.

if you look a the history of newton in GameDev.net you swill see how every user who dare asking a question about the newton engine got systematically banned for the forum
http://www.gamedev.net/topic/450057-newton-vs-physx/

here is a quote for one of the moderator who call himself Principal Scientist
grhodes_at_work wrote:I don't think there is one answer to your query. PhysX is probably faster and more robust in general, with better vendor-provided user support and hardware acceleration for those who have the PhysX board. Newton most likely has some strengths as well, e.g., perhaps easier to use or smaller memory footprint or better performance for some problems? I would develop a set of criteria and try to evaluate with respect to your own needs rather than ask for a broad generic answer.

He never try the engine and yet he already new all those detail.
GameDev.net is the latrine of the advertising world. They are in the pocket of companies like AMD, Intel, Nvidea, etc, for advertising. you will not get a fair assessment there ever.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Let us talk abput a smart self balancing Ragdoll

Postby Julio Jerez » Wed Apr 27, 2016 2:29 pm

her is another thread with mr "Dirk Gregorius" and Mr "MrRowl"
http://www.gamedev.net/topic/672696-seq ... detection/

Dirk Gregorius wrote:You would first integrate external and constraint forces. This will yield tentative new positions. Now you have a start and end position for each body. Next you would find the time of impact between each pair and solve those in order (earliest first). Bodies that all collide at the same time time would need be solved simultaneously. Also once you resolved one pair or group this can potentially create new collision events which need to be considered as well while progressing in time.


MrRowl wrote:You could do that. However, collision detection is/can be costly, so an alternative is to separate out collision detection and collision resolution stages. Do the collision detection first and make a list of potentially colliding objects (i.e. even if the objects are separated up to some threshold, or currently moving apart, still include them in the list). Then for collision resolution stage, iterate through that list multiple times (either a fixed number, or until everything is resolved), resolving each collision if it's active (i.e. the separating velocity is negative) using the pairwise Newton law of restitution. During this process you'll just be updating velocities, not positions, and that means the iteration can be very fast - since the relationship between impulse and velocity change depends only on positions it can be cached once during/immediately after the collision detection stage.


Do you know that kind of brand new Laws of Physics? I never knew Lagragian Dynamics could be formulated that.
Yet those two self appointed Engine Appraisal alone with the rest of the self appointed Experts, decided that engines made using that Kind of Laws Physic where better that a Pure Reduced coordinate system force based physics engine.

I read those and It remind the fool retard science in the movie Tropic Thunder.
I would not go but what you read in GameDev.net what you get from eh moderators is pure misinformation, and in most cases plain an simple propaganda.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Let us talk abput a smart self balancing Ragdoll

Postby JoeJ » Wed Apr 27, 2016 4:24 pm

But there's a lot audience and so a good place to do a little Newton advertising, i'm sure i can do this without getting banned - i have been warned :)

I think there's a bit of jealousy on both sides, success vs. talent.
Just forget about that old * and let it rest. I'm an unforgiving person as well and i know that's a f***ing advice impossible to follow, but at least you can try to act like that and keep just factual.
E.g. AFAIK Shock Propagation has never been stated to be correct, but to be fast and practical.
Personally i also did not like the idea, but just to be fair.

Good things turn up by themselves after time, that's remaining good faith thinking i still have.
Maybe not always - * happens, but there are already some very good games using Newton, the process is running...


Julio Jerez wrote:I do not kwon when the idea that you can not apply force came from.
who say the skeleton of a article animal only apply muscle torque? that is simple incorrect.

I did'n state that, or did i? I know muscle torque will produce force, i refer to them as 'internal' forces, while gravity, contacts or puppet strings would be 'external' forces. Hope those ar proper terms.

I have a better idea of your plans now, thanks- i'll stay tuned...
(I finally might gather some knowledge about how constraint solvers work to understand better...)
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Let us talk abput a smart self balancing Ragdoll

Postby JoeJ » Thu Apr 28, 2016 1:21 am

After some thoughts i beginn to see the advantage, you already mentioned there's no need to backproject the IP to the ragdoll.
I've never measured the error i get from this step, because it's very small compared to another error i probably never mentioned: Measuring acceleration.

Calculating acceleration from body velocities never worked from me.
The problem is my IP controller predicts the state, but there is some lag in Newton doing so and the real acceleration is unexpected by the controller and it does not work.
The problem is the same for 20 bodies ragdoll and 2 bodies IP with only one joint.
One reason for the lag is the error factor of 0.3 in the joint (it fixes only 0.3 * error per step to keep stable).
I compensate by scaling controller output by 1/0.3, but it's still far to inaccurate.
So instead of measuring acceleration, i use the predicted acceleration from the previous controller output. This works but there is some drifting.

Your idea might fix this as well... :D
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Let us talk abput a smart self balancing Ragdoll

Postby Julio Jerez » Thu Apr 28, 2016 5:19 am

there are several ways to implement the idea, that I have available.

the first one is using a hard rigorous holonomic quadratic optimization solve. this is my prefer way.
but I recognize it might have some extra cost and may take long to get up an running.

The second one is but doing what almost everyone does, using DP, I frankly think this method is the worse.

the this is by using the virtual forces calculation in a generalized cordinatetins. Basically this I calculation the partial derivative the relate a force, or a displaces to a joint angle.
the use the jacobian matrix the you get from IK, and with transform he forces or invert the displacemest. Theis method I have some problem because although is work, you end up with a non square matrix (non holonomic and to relate force to acceleration you have to do the pseudo inverse trick) but this trick is better that the DP nonsense, and I might try that first. and then after we get something going I try the first one.

The this method is the hardest which is try to using the same newton solve to set motors, the problem is that here you do no know the values until it is too late, so I am ruling this out.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Let us talk abput a smart self balancing Ragdoll

Postby Julio Jerez » Mon May 02, 2016 2:12 pm

Ok Joe, I was looking at the jitter bug with the 20 link motor you made.

I know that at some point is seemed to be working, by I when back several version in source control and even my last version before we start, show the same problem, if not worse.

Any way as I look over the code, the way I see the way it now is the correct way. the problem is that if is was working is was doing very precariously. we nee a realizable solver that always find the correct solution if the system is feasible.

so these few day I will add complete that option that will solve the system for hard motors always correctly. if it is efficient enough we can just let as the default.
If not we the let the option that do the hard joint separate form the motors as is does now. and motor will be soft.
Since motors do not always has to have hard, then is make sense to have the option, let us see how it goes.

But yes that jitter is not acceptable.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Let us talk abput a smart self balancing Ragdoll

Postby JoeJ » Tue May 03, 2016 4:04 am

I have a older Newton here it seems to work (going to delete temp files to make it small for upload...)

EDIT: Nope - that jitters too
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 26 guests

cron