130s

subscribeDelay_listener-abs_11Nov1

Nov 1st, 2011
197
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. class AbstractSensorAdaptor:
  3. NODENAME_SENSOR = 'turtle1'
  4. INTERVAL_PUBLISH_CONVSWARM = 0.2
  5. SUB_PUB_CROWDTOPIC_LOOPFREQUENCY = 100.0
  6.  
  7. def __init__(self):
  8. nodeName = "SensorAdaptor"
  9. rospy.init_node(nodeName, anonymous=True)
  10. return None
  11.  
  12. def callBack(self, swarm):
  13. print '' # Avoiding interpreter error
  14.  
  15. def listener(self):
  16. rospy.Subscriber(AbstractSensorAdaptor.TOPIC_SUBSC, Swm, self.callBack, None, 1000)
  17. rospy.spin()
  18.  
  19. def convertSensorData(self, crowd):
  20. return None
  21.  
  22. def publish(self, msg):
  23. pub = rospy.Publisher(AbstractSensorAdaptor.topicName_convertedMsg, ConvertedSwm)
  24.  
  25. while not rospy.is_shutdown():
  26. pub.publish(msg)
  27. rospy.sleep(self.INTERVAL_PUBLISH_CONVSWARM)
  28. return None
  29.  
  30. if __name__ == '__main__':
  31. a = AbstractSensorAdaptor()
RAW Paste Data