Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Multiple kinects under ROS Indigo

Hi!

I'm facing the problem I can't handle myself. I know it has been discussed already, but not in my configuration, so I decided to ask you here. I want to run 2 kinects at the same time but it's not so obvious as I thought it will be. In my desktop computer I have only one USB bus so I bought specially ASUS U3S6 expansion card, and during the openni_launch I can see:

[ INFO] [1419095363.737608228]: Number devices connected: 2
[ INFO] [1419095363.737698260]: 1. device on bus 003:16 is a Xbox NUI Camera (2ae) from Microsoft (45e) with serial id '0000000000000000'
[ INFO] [1419095363.737738820]: 2. device on bus 005:06 is a Xbox NUI Camera (2ae) from Microsoft (45e) with serial id 'A00361901528049A'

It looks preety promising. So instead of launching two kinects in the same launch, I decided to do it in separate launches. Why? Somewhere in the deep of the Internet I read it'll be more stable. I created my own package with my own launch files, first launching camera named "camera1" at bus 3 and second one launching "camera_2" at bus 5. I also change num_worker_threads to 2 from 4, because my CPU have only 4 cores - I'm not sure it's necessary, but I want to be sure it'll be working and off course it's not. I can launch both kinects using both launch files but only one at the same time. If I try to launch second launch i get message:

terminate called after throwing an instance of 'openni_wrapper::OpenNIException'
  what():  unsigned int openni_wrapper::OpenNIDriver::updateDeviceList() @ /tmp/buildd/ros-indigo-openni-camera-1.9.2-1trusty-20141104-2335/src/openni_driver.cpp @ 125 : enumerating image nodes failed. Reason: One or more of the following nodes could not be enumerated:

Image: PrimeSense/SensorKinect/5.1.2.1: Failed to set USB interface!

And immediately after that:

[camera2/camera2_nodelet_manager-1] process has died [pid 5659, exit code -6, cmd /opt/ros/indigo/lib/nodelet/nodelet manager __name:=camera2_nodelet_manager __log:=/home/daniel/.ros/log/e90afa98-886e-11e4-9ee4-10feed172e37/camera2-camera2_nodelet_manager-1.log].

I run out of ideas what to do.. Can someone help?

Daniel


kinect1.launch:

<!-- Entry point for using OpenNI devices -->
<launch>

  <!-- "camera" should uniquely identify the device. All topics are pushed down
       into the "camera" namespace, and it is prepended to tf frame ids. -->
  <arg name="camera" default="camera1" />
  <arg name="tf_prefix" default="" />
  <arg name="rgb_frame_id"   default="$(arg camera)_rgb_optical_frame" />
  <arg name="depth_frame_id" default="$(arg camera)_depth_optical_frame" />

  <!-- device_id can have the following formats:
         "B00367707227042B": Use device with given serial number
         "#1"              : Use first device found
         "2@3"             : Use device on USB bus 2, address 3
         "2@0"             : Use first device found on USB bus 2
    -->
  <arg name="device_id" default="3@0" />

  <!-- By default, calibrations are stored to file://${ROS_HOME}/camera_info/${NAME}.yaml,
       where ${NAME} is of the form "[rgb|depth]_[serial#]", e.g. "depth_B00367707227042B".
       See camera_info_manager docs for calibration URL details. -->
  <arg name="rgb_camera_info_url"   default="" />
  <arg name="depth_camera_info_url" default="" />

  <!-- Use OpenNI's factory-calibrated depth->RGB registration? -->
  <arg name="depth_registration" default="false" />

  <!-- Arguments for remapping all device namespaces -->
  <arg name="rgb"              default="rgb" />
  <arg name="ir"               default="ir" />
  <arg name="depth"            default="depth" />
  <arg name="depth_registered" default="depth_registered" />
  <arg name="projector"        default="projector" />

  <!-- Optionally suppress loading the driver nodelet and/or publishing the default tf
       tree. Useful if you are playing back recorded raw data from a bag, or are
       supplying a more accurate tf tree from calibration. -->
  <arg name="load_driver" default="true" />
  <arg name="publish_tf" default="true" />
  <!-- Processing Modules -->
  <arg name="rgb_processing"                  default="true"/>
  <arg name="ir_processing"                   default="true"/>
  <arg name="depth_processing"                default="true"/>
  <arg name="depth_registered_processing"     default="true"/>
  <arg name="disparity_processing"            default="true"/>
  <arg name="disparity_registered_processing" default="true"/>
  <arg name="hw_registered_processing"        default="true" />
  <arg name="sw_registered_processing"        default="true" />

  <!-- Disable bond topics by default -->
  <arg name="bond" default="false" /> <!-- DEPRECATED, use respawn arg instead -->
  <arg name="respawn" default="$(arg bond)" />

  <!-- Worker threads for the nodelet manager -->
  <arg name="num_worker_threads" default="2" />

  <!-- Push down all topics/nodelets into "camera" namespace -->
  <group ns="$(arg camera)">

    <!-- Start nodelet manager in top-level namespace -->
    <arg name="manager" value="$(arg camera)_nodelet_manager" />
    <arg name="debug" default="false" /> <!-- Run manager in GDB? -->
    <include file="$(find rgbd_launch)/launch/includes/manager.launch.xml">
      <arg name="name"                value="$(arg manager)" />
      <arg name="debug"               value="$(arg debug)" />
      <arg name="num_worker_threads"  value="$(arg num_worker_threads)" />
    </include>

    <!-- Load driver -->
    <include if="$(arg load_driver)"
         file="$(find openni_launch)/launch/includes/device.launch.xml">
      <!-- Could really use some syntactic sugar for this -->
      <arg name="manager"               value="$(arg manager)" />
      <arg name="device_id"             value="$(arg device_id)" />
      <arg name="rgb_frame_id"          value="$(arg rgb_frame_id)" />
      <arg name="depth_frame_id"        value="$(arg depth_frame_id)" />
      <arg name="rgb_camera_info_url"   value="$(arg rgb_camera_info_url)" />
      <arg name="depth_camera_info_url" value="$(arg depth_camera_info_url)" />
      <arg name="depth_registration"    value="$(arg depth_registration)" />
      <arg name="rgb"                   value="$(arg rgb)" />
      <arg name="ir"                    value="$(arg ir)" />
      <arg name="depth"                 value="$(arg depth)" />
      <arg name="depth_registered"      value="$(arg depth_registered)" />
      <arg name="projector"             value="$(arg projector)" />
      <arg name="respawn"               value="$(arg respawn)" />
    </include>

    <!-- Load standard constellation of processing nodelets -->
    <include file="$(find rgbd_launch)/launch/includes/processing.launch.xml">
      <arg name="manager"                         value="$(arg manager)" />
      <arg name="rgb"                             value="$(arg rgb)" />
      <arg name="ir"                              value="$(arg ir)" />
      <arg name="depth"                           value="$(arg depth)" />
      <arg name="depth_registered"                value="$(arg depth_registered)" />
      <arg name="projector"                       value="$(arg projector)" />
      <arg name="respawn"                         value="$(arg respawn)" />
      <arg name="rgb_processing"                  value="$(arg rgb_processing)" />
      <arg name="ir_processing"                   value="$(arg ir_processing)" />
      <arg name="depth_processing"                value="$(arg depth_processing)" />
      <arg name="depth_registered_processing"     value="$(arg depth_registered_processing)" />
      <arg name="disparity_processing"            value="$(arg disparity_processing)" />
      <arg name="disparity_registered_processing" value="$(arg disparity_registered_processing)" />
      <arg name="hw_registered_processing"        value="$(arg hw_registered_processing)" />
      <arg name="sw_registered_processing"        value="$(arg sw_registered_processing)" />
    </include>

  </group> <!-- camera -->

  <!-- Load reasonable defaults for the relative pose between cameras -->
  <include if="$(arg publish_tf)"
       file="$(find rgbd_launch)/launch/kinect_frames.launch">
    <arg name="camera" value="$(arg camera)" />
    <arg name="tf_prefix" value="$(arg tf_prefix)" />
  </include>

</launch>

kinect2.launch:

<!-- Entry point for using OpenNI devices -->
<launch>

  <!-- "camera" should uniquely identify the device. All topics are pushed down
       into the "camera" namespace, and it is prepended to tf frame ids. -->
  <arg name="camera" default="camera2" />
  <arg name="tf_prefix" default="" />
  <arg name="rgb_frame_id"   default="$(arg camera)_rgb_optical_frame" />
  <arg name="depth_frame_id" default="$(arg camera)_depth_optical_frame" />

  <!-- device_id can have the following formats:
         "B00367707227042B": Use device with given serial number
         "#1"              : Use first device found
         "2@3"             : Use device on USB bus 2, address 3
         "2@0"             : Use first device found on USB bus 2
    -->
  <arg name="device_id" default="5@0" />

  <!-- By default, calibrations are stored to file://${ROS_HOME}/camera_info/${NAME}.yaml,
       where ${NAME} is of the form "[rgb|depth]_[serial#]", e.g. "depth_B00367707227042B".
       See camera_info_manager docs for calibration URL details. -->
  <arg name="rgb_camera_info_url"   default="" />
  <arg name="depth_camera_info_url" default="" />

  <!-- Use OpenNI's factory-calibrated depth->RGB registration? -->
  <arg name="depth_registration" default="false" />

  <!-- Arguments for remapping all device namespaces -->
  <arg name="rgb"              default="rgb" />
  <arg name="ir"               default="ir" />
  <arg name="depth"            default="depth" />
  <arg name="depth_registered" default="depth_registered" />
  <arg name="projector"        default="projector" />

  <!-- Optionally suppress loading the driver nodelet and/or publishing the default tf
       tree. Useful if you are playing back recorded raw data from a bag, or are
       supplying a more accurate tf tree from calibration. -->
  <arg name="load_driver" default="true" />
  <arg name="publish_tf" default="true" />
  <!-- Processing Modules -->
  <arg name="rgb_processing"                  default="true"/>
  <arg name="ir_processing"                   default="true"/>
  <arg name="depth_processing"                default="true"/>
  <arg name="depth_registered_processing"     default="true"/>
  <arg name="disparity_processing"            default="true"/>
  <arg name="disparity_registered_processing" default="true"/>
  <arg name="hw_registered_processing"        default="true" />
  <arg name="sw_registered_processing"        default="true" />

  <!-- Disable bond topics by default -->
  <arg name="bond" default="false" /> <!-- DEPRECATED, use respawn arg instead -->
  <arg name="respawn" default="$(arg bond)" />

  <!-- Worker threads for the nodelet manager -->
  <arg name="num_worker_threads" default="2" />

  <!-- Push down all topics/nodelets into "camera" namespace -->
  <group ns="$(arg camera)">

    <!-- Start nodelet manager in top-level namespace -->
    <arg name="manager" value="$(arg camera)_nodelet_manager" />
    <arg name="debug" default="false" /> <!-- Run manager in GDB? -->
    <include file="$(find rgbd_launch)/launch/includes/manager.launch.xml">
      <arg name="name"                value="$(arg manager)" />
      <arg name="debug"               value="$(arg debug)" />
      <arg name="num_worker_threads"  value="$(arg num_worker_threads)" />
    </include>

    <!-- Load driver -->
    <include if="$(arg load_driver)"
         file="$(find openni_launch)/launch/includes/device.launch.xml">
      <!-- Could really use some syntactic sugar for this -->
      <arg name="manager"               value="$(arg manager)" />
      <arg name="device_id"             value="$(arg device_id)" />
      <arg name="rgb_frame_id"          value="$(arg rgb_frame_id)" />
      <arg name="depth_frame_id"        value="$(arg depth_frame_id)" />
      <arg name="rgb_camera_info_url"   value="$(arg rgb_camera_info_url)" />
      <arg name="depth_camera_info_url" value="$(arg depth_camera_info_url)" />
      <arg name="depth_registration"    value="$(arg depth_registration)" />
      <arg name="rgb"                   value="$(arg rgb)" />
      <arg name="ir"                    value="$(arg ir)" />
      <arg name="depth"                 value="$(arg depth)" />
      <arg name="depth_registered"      value="$(arg depth_registered)" />
      <arg name="projector"             value="$(arg projector)" />
      <arg name="respawn"               value="$(arg respawn)" />
    </include>

    <!-- Load standard constellation of processing nodelets -->
    <include file="$(find rgbd_launch)/launch/includes/processing.launch.xml">
      <arg name="manager"                         value="$(arg manager)" />
      <arg name="rgb"                             value="$(arg rgb)" />
      <arg name="ir"                              value="$(arg ir)" />
      <arg name="depth"                           value="$(arg depth)" />
      <arg name="depth_registered"                value="$(arg depth_registered)" />
      <arg name="projector"                       value="$(arg projector)" />
      <arg name="respawn"                         value="$(arg respawn)" />
      <arg name="rgb_processing"                  value="$(arg rgb_processing)" />
      <arg name="ir_processing"                   value="$(arg ir_processing)" />
      <arg name="depth_processing"                value="$(arg depth_processing)" />
      <arg name="depth_registered_processing"     value="$(arg depth_registered_processing)" />
      <arg name="disparity_processing"            value="$(arg disparity_processing)" />
      <arg name="disparity_registered_processing" value="$(arg disparity_registered_processing)" />
      <arg name="hw_registered_processing"        value="$(arg hw_registered_processing)" />
      <arg name="sw_registered_processing"        value="$(arg sw_registered_processing)" />
    </include>

  </group> <!-- camera -->

  <!-- Load reasonable defaults for the relative pose between cameras -->
  <include if="$(arg publish_tf)"
       file="$(find rgbd_launch)/launch/kinect_frames.launch">
    <arg name="camera" value="$(arg camera)" />
    <arg name="tf_prefix" value="$(arg tf_prefix)" />
  </include>

</launch>