def close_gripper(self):
		goal = Pose()
		goal_final = baxterGoal(id=3, pose = goal)
		#self.left_client.send_goal(goal_final)
		#result = self.left_client.wait_for_result()
		status = self.left_client.send_goal_and_wait(goal_final)
		result = self.left_client.wait_for_result()
Exemple #2
0
    def __init__(self, arm):
        self.as_goal = {'left': baxterGoal(), 'right': baxterGoal()}
        self.as_feed = {'left': baxterFeedback(), 'right': baxterFeedback()}
        self.as_res = {'left': baxterResult(), 'right': baxterResult()}
        self.action_server_left = actionlib.SimpleActionServer(
            "baxter_action_server_left",
            baxterAction,
            self.execute_left,
            auto_start=False)
        self.action_server_right = actionlib.SimpleActionServer(
            "baxter_action_server_right",
            baxterAction,
            self.execute_right,
            auto_start=False)

        self.left_arm = Limb('left')
        self.right_arm = Limb('right')
        self.left_gripper = Gripper('left')
        self.right_gripper = Gripper('right')
        self.left_gripper.calibrate()

        self.arm = arm
	def go_to_position(self, task, destination, height, width, offset_x, offset_y, offset_z):
		goal = Pose()
		trans = self.transformations(destination)
		if task == 'pick':
			height = Utils().get_pick_height(height)
		else: 
			height = Utils().get_place_height(height)
		goal = self.position(goal, trans, height, width)
		#if destination==0 : offset_y-=0.18
		#if destination==2 : offset_y+=0.18
		#if destination==2 : offset_z+=0.005
		#if destination==0 : offset_y-=0.00
		#if destination==1 : offset_y+=0.18
		#if destination==2 : offset_y+=0.40
		#16.2.2017.
		if destination==0: offset_y-=0.2
		if destination==1: offset_y+=0
		if destination==2: offset_y+=0.2
		offset_z+=0.05
		offset_z-=0.02
		offset_y-=0.05
		if destination==0: offset_z-=0.005
		if destination==1: offset_z-=0.005		

		goal.position.x = goal.position.x + offset_x
		goal.position.y = goal.position.y + offset_y 
		goal.position.z = goal.position.z + offset_z
		goal_final = baxterGoal(id = 1, pose = goal)
		
		self.left_client.send_goal_and_wait(goal_final)
		result = self.left_client.get_result()
		#print result.status
		if result.status:
			#print 'succeeded'
			return 1 
		else:
			#print 'aborted'
			return 0
	def open_gripper(self):
		goal = Pose()
		goal_final = baxterGoal(id=2, pose = goal)
		self.left_client.send_goal(goal_final)
		self.left_client.wait_for_result()