API for creating unsatisfied joints

20 views
Skip to first unread message

jcooper

unread,
Feb 1, 2012, 5:50:42 PM2/1/12
to ode-...@googlegroups.com
I'd like to submit API functions for setting joint anchors and axes such that the constraints aren't currently satisfied.  I'd like it to be useful and incorporated in the project; so I'm hoping to get some thoughts on the best way to do this.

Ball Joint:
The official function, 'dJointSetBallAnchor', takes a single point in global coordinates and transforms it into relative coordinates for both bodies of the joint and stores those two points. 
There also exists an undocumented function 'dJointSetBallAnchor2' that takes a point in Body-2 relative coordinates and sets it as the anchor point for just the second body.  There is no parallel function for independently setting the first body's anchor.  In principle, you could transform a Body-1 relative point into global coordinates and set that point as the joint anchor and then set the anchor for the second point, but this is nasty.  I propose a function for independently setting the anchor point for each body in either global frame or the local frame.  We could specify the frame of reference and the side as a parameter or just have separate functions:

dJointSetBallHalfAnchor(joint,side,rel,x,y,z);

or

dJointSetBallAnchor1(joint,x,y,z)
dJointSetBallAnchor1Rel
dJointSetBallAnchor2
dJointSetBallAnchor2Rel

Does it seriously violate the API feeling to allow points to be specified in a non-global frame?  It seems that it's not currently done in the API, but it can be much more convenient to specify constraints in the local frame rather than global and it seems terribly wasteful to transform a point into the global frame so that it can be transformed immediately back to the way you had it.

Either approach should work fine for the anchor points of all joints since no joint ever has more than one anchor point.  However, many joints have multiple axes and are already using the '1' or '2' suffix to refer to the different axes.  So I'm leaning toward the 'Half' approach. 

So there would be something like this:

dJointSetUniversalHalfAxis1(joint,body,rel,x,y,z)
dJointSetUniversalHalfAxis2(joint,body,rel,x,y,z)

Does anyone have any thoughts? 

Is this something that could get incorporated into the API or am I wasting my time?

jc


Gideon Klompje

unread,
Feb 2, 2012, 11:54:54 AM2/2/12
to ode-...@googlegroups.com
Hi,

For what it's worth, I would appreciate such a contribution.  This is especially useful when saving/loading a simulation, in which case a joint's constraint is not necessarily satisfied at save time, complicating the reconstruction during load time, e.g. at the moment I have to:
1) position connected bodies "correctly" (i.e. so the joint is satisfied),
2) create the joint and set its anchor and/or axes,
3) move/rotate the bodies to their final positions.

For example, Bullet provides flexible constructors that allow you to specify the constraint's parameters relative to each connected body.  Having said that, I do prefer ODE's simplified joint setup functions in general, so I'd consider your suggestion useful only for special cases like the saving/loading mentioned above.

As far as your implementation suggestions go, I would use "Body" (or even "BodyRelative" if it's not too unwieldy) instead of "Half" ("Half" does not describe the functions' intentions clearly i.m.o.), e.g.:

dJointSetUniversalBodyAxis1(joint,body,rel,x,y,z)
dJointSetUniversalBodyAxis2(joint,body,rel,x,y,z)

PS: If it weren't for the current use of "1" and "2" referring to body numbers (e.g. "dJointGetHingeAnchor2") or axis numbers (e.g. "dJointSetUniversalBodyAxis2") in different contexts, I would suggest using "A" and "B" for the bodies across the board (e.g. "dJointSetUniversalAxisA2(joint,x,y,z)").

Regards,
Gideon




--
You received this message because you are subscribed to the Google Groups "ode-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ode-users/-/lsg32rJigawJ.
To post to this group, send email to ode-...@googlegroups.com.
To unsubscribe from this group, send email to ode-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ode-users?hl=en.

Reply all
Reply to author
Forward
0 new messages