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

Unable to launch more than 2 d435i #1326

Closed
mcdzim opened this issue Aug 11, 2020 · 9 comments
Closed

Unable to launch more than 2 d435i #1326

mcdzim opened this issue Aug 11, 2020 · 9 comments
Labels

Comments

@mcdzim
Copy link

mcdzim commented Aug 11, 2020

I am working on a system that requires 4 cameras to be running into ROS melodic on Ubuntu 18.04 using either an intel nuc or jetson nano.

Having tried with both platforms we can reliably launch the realsense-viewer and display 4 live streams (needed to check power from the hub and cables from being a bottleneck)

When I use the multiple launch option in ros I can only get 2 to launch and if I try launch 4 then a random 2 cameras launch and the others fail often reporting an RS2 power state error

Here is the launch file and seeing as the issue is across platform think it had to be a part of the realsense-ros wrapper

Launch file

<launch>
  <arg name="serial_no_camera1"    			default="843112071333"/> 			
  <arg name="serial_no_camera2"    			default="923322070870"/> 			
  <arg name="serial_no_camera3"    			default="919122071947"/> 			
  <arg name="serial_no_camera4"    			default="919122072218"/> 		


  <arg name="camera1"              			default="camera1"/>		
  <arg name="camera2"              			default="camera2"/>		
  <arg name="camera3"              			default="camera3"/>		
  <arg name="camera4"              			default="camera4"/>		
  <arg name="tf_prefix_camera1"         default="$(arg camera1)"/>
  <arg name="tf_prefix_camera2"         default="$(arg camera2)"/>
  <arg name="tf_prefix_camera3"         default="$(arg camera3)"/>
  <arg name="tf_prefix_camera4"         default="$(arg camera4)"/>
  <arg name="initial_reset"             default="true"/>

  <group ns="$(arg camera1)">
    <include file="$(find ziva_bringup)/config/realsense_config.xml">
      <arg name="serial_no"             value="$(arg serial_no_camera1)"/>
      <arg name="tf_prefix"         		value="$(arg tf_prefix_camera1)"/>
      <arg name="initial_reset"         value="$(arg initial_reset)"/>
    </include>
  </group>

  <group ns="$(arg camera2)">
    <include file="$(find ziva_bringup)/config/realsense_config.xml">
      <arg name="serial_no"             value="$(arg serial_no_camera2)"/>
      <arg name="tf_prefix"		          value="$(arg tf_prefix_camera2)"/>
      <arg name="initial_reset"         value="$(arg initial_reset)"/>
    </include>
  </group> -->

  <!-- <group ns="$(arg camera3)" if="$(eval serial_no_camera3 != '')">
    <include file="$(find ziva_bringup)/config/realsense_config.xml">
      <arg name="serial_no"             value="$(arg serial_no_camera3)"/>
      <arg name="tf_prefix"		          value="$(arg tf_prefix_camera3)"/>
      <arg name="initial_reset"         value="$(arg initial_reset)"/>
    </include>
  </group> -->

  <!-- <group ns="$(arg camera4)" if="$(eval serial_no_camera4 != '')">
    <include file="$(find ziva_bringup)/config/realsense_config.xml">
      <arg name="serial_no"             value="$(arg serial_no_camera4)"/>
      <arg name="tf_prefix"		          value="$(arg tf_prefix_camera4)"/>
      <arg name="initial_reset"         value="$(arg initial_reset)"/>
    </include>
  </group> -->

Config file


<launch>
  <arg name="external_manager"    default="false"/>
  <arg name="manager"             default="realsense2_camera_manager"/>
  <arg name="serial_no"           default=""/>
  <arg name="usb_port_id"         default=""/>
  <arg name="device_type"         default=""/>
  <arg name="tf_prefix"           default=""/>
  <arg name="json_file_path"      default=""/>
  <arg name="rosbag_filename"     default=""/>
  <arg name="required"            default="false"/>

  <arg name="fisheye_width"       default="0"/>
  <arg name="fisheye_height"      default="0"/>
  <arg name="enable_fisheye"      default="false"/>
  <arg name="enable_fisheye1"     default="false"/>
  <arg name="enable_fisheye2"     default="false"/>

  <arg name="depth_width"         default="640"/>
  <arg name="depth_height"        default="480"/>
  <arg name="enable_depth"        default="false"/>

  <arg name="infra_width"         default="848"/>
  <arg name="infra_height"        default="480"/>
  <arg name="enable_infra1"       default="true"/>
  <arg name="enable_infra2"       default="false"/>

  <arg name="color_width"         default="848"/>
  <arg name="color_height"        default="480"/>
  <arg name="enable_color"        default="true"/>

  <arg name="fisheye_fps"         default="6"/>
  <arg name="depth_fps"           default="6"/>
  <arg name="infra_fps"           default="30"/>
  <arg name="color_fps"           default="30"/>
  <arg name="gyro_fps"            default="0"/>
  <arg name="accel_fps"           default="0"/>
  <arg name="enable_gyro"         default="false"/>
  <arg name="enable_accel"        default="false"/>

  <arg name="enable_pointcloud"   default="false"/>
  <arg name="pointcloud_texture_stream" default="RS2_STREAM_ANY"/>  <!-- use RS2_STREAM_ANY to avoid using texture -->
  <arg name="pointcloud_texture_index"  default="0"/>

  <arg name="enable_sync"         default="false"/>
  <arg name="align_depth"         default="false"/>

  <arg name="base_frame_id"             default="$(arg tf_prefix)_link"/>
  <arg name="depth_frame_id"            default="$(arg tf_prefix)_depth_frame"/>
  <arg name="infra1_frame_id"           default="$(arg tf_prefix)_infra1_frame"/>
  <arg name="infra2_frame_id"           default="$(arg tf_prefix)_infra2_frame"/>
  <arg name="color_frame_id"            default="$(arg tf_prefix)_color_frame"/>
  <arg name="fisheye_frame_id"          default="$(arg tf_prefix)_fisheye_frame"/>
  <arg name="fisheye1_frame_id"         default="$(arg tf_prefix)_fisheye1_frame"/>
  <arg name="fisheye2_frame_id"         default="$(arg tf_prefix)_fisheye2_frame"/>
  <arg name="accel_frame_id"            default="$(arg tf_prefix)_accel_frame"/>
  <arg name="gyro_frame_id"             default="$(arg tf_prefix)_gyro_frame"/>
  <arg name="pose_frame_id"             default="$(arg tf_prefix)_pose_frame"/>

  <arg name="depth_optical_frame_id"    default="$(arg tf_prefix)_depth_optical_frame"/>
  <arg name="infra1_optical_frame_id"   default="$(arg tf_prefix)_infra1_optical_frame"/>
  <arg name="infra2_optical_frame_id"   default="$(arg tf_prefix)_infra2_optical_frame"/>
  <arg name="color_optical_frame_id"    default="$(arg tf_prefix)_color_optical_frame"/>
  <arg name="fisheye_optical_frame_id"  default="$(arg tf_prefix)_fisheye_optical_frame"/>
  <arg name="fisheye1_optical_frame_id" default="$(arg tf_prefix)_fisheye1_optical_frame"/>
  <arg name="fisheye2_optical_frame_id" default="$(arg tf_prefix)_fisheye2_optical_frame"/>
  <arg name="accel_optical_frame_id"    default="$(arg tf_prefix)_accel_optical_frame"/>
  <arg name="gyro_optical_frame_id"     default="$(arg tf_prefix)_gyro_optical_frame"/>
  <arg name="imu_optical_frame_id"      default="$(arg tf_prefix)_imu_optical_frame"/>
  <arg name="pose_optical_frame_id"     default="$(arg tf_prefix)_pose_optical_frame"/>

  <arg name="aligned_depth_to_color_frame_id"    default="$(arg tf_prefix)_aligned_depth_to_color_frame"/>
  <arg name="aligned_depth_to_infra1_frame_id"   default="$(arg tf_prefix)_aligned_depth_to_infra1_frame"/>
  <arg name="aligned_depth_to_infra2_frame_id"   default="$(arg tf_prefix)_aligned_depth_to_infra2_frame"/>
  <arg name="aligned_depth_to_fisheye_frame_id"  default="$(arg tf_prefix)_aligned_depth_to_fisheye_frame"/>
  <arg name="aligned_depth_to_fisheye1_frame_id" default="$(arg tf_prefix)_aligned_depth_to_fisheye1_frame"/>
  <arg name="aligned_depth_to_fisheye2_frame_id" default="$(arg tf_prefix)_aligned_depth_to_fisheye2_frame"/>

  <arg name="publish_tf"               default="true"/>
  <arg name="tf_publish_rate"          default="0"/> <!-- 0 - static transform -->

  <arg name="odom_frame_id"            default="$(arg tf_prefix)_odom_frame"/>
  <arg name="topic_odom_in"            default="$(arg tf_prefix)/odom_in"/>
  <arg name="calib_odom_file"          default=""/>
  <arg name="publish_odom_tf"          default="false"/>
  <arg name="filters"                  default=""/>
  <arg name="clip_distance"            default="-1"/>
  <arg name="linear_accel_cov"         default="0.01"/>
  <arg name="initial_reset"            default="true"/>
  <arg name="unite_imu_method"         default="none"/> <!-- Options are: [none, copy, linear_interpolation] -->
  <arg name="allow_no_texture_points"  default="false"/>


  <node unless="$(arg external_manager)" pkg="nodelet" type="nodelet" name="$(arg manager)" args="manager" output="screen" required="$(arg required)"/>
  <node pkg="nodelet" type="nodelet" name="realsense2_camera" args="load realsense2_camera/RealSenseNodeFactory $(arg manager)" required="$(arg required)">
    <param name="serial_no"                type="str"  value="$(arg serial_no)"/>
    <param name="usb_port_id"              type="str"  value="$(arg usb_port_id)"/>
    <param name="device_type"              type="str"  value="$(arg device_type)"/>
    <param name="json_file_path"           type="str"  value="$(arg json_file_path)"/>
    <param name="rosbag_filename"          type="str"  value="$(arg rosbag_filename)"/>

    <param name="enable_pointcloud"        type="bool" value="$(arg enable_pointcloud)"/>
    <param name="pointcloud_texture_stream" type="str" value="$(arg pointcloud_texture_stream)"/>
    <param name="pointcloud_texture_index"  type="int" value="$(arg pointcloud_texture_index)"/>
    <param name="enable_sync"              type="bool" value="$(arg enable_sync)"/>
    <param name="align_depth"              type="bool" value="$(arg align_depth)"/>

    <param name="fisheye_width"            type="int"  value="$(arg fisheye_width)"/>
    <param name="fisheye_height"           type="int"  value="$(arg fisheye_height)"/>
    <param name="enable_fisheye"           type="bool" value="$(arg enable_fisheye)"/>
    <param name="enable_fisheye1"          type="bool" value="$(arg enable_fisheye1)"/>
    <param name="enable_fisheye2"          type="bool" value="$(arg enable_fisheye2)"/>

    <param name="depth_width"              type="int"  value="$(arg depth_width)"/>
    <param name="depth_height"             type="int"  value="$(arg depth_height)"/>
    <param name="enable_depth"             type="bool" value="$(arg enable_depth)"/>

    <param name="color_width"              type="int"  value="$(arg color_width)"/>
    <param name="color_height"             type="int"  value="$(arg color_height)"/>
    <param name="enable_color"             type="bool" value="$(arg enable_color)"/>

    <param name="infra_width"             type="int"  value="$(arg infra_width)"/>
    <param name="infra_height"            type="int"  value="$(arg infra_height)"/>
    <param name="enable_infra1"            type="bool" value="$(arg enable_infra1)"/>
    <param name="enable_infra2"            type="bool" value="$(arg enable_infra2)"/>

    <param name="fisheye_fps"              type="int"  value="$(arg fisheye_fps)"/>
    <param name="depth_fps"                type="int"  value="$(arg depth_fps)"/>
    <param name="infra_fps"               type="int"  value="$(arg infra_fps)"/>
    <param name="color_fps"                type="int"  value="$(arg color_fps)"/>
    <param name="gyro_fps"                 type="int"  value="$(arg gyro_fps)"/>
    <param name="accel_fps"                type="int"  value="$(arg accel_fps)"/>
    <param name="enable_gyro"              type="bool" value="$(arg enable_gyro)"/>
    <param name="enable_accel"             type="bool" value="$(arg enable_accel)"/>

    <param name="base_frame_id"            type="str"  value="$(arg base_frame_id)"/>
    <param name="depth_frame_id"           type="str"  value="$(arg depth_frame_id)"/>
    <param name="infra1_frame_id"          type="str"  value="$(arg infra1_frame_id)"/>
    <param name="infra2_frame_id"          type="str"  value="$(arg infra2_frame_id)"/>
    <param name="color_frame_id"           type="str"  value="$(arg color_frame_id)"/>
    <param name="fisheye_frame_id"         type="str"  value="$(arg fisheye_frame_id)"/>
    <param name="fisheye1_frame_id"        type="str"  value="$(arg fisheye1_frame_id)"/>
    <param name="fisheye2_frame_id"        type="str"  value="$(arg fisheye2_frame_id)"/>
    <param name="accel_frame_id"           type="str"  value="$(arg accel_frame_id)"/>
    <param name="gyro_frame_id"            type="str"  value="$(arg gyro_frame_id)"/>
    <param name="pose_frame_id"            type="str"  value="$(arg pose_frame_id)"/>

    <param name="depth_optical_frame_id"    type="str"  value="$(arg depth_optical_frame_id)"/>
    <param name="infra1_optical_frame_id"   type="str"  value="$(arg infra1_optical_frame_id)"/>
    <param name="infra2_optical_frame_id"   type="str"  value="$(arg infra2_optical_frame_id)"/>
    <param name="color_optical_frame_id"    type="str"  value="$(arg color_optical_frame_id)"/>
    <param name="fisheye_optical_frame_id"  type="str"  value="$(arg fisheye_optical_frame_id)"/>
    <param name="fisheye1_optical_frame_id" type="str"  value="$(arg fisheye1_optical_frame_id)"/>
    <param name="fisheye2_optical_frame_id" type="str"  value="$(arg fisheye2_optical_frame_id)"/>
    <param name="accel_optical_frame_id"    type="str"  value="$(arg accel_optical_frame_id)"/>
    <param name="gyro_optical_frame_id"     type="str"  value="$(arg gyro_optical_frame_id)"/>
    <param name="imu_optical_frame_id"      type="str"  value="$(arg imu_optical_frame_id)"/>
    <param name="pose_optical_frame_id"     type="str"  value="$(arg pose_optical_frame_id)"/>

    <param name="aligned_depth_to_color_frame_id"    type="str"  value="$(arg aligned_depth_to_color_frame_id)"/>
    <param name="aligned_depth_to_infra1_frame_id"   type="str"  value="$(arg aligned_depth_to_infra1_frame_id)"/>
    <param name="aligned_depth_to_infra2_frame_id"   type="str"  value="$(arg aligned_depth_to_infra2_frame_id)"/>
    <param name="aligned_depth_to_fisheye_frame_id"  type="str"  value="$(arg aligned_depth_to_fisheye_frame_id)"/>
    <param name="aligned_depth_to_fisheye1_frame_id" type="str"  value="$(arg aligned_depth_to_fisheye1_frame_id)"/>
    <param name="aligned_depth_to_fisheye2_frame_id" type="str"  value="$(arg aligned_depth_to_fisheye2_frame_id)"/>

    <param name="publish_tf"               type="bool"   value="$(arg publish_tf)"/>
    <param name="tf_publish_rate"          type="double" value="$(arg tf_publish_rate)"/>

    <param name="odom_frame_id"            type="str"  value="$(arg odom_frame_id)"/>
    <param name="topic_odom_in"            type="str"  value="$(arg topic_odom_in)"/>
    <param name="calib_odom_file"          type="str"    value="$(arg calib_odom_file)"/>
    <param name="publish_odom_tf"          type="bool" value="$(arg publish_odom_tf)"/>
    <param name="filters"                  type="str"    value="$(arg filters)"/>
    <param name="clip_distance"            type="double" value="$(arg clip_distance)"/>
    <param name="linear_accel_cov"         type="double" value="$(arg linear_accel_cov)"/>
    <param name="initial_reset"            type="bool"   value="$(arg initial_reset)"/>
    <param name="unite_imu_method"         type="str"    value="$(arg unite_imu_method)"/>
    <param name="allow_no_texture_points"  type="bool"   value="$(arg allow_no_texture_points)"/>

  </node>
</launch>

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Aug 12, 2020

Hi @mcdzim Jetson boards sometimes have multicam problems with RealSense in general as well as ROS that are typically related to a failed power state. Version 2.35.2 of librealsense introduced improvements to how multiple cameras are handled in rs2::pipeline, though the changes may not prevent problems that are related to specific models of USB hub. There are long discussions of the subject at the links below:

IntelRealSense/librealsense#5828
IntelRealSense/librealsense#6379
IntelRealSense/librealsense#6395

One possible workaround suggested within IntelRealSense/librealsense#5828 is to plug the cameras in using a certain order of insertion.

IntelRealSense/librealsense#5828 (comment)

If you are launching the cameras with rs_multiple_devices.launch and are using serial numbers to identify the two separate cameras, then an alternative approach in ROS that may give more stable device identification may be to identify by USB port ID instead of serial number with the usb_port_id instruction.

https://github.com/IntelRealSense/realsense-ros#launch-parameters

@MartyG-RealSense
Copy link
Collaborator

Hi @mcdzim Do you still require assistance with this case, please? Thanks!

@mcdzim
Copy link
Author

mcdzim commented Aug 21, 2020

Hi @MartyG-RealSense , sorry for the delay and I am still working on addressing the above issues. I have managed to get all the cameras working using an old macbook pro running Ubuntu 18.04, Librealsense 2.37 and RealsenseRos 1.16.

Can I keep the issue open for another few days to see if I can't get through the suggestions and make it work.

On another note you don't live in Nebraska do you!!! (Credit to https://xkcd.com/2347/)
image

@MartyG-RealSense
Copy link
Collaborator

Yes, it's no problem to leave it open for a further time period - thanks so much for the update!

No I'm not in Nebraska but my living location feels like it sometimes :)

@MartyG-RealSense
Copy link
Collaborator

Hi @mcdzim Do you have a further update yet, please?

@MartyG-RealSense
Copy link
Collaborator

Hi @mcdzim Do you need this case to be kept open for a longer period while you continue to work on issues, please? Thanks!

@MartyG-RealSense
Copy link
Collaborator

Case closed due to no futher comments received - feel free to re-open the case if you need to resume it at a later date.

@mcdzim
Copy link
Author

mcdzim commented Oct 15, 2020

Final fix was making sure to use Librealsense 2.36 and realsense-ros 2.2.15 on Ubuntu 18.04 and with this arrangement managed to get all 4 cameras working reliably on an intel Nuc with large externally powered USB 3.2 hub.

Still unable to make much progress using a Jetson Nano or Xavier NX

@MartyG-RealSense
Copy link
Collaborator

There have been a couple of recent Jetson cases on Nano and Xavier where updating CMake solved problems. The procedure that the RealSense users in those cases used is in the link below:

IntelRealSense/librealsense#6980 (comment)

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

No branches or pull requests

2 participants