Hi all,
I’m trying to import my robot to appear in the screen through the hello_world tutorial program. When I import my robot from the GUI everything works fine, but when I try to write a code to import I get this error:
2022-02-27 17:56:14 [180,538ms] [Error] [omni.isaac.urdf] Failed to parse URDF file '0720_Model_Update.urdf'
2022-02-27 17:56:14 [180,539ms] [Error] [asyncio] [/home/USER/.local/share/ov/pkg/isaac_sim-2021.2.1/kit/python/lib/python3.7/asyncio/base_events.py:1619] Task exception was never retrieved
future: <Task finished coro=<BaseSampleExtension._on_load_world.<locals>._on_load_world_async() done, defined at /home/USER/.local/share/ov/pkg/isaac_sim-2021.2.1/exts/omni.isaac.examples/omni/isaac/examples/base_sample/base_sample_extension.py:161> exception=Exception('object type is not supported yet')>
Traceback (most recent call last):
File "/home/USER/.local/share/ov/pkg/isaac_sim-2021.2.1/exts/omni.isaac.examples/omni/isaac/examples/base_sample/base_sample_extension.py", line 162, in _on_load_world_async
await self._sample.load_world_async()
File "/home/USER/.local/share/ov/pkg/isaac_sim-2021.2.1/exts/omni.isaac.examples/omni/isaac/examples/base_sample/base_sample.py", line 44, in load_world_async
self.setup_scene()
File "/home/USER/.local/share/ov/pkg/isaac_sim-2021.2.1/exts/omni.isaac.examples/omni/isaac/examples/user_examples/hello_world.py", line 20, in setup_scene
ai_link = world.scene.add(imported_robot)
File "/home/USER/.local/share/ov/pkg/isaac_sim-2021.2.1/exts/omni.isaac.core/omni/isaac/core/scenes/scene.py", line 81, in add
raise Exception("object type is not supported yet")
Exception: object type is not supported yet
For now, I just want to make the robot appear on the simulation; nothing fancy. Here’s the code in hello_world.py:
from omni.isaac.examples.base_sample import BaseSample
from omni.isaac.core import World
# from omni.isaac.urdf.scripts.samples.common import import_robot
from omni.isaac.urdf import _urdf
class HelloWorld(BaseSample):
def __init__(self) -> None:
super().__init__()
return
def setup_scene(self):
world = World.instance()
world.scene.add_default_ground_plane()
urdf_interface = _urdf.acquire_urdf_interface()
import_config = _urdf.ImportConfig()
root_path = '~/Downloads/0720_Model_Update/urdf/'
file_name = '0720_Model_Update.urdf'
imported_robot = urdf_interface.parse_urdf(root_path, file_name, import_config)
ai_link = world.scene.add(imported_robot)
return
The method import_robot expects an additional last argument (arg4: str) as shown in the code I posted above. This argument is not currently described in the documentation… and I have no clear idea of its role (even an empty string "" works) 😅
Thanks for your discussion. It seems that the return value “prim_path” is always the urdf file name. Do you guys know how to import urdf to a predefined prim path.
I find another problem. I use the following code to print some info of robot object:
robot.initialize()
print("Num of Joints: ", robot.num_dof)
print("Joint Info: ", robot.get_joints_state())
And I get the following error:
Num of Joints: 0
File "/home/**/.local/share/ov/pkg/isaac_sim-2021.2.1/exts/omni.isaac.core/omni/isaac/core/articulations/articulation.py", line 347, in get_joints_state
positions=self.get_joint_positions(),
File "/home/**/.local/share/ov/pkg/isaac_sim-2021.2.1/exts/omni.isaac.core/omni/isaac/core/articulations/articulation.py", line 286, in get_joint_positions
joint_positions = [joint_positions[i][0] for i in range(len(joint_positions))]
TypeError: object of type 'NoneType' has no len()
The robot object knows nothing about urdf joint info. The urdf imported is the Kaya.urdf in isaac assets.