修改钢针到达抓料点位后再收缩和在震动点不走的问题
This commit is contained in:
40
CU/EMV.py
40
CU/EMV.py
@ -9,7 +9,7 @@ PORT = 50000
|
||||
# 电磁阀控制报文
|
||||
valve_commands = {
|
||||
1: {
|
||||
'open': '00000000000601050000FF00',
|
||||
'open': '00000000000601050000FF00',#钢针
|
||||
'close': '000000000006010500000000',
|
||||
},
|
||||
2: {
|
||||
@ -46,34 +46,38 @@ def send_command(command):
|
||||
return False
|
||||
|
||||
# 控制电磁阀打开
|
||||
def open(grasp, throw, shake):
|
||||
def open(grasp, shake, throw):
|
||||
if grasp:
|
||||
print("打开电磁阀 1") # 抓取
|
||||
print("打开电磁阀 1") # 钢针关闭
|
||||
if send_command(valve_commands[1]['open']):
|
||||
time.sleep(1) # 等待 1 秒
|
||||
if throw:
|
||||
print("打开电磁阀 2") # 扔袋
|
||||
if send_command(valve_commands[2]['open']):
|
||||
time.sleep(1) # 等待 1 秒
|
||||
time.sleep(1)
|
||||
if shake:
|
||||
print("打开电磁阀 3") # 震动
|
||||
print("打开电磁阀 2") # 震动
|
||||
if send_command(valve_commands[2]['open']):
|
||||
time.sleep(0.05)
|
||||
if throw:
|
||||
print("打开电磁阀 3") # 扔袋
|
||||
if send_command(valve_commands[3]['open']):
|
||||
time.sleep(1) # 等待 1 秒
|
||||
time.sleep(0.5)
|
||||
|
||||
# 控制电磁阀关闭
|
||||
def close(grasp, throw, shake):
|
||||
def close(grasp, shake, throw):
|
||||
if grasp:
|
||||
print("关闭电磁阀 1")
|
||||
print("关闭电磁阀 1")#钢针打开
|
||||
if send_command(valve_commands[1]['close']):
|
||||
time.sleep(1) # 等待 1 秒
|
||||
if throw:
|
||||
time.sleep(1)
|
||||
if shake:
|
||||
print("关闭电磁阀 2")
|
||||
if send_command(valve_commands[2]['close']):
|
||||
time.sleep(1) # 等待 1 秒
|
||||
if shake:
|
||||
time.sleep(0.05)
|
||||
if throw:
|
||||
print("关闭电磁阀 3")
|
||||
if send_command(valve_commands[3]['close']):
|
||||
time.sleep(1) # 等待 1 秒
|
||||
time.sleep(0.5)
|
||||
|
||||
# 关闭电磁阀
|
||||
close(True, True, True) # 参数传True和False
|
||||
# open(True, False, False) # 参数传True和False
|
||||
# close(False,False,True)
|
||||
# for i in range(10):
|
||||
# open(False,True,True)
|
||||
# close(True,True,True)
|
||||
|
||||
Reference in New Issue
Block a user