Let us talk about a smart self balancing ragdoll

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Let us talk abput a smart self balancing Ragdoll

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

Just tried to comment out the friction rows - the problem goes away (as expected).
Removing the stiffness row reduces it a lot, but still jitters.
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 » Tue May 03, 2016 9:29 am

oh that stiff is what did the trick?

I can see how, however we nee a solution that work every time, or at least that is more reliably less sensitive to parameters. Otherwise it becomes a black art.

I am working on that now.
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 Stucuk » Wed May 04, 2016 3:33 pm

When you say "smart self balancing Ragdoll" do you mean something similar to Euphoria?

Like in the following video (With the cube falling on the ragdoll):
https://youtu.be/87qdmuOesRs?t=50s
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Let us talk abput a smart self balancing Ragdoll

Postby Julio Jerez » Wed May 04, 2016 5:00 pm

yes, It will not be as finish as that at first.

But I will start with 3 or fort basic controller, maybe: posture, balancing, stand up, fall
and then we will elaborate from there.

Believe or not it is no that hard to do once you figure out that what make a person or a organic articulated object to keep balance, is that body is actually a constrained optimization solver that try to find the equilibrium position while minimizing the potential and kinetic energy available.
It sound exoteric but believe it is truth.

I already started the work on that.
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 0xC0BA » Tue May 17, 2016 10:02 am

Hi, sorry for my bad English, but Euphoria is not software of physic simulation, but software of animation
Something like this https://www.assetstore.unity3d.com/en/#!/content/48977

But you do physics simulation so that similar to these research

http://goatstream.com/research/
http://www.cs.ubc.ca/~van/papers/Simbicon.htm
0xC0BA
 
Posts: 1
Joined: Tue May 17, 2016 9:47 am

Re: Let us talk abput a smart self balancing Ragdoll

Postby Julio Jerez » Tue May 17, 2016 10:32 am

my goal is a solution that will do both.

but primordially I what a system that is practical to use, all of the paper that use the physics approach, in the end only have academic value because they are so expansive to simulate that the end up being un usable in real application.

so yes I wan the physical approach by with the euphoria results.
do you have experience, or like to contribute?
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 Oct 26, 2016 12:21 am

Joe, are you still there?
afte about six month recess. I finally got to work on the engine again

As I was saying before, I needed to completed the row with Limit. now I have that in.
This is was missing for us to complete strong joints with limit an motor.
It seem quite fast, and is has nor been optimized yet.

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

Yes now the joint are exact all the time.

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?

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)

Yes to all those, basically this is how the system is going to work.
assuming with have our reliable constrain solver. There is still a missing part to complete the problem

for this I we need to us a theory called "Principle of the virtual work", you may what to watch some your tube videos, so that you get a better idea.
essentially this is how it will work.

1-we want to be able to apply forces, displacement, limit, motors, and constraint all using a unify system.
2-the solver will only apply muscle torque, by the character can receive, any kind of internal force, like a collision, lift a weight, walk move at a desire velocity, or walk by placing foot steps,
extra keyframe from an animation and have the player playin the animation while adjusting to the environment, etc
3- there will be not PD servo not sense, instead will use what is call a virtual displacement.

to make it more clear I will give an example.
Say the player is standing on a idle location. The problem is to calculate the joint torques need to counter att the gravity.

the principle virtual work say that the entire structure can only move along a virtual displacement consisted with the constraints. plus the work generate by the free degree of freedom must be zero.

mathematically this mean that the sum of the work on all joint is zero
for all joint.
dW = sum (Fi . dx)

On the equation if Fi is the gravity, we need to express the expression F dot dx is such way that that dx if a function the joint angles.
this is a simple concatenation by expreaion the position of the center of mass and a function of the joint angle station form the root, and taking the partial derivatives.
this yield am Matrix that is call the Jacobean matrix.

the form the we apply the Inverse dappled Jacobian algorithm to convert linear displacement to angular word displacement.
with these angle we us to calculate the motor torque requires to cancel the gravity. No need for PD

the pseudo inverse, allowed for conversion desired displacement as well, for example an inverted pendulum can provide the kinematic path of the pelvis, the same method is used to convert any arbitrary displacement to joint angles.

for a key frame, this is the easiest because the key frame already gives the joint angle.

with this we have all we need,
-convert force or joint to virtual displament by using the equation of work
-convert arbitrary virtual displacement to virtual joint angle displacement
-using the joint angles directly form a key frame target.

anyway, we now have the solver, I will start working of the kinematic part, this weekend .
if you are still there, please sync and see if the joint behave the way you expect.

Does this solver take contacts into account, or only the ragdoll?

yes it will take contact and solve the exactly. This will be an option because no all systems require this accuracy.
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 Oct 26, 2016 1:56 pm

now I committed the optimized version.

I also delete the old exact solver, because now we can configure any kind of articulation and the joint will always be strong as long as the are wrapped under a Newton skeleton.
this include internal loops, with motor and frictions.

I will spend a day or two adding functionality functionality, and maybe one more optimization and the move to show some interesting demos.
The I will move to the Smart active rag doll.
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 Oct 26, 2016 4:52 pm

Hey Julio! Of course i'm still there :wink:

There seems a bug with cylinders and capsules.
Creating a cylinder with
radio0&1 of 0.1
and height of 1.0,

the NewtonCollisionInfoRecord gets initialized to
m_radio0: 0.1
m_radio1: 1.0 (from height)
m_height: 5.5e+11

I get the record like this:

NewtonCollision* collPrimitive = NewtonBodyGetCollision (body);
NewtonCollisionInfoRecord collisionInfo;
NewtonCollisionGetInfo (collPrimitive, &collisionInfo);

Probably you have forgotten to update this when merging the tapered primitives?

Also there is an assert at dgDeadJoints::DestroyJoint(dgConstraint* const joint)

---

I need some days to get my ragdoll stuff working again.
As always after a longer break (still busy with realtime GI) every behaviour seems broken.
I have to dig into my code to figure out what settings i need.

So all testing i did for now is on T-Pose ragdoll without any behaviour.
Things look very good. :D
I can even set the error factor of the joint to 1 (previously 0.2)
and stiffness to 1 (previously 0.9)
Even with those 'impossible' settings the simulation runs perfectly.
I can pick up the ragdoll on an arm and it does not jitter, it does not start spinning.
Just the arm starts to oszillate a bit at high freq. But reducing values to 0.98 fixes this as well.
(Using a joint for picking does not so good, but no worries about that now)

Awesome!
First i need to see how this effects my 2-body IP controller - i was never sure if my math is wrong or the lag from low error factor has caused my issues. Got kinda stuck there.
Then i'll get back to the ragdoll... :)
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 Oct 26, 2016 5:20 pm

ha ok my guess is that the data structure is misallied, I will fixed tonight.
on this.
JoeJ wrote:(Using a joint for picking does not so good, but no worries about that now)
Awesome!


here is the good knew, there will be a new feature called NewtonAddCycleJoint ()
this will let you add external joint the Skelton and that Joint will be solve a part of the skeleton.

by using this feature, it will be possible to make the wet dream of animations, close loop cycle, stuff like holding a two handed weapon, a tan thread, picking with a joint or any other kind of attachment.

for example a player can pick up an object from the environment with two hands.
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 » Thu Oct 27, 2016 10:45 am

Ok joe, now I added the cycle link feature
Code: Select all
int NewtonSkeletonContainerAttachCyclingJoint (NewtonSkeletonContainer* const skeletonPtr, NewtonJoint* const jointPtr)
void NewtonSkeletonContainerRemoveCyclingJoint (NewtonSkeletonContainer* const skeleton, NewtonJoint* const joint);

this can attach any joint that relate any node of the skeleton, to any other node of the that is no on any other skeleton.

I test on the Tread demo, an now is smooth as silk, I jitter when stepping of the slab but that ok, because those are no attached. that would be too expensive.
This demo is not practical is jut for demonstration of this feature.
before that demo the thread away jittered, now when standing or driving over infinite mass floor is smooth as silk.
BTW, that vehicle has 630 row, and 36 are limited motors. The 1.8 ms after the scene settled and I am driving only that model. Remarkably this is about twice as fast as before.

now you can implement you pick by joint method, by simply calling attach, and the detach when you are finish
some like this.
Code: Select all
NewtonSkeletonContainer* skel = NewtonBodyGetSkeleton(body of interest)
if (skel) {
NewtonSkeletonContainerAttachCyclingJoint (skel, joint)
}

them when done
NewtonSkeletonContainerRemoveCyclingJoint (skel, joint);


Also Joe, I found a small bug that might explain the small Jitter that you had. please try again an tell me is this was the reason, bare in mind that that the solve is exact in the mathematical sense,
we still have he numerical error of Euler integration at discrete time step and matrix pivoting.
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 » Thu Oct 27, 2016 10:13 pm

Ok Joe I now fixed these bugs.
There seems a bug with cylinders and capsules.
the NewtonCollisionInfoRecord gets initialized to
m_radio0: 0.1
m_radio1: 1.0 (from height)
m_height: 5.5e+11

I get the record like this:
NewtonCollision* collPrimitive = NewtonBodyGetCollision (body);
NewtonCollisionInfoRecord collisionInfo;
NewtonCollisionGetInfo (collPrimitive, &collisionInfo);

Also there is an assert at dgDeadJoints::DestroyJoint(dgConstraint* const joint)


now I am converting the vehicle to use the new Cycling link and then finality I will be on the self balancing ragdoll feature
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 » Sun Oct 30, 2016 7:05 pm

JoeJ wrote:I have to dig into my code to figure out what settings i need.


I found out it's not wrong settings that make all my stuff broken, it must be a change in Newton.
Do you think you did a change that also affects powered joints not using the skeleton?
Maybe you can tell me something helping me narrowing down necessary changes on my side...

I guess it's the way i determinate accelearation. Calculating acceleration from velocity directly from Newton bodies never worked for me, so i used predicted acceleration from my controller instead.
I assumed there was some kind of lag in Newton to build up the acceleration given by powered joints.
Can it be that Newton behaves different now in this regard?

I'll test new version with optimization and jitter fix ASAP...
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 » Sun Oct 30, 2016 9:24 pm

I am confused what problem are to talking about?

Yes calculation acceleration form velocities will show a phase displacement lag, because of the time that it take the iterative solve to converge. how ever I do manage to get some power joint working so long as they do not have to react too quickly.
and example for that was the fork lift which use the actuator joints.

This lag now should be with is the numerical tolerance how, so yo can indeed try get acceleration from the newton velocities. I recommend that you still build in some softness by suing stiffness les that 1.0
some like 0.96 or 0.98 (you can experiment)
this have the effect of simulation natural elasticity of rigid bodies in the real work.
Remember rigid bodies are an approximation of real bodies, each time a body change direction and force over a time step have to be applied, if that system is very stiff then that impulse become vary large.
In that regard impulse system engine are better however that are ton for stuff that can no be done naturally by using impulse systems and they have to be added as after effect So that advantage alone outweigh the stiffness problem of applying impulse using forces.

anyway can you tell what is the problem you have?
maybe you can recreated it using the JoeRagdoll joint you provided last time?
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 » Mon Oct 31, 2016 2:37 am

My problem is only related to my controller so i can't reproduce with JoeRagdoll which does just some procedural animation. It seems the forces i calculate are too weak. I'll try directly from velocity and if it fails i'll update an older backup of my project with actual newton to verify i did not mess up something else...
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 15 guests

cron