I came across this function get_topic_names_and_types
in rclcpp
recently and I have a basic question about it.
Output type is std::map<std::string, std::vector<std::string>>
. In simple term, it is as following
{
"topic_1": ["topic_type"],
"topic_2": ["topic_type"],
}
Here is one of the answers I found that explains the structure of the output by printing it for c++.
My question is, for the topic type, why we need vector of string instead of simple string?
I tried to create topic with the same name but different types. But it has thrown the exception what(): could not create publisher: create_publisher() called for existing topic name
.
So I don't understand why vector of strings as topic types?