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

Publishing and Subscribing Vectors

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

hsoltani gravatar image

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


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 -0500

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

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 -0500 )edit

see my edited answer ;-)

cyborg-x1 gravatar image cyborg-x1  ( 2015-08-02 12:37:34 -0500 )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 -0500 )edit

Question Tools

1 follower


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

Seen: 1,539 times

Last updated: Aug 03 '15