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

rosrun tf view_frames shows no tf being published #120

Closed
sinhau opened this issue Sep 20, 2016 · 12 comments
Closed

rosrun tf view_frames shows no tf being published #120

sinhau opened this issue Sep 20, 2016 · 12 comments
Labels

Comments

@sinhau
Copy link

sinhau commented Sep 20, 2016

System Configuration

Please complete Your Configuration detail below. Refer to the BKC at Configuration.

Version Your Configuration
Operating System Ubuntu 16.04.1 LTS
Kernel 4.4.0-38-generic
Backend Video4Linux
ROS ROS Kinetic
ROS RealSense 1.4.0
librealsense 0.9.1 (although I used git checkout tags/stable so I would think this would say 0.9.2)
Camera Type-Firmware R200 1.0.72.06

I'm launching two R200 cameras using the r200_nodelet_multiple_cameras.launch. I modified the launch file as shown below to change the enable_tf parameter to true. When I run the launch file, both cameras launch and I am getting all the data. The ROS logs even shows that cameras should be publishing transforms (see terminal output below) However, when I run rosrun tf view_frames, the output frames.pdf file says no tf data received. For some reason no tf is being published. Moreover, when I run rostopic echo /tf_static, I only see camera2 tf's.

r200_nodelet_multiple_cameras.launch

<!-- Sample launch file for using multiple RealSense R200 cameras -->
<launch>
  <arg name="manager" value="nodelet_manager" /> <!-- Single nodelet manager for all cameras -->
  <node pkg="nodelet" type="nodelet" name="$(arg manager)" args="manager" output="screen"/>

  <!-- MY MODS -->
  <param name="camera1/enable_pointcloud" type="bool" value="false" />
  <param name="camera1/enable_tf"         type="bool" value="true" />
  <param name="camera2/enable_pointcloud" type="bool" value="false" />
  <param name="camera2/enable_tf"         type="bool" value="true" />
  <!-- ======= -->

  <!-- User must include the .xml file for each camera with unique values for "camera" and 
       either the "serial_no" or "usb_port_id" of the camera.
       "camera" should be a user friendly string that follows the ROS Names convention. -->
  <include file="$(find realsense_camera)/launch/includes/nodelet.launch.xml">
    <arg name="manager"      value="$(arg manager)" />
    <arg name="camera"       value="camera1" />
    <arg name="camera_type"  value="R200" /> <!-- Type of camera -->
    <arg name="serial_no"    value="2431002398" /> <!-- Note: Replace with actual serial number -->
    <arg name="usb_port_id"  value="" /> <!-- USB "Bus#-Port#" -->
  </include>

  <include file="$(find realsense_camera)/launch/includes/nodelet.launch.xml">
    <arg name="manager"      value="$(arg manager)" />
    <arg name="camera"       value="camera2" />
    <arg name="camera_type"  default="R200" /> <!-- Type of camera -->
    <arg name="serial_no"    value="2431018202" /> <!-- Note: Replace with actual serial number -->
    <arg name="usb_port_id"  value="" /> <!-- USB "Bus#-Port#" -->
  </include>
</launch>

Terminal output after running the above launch file

SUMMARY
========

PARAMETERS
 * /camera1/base_frame_id: camera1_link
 * /camera1/camera_type: R200
 * /camera1/color_frame_id: camera1_rgb_frame
 * /camera1/color_optical_frame_id: camera1_rgb_optic...
 * /camera1/depth_frame_id: camera1_depth_frame
 * /camera1/depth_optical_frame_id: camera1_depth_opt...
 * /camera1/enable_pointcloud: False
 * /camera1/enable_tf: True
 * /camera1/ir2_frame_id: camera1_ir2_frame
 * /camera1/ir_frame_id: camera1_ir_frame
 * /camera1/serial_no: 2431002398
 * /camera1/usb_port_id: 
 * /camera2/base_frame_id: camera2_link
 * /camera2/camera_type: R200
 * /camera2/color_frame_id: camera2_rgb_frame
 * /camera2/color_optical_frame_id: camera2_rgb_optic...
 * /camera2/depth_frame_id: camera2_depth_frame
 * /camera2/depth_optical_frame_id: camera2_depth_opt...
 * /camera2/enable_pointcloud: False
 * /camera2/enable_tf: True
 * /camera2/ir2_frame_id: camera2_ir2_frame
 * /camera2/ir_frame_id: camera2_ir_frame
 * /camera2/serial_no: 2431018202
 * /camera2/usb_port_id: 
 * /rosdistro: kinetic
 * /rosversion: 1.12.2

NODES
  /
    camera1 (nodelet/nodelet)
    camera2 (nodelet/nodelet)
    nodelet_manager (nodelet/nodelet)

auto-starting new master
process[master]: started with pid [9707]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 21dbc410-7ec2-11e6-8a74-001fc69bc102
process[rosout-1]: started with pid [9720]
started core service [/rosout]
process[nodelet_manager-2]: started with pid [9731]
process[camera1-3]: started with pid [9738]
process[camera2-4]: started with pid [9739]
[ INFO] [1474328294.635700141]: Initializing nodelet with 4 worker threads.
[ INFO] [1474328294.916099353]: /camera1 - Detected the following cameras:
                - Serial No: 2431002398, USB Port ID: 2-3, Name: Intel RealSense R200, Firmware: 1.0.72.06
                - Serial No: 2431018202, USB Port ID: 2-4, Name: Intel RealSense R200, Firmware: 1.0.72.06
[ INFO] [1474328294.916204645]: /camera1 - Connecting to camera with Serial No: 2431002398, USB Port ID: 2-3
[ INFO] [1474328295.215844540]: /camera1 - Setting static camera options
[ INFO] [1474328295.223619262]: /camera1 - Enabling Color in preset mode
[ INFO] [1474328295.224040801]: /camera1 - Enabling Depth in preset mode
[ INFO] [1474328295.224279460]: /camera1 - Enabling IR in preset mode
[ INFO] [1474328295.224421585]: /camera1 - Enabling IR2 in preset mode
[ INFO] [1474328295.224537239]: /camera1 - Starting camera
[ INFO] [1474328295.256159378]: /camera1 - Publishing camera transforms
[ INFO] [1474328295.256235771]: /camera1 - Setting dynamic camera options
[ INFO] [1474328296.077065450]: /camera2 - Detected the following cameras:
                - Serial No: 2431002398, USB Port ID: 2-3, Name: Intel RealSense R200, Firmware: 1.0.72.06
                - Serial No: 2431018202, USB Port ID: 2-4, Name: Intel RealSense R200, Firmware: 1.0.72.06
[ INFO] [1474328296.077198963]: /camera2 - Connecting to camera with Serial No: 2431018202, USB Port ID: 2-4
[ INFO] [1474328296.358673233]: /camera2 - Setting static camera options
[ INFO] [1474328296.365748123]: /camera2 - Enabling Color in preset mode
[ INFO] [1474328296.366053036]: /camera2 - Enabling Depth in preset mode
[ INFO] [1474328296.366201549]: /camera2 - Enabling IR in preset mode
[ INFO] [1474328296.366304975]: /camera2 - Enabling IR2 in preset mode
[ INFO] [1474328296.366402753]: /camera2 - Starting camera
[ INFO] [1474328296.398035491]: /camera2 - Publishing camera transforms
[ INFO] [1474328296.398113191]: /camera2 - Setting dynamic camera options
@sinhau
Copy link
Author

sinhau commented Sep 26, 2016

Hi @reaganlo, were you able to reproduce this issue? Just checking in to see if there are any updates on this. Please let me know if you need more information.

@reaganlo
Copy link

Hi @sinhau , I was able to reproduce the error. We will look into this and provide you an update.

As a workaround for multiple cameras, could you please do the following:

  • Create default launch files for each of the camera. I am attaching 2 samples.
    E.g r200_nodelet_default_1.launch and r200_nodelet_default_2.launch.
  • Edit each of the launch files to have unique values for the arguments "manager", "camera" and "serial_no/usb_port_id".
  • Launch them in separate terminals.
  • Use rostopic echo /tf_static to view the transforms. Note: rosrun tf view_frames does not work for static transforms.

r200_nodelet_default_1.launch.txt
r200_nodelet_default_2.launch.txt

@sinhau
Copy link
Author

sinhau commented Sep 27, 2016

Thanks for your reply @reaganlo! I tried out your suggestion. One of the cameras is unable to launch sometimes when I call the two launch files simultaneously (see terminal output below). This seems to only happen when I'm launching both camera1 and camera2 simultaneously. If I launch them one after the other, it works fine.

Here are my launch files:
realsense_1.txt
realsense_2.txt

auto-starting new master
process[master]: started with pid [7832]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to b56507c2-845e-11e6-ab6d-001fc69bc102
process[rosout-1]: started with pid [7845]
started core service [/rosout]
process[nodelet_manager1-2]: started with pid [7861]
process[camera1-3]: started with pid [7863]
process[nodelet_manager2-4]: started with pid [7864]
process[camera2-5]: started with pid [7865]
[ INFO] [1474945299.699813056]: Initializing nodelet with 4 worker threads.
[ INFO] [1474945299.704621645]: Initializing nodelet with 4 worker threads.
[ERROR] [1474945299.969685801]: /camera2 - Error calling rs_create_context ( api_version:4 ): 
UVCIOC_CTRL_QUERY:UVC_SET_CUR error 5, Input/output error 

[ INFO] [1474945299.975522897]: /camera1 - Detected the following cameras:
                - Serial No: 2431002398, USB Port ID: 2-3, Name: Intel RealSense R200, Firmware: 1.0.72.06
                - Serial No: 26, USB Port ID: 2-4, Name: Intel RealSense R200, Firmware: 1.0.72.06
[ INFO] [1474945299.975622467]: /camera1 - Connecting to camera with Serial No: 2431002398, USB Port ID: 2-3
[FATAL] [1474945300.091562929]: Service call failed!
[nodelet_manager2-4] process has died [pid 7864, exit code 1, cmd /opt/ros/kinetic/lib/nodelet/nodelet manager __name:=nodelet_manager2 __log:=/home/fellow/.ros/log/b56507c2-845e-11e6-ab6d-001fc69bc102/nodelet_manager2-4.log].
log file: /home/fellow/.ros/log/b56507c2-845e-11e6-ab6d-001fc69bc102/nodelet_manager2-4*.log
[ INFO] [1474945300.273483777]: /camera1 - Setting static camera options
[ INFO] [1474945300.281953536]: /camera1 - Enabling Color in preset mode
[ INFO] [1474945300.282275195]: /camera1 - Enabling Depth in preset mode
[ INFO] [1474945300.282411046]: /camera1 - Enabling IR in preset mode
[ INFO] [1474945300.282505008]: /camera1 - Enabling IR2 in preset mode
[ INFO] [1474945300.282596785]: /camera1 - Starting camera
[ INFO] [1474945300.316738976]: /camera1 - Publishing camera transforms
[ INFO] [1474945300.317081272]: /camera1 - Setting dynamic camera options
[camera2-5] process has died [pid 7865, exit code 255, cmd /opt/ros/kinetic/lib/nodelet/nodelet load realsense_camera/R200Nodelet nodelet_manager2 camera/depth/image_raw:=camera2/depth/image_raw camera/color/image_raw:=camera2/color/image_raw camera/ir/image_raw:=camera2/ir/image_raw camera/ir2/image_raw:=camera2/ir2/image_raw camera/depth/points:=camera2/depth/points camera/depth/camera_info:=camera2/depth/camera_info camera/color/camera_info:=camera2/color/camera_info camera/ir/camera_info:=camera2/ir/camera_info camera/ir2/camera_info:=camera2/ir2/camera_info camera/get_settings:=camera2/get_settings __name:=camera2 __log:=/home/fellow/.ros/log/b56507c2-845e-11e6-ab6d-001fc69bc102/camera2-5.log].
log file: /home/fellow/.ros/log/b56507c2-845e-11e6-ab6d-001fc69bc102/camera2-5*.log

@reaganlo
Copy link

@sinhau Yes, this can happen when you try to launch 2 cameras simultaneous because it leads 2 separate processes trying to access the librealsense "context" at the same time. Just like how you noticed, I would suggest you launch them one after the other.

@tulku
Copy link

tulku commented Oct 26, 2016

It would be good for the drivers to not fail when accessing the "context" simultaneously.

@reaganlo are there plans on fixing this?

@reaganlo reaganlo added the bug label Nov 1, 2016
@mkhansenbot
Copy link

@sinhau and @tulku - I looked into this further and the root cause can be traced to this issue in the roscomm libraries (roscpp):ros/ros_comm#146

Since that is unlikely to be fixed per their maintainers, the work-around of running from 2 launch files is the only option right now.

@tulku
Copy link

tulku commented Nov 18, 2016

Hi! I agree that the solution is to have multiple launchfiles, however that option is not currently working. As soon as you try to start too nodes (via a launchfile, so they start at the same time) one of the nodes crashes. This is probably a different bug, I can open it tomorrow.

@sinhau
Copy link
Author

sinhau commented Nov 18, 2016

@tulku , yes I'm seeing the same issue. Looks like this bug was introduced in one of the newer releases because launching multiple cameras via separate launch files was working for me on 1.4.0. Thanks for opening this issue!

@tulku
Copy link

tulku commented Nov 21, 2016

@mkhansen-intel I've created the issue that should be fixed before being able to use multiple nodelet managers. #156

@mkhansenbot
Copy link

mkhansenbot commented Nov 30, 2016

Since the underlying issue is in roscpp and is not scheduled to be fixed, we're looking into a fix for this one that would fork a new process before calling the static transform publisher. We'll update this issue* with results.

@AndyZe
Copy link
Contributor

AndyZe commented Dec 1, 2016

fyi I'm also interested in having tf's for multiple cameras, so I'll be watching this.

@mdhorn
Copy link

mdhorn commented Dec 23, 2016

Fixed in release 1.7.0
Use Dynamic Transforms by setting both 'enable_tf' and 'enable_tf_dynamic' to true.
https://github.com/intel-ros/realsense/releases/tag/1.7.0

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

6 participants