Wrong orientations for mesh geometries

Discussion in 'Priority support' started by Tarik, Apr 14, 2020.

  1. I define a geom with mesh type as follow:
    <geom name="object_tennis_ball_geom" mesh="tennis_ball" type="mesh" pos="0 0 1.0"/>
    which results in the the orientation as can be seen in the image_no_rot.png. I wanted to align the z-axis of the object with y-axis of the world so add z-axis element to the geom definition:
    <geom name="object_tennis_ball_geom" mesh="tennis_ball" type="mesh" pos="0 0 1.0" zaxis="0 1 0"/>
    however, this did not work. It rotated the object but not aligned correctly which can be seen in image_rot.png. I'm also adding the mesh file if you need reproduce.

    Edit: After reading the mesh documentation here, I understand that principal axes of inertia are used as the orientation of the geom. My question now that is there a way to cancel this?
     

    Attached Files:

    Last edited: Apr 14, 2020
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    You cannot change the frame of a mesh geom for the same reason that you cannot change the frame of a cylinder geom: the whole point of the geom frame is to describe the geometry and make the inertia orthogonal. However, there is a difference between body frames and geom frames, even if there is only one geom in a body. If you specify the <inertial> sub-element of <body>, geom masses and inertia are ignored. But I am not sure if you are even using bodies in your model.

    Alternatively, you can load your current model without any zaxis, write down the quaternion of the geom frame, and then edit the model by specifying the opposite quaternion in the <geom> element. If the original is (w, x, y, z) the opposite is (w, -x, -y, -z).