在实际的开发中,想把不同的消息发布到一个模块中,就考虑把不同类型的消息发布到一个话题上,这样似乎可以省事甚多
然后通过命令测试了一下:
rostopic pub /helloworld std_msgs/String “this is a test string” -r 1
rostopic pub /helloworld std_msgs/Bool 1 -r 1
rostopic echo “/helloworld”
测试现象
订阅者只能收到后发布的数据,先发布者报警告如下:
[WARN] [1581548856.701520]: Could not process inbound connection: topic types do not match: [std_msgs/Bool] vs. [std_msgs/String]{‘message_definition’: ‘bool data’, ‘callerid’: ‘/rostopic_16202_1581548852459’, ‘tcp_nodelay’: ‘0’, ‘md5sum’: ‘8b94c1b53db61fb6aed406028ad6332a’, ‘topic’: ‘/helloworld’, ‘type’: ‘std_msgs/Bool’}[WARN] [1581548856.701520]: Could not process inbound connection: topic types do not match: [st