kinect_poller.py
Go to the documentation of this file.
00001 #! /usr/bin/python
00002 import roslib
00003 roslib.load_manifest("rospy")
00004 roslib.load_manifest("sensor_msgs")
00005 import rospy
00006 
00007 from sensor_msgs.msg import PointCloud2
00008 
00009 class Poller:
00010     def __init__(self):
00011         self.ind = 0
00012     def callback(self,msg):
00013         self.ind += 1
00014 
00015 node_name = 'kinect_poller'
00016 rospy.init_node(node_name)
00017 pc_topic = rospy.get_param(node_name+'/topic_name')
00018 poller = Poller()
00019 rospy.sleep(1.0)
00020 sub = rospy.Subscriber(pc_topic, PointCloud2, poller.callback)
00021 r = rospy.Rate(100)
00022 while not rospy.is_shutdown():
00023     if poller.ind != 0:
00024         break
00025     r.sleep()
00026 print "Polling %s" % pc_topic
00027 rospy.spin()


hrl_pr2_lib
Author(s): haidai
autogenerated on Wed Nov 27 2013 11:40:34