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

Combine image and pose in custom msg

asked 2012-04-17 03:01:13 -0500

moritz89 gravatar image

Hi,

Our project combines two publications Pose and an Image stream into messages which contain robotID, image, and pose. These are published at a dynamic rate (ex. after every 5 cm). This is why we would like to repackage them into a new msg (ImageWithPose).

The question is, should we still use image_transport for publishing the new ImageWithPose msgs or is it a good idea to use the standard publishing method?

Thanks, Mobots - Moritz

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
4

answered 2012-04-17 07:15:32 -0500

TomTUM gravatar image

updated 2012-04-17 07:50:54 -0500

There are some downsides to creating your own derived message type, mostly regarding the usage of tools such as rviz or image_view for showing the image will not work on these. One possibility is to maybe abuse the seq field in the image header for user data such as the robot id. Also the frame id may contain the name of the robot such as /robot1/kinect_optical_frame or such.

Whether you would send the Pose on another topic or via tf, you can always make sure you publish it at the exact same time as the image message has in its stamp and then synchronization should not be hard later.

If you don't care about viewing the images on the fly, from bagfiles or such, I would probably go with a new derived message type as proposed in Bence's answer.

It's actually a pity that composed messages seem not to be transparent when subscribing in ROS. It would be great if you could have a topic "/detections" publishing re_kinect_object_detector/DetectionResult and then a subscriber on "/detections/Image" that would then look for an sensor_msgs/Image. Like this, an image topic in rviz could still view the nested image. rostopic echo does a bit of this magic, like you could say rostopic echo /a_topic_publishing_posestampeds/pose/position/x and get the x-es of all messages displayed.

edit flag offensive delete link more
1

answered 2012-04-17 13:05:03 -0500

joq gravatar image

I don't think image_transport will work with your combined message. And don't forget to publish CameraInfo, too.

Those might be good reasons to consider other alternatives.

The simplest is republishing all those messages on a group of topics at the same time and with the same timestamp. Then, you can use message filters to handle them all in a single subscriber callback.

edit flag offensive delete link more

Comments

I was about to suggest the same thing, but realized that there doesn't seem to be a way to use image_transport with a time synchronizer. Am I missing something?

Dan Lazewatsky gravatar image Dan Lazewatsky  ( 2012-04-17 13:28:26 -0500 )edit

Maybe not. I've never tried it.

joq gravatar image joq  ( 2012-04-17 14:27:15 -0500 )edit
1

answered 2012-04-17 06:00:01 -0500

Bence Magyar gravatar image

updated 2017-09-29 10:40:58 -0500

130s gravatar image

You might be interested in this message type: re_kinect_object_detector/DetectionResult

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-04-17 03:01:13 -0500

Seen: 2,194 times

Last updated: Sep 29 '17