update 调试完成
This commit is contained in:
@ -2,8 +2,8 @@ import Constant
|
||||
from Model.Position import Real_Position, Detection_Position
|
||||
from enum import Enum
|
||||
from COM.COM_Robot import RobotClient
|
||||
from Model.RobotModel import CMDInstructRequest
|
||||
#from Vision.camera_coordinate_dete import Detection
|
||||
from Model.RobotModel import CMDInstructRequest, MoveType
|
||||
from Vision.camera_coordinate_dete import Detection
|
||||
|
||||
|
||||
class FeedStatus(Enum):
|
||||
@ -45,19 +45,18 @@ class Feeding():
|
||||
def run(self):
|
||||
# 获取事件坐标
|
||||
real_position = Real_Position()
|
||||
# real_position.init_position(self.robotClient.status_model.world_n[0],
|
||||
# self.robotClient.status_model.world_n[1],
|
||||
# self.robotClient.status_model.world_n[2],
|
||||
# self.robotClient.status_model.world_n[3],
|
||||
# self.robotClient.status_model.world_n[4],
|
||||
# self.robotClient.status_model.world_n[5],
|
||||
# self.robotClient.status_model.world_n[6]);
|
||||
real_position.init_position(0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
real_position.init_position(self.robotClient.status_model.world_0,
|
||||
self.robotClient.status_model.world_1,
|
||||
self.robotClient.status_model.world_2,
|
||||
self.robotClient.status_model.world_3,
|
||||
self.robotClient.status_model.world_4,
|
||||
self.robotClient.status_model.world_5)
|
||||
# real_position.init_position(0,
|
||||
# 0,
|
||||
# 0,
|
||||
# 0,
|
||||
# 0,
|
||||
# 0);
|
||||
|
||||
|
||||
if self.feedStatus==FeedStatus.FNone:
|
||||
@ -84,7 +83,7 @@ class Feeding():
|
||||
from Trace.handeye_calibration import R_matrix,getPosition
|
||||
rotation = R_matrix(self.robotClient.status_model.world_0,
|
||||
self.robotClient.status_model.world_1,
|
||||
self.robotClient.status_model.world_2,
|
||||
self.robotClient.status_model.world_2-5,
|
||||
self.robotClient.status_model.world_3,
|
||||
self.robotClient.status_model.world_4,
|
||||
self.robotClient.status_model.world_5)
|
||||
@ -130,6 +129,7 @@ class Feeding():
|
||||
position_instruction.m3 = real_position.U
|
||||
position_instruction.m4 = real_position.V
|
||||
position_instruction.m5 = real_position.W
|
||||
position_instruction.action = MoveType.WORLD.value
|
||||
instruction_command = CMDInstructRequest()
|
||||
|
||||
|
||||
|
||||
@ -1,21 +1,23 @@
|
||||
[FeedLine1]
|
||||
name = 阿萨德
|
||||
safeposition_x = 530.250488
|
||||
safeposition_y = 5.518621
|
||||
safeposition_z = 730.206665
|
||||
safeposition_u = -2.411429
|
||||
safeposition_v = -1.808494
|
||||
safeposition_w = -5.283112
|
||||
photoposition_x = 530.250488
|
||||
photoposition_y = 5.518621
|
||||
photoposition_z = 730.206665
|
||||
photoposition_u = -2.411429
|
||||
photoposition_v = -1.808494
|
||||
feedposition_x = 530.250488
|
||||
feedposition_y = 5.518621
|
||||
feedposition_z = 730.206665
|
||||
feedposition_u = -2.411429
|
||||
feedposition_v = -1.808494
|
||||
safeposition_x = 534.907898
|
||||
safeposition_y = 5.525342
|
||||
safeposition_z = 737.267822
|
||||
safeposition_u = -2.196312
|
||||
safeposition_v = -4.094595
|
||||
safeposition_w = -5.294128
|
||||
photoposition_x = 534.907898
|
||||
photoposition_y = 5.525342
|
||||
photoposition_z = 737.267822
|
||||
photoposition_u = -2.196312
|
||||
photoposition_v = -4.094595
|
||||
photoposition_w = -5.294128
|
||||
feedposition_x = 534.907898
|
||||
feedposition_y = 5.525342
|
||||
feedposition_z = 737.267822
|
||||
feedposition_u = -2.196312
|
||||
feedposition_v = -4.094595
|
||||
feedposition_w = -5.294128
|
||||
|
||||
[FeedLine2]
|
||||
name = 艾师傅
|
||||
@ -30,9 +32,11 @@ photoposition_y = 0.0
|
||||
photoposition_z = 0.0
|
||||
photoposition_u = 0.0
|
||||
photoposition_v = 0.0
|
||||
photoposition_w = 0.0
|
||||
feedposition_x = 0.0
|
||||
feedposition_y = 0.0
|
||||
feedposition_z = 0.0
|
||||
feedposition_u = 0.0
|
||||
feedposition_v = 0.0
|
||||
feedposition_w = 0.0
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import os
|
||||
|
||||
position_accuracy = 0.02
|
||||
position_accuracy = 0.05
|
||||
manual_adjust_accuracy = 1
|
||||
speed = 10
|
||||
feedLine_set_section = 'FeedLine'
|
||||
|
||||
@ -124,11 +124,13 @@ class Instruction:
|
||||
self.speed = 10
|
||||
self.delay = 1.0
|
||||
self.smooth = 0
|
||||
self.tool=2
|
||||
|
||||
def toString(self):
|
||||
model_str = f'"oneshot":"{self.oneshot}","action":"{self.action.value}","m0":"{self.m0}","m1":"{self.m1}","m2":"{self.m2}",' \
|
||||
model_str = f'"oneshot":"{self.oneshot}","action":"{self.action}","m0":"{self.m0}","m1":"{self.m1}","m2":"{self.m2}",' \
|
||||
f'"m3":"{self.m3}","m4":"{self.m4}","m5":"{self.m5}","ckStatus":"{self.ckStatus}","speed":"{self.speed}",' \
|
||||
f'"delay":"{self.delay}","smooth":"{self.smooth}"'
|
||||
f'"delay":"{self.delay}","smooth":"{self.smooth}","tool":"{self.tool}"'
|
||||
print(model_str)
|
||||
return model_str
|
||||
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ def R_matrix(x,y,z,u,v,w):
|
||||
# 图像识别结果:xyz和法向量
|
||||
def getPosition(x,y,z,a,b,c,rotation):
|
||||
target = np.asarray([x, y, z,1])
|
||||
camera2robot = np.loadtxt('./cam_pose.txt', delimiter='') #相对目录且分隔符采用os.sep
|
||||
camera2robot = np.loadtxt('./Trace/com_pose.txt', delimiter=' ') #相对目录且分隔符采用os.sep
|
||||
robot2base = rotation
|
||||
camera2base = robot2base @ camera2robot
|
||||
target_position = np.dot(camera2base, target)
|
||||
|
||||
@ -17,10 +17,12 @@ def writeFeedLine_to_ini(feedLine_dirt,file_path:str):
|
||||
config.set(key,'PhotoPosition_z',str(value.photo_position.Z))
|
||||
config.set(key,'PhotoPosition_u',str(value.photo_position.U))
|
||||
config.set(key,'PhotoPosition_v',str(value.photo_position.V))
|
||||
config.set(key, 'PhotoPosition_w', str(value.photo_position.W))
|
||||
config.set(key,'FeedPosition_x',str(value.feed_position.X))
|
||||
config.set(key,'FeedPosition_y',str(value.feed_position.Y))
|
||||
config.set(key,'FeedPosition_z',str(value.feed_position.Z))
|
||||
config.set(key,'FeedPosition_u',str(value.feed_position.U))
|
||||
config.set(key,'FeedPosition_v',str(value.feed_position.V))
|
||||
config.set(key, 'FeedPosition_w', str(value.feed_position.W))
|
||||
config.write(open(file_path,'w',encoding='utf-8'))
|
||||
return True
|
||||
|
||||
@ -23,13 +23,13 @@ class Detection:
|
||||
def __init__(self, use_openvino_model = True):
|
||||
self.use_openvino_model = use_openvino_model
|
||||
if self.use_openvino_model==False:
|
||||
model_path = ''.join([os.getcwd(), '/model/pt/best.pt'])
|
||||
model_path = ''.join([os.getcwd(), '/Vision/model/pt/best.pt'])
|
||||
device = 'cpu'
|
||||
self.camera_rvc = camera()
|
||||
self.model = yolov8_segment()
|
||||
self.model.load_model(model_path, device)
|
||||
else:
|
||||
model_path = ''.join([os.getcwd(), '/model/openvino/best.xml'])
|
||||
model_path = ''.join([os.getcwd(), '/Vision/model/openvino/best.xml'])
|
||||
device = 'CPU'
|
||||
self.camera_rvc = camera()
|
||||
self.model = yolov8_segment_openvino(model_path, device, conf_thres=0.3, iou_thres=0.3)
|
||||
|
||||
6
app.py
6
app.py
@ -16,7 +16,7 @@ import Constant
|
||||
from CU.Command import FeedCommand
|
||||
from CU.Feeding import FeedLine, FeedingConfig, Feeding, FeedStatus
|
||||
from Util.util_log import QTextEditLogger
|
||||
#from Vision.camera_coordinate_dete import Detection
|
||||
from Vision.camera_coordinate_dete import Detection
|
||||
from ui_untitled import Ui_MainWindow
|
||||
from COM.COM_Robot import RobotClient
|
||||
from Expection import Error_Code
|
||||
@ -109,7 +109,7 @@ class MainWindow(QMainWindow,Ui_MainWindow):
|
||||
def init_Run(self):
|
||||
self.robotClient = None
|
||||
self.configReader = configparser.ConfigParser()
|
||||
self.detection = None# Detection()
|
||||
self.detection = Detection()
|
||||
self.command_position_quene = Queue()
|
||||
self.status_address = DataAddress()
|
||||
self.feedLine_dict = {}
|
||||
@ -418,7 +418,7 @@ class MainWindow(QMainWindow,Ui_MainWindow):
|
||||
position_instruction.m3 = float(x4)
|
||||
position_instruction.m4 = float(x5)
|
||||
position_instruction.m5 = float(x6)
|
||||
position_instruction.action = move_type
|
||||
position_instruction.action = move_type.value
|
||||
instruction_command = CMDInstructRequest()
|
||||
instruction_command.instructions.append(position_instruction)
|
||||
request_command = instruction_command.toString()
|
||||
|
||||
Reference in New Issue
Block a user