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

spawn_model package_to_model feature is brittle #449

Closed
scpeters opened this issue Apr 27, 2016 · 3 comments
Closed

spawn_model package_to_model feature is brittle #449

scpeters opened this issue Apr 27, 2016 · 3 comments

Comments

@scpeters
Copy link
Member

The spawn_model command recently added a package_to_model option in #288 that converts package:// to model:// in the mesh filename attribute. It uses regular expressions, which is a brittle way to modify xml. Support for both double and single quotes are being added in #445 but it is still sensitive to the order of attributes, since the <mesh> element can also have a scale attribute (see atlas.urdf for an example), and I believe this regular expression wouldn't work if the attributes are rearranged.

Here's the different cases I can think of:

  • Combinations of quotes with filename first:
<mesh filename="package://description/meshes/mesh.dae" scale="1 1 1" />
<mesh filename='package://description/meshes/mesh.dae' scale="1 1 1" />
<mesh filename="package://description/meshes/mesh.dae" scale='1 1 1' />
<mesh filename='package://description/meshes/mesh.dae' scale='1 1 1' />
  • Combinations of quotes with scale first:
<mesh scale="1 1 1" filename="package://description/meshes/mesh.dae" />
<mesh scale="1 1 1" filename='package://description/meshes/mesh.dae' />
<mesh scale='1 1 1' filename="package://description/meshes/mesh.dae" />
<mesh scale='1 1 1' filename='package://description/meshes/mesh.dae' />
@j-rivero
Copy link
Contributor

After the merge of pr #445, is there any use case still to fix @scpeters ?

@j-rivero j-rivero added the bug label Jun 30, 2016
@kev-the-dev
Copy link
Collaborator

Confirmed does not work if other attributes (like scale) come before the filename attribute. I'm going to use python's xml library to parse the xml and replace the filename attributes. This has the added benefit of detecting if there is an xml error quickly on the client side before sending it off to gazebo

kev-the-dev pushed a commit to kev-the-dev/gazebo_ros_pkgs that referenced this issue Jun 18, 2018
@kev-the-dev
Copy link
Collaborator

Fixed in #730, now uses python's xml library to find the filename attribute in any mesh tags, and url library to replace the protocol. Should be very robust

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

No branches or pull requests

3 participants