Can't create prims if name starts with number

I don’t know if this is a bug, but if i try to create a prim where a part of the prim path starts with a number it throws the following error:

2023-04-12 10:44:38 [6,474ms] [Warning] [omni.usd] Warning: in SdfPath at line 97 of /buildAgent/work/ca6c508eae419cf8/USD/pxr/usd/sdf/path.cpp -- Ill-formed SdfPath </Objects/0my_object>: syntax error

2023-04-12 10:44:38 [6,474ms] [Warning] [omni.usd] Warning: in SdfPath at line 97 of /buildAgent/work/ca6c508eae419cf8/USD/pxr/usd/sdf/path.cpp -- Ill-formed SdfPath </Objects/0my_object>: syntax error

Traceback (most recent call last):
  File "bug.py", line 9, in <module>
    obj_prim = prims.create_prim(prim_path="/Objects/0my_object")
  File "/home/federico/.local/share/ov/pkg/isaac_sim-2022.2.1/exts/omni.isaac.core/omni/isaac/core/utils/prims.py", line 361, in create_prim
    prim = define_prim(prim_path=prim_path, prim_type=prim_type)
  File "/home/federico/.local/share/ov/pkg/isaac_sim-2022.2.1/exts/omni.isaac.core/omni/isaac/core/utils/prims.py", line 66, in define_prim
    return get_current_stage().DefinePrim(prim_path, prim_type)
pxr.Tf.ErrorException: 
        Error in 'pxrInternal_v0_20__pxrReserved__::UsdStage::_IsValidPathForCreatingPrim' at line 3258 in file /buildAgent/work/ca6c508eae419cf8/USD/pxr/usd/usd/stage.cpp : 'Path must be an absolute path: <>'
2023-04-12 10:44:39 [6,898ms] [Warning] [carb.audio.context] 1 contexts were leaked
/home/federico/.local/share/ov/pkg/isaac_sim-2022.2.1/python.sh: line 41: 808741 Segmentation fault      (core dumped) $python_exe "$@" $args
There was an error running python

I got a minimal example to reproduce the error:

from omni.isaac.kit import SimulationApp

simulation_app = SimulationApp(launch_config={"renderer": "RayTracedLighting", "headless": True})

import omni.replicator.core as rep
from omni.isaac.core.utils import prims

obj_prim = prims.create_prim(prim_path="/Objects/0my_object")
with rep.trigger.on_frame(num_frames=1, interval=1):
    pass

rep.orchestrator.run()
while not rep.orchestrator.get_is_started():
    simulation_app.update()
while rep.orchestrator.get_is_started():
    simulation_app.update()
rep.BackendDispatch.wait_until_done()
rep.orchestrator.stop()
simulation_app.update()
simulation_app.close()

Hi @federico.domeniconi. USD has some naming requirements that you need to follow. These are listed here in in TfIsValidIdentifier: Universal Scene Description: String Utilities

In Omniverse, we often try to fix this automatically and that is what you’re working interactively. You implement the same in your code, you can use Tf.IsValidIdentifier and Tf.MakeValidIdentifier in Python.

2 Likes

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