I am trying to publish a rospy.msg.AnyMsg by doing the following:
import rospy
.
.
.
publisher = rospy.Publisher('jason_topic',
rospy.msg.AnyMsg,
queue_size=10)
publisher.publish(ros_message)
I get the following stack trace:
Traceback (most recent call last):
File "subscriber_any.py", line 26, in <module>
publisher.publish(ros_message)
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 879, in publish
data = args_kwds_to_message(self.data_class, args, kwds)
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/msg.py", line 118, in args_kwds_to_message
if len(data_class._slot_types) == 0:
AttributeError: type object 'AnyMsg' has no attribute '_slot_types'
I did a print(dir(rospy.msg.AnyMsg()))
and verified that there was no attribute _slot_types. Is what I am trying to do possible and if so how?