Physics Simulation Forum

 All times are UTC

 Page 1 of 1 [ 7 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: 6DOF Constraint: Y-axis angular limit > 90 degrees?Posted: Sat May 26, 2012 12:34 am

Joined: Thu Mar 03, 2011 2:30 am
Posts: 7
I've been putting together a skeletal animation/dynamics system using two identical skeletons. One skeleton's joints are keyed/animated. Each of the second skeleton's bones (section between each joint) are set up as a rigid body with a btGeneric6DofConstraint between each rigid body pair.

Each frame, I calculate the proper orientation of each joint's constraint from the keyed/animated skeleton, and set the driven skeleton's 6DOF constraint joint angular limits. This works great within a limited range of joint orientations.

Unfortunately, once a joint exceeds +/-90 degrees, the constraint goes haywire. I finally looked at the source for the btGeneric6DofConstraint and found that the y-axis is limited to +/-PI/2, explaining the strange behavior.

For now I am planning to rotate the joint space such that the y-axis maps to each joint's twist axis (which should never exceed +/-90 degrees). Hopefully the x and z axis limit of 180 degrees will avoid this problem... If not, I'm not looking forward to rolling my own custom constraint code.

To the Bullet developers: is there any plan to increase the angular limit range for future Bullet revisions? Or, to create a quaternion based "orientation-matching" constraint? This would be extremely useful for me, and I imagine, for others in the future.

Top

 Posted: Sat May 26, 2012 11:09 am

Joined: Tue Dec 25, 2007 1:06 pm
Posts: 345
info128 wrote:
This works great within a limited range of joint orientations.
Well, the major issue here is probably that the 6DOF Constraint animations are not "quaternion based" but "Euler axis based". Is that the reason of your "limited" range of joint orientations ?
info128 wrote:
Unfortunately, once a joint exceeds +/-90 degrees, the constraint goes haywire. I finally looked at the source for the btGeneric6DofConstraint and found that the y-axis is limited to +/-PI/2, explaining the strange behavior.

For now I am planning to rotate the joint space such that the y-axis maps to each joint's twist axis (which should never exceed +/-90 degrees). Hopefully the x and z axis limit of 180 degrees will avoid this problem... If not, I'm not looking forward to rolling my own custom constraint code.

To the Bullet developers: is there any plan to increase the angular limit range for future Bullet revisions? Or, to create a quaternion based "orientation-matching" constraint? This would be extremely useful for me, and I imagine, for others in the future.
A quaternion-based hinge constraint would be very useful indeed (and it would require just one motor instead of the 3 in a 6DOF constraint): basically, as far as I can understand it, this "quaternion hinge" should be able to change its "hinge axis" based on a "starting" orientation quaternion and a "target" quaternion (without doing any "slerp" rotation, just setting up a motor for it); if somebody knows how to implement it, he's welcome (but I guess it would still be difficult to add "Euler angles limits" to such an implementation: so there are some advantages in sticking to 6DOF constraints after all...).

As far as the 360° rotation around the Y axis with the current implementation of the 6DOF constraint, it's possible and it's working good. See this link: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=4457 (it seems to work with the X or Z axis free, since the Y axis must always be in [-SIMD_HALF_PI,SIMD_HALF_PI] ). I suggest you use a recent Bullet version for this fix (viewtopic.php?f=9&t=5046&hilit=spinning+like+crazy).

PS. You may try the code I posted some time ago as a guideline: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=7676&p=27180&hilit=limits#p27180

Top

 Posted: Thu May 31, 2012 6:44 am

Joined: Thu Mar 03, 2011 2:30 am
Posts: 7
Thanks for your response - yes, the main problem seems to be that the constraint solver uses Euler angles, and in order to avoid orthogonality problems, one axis must always be limited to +-90 degrees (as you noted). Unfortunately, in my case your proposed solution will not work. As far as I have researched, all solutions involve allowing one axis to freely rotate. I need to lock down all axes, with each axis low/high limit set to a single value in the range [-PI, PI]. In essence, I need to constrain the rigid body to a single rotation matrix in a full sphere range of rotation. In Bullet, there is currently no solution for this type of problem, but it seems to me that it would be a common desired feature in many physics simulation projects.

So far, it seems the best solution would be a quaternion-based 3DOF (rotation only) constraint. This is discussed by Claude Lacoursière in his PhD thesis "Ghosts and Machines", as noted by Erwin here:

PhD thesis on numerical methods for rigid bodies

Dirk Gregorius posted a response here on gamedev.net, referencing the book "Game Physics Pearls", which has a chapter on the topic of quaternion constraints. In the post he mentions that he implemented a rigid body engine using quaternion constraints, and the solutions are more stable vs Euler angle constraints.

I am going to order a copy of the book and take a look. Has anyone else either implemented this or thought of doing so? This would be a really cool addition to the Bullet physics library - 3DOF or 6DOF quaternion based constraint, thereby avoiding range limitations to angle limits.

Top

 Posted: Fri Jun 01, 2012 12:54 pm

Joined: Tue Dec 25, 2007 1:06 pm
Posts: 345
info128 wrote:
your proposed solution will not work
Well, actually all that (I think) I've managed to do is to replace a rigidBody->setAngularFactor(0,1,0) with a "one axis free" 6dof constraint and that seemed to work in almost the same way. I haven't tried to lock the Y axis to a different limit range (>90 degrees) so I don't know it it works.

Basically I've implemeted this replecement as a test using this demo as a starting point http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=17&t=7855 (the demo uses the Y "angular factor" to prevent the ragdoll from falling) and it seems to work. The advantage is that I can lock the Y axis while walking so that the character can keep a precise direction, and I can apply a velocity motor to it while the right or left keys are being pressed to make it turn right or left.

Of course it's still Euler axis based, but it works when the character is perfectly vertical.

Thanks for the documentation you're posted; it seems interesting.

info128 wrote:
Dirk Gregorius posted a response here on gamedev.net, referencing the book "Game Physics Pearls", which has a chapter on the topic of quaternion constraints. In the post he mentions that he implemented a rigid body engine using quaternion constraints, and the solutions are more stable vs Euler angle constraints.

I am going to order a copy of the book and take a look. Has anyone else either implemented this or thought of doing so? This would be a really cool addition to the Bullet physics library - 3DOF or 6DOF quaternion based constraint, thereby avoiding range limitations to angle limits.
Useless to say that I would appreciate a similiar addition too.

Top

 Posted: Fri Oct 05, 2012 12:11 pm

Joined: Fri Apr 18, 2008 2:20 pm
Posts: 154
I just came into this issue, and to be honnest, I didn't expect such a restriction in such a hi-end physic engine

Now, in my case I have been able to easily implement a workaround (frame basis change), however, I would second the need for a unrestricted 6 DOF constraint !

Still ,thanks guys for your work

Top

 Posted: Sat Oct 13, 2012 4:13 pm

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3825
Location: California, USA
At some stage I'll look into implementing a quaternion constraint. There is plenty of other work first though.

Top

 Posted: Sun Oct 14, 2012 10:53 pm

Joined: Tue Aug 14, 2012 9:24 pm
Posts: 4
What about the btConeTwistConstraint? You use a quaternion to set the motor target.
Wouldn't that be the 3DOF quaternion constraint you are talking about? If not, what would be the difference?

I tried the btConeTwistConstraint and it will point to the direction set by a quaternion via setMotorTarget. Unfortunately I am unable to control the motor force, so it is always at maximum and the rotations are almost immediate. m_maxMotorImpulse is only used for the obsolete constraint solver. And if I turn the obsolete solver on the body attached to the constraint will just vanish with m_maxMotorImpulse >= 0
Would it be hard to make the motor force adjustable? I looked through the code, but my understanding about bullet's inner workings and physics (engines) in general is way too low to make the right changes.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 7 posts ]

 All times are UTC

Who is online

Users browsing this forum: No registered users and 6 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ BULLET PHYSICS LIBRARY USERS    General Bullet Physics Support and Feedback    Release Announcements    Applications, Games, Demos or Movies using Bullet PHYSICS AUTHORING TOOLS, SERIALIZATION AND STANDARDS    Physics authoring tools, serialization, standards and related topics RESEARCH AND DEVELOPMENT IN COLLISION DETECTION & PHYSICS. Don't post Bullet support questions here!    Research and development discussion about Collision Detection and Physics Simulation    Links, Papers, Libraries, Demos, Movies, Comparisons       Non-technical forum and license/patent discussion    Career Opportunities