def execute_bounding_box(self, goal): self.bb_active = True mybb = BoundingBox(self.bb_done_callback, self.im_server, goal.image) rr = rospy.Rate(self.loop_rate) while (self.bb_active and (not self.bb_server.is_preempt_requested()) and (not rospy.is_shutdown())): rr.sleep() if self.bb_server.is_preempt_requested(): mybb.cancel() self.bb_server.set_preempted() else: result = mybb.get_result() if result is None: self.bb_server.set_aborted() else: (row1, row2, col1, col2) = result resp = BoundingBoxResult() resp.min_row.data = row1 resp.max_row.data = row2 resp.min_col.data = col1 resp.max_col.data = col2 self.bb_server.set_succeeded(resp)