I am not sure if I should ignore this error or how I could resolve it. It produces the photos as expected.
combined_range_arr: [-2.80000155e+01 -2.34000366e+01 -8.58306866e-08 8.00001977e+00
3.05999996e+01 1.43051144e-07]
type of forklift is: __main__.randomize_forklift_position
forklift: __main__.randomize_forklift_position
Outputting data to /home/mona/.local/share/ov/pkg/isaac_sim-2022.2.0/_output_headless
2023-03-15 12:34:16 [21,625ms] [Warning] [carb.flatcache.plugin] UsdRelationship /Render/RenderProduct_omni_kit_widget_viewport_ViewportTexture_0.orderedVars has multiple targets, which is not supported
2023-03-15 12:34:18 [23,235ms] [Warning] [carb.flatcache.plugin] PathToAttributesMap (0x33965dd0) contains attributes with duplicate name "camera" with different types but same per-element size. Data may become corrupted during request to move elements between buckets!
2023-03-15 12:34:18 [23,689ms] [Warning] [omni.usd] Warning: in ProcessPropertyChange at line 519 of /buildAgent/work/ca6c508eae419cf8/USD/pxr/usdImaging/usdSkelImaging/skeletonAdapter.cpp -- Unhandled ProcessPropertyChange callback for cachePath </Root/Worker_scaled_cm_to_m/ManRoot/Worker/Worker/Animation> in UsdSkelImagingSkelAdapter.
2023-03-15 12:34:22 [27,031ms] [Warning] [rtx.flow.plugin] rtx.flow.plugin failed to load Flow dynamic libraries (error: libnvflow.so: cannot open shared object file: No such file or directory)! Flow rendering will not be available. Try enabling the omni.flowusd extension.
2023-03-15 12:34:28 [33,731ms] [Error] [omni.graph.core.plugin] /Replicator/SDGPipeline/OgnSampleChoice: Assertion raised in compute - Tried to set a value on AttributeData '__resolved_outputs:samples' of type 'token' with incompatible data (Unable to cast Python instance to C++ type (compile in debug mode for details))
File "/home/mona/.local/share/ov/pkg/isaac_sim-2022.2.0/extscache/omni.replicator.core-1.6.4+104.1.lx64.r.cp37/omni/replicator/core/ogn/python/_impl/nodes/OgnSampleChoice.py", line 115, in compute
db.outputs.samples = samples
File "/home/mona/.local/share/ov/pkg/isaac_sim-2022.2.0/extscache/omni.replicator.core-1.6.4+104.1.lx64.r.cp37/omni/replicator/core/ogn/OgnSampleChoiceDatabase.py", line 168, in __setattr__
super().__setattr__(item, new_value)
File "/home/mona/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/exts/omni.graph/omni/graph/core/_impl/database.py", line 657, in __setattr__
super().__setattr__(item, new_value)
File "/home/mona/.local/share/ov/pkg/isaac_sim-2022.2.0/extscache/omni.replicator.core-1.6.4+104.1.lx64.r.cp37/omni/replicator/core/ogn/OgnSampleChoiceDatabase.py", line 143, in samples
self.samples.value = value_to_set
File "/home/mona/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/exts/omni.graph/omni/graph/core/_impl/utils.py", line 385, in wrapper_non_const
return func(self, *args, **kwargs)
File "/home/mona/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/exts/omni.graph/omni/graph/core/_impl/runtime.py", line 126, in value
self.helper.set(new_value, on_gpu=self._on_gpu)
File "/home/mona/.local/share/ov/pkg/isaac_sim-2022.2.0/kit/exts/omni.graph/omni/graph/core/_impl/attribute_values.py", line 115, in set
self._data.set(new_value, on_gpu=on_gpu)
Module omni.replicator.core.ogn.python._impl.nodes.OgnSemanticSegmentation load on device 'cuda:0' took 4.16 ms
[53.962s] Simulation App Shutting Down
The code is:
# minimal offline generation code for randomizing the position of forklift in the view of camera
"""Generate offline synthetic dataset
"""
from omni.isaac.kit import SimulationApp
import os
import glob
import shutil
import traceback
from collections import OrderedDict
# Set rendering parameters and create an instance of kit
CONFIG = {"renderer": "RayTracedLighting", "headless": True, "width": 640, "height": 480, "num_frames": 50}
simulation_app = SimulationApp(launch_config=CONFIG)
ENV_URL = "/Isaac/Samples/Replicator/Stage/full_warehouse_worker_and_anim_cameras.usd"
FORKLIFT_URL = "omniverse://localhost/NVIDIA/Assets/Isaac/2022.2.1/Isaac/Props/Forklift/forklift.usd"
PALLET_URL = "omniverse://localhost/NVIDIA/Assets/ArchVis/Industrial/Pallets/Pallet_B1.usd"
SCOPE_NAME = "/MyScope"
import carb
import random
import math
import numpy as np
from pxr import UsdGeom, Usd, Gf, UsdPhysics, PhysxSchema
import inspect
import omni.usd
from omni.isaac.core import World
from omni.isaac.core.utils import prims
from omni.isaac.core.prims import RigidPrim
from omni.isaac.core.utils.nucleus import get_assets_root_path
from omni.isaac.core.utils.stage import get_current_stage, open_stage
from omni.isaac.core.utils.rotations import euler_angles_to_quat, quat_to_euler_angles, lookat_to_quatf
from omni.isaac.core.utils.bounds import compute_combined_aabb, create_bbox_cache
from omni.isaac.core.utils.random import get_random_world_pose_in_view
from omni.replicator.isaac.scripts.writers import DOPEWriter
from omni.syntheticdata import SyntheticData
from omni.isaac.core.prims import XFormPrim
import omni.isaac.core.utils.bounds as bounds_utils
import omni.isaac.core.utils.prims as prims_utils
import omni.replicator.core as rep
# Increase subframes if shadows/ghosting appears of moving objects
# See known issues: https://docs.omniverse.nvidia.com/prod_extensions/prod_extensions/ext_replicator.html#known-issues
rep.settings.carb_settings("/omni/replicator/RTSubframes", 2)
world = World()
world.reset()
# Helper function to find the assets server
def prefix_with_isaac_asset_server(relative_path):
assets_root_path = get_assets_root_path()
if assets_root_path is None:
raise Exception("Nucleus server not found, could not access Isaac Sim assets folder")
return assets_root_path + relative_path
# needed to bring these out of main()
print(f"Loading Stage {ENV_URL}")
open_stage(prefix_with_isaac_asset_server(ENV_URL))
# Create a custom scope for newly added prims
stage = get_current_stage()
floor_prims = [x.GetPath() for x in stage.Traverse() if "SM_floor" in x.GetName() and prims_utils.get_prim_type_name(x.GetPath()) == "Xform"]
print('dir floor_prims: ', dir(floor_prims))
bb_cache = bounds_utils.create_bbox_cache()
combined_range_arr = bounds_utils.compute_combined_aabb(bb_cache, prim_paths=floor_prims)
print('combined_range_arr: ', combined_range_arr)
min_x, min_y, min_z, max_x, max_y, max_z = combined_range_arr
# https://stackoverflow.com/a/52003056
def get_signature(fn):
params = inspect.signature(fn).parameters
args = []
kwargs = OrderedDict()
for p in params.values():
if p.default is p.empty:
args.append(p.name)
else:
kwargs[p.name] = p.default
return args, kwargs
# Starts replicator and waits until all data was successfully written
def run_orchestrator():
rep.orchestrator.run()
# Wait until started
while not rep.orchestrator.get_is_started():
simulation_app.update()
# Wait until stopped
while rep.orchestrator.get_is_started():
simulation_app.update()
rep.BackendDispatch.wait_until_done()
rep.orchestrator.stop()
def main():
#TODO: mona score is not used anywhere!!
scope = UsdGeom.Scope.Define(stage, SCOPE_NAME)
def randomize_forklift_position():
forklift = rep.create.from_usd(FORKLIFT_URL, semantics=[('class', 'forklift')])
margin = 2
with forklift:
rep.physics.collider()
rep.modify.pose(
position=rep.distribution.uniform((min_x + margin, min_y + margin, 0), (max_x - margin, max_y - margin, 0)),
#position=rep.distribution.uniform((0, 0, 0), (0, 0 , 0)),
rotation=rep.distribution.uniform((0, 0, -90), (0, 0, 90 )),
#scale=100
)
return forklift.node
rep.randomizer.register(randomize_forklift_position)
# # Top View Camera
# # Camera looking at the forklift from a top view with large min clipping to see the scene through the ceiling
top_view_cam = rep.create.camera(clipping_range=(6.0, 1000000.0))
with rep.trigger.on_frame(num_frames=CONFIG["num_frames"]):
forklift = rep.randomizer.randomize_forklift_position()
print('type of forklift is: %s' % forklift)
print('forklift: ', forklift)
margin = 2
with top_view_cam:
rep.modify.pose(
#position=rep.distribution.uniform((min_x + margin, 5, min_y + margin), (max_x - margin, 10, max_y - margin)),
position=rep.distribution.uniform((min_x + margin, min_y + margin, 5), (max_x - margin, max_y - margin, 12)),
look_at = forklift
)
if os.path.exists(os.getcwd() + '/_output_headless'):
shutil.rmtree(os.getcwd() + '/_output_headless', ignore_errors=False, onerror=None)
#Basic Writer
# Initialize and attach writer
writer = rep.WriterRegistry.get("BasicWriter")
output_directory = os.getcwd() + "/_output_headless"
print("Outputting data to ", output_directory)
writer.initialize(
output_dir=output_directory,
rgb=True,
bounding_box_2d_tight=True,
semantic_segmentation=True,
instance_segmentation=True,
distance_to_image_plane=True,
bounding_box_3d=True,
occlusion=True,
normals=True,
)
RESOLUTION = (CONFIG["width"], CONFIG["height"])
forklift_rp = rep.create.render_product(top_view_cam, RESOLUTION)
writer.attach([forklift_rp])
run_orchestrator()
simulation_app.update()
if __name__ == "__main__":
try:
main()
except Exception as e:
carb.log_error(f"Exception: {e}")
traceback.print_exc()
finally:
simulation_app.close()
and I run it this way:
(isaac-sim) mona@ard-gpu-01:~/.local/share/ov/pkg/isaac_sim-2022.2.0$ ./python.sh ~/SDG/omniverse-sdg/examples/offline_generation/forklift_generation_offline.py
Here’s my system info:
(base) mona@ard-gpu-01:~$ uname -a
Linux ard-gpu-01 5.19.0-35-generic #36~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 17 15:17:25 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
(base) mona@ard-gpu-01:~$ lsb_release -a
LSB Version: core-11.1.0ubuntu4-noarch:security-11.1.0ubuntu4-noarch
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy
and GPU:
Here’s an example of photo it is producing