Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 214

Subscriber Node No Msg

$
0
0
I have used the sample code for Sub a topic in python but however I am trying to subscribe a topic which gives out a the coordinates, image and etc in single data stream from rtabmap/graph topic. However doing this is just doesn't print out any msg at all. Do i need to convert the data into str or something cause all i need is the raw data in text? #!/usr/bin/env python import rospy from std_msgs.msg import String def callback(data): rospy.loginfo(rospy.get_caller_id() + "I heard %s", data.data) def listener(): # In ROS, nodes are uniquely named. If two nodes with the same # node are launched, the previous one is kicked off. The # anonymous=True flag means that rospy will choose a unique # name for our 'listener' node so that multiple listeners can # run simultaneously. rospy.init_node('listener', anonymous=True) rospy.Subscriber("rtabmap/graph", String, callback) # spin() simply keeps python from exiting until this node is stopped rospy.spin() if __name__ == '__main__': listener()

Viewing all articles
Browse latest Browse all 214

Trending Articles