update 初次融合+调试

This commit is contained in:
FrankCV2048
2024-09-03 23:28:16 +08:00
parent 051de571a8
commit 0af995b9cd
10 changed files with 108 additions and 69 deletions

23
app.py
View File

@ -9,6 +9,7 @@ from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton
from datetime import datetime
from CU.Command import FeedCommand
from CU.Feeding import FeedLine, FeedingConfig, Feeding, FeedStatus
from Vision.camera_coordinate_dete import Detection
from ui_untitled import Ui_MainWindow
from COM.COM_Robot import RobotClient
from Expection import Error_Code
@ -16,7 +17,7 @@ from queue import Queue
from Model.RobotModel import *
import time
from queue import Queue
from Model.Position import Real_Position
from Model.Position import Real_Position, Detection_Position
from threading import Thread
from CU.Command import Status
@ -64,7 +65,7 @@ class MainWindow(QMainWindow,Ui_MainWindow):
def init_Run(self):
self.robotClient = None
self.configReader = configparser.ConfigParser()
self.detection = Detection()
self.command_position_quene = Queue()
self.status_address = DataAddress()
self.feedLine_dict = {}
@ -75,7 +76,7 @@ class MainWindow(QMainWindow,Ui_MainWindow):
ip = self.configReader.get('Robot_Feed', 'IPAddress')
port = int(self.configReader.get('Robot_Feed', 'Port'))
self.robotClient = RobotClient(ip, port, self.command_position_quene, self.status_address)
self.feeding = Feeding(self.robotClient) # 临时
self.feeding = Feeding(self.robotClient,self.detection) # 临时
self.last_time=time.time()
try:
self.robotClient.CreatConnect()
@ -257,8 +258,8 @@ class MainWindow(QMainWindow,Ui_MainWindow):
self.horizontalSlider_J6.setValue(int(self.lineEdit_j6.text()))
instruction_command = CMDInstructRequest()
instruction_command.instructions.append(vars(position_instruction))
request_command = vars(instruction_command)
instruction_command.instructions.append(position_instruction)
request_command = instruction_command.toString()
print(request_command)
self.robotClient.add_sendQuene(request_command)
@ -301,6 +302,18 @@ class MainWindow(QMainWindow,Ui_MainWindow):
self.label_date.setText(datetime.now().strftime("%Y-%m-%d"))
self.label_time.setText(datetime.now().strftime("%H:%M:%S"))
self.updateUI_Position()
def updateUI_Position(self):
self.horizontalSlider_J1.setValue(self.status_address.world_0)
self.horizontalSlider_J2.setValue(self.status_address.world_1)
self.horizontalSlider_J3.setValue(self.status_address.world_2)
self.horizontalSlider_J4.setValue(self.status_address.world_3)
self.horizontalSlider_J5.setValue(self.status_address.world_4)
self.horizontalSlider_J6.setValue(self.status_address.world_5)
def set_label_status_style(self, connected: bool):
if connected: