[ROS1 & ROS2] xxxxxx_multiple_cameras.urdf.xacro doesn't support different variant cameras
Hi
Using test_d435_multiple_cameras.urdf.xacro can properly load d435 cameras. However when adding <xacro:include > any other variant of cameras, it will throw error Error: material 'aluminum' is not unique. Is there any solution for this? Because i wanna build a robot model that using 2 / more different type of cameras.

Best, Samuel
Hi @HappySamuel I have not encountered this particular error before in relation to the RealSense ROS wrapper. My research of your problem indicates that it has also occurred in non-RealSense cases where multiple robots or multiple different components on the same robot have been used. A ROS forum discussion at the link below suggests a couple of workaround methods.
https://answers.ros.org/question/304797/pragma-once-equivalent-for-urdfxacro-files/
Hi
I tried your suggested method by xacro:include different type of cameras.urdf (_d455.urdf.xacro & _d435.urdf.xacro) and _materials.urdf.xacro in one multiple_cameras.urdf. I tried it in both ROS1 and ROS2, both ROS versions will throw same error Error: material 'aluminum' is not unique

Best, Samuel
What happens if you edit the D455 urdf file to change the material name from 'aluminum' to aluminum2 to distinguish it from the definition in the D435 urdf file?
https://github.com/IntelRealSense/realsense-ros/blob/development/realsense2_description/urdf/_d455.urdf.xacro#L70
Hi
What happens if you edit the D455 urdf file to change the material name from 'aluminum' to aluminum2 to distinguish it from the definition in the D435 urdf file?
https://github.com/IntelRealSense/realsense-ros/blob/development/realsense2_description/urdf/_d455.urdf.xacro#L70
This doesn't solve the issue either. The issue is due to both _d435.urdf.xacro and _d455.urdf.xacro are including same _materials.urdf.xacro, which resulting duplication. And i found a solution is not to <xacro:include filename="$(find realsense2_description)/urdf/_materials.urdf.xacro" /> in any cameras' urdf, while for those need material color can redefine the material in each cameras' urdf.xacro, like below:
<material name="aluminum">
<color rgba="0.5 0.5 0.5 1"/>
</material>
Above suggested solution has been tested with 4 different type of cameras (d435, d455, d415, l515) and there's no error thrown out. Below is the multiple_cameras.urdf

Well, the best approach is still using .dae file which contain color, therefore can drop the usage of material color.
Best, Samuel
Thanks so much @HappySamuel for sharing your solution with the RealSense ROS community!
You're welcome. Hope the modification will be applied into both ROS1 & ROS2 debian version too, then everyone can install it via apt directly.
Best, Samuel
If you wish, you can submit a Pull Request (PR) for your change so that it can be considered by the RealSense team for official inclusion in the RealSense ROS wrapper. Thanks again!
https://github.com/IntelRealSense/realsense-ros/pulls
Hi
How shall i submit a PR for the change? I have never done it before. Any tutorials?
Best, Samuel
Pull submission instructions for the main librealsense GitHub should be applicable to the RealSense ROS one too.
-
Go to the ROS wrapper's pull request page and click the New pull request button
-
For base combo-box select development, since you want to submit a PR to that branch
-
For compare combo-box select name_of_your_contribution with your commit
-
Review your changes and click Create pull request
-
Wait for all automated checks to pass
-
The PR will be approved / rejected after review from the team and the community
Has been this merged?
Hi @caranx-medical It has not yet been confirmed by @HappySamuel that a pull was submitted by them.
Created a PR: https://github.com/IntelRealSense/realsense-ros/pull/2325
Thanks very much, @caranx-medical - I have added an Enhancement tag to this case and re-opened it. This case should be kept open for the durartion that the PR associated with it is active.
Is there a time-frame for approving this PR for merge? Seems pretty straight-forward and useful for any and all projects working with multiple cameras.
Hi @srirsank The PR should be merged at a future date but there is not a specific time estimate currently available.
Being able to use two Realsense cameras of different models without having to create our own URDF's is a fairly reasonable ask. Has anyone reviewed this PR yet? And if so, is there any reason this implementation (with separate definitions of materials) undesirable?
Hi @luis-camero The PR is awaiting review at a future date. There is not a time estimate available, unfortunately.
Hi @MartyG-RealSense
There's someone submitted PR that use the same solution i suggested, but still pending to be approved. [Bugfix] Commented materials urdf and defined each material aluminum … #2325 Need your help to review it and approve, so the community will now have this issue resolved.
Best, Samuel
Hi @HappySamuel I will pass the request from yourself and others who have recently asked about it to the ROS wrapper development team. Thanks!
Hi @HappySamuel The ROS wrapper development team was pleased to receive your enquiry about your PR. They created their own official internal report so that they can explore the subject of multiple URDF.
Hi all,
As I see there are several PRs solving this issue:
- #2325 (This PR)
- #1637
- #2674
I think that all of them solve the problem, but as I see #1637 is the one with minimal changes. Do you agree with me ? If so, I can close other PRs and approve that PR.
Thanks, Samer
OK, as long as this issue resolved in Gazebo simulation.
Best, Samuel
A fix has been merged into the RealSense ROS wrapper - see https://github.com/IntelRealSense/realsense-ros/pull/1637 - and so this case can now be closed.