Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes instructions on importing ANYmal URDF in docs #1915

Merged
merged 8 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions docs/source/how-to/import_new_asset.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ extensions to Omniverse Kit:

* **URDF Importer** - Import assets from URDF files.
* **MJCF Importer** - Import assets from MJCF files.
* **Asset Importer** - Import assets from various file formats, including
* **Mesh Importer** - Import assets from various file formats, including
OBJ, FBX, STL, and glTF.

The recommended workflow from NVIDIA is to use the above importers to convert
the asset into its USD representation. Once the asset is in USD format, you can
use the Omniverse Kit to edit the asset and export it to other file formats. Isaac Sim includes these importers by default. They can also be enabled manually in Omniverse Kit.
use the Omniverse Kit to edit the asset and export it to other file formats. Isaac Sim includes
these importers by default. They can also be enabled manually in Omniverse Kit.


An important note to use assets for large-scale simulation is to ensure that they
Expand Down Expand Up @@ -92,7 +93,10 @@ The following shows the steps to clone the repository and run the converter:
./isaaclab.sh -p scripts/tools/convert_urdf.py \
~/git/anymal_d_simple_description/urdf/anymal.urdf \
source/isaaclab_assets/data/Robots/ANYbotics/anymal_d.usd \
--merge-joints
--merge-joints \
--joint-stiffness 0.0 \
--joint-damping 0.0 \
--joint-target-type none


Executing the above script will create a USD file inside the
Expand All @@ -117,9 +121,16 @@ You can press play on the opened window to see the asset in the scene. The asset
Using MJCF Importer
-------------------

Similar to the URDF Importer, the MJCF Importer also has a GUI interface. Please check the documentation at `MJCF importer`_ for more details. For using the MJCF importer from Python scripts, we include a utility tool called ``convert_mjcf.py``. This script creates an instance of :class:`~sim.converters.MjcfConverterCfg` which is then passed to the :class:`~sim.converters.MjcfConverter` class.
Similar to the URDF Importer, the MJCF Importer also has a GUI interface. Please check the documentation at
`MJCF importer`_ for more details. For using the MJCF importer from Python scripts, we include a utility tool
called ``convert_mjcf.py``. This script creates an instance of :class:`~sim.converters.MjcfConverterCfg`
which is then passed to the :class:`~sim.converters.MjcfConverter` class.

The default values for the importer's configuration parameters are specified in the :class:`~sim.converters.MjcfConverterCfg` class. The configuration parameters are listed below. We made a few commonly modified settings to be available as command-line arguments when calling the ``convert_mjcf.py``, and they are marked with ``*`` in the list. For a comprehensive list of the configuration parameters, please check the the documentation at `MJCF importer`_.
The default values for the importer's configuration parameters are specified in the
:class:`~sim.converters.MjcfConverterCfg` class. The configuration parameters are listed below.
We made a few commonly modified settings to be available as command-line arguments when calling the
``convert_mjcf.py``, and they are marked with ``*`` in the list. For a comprehensive list of the configuration
parameters, please check the the documentation at `MJCF importer`_.


* :attr:`~sim.converters.MjcfConverterCfg.fix_base*` - Whether to fix the base of the robot.
Expand Down Expand Up @@ -167,8 +178,6 @@ Executing the above script will create USD files inside the
:alt: result of convert_mjcf.py




Using Mesh Importer
-------------------

Expand Down
9 changes: 6 additions & 3 deletions scripts/tools/convert_mjcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
"""
Utility to convert a MJCF into USD format.

MuJoCo XML Format (MJCF) is an XML file format used in MuJoCo to describe all elements of a robot. For more information, see: http://www.mujoco.org/book/XMLreference.html
MuJoCo XML Format (MJCF) is an XML file format used in MuJoCo to describe all elements of a robot.
For more information, see: http://www.mujoco.org/book/XMLreference.html

This script uses the MJCF importer extension from Isaac Sim (``isaacsim.asset.importer.mjcf``) to convert a MJCF asset into USD format. It is designed as a convenience script for command-line use. For more information on the MJCF importer, see the documentation for the extension:
https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/ext_omni_isaac_mjcf.html
This script uses the MJCF importer extension from Isaac Sim (``isaacsim.asset.importer.mjcf``) to convert
a MJCF asset into USD format. It is designed as a convenience script for command-line use. For more information
on the MJCF importer, see the documentation for the extension:
https://docs.isaacsim.omniverse.nvidia.com/latest/robot_setup/ext_isaacsim_asset_importer_mjcf.html


positional arguments:
Expand Down
31 changes: 29 additions & 2 deletions scripts/tools/convert_urdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
This script uses the URDF importer extension from Isaac Sim (``isaacsim.asset.importer.urdf``) to convert a
URDF asset into USD format. It is designed as a convenience script for command-line use. For more
information on the URDF importer, see the documentation for the extension:
https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/ext_omni_isaac_urdf.html
https://docs.isaacsim.omniverse.nvidia.com/latest/robot_setup/ext_isaacsim_asset_importer_urdf.html


positional arguments:
Expand All @@ -23,6 +23,9 @@
-h, --help Show this help message and exit
--merge-joints Consolidate links that are connected by fixed joints. (default: False)
--fix-base Fix the base to where it is imported. (default: False)
--joint-stiffness The stiffness of the joint drive. (default: 100.0)
--joint-damping The damping of the joint drive. (default: 1.0)
--joint-target-type The type of control to use for the joint drive. (default: "position")

"""

Expand All @@ -43,6 +46,26 @@
help="Consolidate links that are connected by fixed joints.",
)
parser.add_argument("--fix-base", action="store_true", default=False, help="Fix the base to where it is imported.")
parser.add_argument(
"--joint-stiffness",
type=float,
default=100.0,
help="The stiffness of the joint drive.",
)
parser.add_argument(
"--joint-damping",
type=float,
default=1.0,
help="The damping of the joint drive.",
)
parser.add_argument(
"--joint-target-type",
type=str,
default="position",
choices=["position", "velocity", "none"],
help="The type of control to use for the joint drive.",
)

# append AppLauncher cli args
AppLauncher.add_app_launcher_args(parser)
# parse the arguments
Expand Down Expand Up @@ -87,7 +110,11 @@ def main():
merge_fixed_joints=args_cli.merge_joints,
force_usd_conversion=True,
joint_drive=UrdfConverterCfg.JointDriveCfg(
gains=UrdfConverterCfg.JointDriveCfg.PDGainsCfg(stiffness=100.0, damping=1.0)
gains=UrdfConverterCfg.JointDriveCfg.PDGainsCfg(
stiffness=args_cli.joint_stiffness,
damping=args_cli.joint_damping,
),
target_type=args_cli.joint_target_type,
),
)

Expand Down
11 changes: 7 additions & 4 deletions source/isaaclab/isaaclab/sim/converters/urdf_converter_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class UrdfConverterCfg(AssetConverterBaseCfg):

@configclass
class JointDriveCfg:
"""Configuration for the joint drive."""

@configclass
class PDGainsCfg:
Expand Down Expand Up @@ -105,16 +106,18 @@ class NaturalFrequencyGainsCfg:
"""Convert mimic joints to normal joints. Defaults to False."""

joint_drive: JointDriveCfg | None = JointDriveCfg()
"""The joint drive settings.
"""The joint drive settings. Defaults to :class:`JointDriveCfg`.

None can be used for URDFs without joints.
The parameter can be set to ``None`` for URDFs without joints.
"""

collision_from_visuals = False
"""Create collision geometry from visual geometry."""
"""Whether to create collision geometry from visual geometry. Defaults to False."""

collider_type: Literal["convex_hull", "convex_decomposition"] = "convex_hull"
"""The collision shape simplification. Defaults to ``"convex_hull"``.
"""The collision shape simplification. Defaults to "convex_hull".

Supported values are:

* ``"convex_hull"``: The collision shape is simplified to a convex hull.
* ``"convex_decomposition"``: The collision shape is decomposed into smaller convex shapes for a closer fit.
Expand Down
Loading