Minor bugs in conetwist and hinge constraints (obsolete)

eddybox
Posts: 25
Joined: Thu Nov 29, 2007 7:08 pm

Minor bugs in conetwist and hinge constraints (obsolete)

Post by eddybox »

Hi,

I just updated to the most recent source (it had been a while) and noticed some minor bugs in the obsolete versions of btHingeConstraint and btConeTwistConstraint.

Specifically: neither of them reset m_accMotorImpulse. (it accumulates the applied motor impulse per tick, used for impulse clipping/clamping.) The fix is basically a one-liner (zeroing m_accMotorImpulse) near the top of buidJacobian() for both classes.

Shall I open a google issue and submit a patch?

A few more details (for Roman, Erwin, or if you're curious): I'm using the obsolete solver version of btConeTwistConstraint for the motor. I've also added some accumulated motor clipping to my local version of btHingeConstraint (obsolete solver again), which is why m_accMotorImpulse becomes important. If you'd like, I can include this clipping code in the patch. I've also added some convenience functionality to the btHingeConstraint allowing the motor target to be set in terms of angle instead of velocity. (Converted to velocity under the hood however.) I could add that as well if you're interested.

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

Re: Minor bugs in conetwist and hinge constraints (obsolete)

Post by Erwin Coumans »

eddybox wrote: Shall I open a google issue and submit a patch?
Yes, please do so.

We plan to remove the obsolete versions of constraints, so can you tell what is missing from the new (non-obsolete) version?
Thanks,
Erwin
eddybox
Posts: 25
Joined: Thu Nov 29, 2007 7:08 pm

Re: Minor bugs in conetwist and hinge constraints (obsolete)

Post by eddybox »

I've created a google issue and attached a patch file: http://code.google.com/p/bullet/issues/detail?id=219.

As for what's missing in the non-obsolete constraints:
- btConeTwistConstraint: motor, soft limits, and damping are all missing.

More generally, are soft limits supported by the new solver architecture? Same question for damping and accumulated impulse clipping/clamping.

While I was at it, I also noticed that the non-obsolete version of the btConeTwistConstraint has a problem (swing/twist coupling/instability) when using non-circular conic limits (ie. swingspan1 != swingspan2). This is not a problem in the obsolete version, as I had added some code to specifically remove the twist component from any corrective swing impulses applied. Not sure exactly how to map this to the non-obsolete version. In the meantime, I've slightly modified the MotorDemo in the patch to demonstrate the problem. (Try pushing the cone-twist constraint around a bit and watch. The problem disappears if you use the obsolete version.)

Cheers,
Eddy
LarriPapi
Posts: 3
Joined: Mon Apr 12, 2010 6:19 am

Re: Minor bugs in conetwist and hinge constraints (obsolete)

Post by LarriPapi »

Sorry for my ignorance, but I'm working in my thesis about Dynamic Character Control, specifying PD Controller and RagDolls, whose I could implement with Bullet physic, but I have a difficult with the compute of angles and angles rate (angular velocity) of Joints. Should someone tell me if btConeTwist is good to my purpose? Because I want can to change between Rag Dolls and PD Controller and to compute the necessary torque to apply to joint I need the angles and the angles rate, I have a doubt in what is SwingSpan, TwistSpan and TwistAngle??. I have work something with ODE, but Bullet is some difficult and it has little documentation. Sorry for my total ignorance.
Thanks behand.