修改钢针到达抓料点位后再收缩和在震动点不走的问题

This commit is contained in:
cdeyw
2025-02-20 17:48:54 +08:00
parent 1e73137f72
commit 0e69647b11
12 changed files with 3905 additions and 174 deletions

View File

@ -1,10 +1,11 @@
#!/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 *
from .EMV import *
class CatchStatus(Enum):
CNone = 0
@ -37,10 +38,6 @@ class Catch:
# 网络继电器
open(1, 0, 0)
self.is_send_take_command = True
else:
if self.take_continue.Q(True,self.robotClient.time_delay_take*1000):
self.is_send_take_command = False
self.catch_status = CatchStatus.COk
if self.catch_status == CatchStatus.CDrop:
if not self.is_send_command:

View File

@ -28,7 +28,7 @@ class Detect:
return
_, img, xyz, uvw, points = self.detection.get_position(Point_isVision=False, Box_isPoint=True,
First_Depth=True, Iter_Max_Pixel=30,
save_img_point=0, Height_reduce=30, width_reduce=30)
save_img_point=1, Height_reduce=30, width_reduce=30)
self.detection_image = img.copy()
if xyz == None or uvw == None or points == None:

View File

@ -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)

View File

@ -322,7 +322,8 @@ class Feeding(QObject):
if feed_pos.get_position().compare(real_position):
self.log_signal.emit(logging.INFO, Constant.str_feed_mid)
self.next_position(self.is_reverse)
if self.feedStatus == FeedStatus.FTake:
self.catch.catch_status=CatchStatus.CTake
elif self.feedStatus == FeedStatus.FPhoto:
@ -444,17 +445,11 @@ class Feeding(QObject):
# self.sendIOControl(self.robotClient.con_ios[2], 1)
self.log_signal.emit(logging.INFO, "到达抓料点位")
if self.catch.catch_status == CatchStatus.CNone :
self.catch.catch_status = CatchStatus.CTake
return
if self.catch.catch_status == CatchStatus.CTake:
return
if self.catch.catch_status == CatchStatus.COk :
self.catch.catch_status = CatchStatus.CNone
#self.feedConfig.feedLine.set_take_position(None)
# time.sleep(self.robotClient.time_delay_take)
self.log_signal.emit(logging.INFO, Constant.str_feed_take_success)
self.next_position()
#self.feedConfig.feedLine.set_take_position(None)
# time.sleep(self.robotClient.time_delay_take)
self.log_signal.emit(logging.INFO, Constant.str_feed_take_success)
self.next_position()
self.catch.catch_status = CatchStatus.COk
else:
self.log_signal.emit(logging.ERROR, Constant.str_feed_takePhoto_fail)