def get_segmentation(self, data): goal = SegmentGoal() goal.image = data.image goal.depth = data.depth # this callback will set the member variable mask self.segment_client.send_goal(goal, done_cb=self.segmentDoneCB, feedback_cb=self.segmentFeedbackCB) self.segment_client.wait_for_result() return self.mask
def get_segmentation(self, data): goal = SegmentGoal() goal.image = data.image goal.depth = data.depth rospy.loginfo("got segmentation server") # this callback will set the member variable mask self.mask = None self.segment_client.send_goal(goal, done_cb=self.segmentDoneCB) self.segment_client.wait_for_result() return self.mask
def get_segmentation(self, kinect_data): """ And this handles calling the segmentation actionlib """ print "waiting for segmentation server" self.segment_client.wait_for_server() print "... got segmentation server" goal = SegmentGoal() goal.image = kinect_data.image goal.depth = kinect_data.depth print "Attempting to get segmentation" self.segment_client.send_goal(goal) self.segment_client.wait_for_result() state = self.segment_client.get_state() result = self.segment_client.get_result() return (state, result)
def segment_client(input_image, input_depth): client = actionlib.SimpleActionClient('segment_service', SegmentAction) rospy.loginfo('constructed simple action client') # Waits until the action server has started up and started # listening for goals. client.wait_for_server() rospy.loginfo('got server!') # tests preemption by "cancel_all_goals" goal = SegmentGoal(image=input_image, depth=input_depth) client.send_goal(goal) rospy.loginfo('sent first goal') client.wait_for_result() rospy.loginfo('and, got result!') print client.get_state()