yourdfpy

0.0.60 · active · verified Sun Apr 12

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.

Warnings

Install

Imports

Quickstart

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.

from yourdfpy import URDF, primitives

# Create a simple demo URDF programmatically (e.g., a multi-link chain)
robot = primitives.create_urdf(joints=['prismatic', 'revolute', 'fixed'])

# Alternatively, load from a file (replace 'path/to/robot.urdf' with your file)
# from yourdfpy import URDF
# robot = URDF.load('path/to/robot.urdf')

# You can update joint configurations
robot.update_cfg({'prismatic_0': 0.5, 'revolute_1': 0.785}) # move prismatic joint by 0.5 and revolute by 45 degrees

# Display the robot model in an interactive viewer
robot.show()

# Access robot properties
print(f"Robot name: {robot.name}")
print(f"Number of joints: {len(robot.joint_map)}")
print(f"Current configuration: {robot.config}")

view raw JSON →