URDF Import Extension [omni.isaac.urdf]

URDF Import Commands

The following commands can be used to simplify the import process. Below is a sample demonstrating how to import the Carter URDF included with this extension

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import omni.kit.commands
from pxr import UsdLux, Sdf, Gf, UsdPhysics, PhysicsSchemaTools

# setting up import configuration:
status, import_config = omni.kit.commands.execute("CreateURDFImportConfigCommand")
import_config.merge_fixed_joints = False
import_config.convex_decomp = False
import_config.import_inertia_tensor = True
import_config.fix_base = False

# Get path to extension data:
ext_manager = omni.kit.app.get_app().get_extension_manager()
ext_id = ext_manager.get_enabled_extension_id("omni.isaac.urdf")
extension_path = ext_manager.get_extension_path(ext_id)
# import URDF
omni.kit.commands.execute(
    "ParseAndImportURDFCommand",
    urdf_path=extension_path + "/data/urdf/robots/carter/urdf/carter.urdf",
    import_config=import_config,
)
# get stage handle
stage = omni.usd.get_context().get_stage()

# enable physics
scene = UsdPhysics.Scene.Define(stage, Sdf.Path("/physicsScene"))
# set gravity
scene.CreateGravityDirectionAttr().Set(Gf.Vec3f(0.0, 0.0, -1.0))
scene.CreateGravityMagnitudeAttr().Set(981.0)

# add ground plane
PhysicsSchemaTools.addGroundPlane(stage, "/World/groundPlane", "Z", 1500, Gf.Vec3f(0, 0, -50), Gf.Vec3f(0.5))

# add lighting
distantLight = UsdLux.DistantLight.Define(stage, Sdf.Path("/DistantLight"))
distantLight.CreateIntensityAttr(500)
class URDFCreateImportConfig

Returns an ImportConfig object that can be used while parsing and importing. Should be used with URDFParseFile and URDFParseAndImportFile commands

Returns

Parsed URDF stored in an internal structure.

Return type

omni.isaac.urdf._urdf.ImportConfig

class URDFParseAndImportFile(urdf_path: str = '', import_config=<omni.isaac.urdf._urdf.ImportConfig object>)

This command parses and imports a given urdf and returns a UrdfRobot object

Parameters
Returns

Path to the robot on the USD stage.

Return type

str

class URDFParseFile(urdf_path: str = '', import_config: omni.isaac.urdf._urdf.ImportConfig = <omni.isaac.urdf._urdf.ImportConfig object>)

This command parses a given urdf and returns a UrdfRobot object

Parameters
Returns

Parsed URDF stored in an internal structure.

Return type

omni.isaac.urdf._urdf.UrdfRobot

This extension provides an interface to the URDF importer.

Example

Setup the configuration parameters before importing. Files must be parsed before imported.

from omni.isaac.urdf import _urdf
urdf_interface = _urdf.acquire_urdf_interface()

# setup config params
import_config = _urdf.ImportConfig()
import_config.merge_fixed_joints = False
import_config.fix_base = True

# parse and import file
imported_robot = urdf_interface.parse_urdf(robot_path, filename, import_config)
urdf_interface.import_robot(robot_path, filename, imported_robot, import_config)

Refer to the sample documentation for more examples and usage

class Urdf
get_kinematic_chain(self: omni.isaac.urdf._urdf.Urdf, arg0: omni.isaac.urdf._urdf.UrdfRobot)dict

Get the kinematic chain of the robot. Mostly used for graphic display of the kinematic tree.

Parameters

arg0 (omni.isaac.urdf._urdf.UrdfRobot) – The parsed URDF, the output from parse_urdf

Returns

A dictionary with information regarding the parent-child relationship between all the links and joints

Return type

dict

import_robot(self: omni.isaac.urdf._urdf.Urdf, arg0: str, arg1: str, arg2: omni.isaac.urdf._urdf.UrdfRobot, arg3: omni.isaac.urdf._urdf.ImportConfig)str

Importing the robot, from the already parsed URDF file.

Parameters
  • arg0 (str) – The absolute path to where the urdf file is

  • arg1 (str) – The name of the urdf file

  • arg2 (omni.isaac.urdf._urdf.UrdfRobot) – The parsed URDF file, the output from parse_urdf

  • arg3 (omni.isaac.urdf._urdf.ImportConfig) – Import configuration parameters

Returns

Path to the robot on the USD stage.

Return type

str

parse_urdf(self: omni.isaac.urdf._urdf.Urdf, arg0: str, arg1: str, arg2: omni.isaac.urdf._urdf.ImportConfig)omni.isaac.urdf._urdf.UrdfRobot

Parse URDF file into the internal data structure, which is displayed in the importer window for inspection.

Parameters
  • arg0 (str) – The absolute path to where the urdf file is

  • arg1 (str) – The name of the urdf file

  • arg2 (omni.isaac.urdf._urdf.ImportConfig) – Import configuration parameters

Returns

Parsed URDF stored in an internal structure.

Return type

omni.isaac.urdf._urdf.UrdfRobot

class ImportConfig
property convex_decomp

Decompose a convex mesh into smaller pieces for a closer fit

property create_physics_scene

add a physics scene to the stage on import if none exists

property default_drive_strength

default drive stiffness used for joints

property default_drive_type

default drive type used for joints

property default_position_drive_damping

default drive damping used if drive type is set to position

property density

default density used for links, use 0 to autocompute

property distance_scale

Set the unit scaling factor, 1.0 means meters, 100.0 means cm

property fix_base

Create fix joint for base link

property import_inertia_tensor

Import inertia tensor from urdf, if not specified in urdf it will import as identity

property make_default_prim

set imported robot as default prim

property merge_fixed_joints

Consolidating links that are connected by fixed joints

property self_collision

Self collisions between links in the articulation

set_convex_decomp(self: omni.isaac.urdf._urdf.ImportConfig, arg0: bool)None
set_create_physics_scene(self: omni.isaac.urdf._urdf.ImportConfig, arg0: bool)None
set_default_drive_strength(self: omni.isaac.urdf._urdf.ImportConfig, arg0: float)None
set_default_drive_type(self: omni.isaac.urdf._urdf.ImportConfig, arg0: int)None
set_default_position_drive_damping(self: omni.isaac.urdf._urdf.ImportConfig, arg0: float)None
set_density(self: omni.isaac.urdf._urdf.ImportConfig, arg0: float)None
set_distance_scale(self: omni.isaac.urdf._urdf.ImportConfig, arg0: float)None
set_fix_base(self: omni.isaac.urdf._urdf.ImportConfig, arg0: bool)None
set_import_inertia_tensor(self: omni.isaac.urdf._urdf.ImportConfig, arg0: bool)None
set_make_default_prim(self: omni.isaac.urdf._urdf.ImportConfig, arg0: bool)None
set_merge_fixed_joints(self: omni.isaac.urdf._urdf.ImportConfig, arg0: bool)None
set_self_collision(self: omni.isaac.urdf._urdf.ImportConfig, arg0: bool)None
set_up_vector(self: omni.isaac.urdf._urdf.ImportConfig, arg0: float, arg1: float, arg2: float)None
property up_vector

Up vector used for import