Ask Your Question
0

How to use depth_image_proc/point_cloud_xyzrgb nodelet with rosbag?

asked 2015-08-30 14:16:51 -0500

Megacephalo gravatar image

I'm sorry to post such a simple question but I found little references on the web. I have a couple of rosbags recorded with the following topics and I want to take rgb and depth topics to form point clouds in the data type of sensor_msgs/PointCloud2.

topics:       /camera/depth/camera_info   49 msgs    : sensor_msgs/CameraInfo        
              /camera/depth/image         49 msgs    : sensor_msgs/Image             
              /camera/depth/points        49 msgs    : sensor_msgs/PointCloud2       
              /camera/rgb/camera_info     49 msgs    : sensor_msgs/CameraInfo        
              /camera/rgb/image_color     49 msgs    : sensor_msgs/Image             
              /camera/rgb/points          49 msgs    : sensor_msgs/PointCloud2       
              /cortex_marker_array        49 msgs    : visualization_msgs/MarkerArray
              /imu                        49 msgs    : sensor_msgs/Imu               
              /tf                         49 msgs    : tf/tfMessage

And from the depth_image_proc ROS Wiki documentation provided here, I understood that I need to remap the corresponding topics so to get the point clouds. I followed the instruction of nodelet - ROS Wiki and example such as this one to write my launch file. However, once I played my rosbag and then launched my nodelet launch file, the rosbag play node and the point_xyzrgb won't accept any topics whatsoever. So, what is the proper way so to make topics recorded in a rosbag to play as PointCloud2? Thanks !

What I did was the following:

$ rosbag play my_rosbag.bag

and then launched my launch file which is as follows:

<launch>
  <arg name="rgb_camera_info" value="/camera/rgb/camera_info"/>
  <arg name="rgb_rimg_ect" value="/camera/rgb/image_color"/>  <!--Rectified color image-->
  <arg name="depReg_imgrect" value="/camera/depth/image"/>  <!--Rectified depth image-->
  <arg name="out_cloud" value="camera/depth_registered/points"/>

  <node pkg="nodelet" type="nodelet" name="standalone_nodelet" args="manager" output="screen"/>

  <!-- Construct point cloud of the rgb and depth topics -->
  <node pkg="nodelet" type="nodelet" name="points_xyzrgb" args="load depth_image_proc/point_cloud_xyzrgb standalone_nodelet --no-bond">
    <remap from="rgb/camera_info" to="$(arg rgb_camera_info)" />  
    <remap from="rgb/image_rect_color" to="$(arg rgb_rimg_ect)"/>  
    <remap from="depth_registered/image_rect" to="$(arg depReg_imgrect)"/>  
    <remap from="depth_registered/points" to="$(arg out_cloud)"/>
  </node>
</launch>
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2016-04-26 08:28:02 -0500

updated 2016-05-02 04:25:58 -0500

There's a good tutorial on that here: BagRecordingPlayback. It also works with openni2, not only openni. For openni2, this script + launch file does the trick:

record-rosbag.sh:

#!/bin/sh
rosbag record \
   /tf \
   /camera/rgb/image_raw \
   /camera/rgb/camera_info \
   /camera/depth_registered/image_raw \
   /camera/depth_registered/camera_info

depth+rgb_to_pointcloud.launch:

<launch>
  <param name="use_sim_time" value="true" />

  <include file="$(find openni2_launch)/launch/openni2.launch">
    <arg name="depth_registration" value="true" />
    <arg name="load_driver" value="false" />
    <arg name="publish_tf" value="false" />
  </include>
</launch>
edit flag offensive delete link more

Comments

Well answered, @Martin Günther ! But where to find multisensor_tracking_ros? I only found ethzasl_sensor_fusion when I tried to google it.

Megacephalo gravatar imageMegacephalo ( 2016-04-28 23:29:57 -0500 )edit

Sorry, that was a copy-paste error. You don't need the package multisensor_tracking_ros, I've removed that from my answer.

Martin Günther gravatar imageMartin Günther ( 2016-05-02 04:26:44 -0500 )edit

OK! Got it ! Thank you so much !

Megacephalo gravatar imageMegacephalo ( 2016-05-05 21:59:23 -0500 )edit
0

answered 2016-04-26 02:20:10 -0500

MAPLE gravatar image

I meet the same problem just like you.Have you solved it?

edit flag offensive delete link more

Comments

That's not an answer, please use the comment function instead.

Martin Günther gravatar imageMartin Günther ( 2016-04-26 02:30:06 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-08-30 14:16:51 -0500

Seen: 1,721 times

Last updated: May 02 '16