ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Publishing and Subscribing Vectors

asked 2015-08-02 09:03:32 -0600

hsoltani gravatar image

updated 2015-08-03 06:45:24 -0600


How can I receive a vector (with unknown length and contains three floats) over Publisher and Subscriber in C++?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-08-02 09:15:24 -0600

updated 2015-08-02 12:37:15 -0600

Do you want a dynamic array of geometry_msgs/Vector3 by defining your own message type ?

Like this:


geometry_msgs/Vector3[] data

Question in Comment:

PubSub Tutorial:

To Create your own message, follow this:

edit flag offensive delete link more


That's right. I guess I should use std_msgs/Float32MultiArray type. Can you give some tips? How can I write publisher and subscriber or create my own message?

hsoltani gravatar image hsoltani  ( 2015-08-02 09:28:04 -0600 )edit

see my edited answer ;-)

cyborg-x1 gravatar image cyborg-x1  ( 2015-08-02 12:37:34 -0600 )edit

Is anything unclear yet? (Just ask because you edited your question with no change...)

cyborg-x1 gravatar image cyborg-x1  ( 2015-08-03 06:49:23 -0600 )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


Asked: 2015-08-02 09:03:32 -0600

Seen: 1,320 times

Last updated: Aug 03 '15