subscriber.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 """ For backwards compatibility with the old driver files
4  Will be DELETED in the future """
5 
6 __author__ = 'flier'
7 
8 import rospy
9 from leap_motion.msg import leap
10 from leap_motion.msg import leapros
11 
12 # Native datatypes, I've heard this is bad practice, use the geometry messages instead.
13 # def callback(data):
14 # rospy.loginfo(rospy.get_name() + ": Leap Raw Data %s" % data)
15 
16 
17 # Callback of the ROS subscriber, just print the received data.
18 def callback_ros(data):
19  rospy.loginfo(rospy.get_name() + ": Leap ROS Data %s" % data)
20 
21 
22 # Yes, a listener aka subscriber ;) obviously. Listens to: leapmotion/data
23 def listener():
24  rospy.init_node('leap_sub', anonymous=True)
25  # rospy.Subscriber("leapmotion/raw", leap, callback)
26  rospy.Subscriber("leapmotion/data", leapros, callback_ros)
27  rospy.spin()
28 
29 
30 if __name__ == '__main__':
31  listener()
def listener()
Definition: subscriber.py:23
def callback_ros(data)
Definition: subscriber.py:18


leap_motion
Author(s): Florian Lier , Mirza Shah , Isaac IY Saito
autogenerated on Tue Jun 2 2020 03:58:01