yourdfpy is a Python library designed for simpler and easier loading, manipulation, saving, and visualization of URDF (Universal Robot Description Format) files. It is currently at version 0.0.60 and is actively maintained with frequent micro-releases addressing bug fixes and minor improvements.
pip install yourdfpyVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to load a simple URDF model (either programmatically or from a file), update its joint configuration, and visualize it using the built-in interactive viewer. Ensure you have a graphics environment capable of running pyglet for the `robot.show()` method.
Ensure your environment meets pyglet's graphical requirements. For headless environments, consider using `yourdfpy.visualization.urdf_to_scene` to get a `trimesh.Scene` object and render it with an alternative backend or export to an image.
Ensure your URDF file and its associated mesh files (e.g., .stl, .obj) are correctly placed relative to each other, or pass an absolute path to the URDF. For complex asset structures, consider implementing a custom `filename_handler` when loading the URDF (e.g., `URDF.load('robot.urdf', filename_handler=my_handler)`).Monitor release notes for each update. Pay close attention to changes involving numerical calculations (e.g., NumPy array handling, kinematics) and ensure your input data types align with expected arguments, especially for methods like `update_cfg`.
Always verify joint names in your URDF file or via `robot.joint_map.keys()` and ensure these exact strings are used as keys in the configuration dictionary passed to `update_cfg`.
Install the library using pip: `pip install yourdfpy`
Verify the file path and ensure the URDF file is present. Use an absolute path or ensure the relative path is correct from your script's execution directory, for example: `robot = URDF.load('your_robot_model.urdf')`Install the display dependencies for `yourdfpy` (which includes `pyrender` and `trimesh`): `pip install "yourdfpy[display]"`
Inspect the URDF file to ensure it's a well-formed XML document, starting with an XML declaration and a root `<robot>` tag. Correct any syntax errors in the XML structure.
Use the correct method name `show()` to visualize the URDF: `robot.show()`