help with constraint debugging

Post Reply
binofet
Posts: 20
Joined: Fri Jun 15, 2007 5:03 pm

help with constraint debugging

Post by binofet »

Hello all, I've been implementing a ragdoll system in our engine and I'm having trouble getting constraint stability and limit consistancy. I have p2p, hinge, and conetwist joints all in place (but for getting the tuning right i'm using only hinges).

Posing the ragdoll from animation works fine. But the constraints seem somewhat unstable . . . lots of jittering and "crawling" especially when on the ground. I've been trying to get a good grasp on the Limit settings, but I can't seem to find any combination that works, nor a good explanation on how they all work together.

Additionally, the hinge for the right and left elbows do not act uniformly even with exactly the same settings for limits, softness, bias, and relaxation. One arm will move properly and the other will spin around the correct axis, but as though it has a motor on it and no limits.

Basically I'm looking for help debugging; where can I be looking for clues, the jocobian? the correction values?.

Thanks in advance,

binofet

BTW, thanks very much for Bullet and the continuing active developement. I also have started a ragdoll sample that I hope to submit to be included with the bullet demos, just pressed for time as of late.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: help with constraint debugging

Post by Erwin Coumans »

Could you make sure to disable collisions between rigidbodies, when adding a constraint? This is an optional second argument in 'addConstraint'. Also, have you tried lower values for 'bias' in the btConeTwistConstraint?

Sharing such sample would be of great help to tune parameters better.

Thanks,
Erwin
binofet
Posts: 20
Joined: Fri Jun 15, 2007 5:03 pm

Post by binofet »

I am already disabling collision between linked bodies. At the moment, although I can use btConeTwist constraints, I've been trying to get the tuning in using only hinges (this makes it easier for me to focus on pairs of joints at a time, if i can get this to work smoothly I'll turn on the conetwist joints). One thing that would be useful to me is an explanation of softness, bias, and relaxation. IE. what do they strictly modify? what range is valid? etc. Also for the limits themselves; are they measure of angles in radians?

Thanks for the reply, I'll keep trying different numbers and see if I can't get things more stable.
mhx
Posts: 6
Joined: Wed Apr 18, 2007 8:12 pm

Post by mhx »

Hey Binofet,

My guess is that there still are bugs in the code, I'll try to fix them once I've investigated more.

Anyways, some return questions:

Are you initializing the Hinge Constraint by feeding it a proper frame (btTransform) for each body? The constructor which takes axii as input should mainly be used when no limits are desired. It will just create random axis for the frame.

You mention that one of the forearms spins, might be that the frame is flipped. Try flipping the constraint axis vector of your transform and see if it helps. the constraint axis is assumed to be colum 3 of the frame.

The limits are in radians and the parameters are as follows:

Relaxation is the rate at which velocity errors are corrected. This can be seen as the strength of the limits. A low value will make the the limits more spongy.

BiasFactor is the magnitude of the position correction. It tells you how strictly the position error (drift ) is corrected.

Softness is the factor at which the velocity error correction starts operating,i.e a softness of 0.9 means that the vel. corr starts at 90% of the limit range. What this means in practice is that if you're above the softness, velocities that would shoot through the actual limit are slowed down. You can compare this to the "slop" in Erin Catto's GDC06 slides.
The bias be in the range of 0.2 - 0.5.

One note for both bias and relaxation is that these constants should not be above 1. This will lead to increased overshooting and oscillations (jittering) and eventually divergence. There are special cases where one wants to do overrelaxation so I left the range open.

As for overall stability, it can be a bit tricky to get things to behave nicely.
Jointing stuff together slows down convergence of the solver and thus gives you more jitter. This can be alleviated by adding more damping to the rigid bodies and also by experimenting with mass ratios among the different bodies.

One thing that would help a bit is to have individual sleeping thresholds per body/constraint and thus putting the ragdoll to sleep before it starts crawling around. Is there something like this planned, Erwin?

I have a pretty nicely behaving ragdoll in our game engine now, using hinge and conetwist constraint. It did however take a bit of tweaking.

Could you please tell me more about your setup? Are you using capsules? Mass ratios? Collision Margins? Damping? Bias ? Softness? Relaxation?

Anyways, Thanks for your feedback. I appreciate your help sorting out the issues with the joints.

/Marcus
binofet
Posts: 20
Joined: Fri Jun 15, 2007 5:03 pm

Post by binofet »

Thank you for the reply Marcus.

I was using the constructor that takes local pivots and axii. So, I'll get that switched out.

As for my setup:
I have been playing with different combos of collision shapes. Ultimately what we want is multispheres for every rigid body so we can tune the shape very closely to the model. I have that implemented and it seems to work well, but my debug-draw method for multispheres is broken atm. so i'm just using boxes and spheres. I was thinking that capsules/multisphers would likely be a little more stable because there would be less contact points to deal with. Is that assumption true?

The mass ratios were originally similar to that of a real body, but until i get things stable i'm just going 1:1 for each RB. Collision margin is currently 0.5. Played a little with ang+lin dampening ( which seems to help smooth things out), but i think i really just need to get the limits stable first.

I'm extremely happy to have help here. I am an ultra-noob.

Binofet
Shreejan Shrestha
Posts: 7
Joined: Fri Aug 08, 2008 2:51 am

Re: help with constraint debugging

Post by Shreejan Shrestha »

Hey Marcus

Your explanation about the different parameters for btHingeContraint was very good. I am using btGeneric6DofConstraint in my project which uses btTranslationalLimitMotor and btRotationalLimitMotor. An it also has about the same and more paramters as hinge contraint. I want to learn about the different paramters used in the generic 6dof contraint. Could you please explain about those additional parameters used in the generic 6dof contraint or show me some references to learn from? I would be thankful to you if so.

Thanks in advance.

Shreejan.
Post Reply