00001
00002
00003 import roslib; roslib.load_manifest('dummy_applications')
00004 import rospy
00005 import optparse
00006 import actionlib
00007 from application_msgs.msg import ApplicationAction
00008
00009 class Task():
00010 def __init__(self, ns):
00011 self.actionserver = actionlib.SimpleActionServer(ns, ApplicationAction, self.execute_cb)
00012 self.name = ns
00013
00014 def execute_cb(self, goal):
00015 while not rospy.is_shutdown():
00016 rospy.loginfo('Testing task %s is running'%self.name)
00017 rospy.sleep(1.0)
00018 self.actionserver.set_preempted()
00019
00020
00021 def main():
00022 rospy.init_node('task_task')
00023 parser = optparse.OptionParser()
00024 (options, args) = parser.parse_args()
00025 ns = args[0]
00026 task = Task(ns)
00027 rospy.spin()
00028
00029
00030 if __name__ == '__main__':
00031 main()