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

Publishing and Subscribing Vectors

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

hsoltani gravatar image

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

Hi,

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
3

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:

Vector3Array.msg:

geometry_msgs/Vector3[] data

Question in Comment:

PubSub Tutorial: http://wiki.ros.org/ROS/Tutorials/Wri...

To Create your own message, follow this:

http://wiki.ros.org/ROS/Tutorials/Def...

edit flag offensive delete link more

Comments

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

Question Tools

1 follower

Stats

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

Seen: 1,605 times

Last updated: Aug 03 '15