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

Launching muiltiple cameras #4

Open
nrjbs87 opened this issue Feb 20, 2022 · 3 comments
Open

Launching muiltiple cameras #4

nrjbs87 opened this issue Feb 20, 2022 · 3 comments

Comments

@nrjbs87
Copy link

nrjbs87 commented Feb 20, 2022

Hi there,

I noticed there is a test_d435_multiple_cameras.urdf.xacro file. I tried changing the file path to point to this xacro file inside of view_d435_model_rviz_gazebo.launch, however i got the error that both cameras were trying to publish to the same topic. How could I spawn multiple cameras and receive information from them on different topics?

Thanks

@issaiass
Copy link
Owner

You have to change the name of them, let me see if tonight I could do something or at least look for a demo

You could do that in the launch file

@wonwon0
Copy link

wonwon0 commented Aug 22, 2022

There you go, this is ian example using 6 cams. Put this is an UDRF file in the urdf folder of this repo.

<?xml version="1.0"?>
<robot name="realsense2_camera" xmlns:xacro="http://ros.org/wiki/xacro">
  <xacro:include filename="$(find realsense2_description)/urdf/_d435.urdf.xacro" />
 <link name="world" />

 <joint name="world_joint" type="fixed">
    <parent link="world" />
    <child link = "base_link" />
    <origin xyz="0.0 0.0 1" rpy="0.0 0.0 0.0" />
 </joint>
  <link name="base_link" />
  <xacro:sensor_d435 name="camera1" topics_ns="camera1" parent="base_link" publish_pointcloud="true">
    <origin xyz="0.07625 0 0" rpy="1.57 0.7854 0"/>
  </xacro:sensor_d435>  
  <xacro:sensor_d435 name="camera2" topics_ns="camera2" parent="base_link" publish_pointcloud="true">
    <origin xyz="0.03462 0.07209 0" rpy="1.57 0.7854 1.0472"/>
  </xacro:sensor_d435>
    <xacro:sensor_d435 name="camera3" topics_ns="camera3" parent="base_link" publish_pointcloud="true">
    <origin xyz="-0.03462 0.07209 0" rpy="1.57 0.7854 2.0944"/>
  </xacro:sensor_d435>  
    <xacro:sensor_d435 name="camera4" topics_ns="camera4" parent="base_link" publish_pointcloud="true">
    <origin xyz="-0.07625 0 0" rpy="1.57 0.7854 3.1456"/>
  </xacro:sensor_d435>  
    <xacro:sensor_d435 name="camera5" topics_ns="camera5" parent="base_link" publish_pointcloud="true">
    <origin xyz="-0.03462 -0.07209 0" rpy="1.57 0.7854 -2.0944"/>
  </xacro:sensor_d435>
  <xacro:sensor_d435 name="camera6" topics_ns="camera6" parent="base_link" publish_pointcloud="true">
    <origin xyz="0.03462 -0.07209 0" rpy="1.57 0.7854 -1.0472"/>
  </xacro:sensor_d435>
</robot>

Then you call this urdf file in a launch file like the author of this repo does in other launch files.

Then you profit.

@lucanunz
Copy link

lucanunz commented Jan 8, 2024

I do not know if this may still be helpful to someone, but I did this fix that works for me and may be more scalable.

Changing the camera name at line 142 of _d435.urdf.xacro to include the namespace

<!-- Realsense Gazebo Plugin -->
<xacro:gazebo_d435 camera_name="${topics_ns}/${name}" reference_link="${name}_link" topics_ns="${topics_ns}" depth_optical_frame="${name}_depth_optical_frame" color_optical_frame="${name}_color_optical_frame" infrared1_optical_frame="${name}_left_ir_optical_frame" infrared2_optical_frame="${name}_right_ir_optical_frame" publish_pointcloud="${publish_pointcloud}"/>

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

No branches or pull requests

4 participants