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

How to send a vector with Service Client Communication?

asked 2018-06-05 03:48:28 -0500

Developer gravatar image


How can I send a hole vector in once(not one by one of each entries) from client to the service ? is it possible?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-06-05 06:03:59 -0500

Yes this is possible.

You can define a variable in a service or message definition as a vector by adding empty square brackets after the type, eg:

int32[] myVectorOfInts

So in your case to send a vector of values to a service provider from the client your service definition could look something like this:

string singleVariable
int32[] vectorOfIntegers
std_msgs/ColorRGBA[] vectorOfAnotherMessage
int32 variableReturnedToClient

Hope this helps.

edit flag offensive delete link more


Thanks! it helped

Developer gravatar image Developer  ( 2018-06-05 06:39:26 -0500 )edit

Question Tools



Asked: 2018-06-05 03:48:28 -0500

Seen: 284 times

Last updated: Jun 05 '18