Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The std_msgs/Float64MultiArray message should do what you want:

http://docs.ros.org/api/std_msgs/html/msg/Float64MultiArray.html

The message structure has a single field called data which can be treated as a std::vector<double> type in your C++ node. If you know it will be a fixed array of 9 values, just allocate 9 elements in the vector after declaring the message variable:

std_msgs::Float64MultiArray array_msg;
array_msg.data.resize(9);

You can then publish and subscribe to a topic to transmit array messages between your nodes.

I hope this helps!