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

creating a custom message type including an image

asked 2016-03-10 03:34:25 -0600

I'm trying to define and use a custom message type. This message will include a few primitive data types as well as a sensor_msgs/Image.msg type for transferring the image. I have not managed to work out how to define this last element yet.

Do I need to update the package dependencies somehow? What type name would I use for this.

I'm assuming this is even possible, if not would I need to make a copy of what's in the sensor_msgs/Image.msg instead.

Thanks

edit retag flag offensive close merge delete

Comments

2

Please add whatever you currently already have, how you configured your CMakeLists.txt and what errors you are getting. Composing custom messages out of others is a typical use case that should-just-work if you set things up correctly.

gvdhoorn gravatar image gvdhoorn  ( 2016-03-10 03:41:17 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
4

answered 2016-03-11 06:15:02 -0600

Thanks for the reply gvhoorn. I've managed to get to the bottom of this one now. I couldn't find any description of the syntax of the type name for messages from external packages. Through trial and error I worked out I needed to write this:

sensor_msgs/Image <variable name>

Now everything is working properly!

edit flag offensive delete link more

Comments

2

That is actually documented: from wiki/msg - Field Types:

When embedding other Message descriptions, the type name may be relative (e.g. Point32) if it is in the same package; otherwise it must be the full Message type (e.g. std_msgs/String).

gvdhoorn gravatar image gvdhoorn  ( 2016-03-11 06:24:04 -0600 )edit

You're right. Not sure how I missed that the first time around!

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2016-03-11 07:50:15 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-03-10 03:34:25 -0600

Seen: 2,243 times

Last updated: Mar 11 '16