Set internal camera parameters with Python

Hi,

I want to generate cameras with different properties like focal length or fish eye effect in my scenes. I then wonder if there is a way to modify those parameters not with the UI but thanks to functions in a python script that could be run in the Isaac Sim Examples.

In the Omniverse doc, the only functions related to cameras are for setting pose and target (here : OmniGraph Node omni.graph.ui.SetCameraTarget β€” Omniverse Kit 102.1.2+release.46667.2027b54e.teamcity documentation). However, some parameters like focal lenght appear in the Raw USD Properties section which means that setting these parameters with Python must be possible but I can’t find how.

Looking forward to people with any idea :)

Hi @yan.mtx

You can set an attribute from Python code as follow:

import omni

stage = omni.usd.get_context().get_stage()
prim = stage.GetPrimAtPath("/World/Camera")
attr = prim.GetAttribute("focalLength")
attr.Set(100)

Place the cursor over the attribute (parameter) to get its attribute name

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.