Ask Your Question
0

How to change subscribed topics of depth_image_proc/point_cloud_xyz node??

asked 2019-03-23 14:54:49 -0500

ZeroSan gravatar image

updated 2019-03-26 12:13:13 -0500

Hi, how do I change the topic subscriptions of depth_image_proc's depth_image_proc/point_cloud_xyz node?

I have made a node which publishes a sensor_msgs/Image topics which is:

/face_detector/depth_image_roi

Through openni_launch, I also have topic camera/depth/camera_info published.

If I understand correctly, the depth_image_proc/point_cloud_xyz node subscribes to the following topics:

depth/camera_info (sensor_msgs/CameraInfo)
depth_registered/image_rect (sensor_msgs/Image)

As such, I think I have the required topics published.

I found this. However, I don't know how to change the topic subscriptions to suit my needs.

Any help would be appreciated!

edit 1:

rosnode info /standalone_nodelet:

    Node [/standalone_nodelet]
    Publications: 
     * /point_cloud/points [sensor_msgs/PointCloud2]
     * /rosout [rosgraph_msgs/Log]
     * /standalone_nodelet/bond [bond/Status]

    Subscriptions: 
     * /camera/rgb/camera_info [sensor_msgs/CameraInfo]
     * /face_detector/depth_image_roi [sensor_msgs/Image]
     * /face_detector/rgb_image_roi [sensor_msgs/Image]
     * /standalone_nodelet/bond [bond/Status]

    Services: 
     * /standalone_nodelet/get_loggers
     * /standalone_nodelet/list
     * /standalone_nodelet/load_nodelet
     * /standalone_nodelet/set_logger_level
     * /standalone_nodelet/unload_nodelet

[....]

depth_image_proc/point_cloud_xyz launch file:

<!-- Convert the depth image and the rgb image into a xyzrgb Point Cloud -->
<launch>
    <!-- Nodelet manager for this pipeline -->
    <node pkg="nodelet" type="nodelet" args="manager" name="standalone_nodelet" output="screen"/>

    <!-- Convert to point cloud -->
    <node pkg="nodelet" type="nodelet" name="depth_image_proc" args="load depth_image_proc/point_cloud_xyzrgb standalone_nodelet" output="screen">

        <!-- Input: Camera calibration and metadata.  (sensor_msgs/CameraInfo) -->
        <remap from="rgb/camera_info" to="/camera/rgb/camera_info"/>

        <!-- Input: Rectified color image. (sensor_msgs/Image) -->
        <remap from="rgb/image_rect_color" to="/face_detector/rgb_image_roi"/>

        <!-- Input: Rectified depth image, registered to the RGB camera. (sensor_msgs/Image) -->
        <remap from="depth_registered/image_rect" to="/face_detector/depth_image_roi"/>

        <!-- Output: XYZ point cloud. If using PCL, subscribe as PointCloud<PointXYZ>.  (sensor_msgs/PointCloud2)  -->
        <remap from="depth_registered/points" to="/point_cloud/points"/>

    </node>
</launch>

Also based on depth_image_proc's lazy subscribing behavior, my face_detector node subscribes to output /point_cloud/points.

Without subscribing to the output, the depth_image_proc/point_cloud_xyz node will not subscribe to the required topics stated above.

edit retag flag offensive close merge delete

Comments

Do you mean that the depth_image_proc/point_cloud_xyzrgb node is subscribed to the topics mentioned above but receiving nothing?

Jasmin gravatar imageJasmin ( 2019-03-23 15:17:54 -0500 )edit

Sorry, I edited the question. I meant depth_image_proc/point_cloud_xyz node. By default, I think that node subscribes to default topic names of depth/camera_info and depth_registered/image_rect which is not publishing anything since those topic names does not exist. Is there any way to change those default subscribed topics to camera/depth/camera_info and /face_detectoe/depth_image_roi ?

ZeroSan gravatar imageZeroSan ( 2019-03-23 15:55:17 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-03-23 16:11:44 -0500

dljubic gravatar image

Hello ZeroSan,

your question is actually relating to a concept called remapping. What you want to do is to remap depth_image_proc/point_cloud_xyz topics to your topics.

You can do it in two ways... First, remap it directly by doing the following:

rosrun depth_image_proc point_cloud_xyz camera_info:=camera/depth/camera_info image_rect:=/face_detectoe/depth_image_roi

Second, you could write a launch file in which you can use remap tag.

<node pkg="depth_image_proc" type="point_cloud_xyz" name="point_cloud_xyz">
    <remap from="camera_info" to="camera/depth/camera_info"/>
    <remap from="image_rect" to="/face_detectoe/depth_image_roi"/>
</node>

You can read more about remapping here and here.

If you have any further questions, feel free to ask. :)

edit flag offensive delete link more

Comments

Hi dljubic. Thanks for the reply! I will look into this tomorrow when I get back to the lab.

ZeroSan gravatar imageZeroSan ( 2019-03-24 10:25:54 -0500 )edit

I managed to get the topic subscriptions correct. However, there was no pointcloud2 messages displayed after doing rostopic echo. Should I make a new question?

ZeroSan gravatar imageZeroSan ( 2019-03-26 09:33:09 -0500 )edit

Let's try a few more things before that... Could you provide the output of rosnode info for your point_cloud_xyz node?

dljubic gravatar imagedljubic ( 2019-03-26 10:52:55 -0500 )edit

Sure thing. I have edited the question and also included my launch file.

ZeroSan gravatar imageZeroSan ( 2019-03-26 12:11:28 -0500 )edit

I have copied your launch file, modified topic names to mine and everything worked well. How do you get your images? Do you play a .bag file or do you capture live images?

dljubic gravatar imagedljubic ( 2019-03-27 14:13:30 -0500 )edit

I'm using live images. I managed to convert depth image to pointcloud after digging around though. (Not using point_cloud_xyz node)

ZeroSan gravatar imageZeroSan ( 2019-03-27 14:41:52 -0500 )edit

I'm glad to hear that. :)

dljubic gravatar imagedljubic ( 2019-03-28 08:03:31 -0500 )edit

Dljubic - I am attempting something very similar to ZeroSan. I am doing some post-processing on the sensor_msgs/Image through a python node and would like to see the result of the point cloud using the depth_image_proc nodelet. I believe that the remapping is done correctly however I am getting an out-of-sync warning in the terminal and no output at the pointcloud_output topic.

Did you ever encounter this behaviour? If the nodelet cannot be used due to synchronisation issues I'd like to hear how ZeroSan generated the pointcloud from the depth image without using the nodelet.

Apologies if this comment is out of place (new to the forum).

sacco22 gravatar imagesacco22 ( 2019-09-16 02:55:03 -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: 2019-03-23 14:54:49 -0500

Seen: 190 times

Last updated: Mar 26