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

advertise() function parameter for vector type

asked 2016-02-23 09:07:17 -0500

Jägermeister gravatar image

I'd like to publish a vector (cpp) in my publisher, and I do not want to create my own message. Is there already a built-in type for it? What I mean is to replace "std_msgs::Float64" part below:

ros::Publisher pub = n.advertise<std_msgs::Float64>("/radar", 500);

I already checked the message types here and I couldn't see anything for vector. I already desperately tried std_msgs::vector<int> and it didn't work, gave parameter error, seems like it is not the way.

Any thoughts?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2016-02-23 09:59:18 -0500

dornhege gravatar image

If you don't want to do your own, Float64MultiArray is the equivalent. A vector is essentially a 1-dimensional array.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-02-23 09:07:17 -0500

Seen: 194 times

Last updated: Feb 23 '16