ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

depth_image_proc subscriber

asked 2018-05-17 13:46:39 -0600

updated 2018-05-21 09:33:30 -0600

I am trying to use the depth_image_proc node and am unsure how to connect it to my network. I have no experience with a nodelet and cannot seem to remap the topics correctly. Below is my output rqt_graph. image description

I wish to connect to topics published from the matlab global node and cannot subscribe correctly.

Here is my launch file:

    <group ns="cloud_gen">
<!-- This launch file uses the depth_image_proc node to transform a color image and a depth image
    into an xyzrgb point cloud for use with the Navigation Stack -->

<!-- This file is to be used with the Intel Realsense node rs_rgbd.launch and the MATLAB code titles
     realsense_lane_detect.m outputting the processed images-->

         <arg name="rgb_camera_info"     value="/camera/color/camera_info"/>
         <arg name="rgb_rimg_ect"        value="/processed_color"/>  <!--Rectified color image-->
         <arg name="depReg_imgrect"      value="/processed_depth"/>  <!--Rectified depth image-->
         <arg name="out_cloud"           value="/white_lines"/>

        <!-- Nodelet manager for this pipeline -->
        <node pkg="nodelet" type="nodelet" args="manager"
            name="standalone_nodelet" output="screen"/>

        <!-- Construct point cloud of the rgb and depth topics -->
        <node pkg="nodelet" type="nodelet" name="depth_image_proc"
            args="load depth_image_proc/point_cloud_xyzrgb standalone_nodelet" output="screen">
            <remap from="rgb/camera_info"               to="/camera/color/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)"/>

Any help is appreciated!

Edit 1: Below is the output of rosnode info on that MATLAB node.

rosnode info /matlab_global_node_59233 
    Node [/matlab_global_node_59233]
     * /processed_color [sensor_msgs/Image]
     * /processed_depth [sensor_msgs/Image]
     * /rosout [rosgraph_msgs/Log]

     * /camera/depth_registered/points [sensor_msgs/PointCloud2]

    Services: None

    contacting node http://whitelines:42372/ ...
    Pid: 21599
     * topic: /rosout
        * to: /rosout
        * direction: outbound
        * transport: TCPROS
     * topic: /camera/depth_registered/points
        * to: /camera/realsense2_camera_manager (http://whitelines:44751/)
        * direction: inbound
        * transport: TCPROS
edit retag flag offensive close merge delete


Hello cmfuhrman, could you please elaborate more what you are trying to do? Which node needs to be connected to which? Which node needs to be connected to MATLAB node? Is it realsense->depth_image_proc->matlab?

dljubic gravatar image dljubic  ( 2018-05-18 15:25:08 -0600 )edit

I am taking the point cloud from the RealSense node and processing in MATLAB. I want to send the processed depth image and the processed rgb image back to the depth_image_proc node. I would be going RealSense-->MATLAB-->depth_image_proc. I am unsure why I cannot get the topics properly remapped.

cmfuhrman gravatar image cmfuhrman  ( 2018-05-18 16:07:56 -0600 )edit

I wand the depth_image_proc to subsribe to the following: "/camera/color/camera_info" "/processed_color" "/processed_depth" through remapping.

cmfuhrman gravatar image cmfuhrman  ( 2018-05-18 16:09:53 -0600 )edit

Thanks for the explanation! I have actually tried running your launch script with some .bag files and it worked right away. My depth_image_proc node subscribes to all the topics from the .bag and produces pointcloud visible in rviz. Could you please provide rosnode info of your MATLAB node?

dljubic gravatar image dljubic  ( 2018-05-19 10:30:23 -0600 )edit

Sorry to take so long - did not have access to the camera. Please see edit 1.

cmfuhrman gravatar image cmfuhrman  ( 2018-05-21 09:33:55 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-05-23 08:36:26 -0600

This launch file is actually working correctly. I did not know that depth_image_proc would not subscribe to any topics until its output (/white_lines in this case) has been subscribed. This solves my problem!

edit flag offensive delete link more


Great that you figured out what was wrong! That behavior is usually called lazy subscribing i.e. it does not subscribe to the input topic unless there is at least one subscriber to the output topic.

dljubic gravatar image dljubic  ( 2018-05-23 14:37:06 -0600 )edit

Question Tools



Asked: 2018-05-17 13:46:39 -0600

Seen: 1,128 times

Last updated: May 23 '18