[ODE] Setting orientation - Once before and once after attaching joints

skjold@cistron.nl skjold at cistron.nl
Wed Feb 12 03:05:02 2003


Hi all,

A small question about setting the initial rotation of an articulated structure. The question is, basically, how to do that safely (meaning without violating the joint constraints). See, I had no problem creating a few boxes, connecting them with joints and then setting some initial position and orientation of the whole thing. But it became a problem when one of the bodies had to be rotated *before* attaching joints to it, and then rotated again afterwards with the rest of the attached bodies to give it an initial orientation before the simulation starts.

Let's say I want to create a capped cylinder. It is in a vertical orientation when created, but let's say I want it horizontal before attaching it to other bodies. No problem. But then, when all bodies are attached to eachother as desired, I want to give the construction as a whole a new orientation and position before it starts out in the simulation. For this capped cylinder, that means it is rotated a *second* time on top of the inital rotation. When doing that, I found the following two problems: 1st, the only ODE interface I could find for doing that was using quaternions (I didn't find any matrix concat functions, did I miss something there?) and 2nd, taking the quaternion solution, I found that the result violated the joint constraints in some cases (causing those bodies to fly off at warp 9.5), but not in other cases. I'm not sure about the order of rotation when it comes to quaternions (I'm no maths-expert, and I suspect the docs of dQMultiplyX has typos), but it seems strange to me that the result was faulty in only some cases - no matter what order I tried.

Can anyone shed some light on this for me?

Thanks in advance,
Mark