Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an ItemIdentityException I encountered while working through this tutorial (more details here).
I found that two different materials were being given the same name. It looks like the material name gets set in two places. Here, the name gets created by appending the word "Material" and an integer i to the path to the file containing the material. Then, here, that name is changed by appending another integer, material_count, and the word "Robot". The problem is that the digits in i and material_name run together, so some combinations of i and material_count result in exactly the same string.
In the issue I linked to, the file package://moveit_resources_panda_description/meshes/visual/link6.dae contained (at least) 15 different materials, so AssimpLoader::loadMaterials named them:
package://moveit_resources_panda_description/meshes/visual/link6.daeMaterial0
package://moveit_resources_panda_description/meshes/visual/link6.daeMaterial1
...
package://moveit_resources_panda_description/meshes/visual/link6.daeMaterial14
Material14 was added when material_count=1120, resulting in the name
package://moveit_resources_panda_description/meshes/visual/link6.daeMaterial141120Robot
Later, Material1 was added when material_count=41120, which resulted in the same name, hence the ItemIdentityException. To fix this, I added an underscore before appending material_count to the material name, so for the preceding example we get two different names:
package://moveit_resources_panda_description/meshes/visual/link6.daeMaterial14_1120Robot
package://moveit_resources_panda_description/meshes/visual/link6.daeMaterial1_41120Robot