Skip to content

Missing parsing of ROS mesh filename 'file://' prefix #204

@IDavGal

Description

@IDavGal

The file:// prefix is not being parsed out of the mesh filename in the URDF definition.

I'm thinking this can be fixed by modifying the code in parserURDF.py in a similar manner to how the package:// prefix is addressed there, although both checks should be done before the absolute path checking, since filenames with any of these prefixes would be categorized as relative paths and therefore be affected by the os.path.normpath() method, collapsing all consecutive backslashes into a single one. The modified code would look like this:

elif hasElement(geometryElement, 'mesh'):
    meshfile = geometryElement.getElementsByTagName('mesh')[0].getAttribute('filename')
    # hack for gazebo mesh database
    if meshfile.count('package'):
        idx0 = meshfile.find('package://')
        meshfile = meshfile[idx0 + len('package://'):]
    if meshfile.count('file'):
        idx0 = meshfile.find('file://')
        meshfile = meshfile[idx0 + len('file://'):]
    if not os.path.isabs(meshfile):
        # Use the path relative to the output file
        meshfile = os.path.normpath(os.path.relpath(os.path.join(path, meshfile), outputDirectory))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions