Motors & Torques For Ragdolls

Eater1
Posts: 3
Joined: Wed Nov 14, 2007 1:29 am

Motors & Torques For Ragdolls

Post by Eater1 »

I'm trying to do a sort of simulated animation system, and as a first step, I want to get the ragdoll I created to be able to stand on its own. For this purpose, I intended to put a balancing torque on the root (the pelvis), and use motors to keep the limbs in the proper position - for now, I'm just using hinge joints, I intend to figure out what to do about the cones later.
The problem is that the motors are either too weak to keep the legs upright, or too strong and immediately cause the legs to explode. I'm using a threshold value of about PI/6, after which I turn the motor to full speed (essentially causing it to add as much torque as possible). However, either the motor is too weak and the whole thing bends anyway, or it becomes unstable and explodes. However, under no circumstances does it actually seem to hold the ragdoll up, or lift it back up after it has sat down. If I remove the lower leg and foot bones, leaving only the upper legs, then the motors seem sufficient to keep it upright pretty reliably.
Also, I tried removing the motors and settings the joints in the legs to have a tighter limit (about 0.01 in either direction). However, the ragdoll still refuses to stand - instead, it prefers to violate the joint constraints and rotates the legs however it pleases in order to drop the pelvis to ground level. This second part I find particularly disturbing, because it seems to suggest that even if I do get the motors working, the joints will simply break down and allow the pelvis to drop anyway.
Does anyone have suggestions as to whether there are any settings for the joints or motors I could alter to fix this? Does this seem like something that could be fixed by applying torques somewhere else? Do I need to solve the joint again at some point in there, or is this just a fundamental limitation of how bullet does joints?
Eater1
Posts: 3
Joined: Wed Nov 14, 2007 1:29 am

Re: Motors & Torques For Ragdolls

Post by Eater1 »

So, after playing around a little bit, I've discovered that I *can* keep the ragdoll upright if I apply world-space torques to the legs, but only if I remove most of the upper body. As I add in more upper body bones, the amount of torque necessary to keep the ragdoll standing increases way more than it should (at least 3 orders of magnitude for each bone - all the bones have almost the same weight, and the entire ragdoll is about 1.6 units tall), until eventually it seems like no torque value is really sufficient.
I suspect that there is some bug in the way the joints are solved which results in my torques being partially or completely cancelled out due to the increased number of joints.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Motors & Torques For Ragdolls

Post by Erwin Coumans »

Eater1 wrote:I'm trying to do a sort of simulated animation system, and as a first step, I want to get the ragdoll I created to be able to stand on its own.
[...]
Does anyone have suggestions as to whether there are any settings for the joints or motors I could alter to fix this? Does this seem like something that could be fixed by applying torques somewhere else? Do I need to solve the joint again at some point in there, or is this just a fundamental limitation of how bullet does joints?
Motors using iterative constraint solvers (currently used in Bullet) are typically not strong enough for your purpose.

There is a plan to add a Featherstone implementation and better (stronger) motors in Bullet at some stage (no date).

Another approach is looking into Dynamic Animation and Control Environment (Dance) by Ari Shapiro. They interface with ODE by calculating/directly setting the body velocities. Such approach also works fine with Bullet.

Hope this helps,
Erwin
Eater1
Posts: 3
Joined: Wed Nov 14, 2007 1:29 am

Re: Motors & Torques For Ragdolls

Post by Eater1 »

I see. Is this an artifact of how the constraints are solved then? The reason I ask is that this paper claims to have done precisely what I'm doing (they apply torques to bones themselves instead of using motors, which is what I talk about in my 2nd post):
http://graphics.cs.williams.edu/papers/ ... -vgs06.pdf
They use ODE for joints, but I thought bullet and ODE used the same method for solving constraints. Is that not correct?
eddybox
Posts: 25
Joined: Thu Nov 29, 2007 7:08 pm

Re: Motors & Torques For Ragdolls

Post by eddybox »

I'm also interested in this subject (ODE vs. Bullet for joint control).
Is Bullet really not an option for this type of problem? (That statement about the joint constraints being violated - not just the motors being too weak - is particularly disturbing.)

Thanks,
Eddy
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Motors & Torques For Ragdolls

Post by Erwin Coumans »

It is probably better to discuss algorithms instead of implementations.

Most users use ODE quickstep constraint solver, which is very similar to Bullet sequential impulse constraint solver. Both use the same concepts (iterative lcp, successive over relaxation / projected gauss seidel, relaxation).
Alternatively, ODE has a direct/pivoting lcp solver (Dantzig, worldstep), which has higher quality in some cases but it can 'explode' / diverge as well in some cases.

Eater1 (or someone else), can you help providing a test case/demo in Bullet?
That way, we have a prototype that we can use to measure improvements. It might be that an iterative solution gives good results, when we implement better quality constraint motors. Futher along the line, we can look into alternative constraint solving methods, including 'chain' constraints or Featherstone.

Thanks,
Erwin