58 lines
1.4 KiB
Python
58 lines
1.4 KiB
Python
#!/usr/bin/python3
|
||
import time
|
||
from enum import Enum
|
||
|
||
# import Constant
|
||
# from COM.COM_Robot import RobotClient
|
||
# from Util.util_time import CClockPulse, CTon
|
||
from .EMV import *
|
||
|
||
|
||
class CatchStatus(Enum):
|
||
CNone = 0
|
||
CTake = 1 # 抓取
|
||
CRelease = 2 # 放开
|
||
CDrop = 3
|
||
CShake = 4
|
||
COk = 5
|
||
|
||
class CatchTool:
|
||
def __init__(self):
|
||
self.catch_status = CatchStatus.CNone
|
||
|
||
# =========================================
|
||
# 密胺餐盘
|
||
# 电磁阀1 需要在 吸盘吸的时候 关闭
|
||
# 电磁阀1 需要在 夹爪工作的时候打开
|
||
|
||
# 电磁阀2 开 -> 吸盘吸
|
||
# 电磁阀2 关 -> 吸盘放开
|
||
|
||
# 电磁阀3 开-> 打开夹爪
|
||
# 电磁阀3 关 -> 闭合夹爪
|
||
|
||
# =======================================
|
||
# 夹爪 抓取
|
||
def gripper_grasp(self):
|
||
close(0, 0, 1) # 电磁阀3关
|
||
open(1, 0, 0) # 电磁阀1开
|
||
time.sleep(1) # 间隔1秒
|
||
|
||
# 夹爪 放开
|
||
def gripper_release(self):
|
||
open(1, 0, 1) # 电磁阀1开,电磁阀3开
|
||
time.sleep(1) # 间隔1秒
|
||
|
||
# 吸盘 吸取
|
||
def suction_pick(self):
|
||
close(1, 0, 0) # 电磁阀1关
|
||
open(0, 1, 0) # 电磁阀2开
|
||
time.sleep(1) # 间隔1秒
|
||
|
||
# 吸盘 释放(松开)
|
||
def suction_release(self):
|
||
close(0, 1, 0) # 电磁阀2关
|
||
time.sleep(1) # 间隔1秒
|
||
|
||
# catch_tool = CatchTool()
|
||
# catch_tool.gripper_grasp() |