ROS Q&A | Publish and subscribe array of vector as message

Written by Marco Arruda

23/10/2017


Q: Hi all, I am trying to send an array of vector points from one node to another node as a message. The message contains this array and other message fields as well.

My cpp file has the following array vector:

Vector Point distancePoints[11];
The above array of vector is the one I need to publish and subscribe.

For example, distancePoints[0] contains vector Point from distance 1m and so on. Point contains x and y coordinates. Point is an opencv 2D point class.

Is it possible to publish and receive such array of vector using ROS messages? Does anyone have an idea about how it can be done? What will be the structure of message header?

A: Hello,

I’ve created a new message to do that, including an array and another field, just to show how you can do that.

Topics:
Masterclass 2023 batch2 blog banner

Check Out These Related Posts

0 Comments

Submit a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It on Pinterest

Share This