realsense-ros icon indicating copy to clipboard operation
realsense-ros copied to clipboard

[ROS1 & ROS2] xxxxxx_multiple_cameras.urdf.xacro doesn't support different variant cameras

Open HappySamuel opened this issue 4 years ago • 20 comments

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.

Screenshot from 2022-03-14 13-50-02

Best, Samuel

HappySamuel avatar Mar 14 '22 05:03 HappySamuel

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/

MartyG-RealSense avatar Mar 14 '22 12:03 MartyG-RealSense

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

Screenshot from 2022-03-15 16-47-15

Best, Samuel

HappySamuel avatar Mar 15 '22 08:03 HappySamuel

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

MartyG-RealSense avatar Mar 15 '22 09:03 MartyG-RealSense

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 Screenshot from 2022-03-15 18-15-15

Well, the best approach is still using .dae file which contain color, therefore can drop the usage of material color.

Best, Samuel

HappySamuel avatar Mar 15 '22 10:03 HappySamuel

Thanks so much @HappySamuel for sharing your solution with the RealSense ROS community!

MartyG-RealSense avatar Mar 15 '22 10:03 MartyG-RealSense

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

HappySamuel avatar Mar 15 '22 10:03 HappySamuel

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

MartyG-RealSense avatar Mar 15 '22 10:03 MartyG-RealSense

Hi

How shall i submit a PR for the change? I have never done it before. Any tutorials?

Best, Samuel

HappySamuel avatar Mar 15 '22 11:03 HappySamuel

Pull submission instructions for the main librealsense GitHub should be applicable to the RealSense ROS one too.

  1. Go to the ROS wrapper's pull request page and click the New pull request button

  2. For base combo-box select development, since you want to submit a PR to that branch

  3. For compare combo-box select name_of_your_contribution with your commit

  4. Review your changes and click Create pull request

  5. Wait for all automated checks to pass

  6. The PR will be approved / rejected after review from the team and the community

MartyG-RealSense avatar Mar 15 '22 12:03 MartyG-RealSense

Has been this merged?

caranx-medical avatar Apr 20 '22 07:04 caranx-medical

Hi @caranx-medical It has not yet been confirmed by @HappySamuel that a pull was submitted by them.

MartyG-RealSense avatar Apr 20 '22 07:04 MartyG-RealSense

Created a PR: https://github.com/IntelRealSense/realsense-ros/pull/2325

caranx-medical avatar Apr 20 '22 09:04 caranx-medical

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.

MartyG-RealSense avatar Apr 20 '22 09:04 MartyG-RealSense

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.

srirsank avatar Jul 19 '22 18:07 srirsank

Hi @srirsank The PR should be merged at a future date but there is not a specific time estimate currently available.

MartyG-RealSense avatar Jul 19 '22 19:07 MartyG-RealSense

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?

luis-camero avatar Sep 09 '22 18:09 luis-camero

Hi @luis-camero The PR is awaiting review at a future date. There is not a time estimate available, unfortunately.

MartyG-RealSense avatar Sep 10 '22 07:09 MartyG-RealSense

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

HappySamuel avatar Sep 12 '22 06:09 HappySamuel

Hi @HappySamuel I will pass the request from yourself and others who have recently asked about it to the ROS wrapper development team. Thanks!

MartyG-RealSense avatar Sep 12 '22 07:09 MartyG-RealSense

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.

MartyG-RealSense avatar Sep 23 '22 07:09 MartyG-RealSense

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

SamerKhshiboun avatar Apr 11 '23 03:04 SamerKhshiboun

OK, as long as this issue resolved in Gazebo simulation.

Best, Samuel

HappySamuel avatar Apr 12 '23 07:04 HappySamuel

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.

MartyG-RealSense avatar Apr 12 '23 12:04 MartyG-RealSense