ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I'm trying to publish in a topic a dictionary with other dictionary inside
As there are no direct dictionaries available in the message format, you have these options:
string
variable (or uint8[]
if it's a binary blob).d["key1"]["key2"]["key3"]
turns to "key1.key2.key3"
). Then you can use something like diagnostic_msgs/KeyValue[]
to hold your data.KeyDictValue
message, in which you store the KeyValue[]
"dictionaries" for each "top level" key.2 | No.2 Revision |
I'm trying to publish in a topic a dictionary with other dictionary inside
As there are no direct dictionaries available in the message format, you have these options:
string
variable (or uint8[]
if it's a binary blob).d["key1"]["key2"]["key3"]{"key1": {"key2": {"key3": "value"}}}
turns to "key1.key2.key3"[("key1.key2.key3": "value")]
). Then you can use something like diagnostic_msgs/KeyValue[]
to hold your data.KeyDictValue
message, in which you store the KeyValue[]
"dictionaries" for each "top level" key.