update 流程调试
This commit is contained in:
@ -19,7 +19,7 @@ class RobotClient(TCPClient):
|
|||||||
try:
|
try:
|
||||||
if self.command_quene.qsize()!=0:
|
if self.command_quene.qsize()!=0:
|
||||||
command = self.command_quene.get()
|
command = self.command_quene.get()
|
||||||
self.client_socket.send(command.encode('utf-8'))
|
self.client_socket.send(command.encode())
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
response = self.client_socket.recv(1024).decode('utf-8')
|
response = self.client_socket.recv(1024).decode('utf-8')
|
||||||
@ -48,19 +48,20 @@ class RobotClient(TCPClient):
|
|||||||
# 转字符串
|
# 转字符串
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.client_socket.send(request_status_json.encode('utf-8'))
|
self.client_socket.send(request_status_json.encode())
|
||||||
if True:
|
if True:
|
||||||
response = self.client_socket.recv(1024).decode('utf-8')
|
response = self.client_socket.recv(1024).decode('utf-8')
|
||||||
response_message = json.loads(response)
|
response_message = json.loads(response)
|
||||||
if True:
|
if True:
|
||||||
data_status = DATAReply()
|
data_status = DATAReply()
|
||||||
data_status.__dict__ = response_message
|
data_status.__dict__ = response_message
|
||||||
data_address_array = data_status.queryAddr
|
data_address_array = data_status.queryData
|
||||||
data_Address = DataAddress()
|
data_Address = DataAddress()
|
||||||
data_Address.setPosition(*data_address_array)
|
data_Address.setPosition(*data_address_array)
|
||||||
self.status_model.setPosition(*data_address_array)
|
self.status_model.setPosition(*data_address_array)
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
print(e.with_traceback())
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ class Feeding():
|
|||||||
if self.feedConfig.num != 0:
|
if self.feedConfig.num != 0:
|
||||||
self.feedStatus = FeedStatus.FSafeP
|
self.feedStatus = FeedStatus.FSafeP
|
||||||
|
|
||||||
self.sendTargPosition(self.feedConfig.safe_position)
|
self.sendTargPosition(self.feedConfig.feedLine.safe_position)
|
||||||
#print(request_command)
|
#print(request_command)
|
||||||
|
|
||||||
pass
|
pass
|
||||||
@ -72,7 +72,7 @@ class Feeding():
|
|||||||
|
|
||||||
if self.feedConfig.safe_position.compare(real_position):
|
if self.feedConfig.safe_position.compare(real_position):
|
||||||
self.feedStatus = FeedStatus.FPhoto
|
self.feedStatus = FeedStatus.FPhoto
|
||||||
self.sendTargPosition(self.feedConfig.photo_position)
|
self.sendTargPosition(self.feedConfig.feedLine.photo_position)
|
||||||
|
|
||||||
elif self.feedStatus == FeedStatus.FPhoto:
|
elif self.feedStatus == FeedStatus.FPhoto:
|
||||||
if self.feedConfig.photo_position.compare(real_position):
|
if self.feedConfig.photo_position.compare(real_position):
|
||||||
@ -103,7 +103,7 @@ class Feeding():
|
|||||||
elif self.feedStatus == FeedStatus.FSafeF:
|
elif self.feedStatus == FeedStatus.FSafeF:
|
||||||
if self.feedConfig.safe_position.compare(real_position):
|
if self.feedConfig.safe_position.compare(real_position):
|
||||||
self.feedStatus = FeedStatus.FFeedP
|
self.feedStatus = FeedStatus.FFeedP
|
||||||
self.sendTargPosition(self.feedConfig.feed_position)
|
self.sendTargPosition(self.feedConfig.feedLine.feed_position)
|
||||||
pass #吸嘴开始
|
pass #吸嘴开始
|
||||||
|
|
||||||
|
|
||||||
@ -120,15 +120,17 @@ class Feeding():
|
|||||||
def sendTargPosition(self,real_position):
|
def sendTargPosition(self,real_position):
|
||||||
from Model.RobotModel import Instruction
|
from Model.RobotModel import Instruction
|
||||||
position_instruction = Instruction()
|
position_instruction = Instruction()
|
||||||
position_instruction.m0 = self.feedConfig.safe_position.X
|
position_instruction.m0 = real_position.X
|
||||||
position_instruction.m1 = self.feedConfig.safe_position.Y
|
position_instruction.m1 = real_position.Y
|
||||||
position_instruction.m2 = self.feedConfig.safe_position.Z
|
position_instruction.m2 = real_position.Z
|
||||||
position_instruction.m3 = self.feedConfig.safe_position.U
|
position_instruction.m3 = real_position.U
|
||||||
position_instruction.m4 = self.feedConfig.safe_position.V
|
position_instruction.m4 = real_position.V
|
||||||
position_instruction.m5 = self.feedConfig.safe_position.W
|
position_instruction.m5 = real_position.W
|
||||||
instruction_command = CMDInstructRequest()
|
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()
|
||||||
self.robotClient.add_sendQuene(request_command)
|
self.robotClient.add_sendQuene(request_command)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ PhotoPosition_y=0
|
|||||||
PhotoPosition_z=0
|
PhotoPosition_z=0
|
||||||
PhotoPosition_u=0
|
PhotoPosition_u=0
|
||||||
PhotoPosition_v=0
|
PhotoPosition_v=0
|
||||||
PhotoPosition_w=0
|
PhotoPosition_w=20
|
||||||
FeedPosition_x=0
|
FeedPosition_x=0
|
||||||
FeedPosition_y=0
|
FeedPosition_y=0
|
||||||
FeedPosition_z=0
|
FeedPosition_z=0
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
class DATARequest:
|
class DATARequest:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.dsID = 'www.hc-system.com.RemoteMonitor"'
|
self.dsID = 'www.hc-system.com.RemoteMonitor'
|
||||||
self.reqType = 'query'
|
self.reqType = 'query'
|
||||||
self.queryAddr = []
|
self.queryAddr = []
|
||||||
def toString(self):
|
def toString(self):
|
||||||
@ -28,6 +28,12 @@ class DataAddress:
|
|||||||
self.world_3 = 0
|
self.world_3 = 0
|
||||||
self.world_4 = 0
|
self.world_4 = 0
|
||||||
self.world_5 = 0
|
self.world_5 = 0
|
||||||
|
self.axis_0 = 0
|
||||||
|
self.axis_1 = 0
|
||||||
|
self.axis_2 = 0
|
||||||
|
self.axis_3 = 0
|
||||||
|
self.axis_4 = 0
|
||||||
|
self.axis_5 = 0
|
||||||
self.curAlarm = ''
|
self.curAlarm = ''
|
||||||
self.curCycle = ''
|
self.curCycle = ''
|
||||||
self.lastCycle = ''
|
self.lastCycle = ''
|
||||||
@ -40,17 +46,26 @@ class DataAddress:
|
|||||||
self.isMoving = ''
|
self.isMoving = ''
|
||||||
self.M_n = ''
|
self.M_n = ''
|
||||||
#return
|
#return
|
||||||
def setPosition(self,w0,w1,w2,w3,w4,w5):
|
def setPosition(self,w0,w1,w2,w3,w4,w5,a0,a1,a2,a3,a4,a5):
|
||||||
self.world_0 = int(w0)
|
self.world_0 = float(w0)
|
||||||
self.world_1 = int(w1)
|
self.world_1 = float(w1)
|
||||||
self.world_2 = int(w2)
|
self.world_2 = float(w2)
|
||||||
self.world_3 = int(w3)
|
self.world_3 = float(w3)
|
||||||
self.world_4 = int(w4)
|
self.world_4 = float(w4)
|
||||||
self.world_5 = int(w5)
|
self.world_5 = float(w5)
|
||||||
|
self.axis_0 = float(a0)
|
||||||
|
self.axis_1 = float(a1)
|
||||||
|
self.axis_2 = float(a2)
|
||||||
|
self.axis_3 = float(a3)
|
||||||
|
self.axis_4 = float(a4)
|
||||||
|
self.axis_5 = float(a5)
|
||||||
|
|
||||||
|
|
||||||
|
def setAngle(self,a0,a1,a2,a3,a4,a5):
|
||||||
|
pass
|
||||||
|
|
||||||
def toString(self):
|
def toString(self):
|
||||||
model_str = f'"world_0","world_1","world_2","world_3","world_4","world_5"'
|
model_str = f'"world-0","world-1","world-2","world-3","world-4","world-5","axis-0","axis-1","axis-2","axis-3","axis-4","axis-5"'
|
||||||
return model_str
|
return model_str
|
||||||
|
|
||||||
|
|
||||||
@ -85,7 +100,7 @@ class CMDReply:
|
|||||||
class Instruction:
|
class Instruction:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.oneshot = 1
|
self.oneshot = 1
|
||||||
self.action = 10 #4 自由路径 10 姿势直线 17 姿势曲线
|
self.action = 4 #4 自由路径 10 姿势直线 17 姿势曲线
|
||||||
self.m0 = 0.0
|
self.m0 = 0.0
|
||||||
self.m1 = 0.0
|
self.m1 = 0.0
|
||||||
self.m2 = 0.0
|
self.m2 = 0.0
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
|
|
||||||
[Robot_Feed]
|
[Robot_Feed]
|
||||||
IPAddress=192.168.3.5
|
IPAddress=192.168.10.4
|
||||||
Port=8116
|
Port=502
|
||||||
j1_min=-150
|
j1_min=-150
|
||||||
j1_max=+150
|
j1_max=+150
|
||||||
j2_min=-150
|
j2_min=-150
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy.spatial.transform import Rotation as R
|
from scipy.spatial.transform import Rotation as R
|
||||||
|
|
||||||
@ -62,7 +64,7 @@ def R_matrix(x,y,z,u,v,w):
|
|||||||
# 图像识别结果:xyz和法向量
|
# 图像识别结果:xyz和法向量
|
||||||
def getPosition(x,y,z,a,b,c,rotation):
|
def getPosition(x,y,z,a,b,c,rotation):
|
||||||
target = np.asarray([x, y, z,1])
|
target = np.asarray([x, y, z,1])
|
||||||
camera2robot = np.loadtxt('D:\BaiduNetdiskDownload\机械臂\GRCNN\\real\cam_pose.txt', delimiter=' ') #相对目录且分隔符采用os.sep
|
camera2robot = np.loadtxt('./cam_pose.txt', delimiter='') #相对目录且分隔符采用os.sep
|
||||||
robot2base = rotation
|
robot2base = rotation
|
||||||
camera2base = robot2base @ camera2robot
|
camera2base = robot2base @ camera2robot
|
||||||
target_position = np.dot(camera2base, target)
|
target_position = np.dot(camera2base, target)
|
||||||
|
|||||||
18
app.py
18
app.py
@ -65,7 +65,7 @@ class MainWindow(QMainWindow,Ui_MainWindow):
|
|||||||
def init_Run(self):
|
def init_Run(self):
|
||||||
self.robotClient = None
|
self.robotClient = None
|
||||||
self.configReader = configparser.ConfigParser()
|
self.configReader = configparser.ConfigParser()
|
||||||
self.detection = Detection()
|
self.detection = None# Detection()
|
||||||
self.command_position_quene = Queue()
|
self.command_position_quene = Queue()
|
||||||
self.status_address = DataAddress()
|
self.status_address = DataAddress()
|
||||||
self.feedLine_dict = {}
|
self.feedLine_dict = {}
|
||||||
@ -172,9 +172,9 @@ class MainWindow(QMainWindow,Ui_MainWindow):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def send_startFeed_button_click(self):
|
def send_startFeed_button_click(self):
|
||||||
num = self.horizontalSlider_feedingNum.value()
|
num = 1#self.horizontalSlider_feedingNum.x()
|
||||||
line_index = str(self.comboBox_lineIndex.currentIndex()+1)
|
line_index = str(self.comboBox_lineIndex.currentIndex()+1)
|
||||||
self.command_quene.put(FeedCommand(FeedingConfig(num, line_index)))
|
self.command_quene.put(FeedCommand(FeedingConfig(num, self.feedLine_dict[line_index])))
|
||||||
self.stackedWidget_num.setCurrentIndex(1)
|
self.stackedWidget_num.setCurrentIndex(1)
|
||||||
|
|
||||||
def send_num_button_click(self):
|
def send_num_button_click(self):
|
||||||
@ -305,12 +305,12 @@ class MainWindow(QMainWindow,Ui_MainWindow):
|
|||||||
self.updateUI_Position()
|
self.updateUI_Position()
|
||||||
|
|
||||||
def updateUI_Position(self):
|
def updateUI_Position(self):
|
||||||
self.horizontalSlider_J1.setValue(self.status_address.world_0)
|
self.horizontalSlider_J1.setValue(self.status_address.axis_0)
|
||||||
self.horizontalSlider_J2.setValue(self.status_address.world_1)
|
self.horizontalSlider_J2.setValue(self.status_address.axis_1)
|
||||||
self.horizontalSlider_J3.setValue(self.status_address.world_2)
|
self.horizontalSlider_J3.setValue(self.status_address.axis_2)
|
||||||
self.horizontalSlider_J4.setValue(self.status_address.world_3)
|
self.horizontalSlider_J4.setValue(self.status_address.axis_3)
|
||||||
self.horizontalSlider_J5.setValue(self.status_address.world_4)
|
self.horizontalSlider_J5.setValue(self.status_address.axis_4)
|
||||||
self.horizontalSlider_J6.setValue(self.status_address.world_5)
|
self.horizontalSlider_J6.setValue(self.status_address.axis_5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user