Publishing array data with rqt
I'm trying to use the rqt message publisher to publish a message of type std_msgs/msg/Float64MultiArray
.
I can't figure out how I'm supposed to give the data
field of type sequence<double>
. The default value in the expression field suggests that one should simply specify the array initializer in the array('d')
constructor. I tried this to no avail with: array('d', [0.1, 0.1])
>>> [ERROR] [1644749632.166618229] [get_message_class]: Malformed message_type: sequence<double>
Python eval failed for expression "array('d', [0.1, 0.1])" with an exception "name 'array' is not defined"
Publisher._evaluate_expression(): failed to evaluate expression: "array('d', [0.1, 0.1])" as Python type "None"
Traceback (most recent call last):
File "/opt/ros/rolling/lib/python3.8/site-packages/rqt_publisher/publisher.py", line 161, in change_publisher
new_text = handler(self._publishers[publisher_id], topic_name, new_value)
File "/opt/ros/rolling/lib/python3.8/site-packages/rqt_publisher/publisher.py", line 262, in _change_publisher_expression
expression, error_prefix, slot_type.__name__)
AttributeError: 'NoneType' object has no attribute '__name__'
The interesting bit here is what seems to be the root cause of the problem:
Python eval failed for expression "array('d', [0.1, 0.1])" with an exception "name 'array' is not defined"
If this isn't the correct way to do it, what am I supposed to do? I also tried, all in vain, these options:
[0.1, 0.1]
array.array('d', [0.1, 0.1])
import array; array.array('d', [0.1, 0.1])
I'm using ROS2 Rolling at the moment, although I've had the same issue with Foxy and Galactic before.