Exemplo n.º 1
0
    def callback_service_on_request(self, req):
        rospy.loginfo('\033[94m' + " >>> Gripper Activate: {}".format(req.activate_gripper) + '\033[0m')
        rospy.loginfo('\033[94m' + " >>> Gripper Flag Pickable: {}".format(self.pickable_flag) + '\033[0m')

        if((req.activate_gripper == True) and (self.pickable_flag == 'True') ):
            self.activate_gripper()
            return GripperResponse(True)
        else:
            self.deactivate_gripper()
            return GripperResponse(False)
Exemplo n.º 2
0
 def callback_service_on_request(self, req):
     pickable, box_name = self.check()
     rospy.loginfo('\033[94m' + " >>> Gripper Activate: {}".format(req.activate_gripper) + '\033[0m')
     rospy.loginfo('\033[94m' + " >>> Gripper Flag Pickable: {}".format(str(pickable)) + '\033[0m')
     if pickable:
         if(req.activate_gripper is True):
             self.activate_gripper(box_name)
             return GripperResponse(True)
         else:
             self.deactivate_gripper(box_name)
             return GripperResponse(False)
     else:
         return GripperResponse(False)
Exemplo n.º 3
0
def attach():
	'''
	Purpose:
	---
	This function is used to activate gripper and if the box gets attached with drone it checks value of result and change the global variable grip_res=1

	Input Arguments:
	---
	None

	Returns:
	---
	None
	'''

	req = 0
	resp = 0
	activate = 0
	rospy.wait_for_service('/edrone/activate_gripper')
	activate = rospy.ServiceProxy('/edrone/activate_gripper', Gripper)
	req = GripperRequest(True)
	resp = activate(req)
	GripperResponse(resp)
	global grip_res
	if(req.activate_gripper == True and resp.result == True):
	   	grip_res = 1
Exemplo n.º 4
0
    def check_pick_gripper(self):
        '''
        Purpose:
        ---
        Function to check if gripper status is true or not and requests for gripping when available.

        Input Arguments:
        ---
        None

        Returns:
        ---
        None

        Example call:
        ---
        self.check_pick_gripper()
        '''

        # print(self.gripper)
        while self.gripper == False:
            rospy.logwarn("gripping unavailable")
            continue

        # Fetching Gripper Response
        res = GripperResponse()

        # if grip is successsful
        while not res.result:
            res = self.gripper_srv(True)
            rospy.loginfo("Pick up successful")
        self.isLoaded = True
Exemplo n.º 5
0
    def check_pick_gripper(self):
        print(self.gripper)
        while self.gripper == False:
            rospy.logwarn("gripping unavailable")
            continue
        res = GripperResponse()

        while not res.result:
            res = self.gripper_srv(True)
            rospy.loginfo("Pick up successful")
        self.isLoaded = True
Exemplo n.º 6
0
def dettach():
	'''
	Purpose:
	---
	This function is used to deactivate gripper and dettached box with drone

	Input Arguments:
	---
	None

	Returns:
	---
	None
	'''

	req = 0
	resp = 0
	activate = 0
	rospy.wait_for_service('/edrone/activate_gripper')
	activate = rospy.ServiceProxy('/edrone/activate_gripper', Gripper)
	req = GripperRequest(False)
	resp = activate(req)
	GripperResponse(resp)