urchin
urchin copied to clipboard
URDF Mesh File Path Error on Windows
I encountered an issue while working on Windows using a Conda environment with only python and urchin installed. I wrote a Python script to generate a URDF file for a simple robot:
from urchin import URDF, Link, Visual, Collision, Inertial, Geometry, Mesh, Material
# Define the mesh file path
mesh_file = 'package://my_robot_description/meshes/base_link.dae'
# Create the material
material = Material(name='gray', color=[0.5, 0.5, 0.5, 1.0])
# Create the geometry for visual and collision
geometry = Geometry(mesh=Mesh(filename=mesh_file, scale=[1, 1, 1], combine=False, lazy_filename=True))
# Create the visual element
visual = Visual(geometry=geometry, material=material)
# Define the inertial properties
inertial = Inertial(
mass=1.0,
inertia=[[0.1, 0.0, 0.0],
[0.0, 0.1, 0.0],
[0.0, 0.0, 0.1]]
)
# Create the link
link = Link(
name='base_link',
visuals=[visual],
collisions=[],
inertial=inertial
)
# Create the URDF
robot = URDF(
name='simple_robot',
links=[link]
)
# Save the URDF to a file
robot.save("simple_robot.urdf")
However, when I run the script, it throws the following error:
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'package:'
Notably, the same script runs without any issues on Linux.
Thanks for the report! Probably at some point some functions mistakes the package:// URI to refer to a drive name (like C: or D:).