In the model XML files, cameras are defined with a position in the worldbody and a rotation attribute such as quat or axisangle. However, mjvCamera uses Pose (lookat, distance, azimuth, elevation). Is there a mujoco function, or other method, for converting back and forth between pos/quat and pose?
The conversion is done internally, but there is no utility function that you can call directly. You can do the math yourself, it involves a bunch of sin and cos functions. Actually the camera pose (lookat, distance, azimuth, elevation) can only encode a subset of possible body poses, because the camera cannot twist around the gaze axis. So the conversion is well-defined only in one direction.
Sorry to revive an old thread! I was wondering whether the above guidance still holds true. A workflow where the free camera can be interactively positioned, then the (lookat, distance, azimuth, elevation) parameters recorded, and then converted to the Quaternion+Position form for defining in a model XML would be very useful. Often one would like to render offscreen but from a very particular viewpoint. Unless you dream in quaternions it can be hard to hone in on this viewpoint without interactive camera control as a first step. Many thanks!