Alternatively, the same converter functionality can be accessed from the python module directly, which is useful when further transforming the USD data after conversion.
import urdf_usd_converter
import usdex.core
from pxr import Sdf, Usd
converter = urdf_usd_converter.Converter()
asset: Sdf.AssetPath = converter.convert("/path/to/robot.urdf", "/path/to/usd_robot")
stage: Usd.Stage = Usd.Stage.Open(asset.path)
# modify further using Usd or usdex.core functionality
usdex.core.saveStage(stage, comment="modified after conversion")
Specifying ROS packages
If a filename within a mesh or texture in the URDF file is specified as package://<package_name>/<path>, we must separately provide the actual path where the package is located. <package_name> is the ROS package name and has a corresponding path.
<path> is a relative path within that package path.
The package path specified for <package_name> can be either a relative path or an absolute path.
If the package path is a relative path, the path specification will be relative to this URDF file.
When the converter traces back to the parent directory with the URDF file as the current directory, if a file matching the specified path is found, the combination of the package name and path at that time is automatically used.
If the ROS package path still cannot be found, we must manually specify the path combination for the package name.
CLI
Specify the path to the package name by using the --package argument in the CLI.
We can also specify multiple packages.
When a filename is specified in an URDF file as shown below, the "robot_package" following package:// is the package name.
ROS packages are assigned either a relative path or an absolute path from the URDF relative to the package name.
If the path contains spaces, please enclose it in double quotation marks.
Python
When specifying a list of ROS package names and paths in Python, assign the package name to the "name" key and the path to the "path" key in a dictionary.
Specify the list of packages for this package in the ros_packages argument of urdf_usd_converter.Converter.
Once your asset is saved to storage, it can be loaded into an OpenUSD Ecosystem application.
We recommend starting with usdview, a simple graphics application to confirm the visual geometry & materials are working as expected. You can inspect any of the USD properties in this application, including the UsdPhysics properties.
Tip: OpenUSD Exchange Samples provides ./usdview.sh and .\usdview.bat commandline tools which bootstrap usdview with the necessary third party dependencies.
However, you cannot start simulating in usdview, as there is no native simulation engine in this application.
To simulate this asset in Newton, call newton.ModelBuilder.add_usd() to parse the asset and add it to your Newton model.
Simulating in other UsdPhysics enabled products (e.g. NVIDIA Omniverse, Unreal Engine, etc) may provided mixed results. The rigid bodies are structured hierarchically, which maximal coordinate solvers often do not support. In order to see faithful simulation in these applications, the USD asset will need to be modified to suit the expectations of each target runtime.
Contribution Guidelines
Contributions from the community are welcome. See CONTRIBUTING.md to learn about contributing via GitHub issues, as well as building the project from source and our development workflow.
General contribution guidelines for Newton repositories are available here.
Community
For questions about this urdf-usd-converter, feel free to join or start a GitHub Discussions.