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


leap_motion
Author(s): Florian Lier , Mirza Shah , Isaac IY Saito
autogenerated on Sat Jun 8 2019 18:47:25