Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
IDavGal opened this issue May 29, 2023 · 1 comment
Open

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

IDavGal opened this issue May 29, 2023 · 1 comment

Comments

@IDavGal
Copy link

IDavGal commented May 29, 2023

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))
@IDavGal IDavGal changed the title Missing parsing of gazebo mesh filename 'file://' prefix Missing parsing of ROS mesh filename 'file://' prefix May 31, 2023
@omichel
Copy link
Member

omichel commented Jun 13, 2023

Thank you for this contribution.
Can you please create a new pull request for proposing this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants