Re: Two kinects connect to two Raspberry Pi 3 both streaming to a computer (RTABMAP/RVIZ)

Posted by matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/Two-kinects-connect-to-two-Raspberry-Pi-3-both-streaming-to-a-computer-RTABMAP-RVIZ-tp4295p4308.html

You cannot use the same freenect_throttle.aunch as is in the Remote tutorial for the two RPIs, you should set the camera namespace:
<launch>
  <arg name="camera_ns" value="camera"/>

  <include file="$(find freenect_launch)/launch/freenect.launch">
     <arg name="depth_registration" value="True" />
     <arg name="camera" value="$(arg camera_ns)" />
  </include>

  <arg name="rate"  default="5"/>
  <arg name="decimation"  default="1"/> <!-- Reduce the image size, e.g., 2 means "width/2 x height/2". -->
  <arg name="approx_sync" default="true" />

  <!-- Use same nodelet used by Freenect/OpenNI -->
  <group ns="$(arg camera_ns)">
    <node pkg="nodelet" type="nodelet" name="data_throttle" args="load rtabmap_ros/data_throttle camera_nodelet_manager" output="screen">
      <param name="rate" type="double" value="$(arg rate)"/>
      <param name="decimation" type="int" value="$(arg decimation)"/>
      <param name="approx_sync" type="bool" value="$(arg approx_sync)"/>

      <remap from="rgb/image_in"       to="rgb/image_rect_color"/>
      <remap from="depth/image_in"     to="depth_registered/image_raw"/>
      <remap from="rgb/camera_info_in" to="rgb/camera_info"/>

      <remap from="rgb/image_out"       to="data_throttled_image"/>
      <remap from="depth/image_out"     to="data_throttled_image_depth"/>
      <remap from="rgb/camera_info_out" to="data_throttled_camera_info"/>
    </node>
  </group>      
</launch>

Then run it on each RPI:
// On RPI-1
$roslaunch freenect_throttle.launch camera_ns:="camera1"
// On RPI-2
$roslaunch freenect_throttle.launch camera_ns:="camera2"

cheers,
Mathieu