update 增加速度设置,点位比对,启动警报等

This commit is contained in:
FrankCV2048
2024-12-05 20:29:27 +08:00
parent a884e241d3
commit 6f22ef051a
10 changed files with 795 additions and 640 deletions

View File

@ -8,8 +8,11 @@ import Constant
from COM.COM_TCP import TCPClient
import queue
import json
from Model.RobotModel import DataAddress,DATARequest,DATAReply
from Model.RobotModel import DataAddress, DATARequest, DATAReply, CMDInstructRequest, Instruction
from Util.util_log import log
from Util.util_math import is_bit_set
class DetectType(Enum):
EyeOnHand = 0
EyeOutHand = 1
@ -28,6 +31,9 @@ class RobotClient(TCPClient):
self.time_delay_shake = time_delay_shake
self.type_detection = DetectType.EyeOutHand
self.origin_position = origin_position
self.debug_speed = 10
self.feed_speed = 10
self.reset_speed = 10
def add_sendQuene(self,command): #后面 命令分等级,紧急命令直接执行
self.command_quene.put(command)
@ -95,6 +101,31 @@ class RobotClient(TCPClient):
log.log_message(logging.ERROR,f'{e}')
raise
def send_emergency_sound(self):
self.sendIOControl(Constant.IO_EmergencyPoint, 1)
def send_emergency_stop(self):
self.sendIOControl(Constant.IO_EmergencyPoint, 0)
def sendIOControl(self, IO_bit, IO_Status: int):
IO_command = CMDInstructRequest()
io_instruction = Instruction()
io_instruction.IO = True
io_instruction.io_status = IO_Status
io_instruction.point = IO_bit # {"dsID":"HCRemoteCommand","reqType":"AddRCC","emptyList":"1","instructions":[{"oneshot":"1","action":"200","type":"0","io_status":"1","point":"15","delay":"0"}]}
IO_command.dsID = 'HCRemoteCommand'
IO_command.instructions.append(io_instruction)
self.add_sendQuene(IO_command.toString())
log.log_message(logging.INFO, f'{Constant.str_feed_io_control}{IO_bit}{IO_Status}')
pass
def check_outputQ(self,IO_bit):
if is_bit_set(self.status_model.output_n, IO_bit):
return True
else:
return False
def get_origin_position(self):
return self.status_model.getRealPosition()
pass