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

Revision history [back]

This is similar to a previous question. There is a good answer there that has some example code and points to this tutorial. The tutorial has example code for publishers and subscribers. Hope that helps.

click to hide/show revision 2
Little bit about C++ vectors, correct me if I'm wrong.

This is similar to a previous question. There is a good answer there that has some example code and points to this tutorial. The tutorial has example code for publishers and subscribers. Hope that helps.subscribers.

For C++ vectors you can do something like the following (someone correct my C++ if I'm wrong please):

std::vector<double>::iterator my_iterator;
int i = 0;
for (my_iterator = msg.vector_field.begin(); msg.vector_field.end(); my_iterator++)
{
    my_local_battery_value[i] = msg.vector_field[my_iterator];
    i++;
}

or follow this page.