update 更新界面显示
This commit is contained in:
@ -1,14 +1,16 @@
|
||||
import time
|
||||
|
||||
import cv2
|
||||
|
||||
import Constant
|
||||
from Model.Position import Real_Position, Detection_Position
|
||||
from enum import Enum
|
||||
from enum import Enum, IntEnum
|
||||
from COM.COM_Robot import RobotClient
|
||||
from Model.RobotModel import CMDInstructRequest, MoveType
|
||||
from Vision.camera_coordinate_dete import Detection
|
||||
|
||||
|
||||
class FeedStatus(Enum):
|
||||
class FeedStatus(IntEnum):
|
||||
FNone = 0
|
||||
FStart = 1
|
||||
FSafeP = 2
|
||||
@ -40,13 +42,17 @@ class FeedingConfig:
|
||||
|
||||
|
||||
class Feeding():
|
||||
def __init__(self,robotClient:RobotClient,detection):
|
||||
def __init__(self,robotClient:RobotClient,detection:Detection):
|
||||
self.feedConfig = None
|
||||
self.feedStatus = FeedStatus.FNone
|
||||
self.robotClient = robotClient
|
||||
self.detection = detection
|
||||
self.detection_image = None
|
||||
self.init_detection_image()
|
||||
pass
|
||||
|
||||
def init_detection_image(self):
|
||||
self.detection_image = cv2.imread("./Image/wait.png")
|
||||
def run(self):
|
||||
# 获取事件坐标
|
||||
real_position = Real_Position()
|
||||
@ -84,9 +90,10 @@ class Feeding():
|
||||
|
||||
elif self.feedStatus == FeedStatus.FPhoto:
|
||||
if self.feedConfig.feedLine.photo_position.compare(real_position):
|
||||
_, _, xyz, uvw = self.detection.get_position() #检测结果
|
||||
code, img, xyz, uvw = self.detection.get_position() #检测结果
|
||||
self.detection_image = img
|
||||
if xyz!=None:
|
||||
self.feedStatus = FeedStatus.FTake
|
||||
|
||||
#dp = Detection_Position().init_position(*xyz, *uvw)
|
||||
from Trace.handeye_calibration import R_matrix,getPosition
|
||||
rotation = R_matrix(self.robotClient.status_model.world_0,
|
||||
@ -99,6 +106,7 @@ class Feeding():
|
||||
# 黄老师给我的xyz和法向量
|
||||
target_position, noraml_base = getPosition(*xyz, *uvw,rotation)
|
||||
self.feedConfig.feedLine.take_position = Real_Position().init_position(*target_position[:3],*noraml_base)
|
||||
self.feedStatus = FeedStatus.FTake
|
||||
self.sendTargPosition(self.feedConfig.feedLine.take_position)
|
||||
else:
|
||||
print("打印日志,保存失败图像")
|
||||
@ -129,6 +137,7 @@ class Feeding():
|
||||
if self.feedConfig.num == 0:
|
||||
self.feedStatus=FeedStatus.FNone
|
||||
self.sendTargPosition(self.feedConfig.feedLine.safe_position)
|
||||
self.init_detection_image()
|
||||
else:
|
||||
self.feedStatus = FeedStatus.FSafeP
|
||||
self.sendTargPosition(self.feedConfig.feedLine.safe_position)
|
||||
|
||||
Reference in New Issue
Block a user