ROS2, TypeError when publishing custom message to Topic
Hi everyone,
I have defined a custom message:
uint8[] data
The custom message is imported in my Node class with no problems:
from my_shared.msg import MyMessage
In the same Node, I create the publisher with:
self.my_publisher = self.create_publisher(MyMessage, 'topic_in', 200)
and I publish the message with:
self.my_publisher.publish(my_msg)
my_msg is built in the following way:
payload_bitstream = np.fromstring(my_data, np.uint8)
my_msg = payload_bitstream.tolist()
Sadly, I get a TypeError:
File "/opt/ros/eloquent/lib/python3.6/site-packages/rclpy/publisher.py", line 68, in publish
raise TypeError()
TypeError
Could you help out with this if you know what I am doing wrong pls?
Thanks in advance, G.