I have problems with setting orientation of camera using function omni.isaac.sensor.scripts.camera.Camera.set_world_pose(orientation=...)
For instance, when I want to set quaternion: [0, -1, 0, 0] I get a completely different orientation. The GUI in this case shows:
I am running Isaac 2022.2. Thank you for any suggestions.
In the end I had to write this function, using USD APIs:
def set_pose(prim_path, position=None, angle=None, rotation_axis=(0, 0, 1)):
"""Initiate the pose of a prim
Args:
position (tuple): position
angle (float): angle in degrees
rotation_axis (tuple): axis to rotate around,
defaults to rotation around z axis (0, 0, 1)
"""
prim = omni.usd.get_context().get_stage().GetPrimAtPath(str(prim_path))
xform = UsdGeom.Xformable(prim)
xform.ClearXformOpOrder()
transform = xform.AddTransformOp()
mat = Gf.Matrix4d()
if position is not None:
mat.SetTranslateOnly(Gf.Vec3d(*position))
if angle is not None:
mat.SetRotateOnly(Gf.Rotation(Gf.Vec3d(*rotation_axis), angle))
transform.Set(mat)
It is able to set orientation by rotating around some axis. (You just need to use the path of the camera prim)