def test_example_requester_(self): """ Initialize ROCON scheduler node for example requester. """ self.number_of_requests = 3 # number of requests desired self.queued_request = None rospy.init_node("test_example_requester") self.sch = Scheduler(self.callback) rospy.spin() # spin in the main thread
def __init__(self): rospy.init_node("example_scheduler") # simplifying assumptions: all requests want a single robot, # and any of these will do: self.avail = deque([ # FIFO queue of available robots Resource(rapp='example_rapp', uri='rocon:/turtlebot/roberto'), Resource(rapp='example_rapp', uri='rocon:/turtlebot/marvin') ]) self.ready_queue = deque() # FIFO queue of waiting requests self.sch = Scheduler(self.callback) rospy.spin()
def test_timeout_scheduler(self): """ Initialize ROCON scheduler node for timeout test. """ rospy.init_node("timeout_scheduler") # simplifying assumptions: all requests want a single robot, # and any of these will do: self.avail = deque( # FIFO queue of available robots [ Resource(rapp='example_rapp', uri='rocon:/turtlebot/roberto'), Resource(rapp='example_rapp', uri='rocon:/turtlebot/marvin') ]) self.ready_queue = deque() # FIFO queue of waiting requests self.seen_requester = False self.timer = rospy.Timer(rospy.Duration(2.0), self.check_finished) self.sch = Scheduler(self.callback, frequency=1.0) rospy.spin()