Ask Your Question

Publishing arrays with rqt_publisher in ROS2

asked 2021-01-26 19:11:18 -0500

ryan.delgizzi gravatar image

updated 2021-01-26 19:11:38 -0500

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] [get_message_class]: Malformed message_type: sequence<double> Python eval failed for expression "array('d',[1])" with an exception "name 'array' is not defined" Publisher._evaluate_expression(): 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/rqt_publisher/", line 157, in change_publisher new_text = handler(self._publishers[publisher_id], topic_name, new_value) File "/opt/ros/foxy/lib/python3.8/site-packages/rqt_publisher/", line 258, in _change_publisher_expression expression, error_prefix, slot_type.__name__) AttributeError: 'NoneType' object has no attribute '__name__'

Can someone provide an example of proper usage for the expression field?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-02-09 07:58:36 -0500

GeorgeG gravatar image

Did anyone find a way for this?

edit flag offensive delete link more


Basically it similar to this post and answer. You have to populate data field of the message (of the correct type).

ljaniec gravatar image ljaniec  ( 2021-12-02 18:23:47 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2021-01-26 19:11:18 -0500

Seen: 300 times

Last updated: Feb 09 '21