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

Revision history [back]

There is no predefined message to do this easily. You can do what @praskot suggested, or go one of many other ways. (Note, you can always check the other common_msgs if you want to use one of the generic types ones)

In general, it is, however, advised to add semantic meaning to messages and thus stay away from the std_msgs package as much as possible. See also #q255674.

All in all, you have to create your own message type. The following are just some ways to do that, in addition to what @praskot suggested:

KeyValueLists.msg

std_msgs/String[] keys
std_msgs/String[] values

Dictionary.msg (using a message from the diagnostic_msgs package

diagnostic_msgs/KeyValue[] items

of course, you could that create yourself too, if you don't want to depend on the diagnostic_msgs package

KeyValueString.msg

std_msgs/String key
std_msgs/String value

and thus:

StringDictionary.msg

KeyValueString[] items

(obviously, the names are free to choose...)

There is no predefined message to do this easily. You can do what @praskot suggested, or go one of many other ways. (Note, you can always check the other common_msgs if you want to use one of the generic types ones)

In general, it is, however, advised to add semantic meaning to messages and thus stay away from the std_msgs package as much as possible. See also #q255674.

All in all, you have to create your own message type. The following are just some ways to do that, in addition to what @praskot suggested:

KeyValueLists.msg

std_msgs/String[] keys
std_msgs/String[] values

Dictionary.msg (using a message from the diagnostic_msgs packagepackage)

diagnostic_msgs/KeyValue[] items

of course, you could that create yourself too, if you don't want to depend on the diagnostic_msgs package

KeyValueString.msg

std_msgs/String key
std_msgs/String value

and thus:

StringDictionary.msg

KeyValueString[] items

(obviously, the names are free to choose...)