subscriber.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 __author__ = 'flier'
00003 
00004 import rospy
00005 from leap_motion.msg import leap
00006 from leap_motion.msg import leapros
00007 
00008 # Native datatypes, I've heard this is bad practice, use the geometry messages instead.
00009 # def callback(data):
00010 #    rospy.loginfo(rospy.get_name() + ": Leap Raw Data %s" % data)
00011 
00012 
00013 # Callback of the ROS subscriber, just print the received data.
00014 def callback_ros(data):
00015     rospy.loginfo(rospy.get_name() + ": Leap ROS Data %s" % data)
00016 
00017 
00018 # Yes, a listener aka subscriber ;) obviously. Listens to: leapmotion/data
00019 def listener():
00020     rospy.init_node('leap_sub', anonymous=True)
00021     # rospy.Subscriber("leapmotion/raw", leap, callback)
00022     rospy.Subscriber("leapmotion/data", leapros, callback_ros)
00023     rospy.spin()
00024 
00025 
00026 if __name__ == '__main__':
00027     listener()


leap_motion
Author(s): Florian Lier
autogenerated on Thu Aug 27 2015 13:50:42