We have now released v0.3.0! Please use the latest version for the best experience.

Writing an Asset Configuration#

This guide walks through the process of creating an ArticulationCfg. The ArticulationCfg is a configuration object that defines the properties of an Articulation in Orbit.

Note

While we only cover the creation of an ArticulationCfg in this guide, the process is similar for creating any other asset configuration object.

We will use the Cartpole example to demonstrate how to create an ArticulationCfg. The Cartpole is a simple robot that consists of a cart with a pole attached to it. The cart is free to move along a rail, and the pole is free to rotate about the cart.

Code for Cartpole configuration
 1# Copyright (c) 2022-2024, The ORBIT Project Developers.
 2# All rights reserved.
 3#
 4# SPDX-License-Identifier: BSD-3-Clause
 5
 6"""Configuration for a simple Cartpole robot."""
 7
 8
 9import omni.isaac.orbit.sim as sim_utils
10from omni.isaac.orbit.actuators import ImplicitActuatorCfg
11from omni.isaac.orbit.assets import ArticulationCfg
12from omni.isaac.orbit.utils.assets import ISAAC_ORBIT_NUCLEUS_DIR
13
14CARTPOLE_CFG = ArticulationCfg(
15    spawn=sim_utils.UsdFileCfg(
16        usd_path=f"{ISAAC_ORBIT_NUCLEUS_DIR}/Robots/Classic/Cartpole/cartpole.usd",
17        rigid_props=sim_utils.RigidBodyPropertiesCfg(
18            rigid_body_enabled=True,
19            max_linear_velocity=1000.0,
20            max_angular_velocity=1000.0,
21            max_depenetration_velocity=100.0,
22            enable_gyroscopic_forces=True,
23        ),
24        articulation_props=sim_utils.ArticulationRootPropertiesCfg(
25            enabled_self_collisions=False,
26            solver_position_iteration_count=4,
27            solver_velocity_iteration_count=0,
28            sleep_threshold=0.005,
29            stabilization_threshold=0.001,
30        ),
31    ),
32    init_state=ArticulationCfg.InitialStateCfg(
33        pos=(0.0, 0.0, 2.0), joint_pos={"slider_to_cart": 0.0, "cart_to_pole": 0.0}
34    ),
35    actuators={
36        "cart_actuator": ImplicitActuatorCfg(
37            joint_names_expr=["slider_to_cart"],
38            effort_limit=400.0,
39            velocity_limit=100.0,
40            stiffness=0.0,
41            damping=10.0,
42        ),
43        "pole_actuator": ImplicitActuatorCfg(
44            joint_names_expr=["cart_to_pole"], effort_limit=400.0, velocity_limit=100.0, stiffness=0.0, damping=0.0
45        ),
46    },
47)

Defining the spawn configuration#

As explained in Spawning prims into the scene tutorials, the spawn configuration defines the properties of the assets to be spawned. This spawning may happen procedurally, or through an existing asset file (e.g. USD or URDF). In this example, we will spawn the Cartpole from a USD file.

When spawning an asset from a USD file, we define its UsdFileCfg. This configuration object takes in the following parameters:

The last two parameters are optional. If not specified, they are kept at their default values in the USD file.

spawn=sim_utils.UsdFileCfg(
    usd_path=f"{ISAAC_ORBIT_NUCLEUS_DIR}/Robots/Classic/Cartpole/cartpole.usd",
    rigid_props=sim_utils.RigidBodyPropertiesCfg(
        rigid_body_enabled=True,
        max_linear_velocity=1000.0,
        max_angular_velocity=1000.0,
        max_depenetration_velocity=100.0,
        enable_gyroscopic_forces=True,
    ),
    articulation_props=sim_utils.ArticulationRootPropertiesCfg(
        enabled_self_collisions=False,
        solver_position_iteration_count=4,
        solver_velocity_iteration_count=0,
        sleep_threshold=0.005,
        stabilization_threshold=0.001,
    ),
),

To import articulation from a URDF file instead of a USD file, you can replace the UsdFileCfg with a UrdfFileCfg. For more details, please check the API documentation.

Defining the initial state#

Every asset requires defining their initial or default state in the simulation through its configuration. This configuration is stored into the asset’s default state buffers that can be accessed when the asset’s state needs to be reset.

Note

The initial state of an asset is defined w.r.t. its local environment frame. This then needs to be transformed into the global simulation frame when resetting the asset’s state. For more details, please check the Interacting with an articulation tutorial.

For an articulation, the InitialStateCfg object defines the initial state of the root of the articulation and the initial state of all its joints. In this example, we will spawn the Cartpole at the origin of the XY plane at a Z height of 2.0 meters. Meanwhile, the joint positions and velocities are set to 0.0.

init_state=ArticulationCfg.InitialStateCfg(
    pos=(0.0, 0.0, 2.0), joint_pos={"slider_to_cart": 0.0, "cart_to_pole": 0.0}
),

Defining the actuator configuration#

Actuators are a crucial component of an articulation. Through this configuration, it is possible to define the type of actuator model to use. We can use the internal actuator model provided by the physics engine (i.e. the implicit actuator model), or use a custom actuator model which is governed by a user-defined system of equations (i.e. the explicit actuator model). For more details on actuators, see Actuators.

The cartpole’s articulation has two actuators, one corresponding to its each joint: cart_to_pole and slider_to_cart. We use two different actuator models for these actuators as an example. However, since they are both using the same actuator model, it is possible to combine them into a single actuator model.

Actuator model configuration with separate actuator models
actuators={
    "cart_actuator": ImplicitActuatorCfg(
        joint_names_expr=["slider_to_cart"],
        effort_limit=400.0,
        velocity_limit=100.0,
        stiffness=0.0,
        damping=10.0,
    ),
    "pole_actuator": ImplicitActuatorCfg(
        joint_names_expr=["cart_to_pole"], effort_limit=400.0, velocity_limit=100.0, stiffness=0.0, damping=0.0
    ),
Actuator model configuration with a single actuator model
actuators={
   "all_joints": ImplicitActuatorCfg(
      joint_names_expr=[".*"],
      effort_limit=400.0,
      velocity_limit=100.0,
      stiffness={"slider_to_cart": 0.0, "cart_to_pole": 0.0},
      damping={"slider_to_cart": 10.0, "cart_to_pole": 0.0},
   ),
},