# Replicator Camera Orientation

**URL:** <https://forums.developer.nvidia.com/t/replicator-camera-orientation/262956>\
**Category:** Synthetic Data Generation (SDG)\
**Tags:** camera\
**Created:** [August 12, 2023, 12:43pm UTC](https://forums.developer.nvidia.com/t/replicator-camera-orientation/262956 "2023-08-12T12:43:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![toninsemaan](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@toninsemaan](https://forums.developer.nvidia.com/u/toninsemaan)\
**Post date:** [August 12, 2023, 12:43pm UTC](https://forums.developer.nvidia.com/t/replicator-camera-orientation/262956/1 "2023-08-12T12:43:59Z")

</div>

Hello,  
I am using the replicator create camera function to generate synthetic data. This camera is randomized using the approach mentioned in the documentation. I already have a list of orientations and positions parameters for the camera to use. These parameters have been collected manually while navigating in my scene using Isaac Sim, and annotating the postion / orientation in the desired locations. While the positions seems to be correct, there is a major problem in the orientation. None of the annotated angles give me the same angle as I earlier saw them in the viewport.

What might be the problem?  
Thank you in advance

Best  
Anthony

---

<div class="post-metadata">

**Author:** ![Simplychenable](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/simplychenable/32/271930_2.png) [@Simplychenable](https://forums.developer.nvidia.com/u/Simplychenable)\
**Post date:** [August 13, 2023, 8:07pm UTC](https://forums.developer.nvidia.com/t/replicator-camera-orientation/262956/2 "2023-08-13T20:07:08Z")

</div>

@toninsemaan is it possible for you to upload a screenshot or do a side by side comparison to show what you are getting from the annotated angles vs from within the viewport?

---

<div class="post-metadata">

**Author:** ![dennis.lynch](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/dennis.lynch/32/175642_2.png) [@dennis.lynch](https://forums.developer.nvidia.com/u/dennis.lynch)\
**Post date:** [August 19, 2023, 2:19am UTC](https://forums.developer.nvidia.com/t/replicator-camera-orientation/262956/3 "2023-08-19T02:19:09Z")

</div>

Hi @toninsemaan ,

More information would be needed to help debug your issue.

Screenshots/images, how you are setting the position and orientations for the new camera, also how you are getting the orientations.

---

<div class="post-metadata">

**Author:** ![toninsemaan](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@toninsemaan](https://forums.developer.nvidia.com/u/toninsemaan)\
**Post date:** [August 19, 2023, 9:26am UTC](https://forums.developer.nvidia.com/t/replicator-camera-orientation/262956/4 "2023-08-19T09:26:51Z")

</div>

Sure!

# Create a camera

```python
import omni.replicator.core as rep
rep_camera = rep.create.camera()

```

# Get the orientation / position of all the set cameras in the usd scene and launch the randomizer

```python
stage = omni.usd.get_context().get_stage()
cams_positions = []
cams_rotations = []
camera_paths = ["/World/Camera", "/World/Camera_01"]
for cam_path in camera_paths:
        prim: Usd.Prim = stage.GetPrimAtPath(cam_path)
        orient = prim.GetAttribute("xformOp:orient").Get()
        translate = prim.GetAttribute("xformOp:translate").Get()

        #Then, since the above command gives me the orientation in quad, I am transforming them to euler using the following:
        rotation = quat_to_euler_angles(quat=gf_quat_to_np_array(orient), degrees=True).tolist()

        cams_rotations.append(rotation)
        cams_positions.append(translate)

cams_positions_float = []
cams_rotations_float = []
for i in range(len(cams_positions)):
        if cams_positions[i] is not None and cams_rotations[i] is not None:
                cams_positions_float.append((cams_positions[i][0], cams_positions[i][1], cams_positions[i][2]))
                cams_rotations_float.append((cams_rotations[i][0], cams_rotations[i][1], cams_rotations[i][2]))

# Randomize Camera
with rep.trigger.on_frame(num_frames=len(cams_positions_float)):
        with rep_camera:
                rep.modify.pose(position=rep.distribution.sequence(cams_positions_float),
                                rotation=rep.distribution.sequence(cams_rotations_float))
rp = rep.create.render_product(rep_camera, (512,512), True)
writer.attach([rp])

```

While the current viewport of the camera are as follows:

 ![image](https://global.discourse-cdn.com/nvidia/original/4X/1/e/f/1efd8768dbf91ddbcf67c2154c6c7a34ae01c049.jpeg)  
 ![image](https://global.discourse-cdn.com/nvidia/original/4X/2/f/3/2f327892eb17269ede00b69cb853eef62481f7cc.jpeg)

I am the getting rgb synthetic data:

 ![image](https://global.discourse-cdn.com/nvidia/original/4X/d/7/e/d7e2405338918577051ade07a25ea4b57b0b08fd.png)  
 ![image](https://global.discourse-cdn.com/nvidia/original/4X/c/3/6/c36e9c74a81437cd14652f3ac2b9a33d057392e4.png)

It feels like the orientation of the camera is following a completely different axis.

Thank you for you time,  
Best

Anthony

---

<div class="post-metadata">

**Author:** ![toninsemaan](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@toninsemaan](https://forums.developer.nvidia.com/u/toninsemaan)\
**Post date:** [September 4, 2023, 8:49am UTC](https://forums.developer.nvidia.com/t/replicator-camera-orientation/262956/6 "2023-09-04T08:49:01Z")

</div>

Hello @Simplychenable @dennis.lynch,

Is there any updates on the following issue?

Apologies for the inconvenience.

Thank you,  
Best  
Anthony

---

<div class="post-metadata">

**Author:** ![Simplychenable](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/simplychenable/32/271930_2.png) [@Simplychenable](https://forums.developer.nvidia.com/u/Simplychenable)\
**Post date:** [September 4, 2023, 5:18pm UTC](https://forums.developer.nvidia.com/t/replicator-camera-orientation/262956/7 "2023-09-04T17:18:08Z")

</div>

just fyi, i am just another user so you can take my input as a grain of salt. always air on the side of what the dev has to say.

that said, regarding the orientation, i am not sure what you are seeing pertains to the [z-up discrepancy mentioned in this post](https://forums.developer.nvidia.com/t/different-methods-for-creating-camera/252410/5). and another optional step if see further mismatch in terms of what you are seeing in the render output, you could try capturing additional camera attributes such as focusDistance, focalLength, clippingRange, etc so it matches exactly to the camera setting used in Stage.

---

<div class="post-metadata">

**Author:** ![voyager.yupeng](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@voyager.yupeng](https://forums.developer.nvidia.com/u/voyager.yupeng)\
**Post date:** [May 1, 2024, 10:41am UTC](https://forums.developer.nvidia.com/t/replicator-camera-orientation/262956/8 "2024-05-01T10:41:31Z")

</div>

Hi, I found the similar problem with you, and I wrote a pose of it, hope it can help you out.  
Or you can just read the following “Solution part”.

> [@Isaac Sim camera orientation auto rotate in set\_world\_pose()](https://forums.developer.nvidia.com/t/isaac-sim-camera-orientation-auto-rotate-in-set-world-pose/291467):
>
> Issue The default coordinate system in Isaac Sim is Z-up, and the cameras in USD are always y-up. As many issues in Forums have mentioned, when you creating a camera and set its world pose to dafult using set\_world\_pose(), from omni.isaac.sensor import Camera camera = Camera( prim\_path="/World/camera", position=np.array([0, 0, 0]), orientation=np.array([1, 0, 0, 0]), ) camera.set\_world\_pose(np.array([0, 0, 0]), np.array([1, 0, 0, 0])) my\_world.step(render=True) the camera pose is …

# Solution

According to the discussion in the form, I think its a designed mechanism to automatically keep the same camera coordinate system(+Y up) across different USD files.

And if you want to cancel this “auto-rotation” effect, you can use `camera_axes="usd"` args in `set_world_pose()`.

```auto
from omni.isaac.sensor import Camera
camera = Camera(
    prim_path="/World/camera",
    position=np.array([0, 0, 0]),
    orientation=np.array([1, 0, 0, 0]),
)
camera.set_world_pose(np.array([0, 0, 0]), np.array([1, 0, 0, 0]), camera_axes="usd")
my_world.step(render=True)

```

This way, the default camera pose will aligned with the world frame.

 ![Pasted image 20240501181344](https://global.discourse-cdn.com/nvidia/original/4X/9/a/c/9acc6d23daf7ae4caff34516e01b6c37a7cee263.png) ![Pasted image 20240501181355](https://global.discourse-cdn.com/nvidia/original/4X/1/2/f/12f737806151f3d1f33d4d9aa2cb6f6decca5a31.png)

You can find more detailed information about `set_world_pose()` in [the API docs of it here](https://docs.omniverse.nvidia.com/py/isaacsim/source/extensions/omni.isaac.sensor/docs/index.html?highlight=camera#omni.isaac.sensor.scripts.camera.Camera.set_world_pose).
