Float64MultiArray message type does not show up in published topic
I am trying to do a test where I publish an array to a topic
/chatter2s
. Here is my publisher below:
#!/usr/bin/python3
import rospy
from std_msgs.msg import Float64MultiArray
#Float64MultiArray
def do_it():
data_to_send = Float64MultiArray()
rospy.init_node("array_publisher")
pub=rospy.Publisher("chatters2", Float64MultiArray, queue_size=10)
data_to_send.data = [1.2354567, 99.7890]
#ata_to_send.data_offset = 0
pub.publish(data_to_send)
rospy.spin()
do_it()
Here is my listener:
#!/usr/bin/python3
import rospy
from std_msgs.msg import Float64MultiArray
def callback(msg):
rospy.loginfo(msg)
rospy.init_node("array_listener")
rospy.Subscriber("chatters2",Float64MultiArray, callback)
#rospy.sleep(3.0)
rospy.spin()
The problem is, when I run these two codes in their respective terminals, they seem to run but then nothing shows up for the listener, I do a rostopic echo /chatters2
and dont see anything coming out for that either.
I check the rqt_graph
and I see both nodes as well as the chatter topic, so these nodes seem to be active. whats going on?