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
1import omni.kit.commands
2from pxr import UsdLux, Sdf, Gf, UsdPhysics, PhysicsSchemaTools
3
4# setting up import configuration:
5status, import_config = omni.kit.commands.execute("URDFCreateImportConfig")
6import_config.merge_fixed_joints = False
7import_config.convex_decomp = False
8import_config.import_inertia_tensor = True
9import_config.fix_base = False
10
11# Get path to extension data:
12ext_manager = omni.kit.app.get_app().get_extension_manager()
13ext_id = ext_manager.get_enabled_extension_id("omni.isaac.urdf")
14extension_path = ext_manager.get_extension_path(ext_id)
15# import URDF
16omni.kit.commands.execute(
17 "URDFParseAndImportFile",
18 urdf_path=extension_path + "/data/urdf/robots/carter/urdf/carter.urdf",
19 import_config=import_config,
20)
21# get stage handle
22stage = omni.usd.get_context().get_stage()
23
24# enable physics
25scene = UsdPhysics.Scene.Define(stage, Sdf.Path("/physicsScene"))
26# set gravity
27scene.CreateGravityDirectionAttr().Set(Gf.Vec3f(0.0, 0.0, -1.0))
28scene.CreateGravityMagnitudeAttr().Set(9.81)
29
30# add ground plane
31PhysicsSchemaTools.addGroundPlane(stage, "/World/groundPlane", "Z", 1500, Gf.Vec3f(0, 0, -50), Gf.Vec3f(0.5))
32
33# add lighting
34distantLight = UsdLux.DistantLight.Define(stage, Sdf.Path("/DistantLight"))
35distantLight.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
- class URDFParseAndImportFile(urdf_path: str = '', import_config=<omni.isaac.urdf._urdf.ImportConfig object>, dest_path: str = '')
This command parses and imports a given urdf and returns a UrdfRobot object
- Parameters
arg0 (
str
) – The absolute path to where the urdf file isarg1 (
omni.isaac.urdf._urdf.ImportConfig
) – Import Configurationarg2 (
str
) – destination path for robot usd. Default is “” which will load the robot in-memory on the open stage.
- 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
arg0 (
str
) – The absolute path to where the urdf file isarg1 (
omni.isaac.urdf._urdf.ImportConfig
) – Import Configuration
- 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.set_merge_fixed_joints(False)
import_config.set_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 fromparse_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, assetRoot: str, assetName: str, robot: omni.isaac.urdf._urdf.UrdfRobot, importConfig: omni.isaac.urdf._urdf.ImportConfig, stage: str = '') str
Importing the robot, from the already parsed URDF file.
- Parameters
arg0 (
str
) – The absolute path to where the urdf file isarg1 (
str
) – The name of the urdf filearg2 (
omni.isaac.urdf._urdf.UrdfRobot
) – The parsed URDF file, the output fromparse_urdf
arg3 (
omni.isaac.urdf._urdf.ImportConfig
) – Import configuration parametersarg4 (
str
) – optional: path to stage to use for importing. leaving it empty will import on open stage. If the open stage is a new stage, textures will not load.
- 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 isarg1 (
str
) – The name of the urdf filearg2 (
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 instanceable_usd_path
USD file to store instanceable mehses in
- property make_default_prim
set imported robot as default prim
- property make_instanceable
Creates an instanceable version of the asset. All meshes will be placed in a separate USD file
- 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_instanceable_usd_path(self: omni.isaac.urdf._urdf.ImportConfig, arg0: str) None
- set_make_default_prim(self: omni.isaac.urdf._urdf.ImportConfig, arg0: bool) None
- set_make_instanceable(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_subdivision_scheme(self: omni.isaac.urdf._urdf.ImportConfig, arg0: int) None
- set_up_vector(self: omni.isaac.urdf._urdf.ImportConfig, arg0: float, arg1: float, arg2: float) None
- property subdivision_scheme
Subdivision scheme to be used for mesh normals
- property up_vector
Up vector used for import