예제 #1
0
	def __init__(self,arduino_comm_num=0,gripper1_comm_num=3,gripper2_comm_num=1):
		self.time_gap_valve_and_gripper = 0.1
		# arduino object
		self.objarduino=arduino_comm.CommModule(arduino_comm_num)
		self.objarduino.arduinocomm()
		# gripper 1 object
		print("gripper1_comm_num :" + str(gripper1_comm_num))
		self.objgripper1=gripper_comm.GripperIO(gripper1_comm_num)
		self.objgripper1.set_speed(255)
		self.objgripper1.set_force(0)
		# gripper 2 object
		print("gripper2_comm_num :"+str(gripper2_comm_num))
		self.objgripper2=gripper_comm.GripperIO(gripper2_comm_num)
		self.objgripper2.set_speed(255)
		self.objgripper2.set_force(0)
		self.open_pos_g1 = 170
		self.open_pos_g2 = 170
		self.close_pos_g1 = 255
		self.close_pos_g2 = 255
예제 #2
0

def gripper_motion(req):
    global objgripper_GREEN
    rospy.loginfo(rospy.get_caller_id() + "I received %s", req.action)
    rospy.loginfo("green has received this")
    if req.action == "open":
        objgripper_GREEN.go_to(50)
        rospy.loginfo("Opened green")
    elif req.action == "close":
        objgripper_GREEN.go_to(250)
        rospy.loginfo("Closed green")
    elif req.action == "troubleshoot":
        objgripper_GREEN.activate()
    rospy.loginfo("None of the actions are performed")
    return GripperMotionResponse("Done!")


def initialize_grippers():
    rospy.init_node('gripper_green_motion')
    s = rospy.Service('gripper_green_service', GripperMotion, gripper_motion)
    rospy.spin()


if __name__ == "__main__":
    objgripper_GREEN = gripper_comm.GripperIO(3)
    objgripper_GREEN.set_speed(150)
    objgripper_GREEN.set_force(245)
    objgripper_GREEN.activate()
    initialize_grippers()
예제 #3
0
#
#****************************************************************************************

import gripper_comm
import arduino_comm
import time
import sys

time_gap_valve_and_gripper = 0.1

# arduino object
objarduino = arduino_comm.CommModule(0)
objarduino.arduinocomm()

# gripper object
objgripper = gripper_comm.GripperIO(3)
objgripper.set_speed(255)
objgripper.set_force(0)
objgripper.activate()


def gripper_1_open_with_valves():
    objarduino.valve_open(1)
    time.sleep(2 * time_gap_valve_and_gripper)
    objarduino.valve_open(2)
    time.sleep(time_gap_valve_and_gripper)
    objgripper.go_to(170)


def gripper_1_valves_close():
    objarduino.valve_close(1)
예제 #4
0

def gripper_motion(req):
    global objgripper_BLUE
    rospy.loginfo(rospy.get_caller_id() + "I received %s", req.action)
    rospy.loginfo("blue has received this")
    if req.action == "open":
        objgripper_BLUE.go_to(50)
        rospy.loginfo("Opened blue")
    elif req.action == "close":
        objgripper_BLUE.go_to(250)
        rospy.loginfo("Closed blue")
    elif req.action == "troubleshoot":
        objgripper_BLUE.activate()
    rospy.loginfo("None of the actions are performed")
    return GripperMotionResponse("Done!")


def initialize_grippers():
    rospy.init_node('gripper_blue_motion')
    s = rospy.Service('gripper_blue_service', GripperMotion, gripper_motion)
    rospy.spin()


if __name__ == "__main__":
    objgripper_BLUE = gripper_comm.GripperIO(1)
    objgripper_BLUE.set_speed(150)
    objgripper_BLUE.set_force(245)
    objgripper_BLUE.activate()
    initialize_grippers()