In Isaac Sim 2022.2.1,
When executing the script containing the following .py file, an error occurred.
The error is as follows:
Traceback (most recent call last):
File "/home/nvidia/robot_freespace_seg_Isaac_TAO/IsaacSim/replicator/warehouse_freespace.py", line 430, in <module>
max_queue_size=args.max_queue_size, floor_dr=args.floor_dr, wall_dr=args.wall_dr,light_dr=args.light_dr, yaml_path=args.yaml_path)
File "/home/nvidia/robot_freespace_seg_Isaac_TAO/IsaacSim/replicator/warehouse_freespace.py", line 95, in __init__
self._setup_world(scenario_path)
File "/home/nvidia/robot_freespace_seg_Isaac_TAO/IsaacSim/replicator/warehouse_freespace.py", line 129, in _setup_world
self.add_camera_to_viewport()
File "/home/nvidia/robot_freespace_seg_Isaac_TAO/IsaacSim/replicator/warehouse_freespace.py", line 158, in add_camera_to_viewport
self.viewport = omni.kit.viewport_legacy.get_viewport_interface()
AttributeError: module 'omni.kit' has no attribute 'viewport_legacy'
2023-08-31 00:48:53 [279,131ms] [Warning] [carb.audio.context] 1 contexts were leaked
./python.sh: line 41: 251664 Segmentation fault (core dumped) $python_exe "$@" $args
There was an error running python
The relevant code is as follows:
def add_camera_to_viewport(self):
# Add a camera to the scene and attach it to the viewport
self.camera_rig = UsdGeom.Xformable(create_prim("/Root/CameraRig", "Xform"))
self.camera = create_prim("/Root/CameraRig/Camera", "Camera", position=np.array([20, 30.650, 2]), orientation=euler_angles_to_quat(np.array([90, 0.0, 0]), degrees=True))
self.viewport = omni.kit.viewport_legacy.get_viewport_interface()
viewport_handle = self.viewport.get_instance("Viewport")
self.viewport_window = self.viewport.get_viewport_window(viewport_handle)
self.viewport_window.set_active_camera(str(self.camera.GetPath()))
It is likely that an error is occurring in the code related to viewport_legacy.
Additionally, when executing the script in Isaac Sim 2022.1.1, the generation of synthetic data was successful.
I believe that the issue might be due to changes in the viewport_legacy code to something else.
However, since I would like to run this code in Isaac Sim 2022.2.1, please provide a solution if possible.
warehouse_freespace_2022.1.1.sh (2.1 KB)
warehouse_freespace_2022.2.1.sh (2.1 KB)
error (22.2 KB)