Publishing arrays with rqt_publisher in ROS2
I am having trouble publishing messages with sequences in them, such as example_interfaces/UInt8MultiArray. By default, the expression is populated with array('B')
. When I try to populate with data, such as array('B', [1])
I get errors in the terminal.
[ERROR] [1611709217.176271581] [getmessageclass]: Malformed messagetype: sequence
Python eval failed for expression "array('d',[1])" with an exception "name 'array' is not defined" Publisher. evaluateexpression(): failed to evaluate expression: "array('d',[1])" as Python type "None" Traceback (most recent call last): File "/opt/ros/foxy/lib/python3.8/site-packages/rqtpublisher/publisher.py", line 157, in changepublisher newtext = handler(self.publishers[publisherid], topicname, newvalue) File "/opt/ros/foxy/lib/python3.8/site-packages/rqtpublisher/publisher.py", line 258, in _changepublisherexpression expression, errorprefix, slottype.name) AttributeError: 'NoneType' object has no attribute 'name_'
Can someone provide an example of proper usage for the expression field?
Thanks!
Asked by ryan.delgizzi on 2021-01-26 20:11:18 UTC
Answers
Did anyone find a way for this?
Asked by GeorgeG on 2021-02-09 08:58:36 UTC
Comments
Basically it similar to this post and answer. You have to populate data
field of the message (of the correct type).
Asked by ljaniec on 2021-12-02 19:23:47 UTC
Comments