update 更新图片处理,点位比较方法,夹爪控制
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import math
|
||||
|
||||
from Constant import position_accuracy
|
||||
class Position:
|
||||
def __init__(self):
|
||||
@ -7,17 +9,30 @@ class Position:
|
||||
self.U = 0.0
|
||||
self.V = 0.0
|
||||
self.W = 0.0
|
||||
|
||||
def compare(self,position):
|
||||
if self.X-position.X<position_accuracy and \
|
||||
self.Y-position.Y<position_accuracy and \
|
||||
self.Z - position.Z < position_accuracy and \
|
||||
self.U - position.U < position_accuracy and \
|
||||
self.V - position.V < position_accuracy and \
|
||||
self.W - position.W < position_accuracy:
|
||||
distance = math.sqrt((self.X-position.X)**2+
|
||||
(self.Y-position.Y)**2+
|
||||
(self.Z - position.Z)**2+
|
||||
(self.U - position.U)**2+
|
||||
(self.V - position.V)**2+
|
||||
(self.W - position.W) ** 2)
|
||||
if distance<=position_accuracy:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
pass
|
||||
|
||||
# def compare(self,position):
|
||||
# if self.X-position.X<position_accuracy and \
|
||||
# self.Y-position.Y<position_accuracy and \
|
||||
# self.Z - position.Z < position_accuracy and \
|
||||
# self.U - position.U < position_accuracy and \
|
||||
# self.V - position.V < position_accuracy and \
|
||||
# self.W - position.W < position_accuracy:
|
||||
# return True
|
||||
# else:
|
||||
# return False
|
||||
# pass
|
||||
|
||||
def is_error_angel_move(self,position,interval):
|
||||
if self.X - position.X >= interval or \
|
||||
|
||||
@ -189,8 +189,7 @@ class CMDInstructRequest:
|
||||
if len(self.instructions) != 0:
|
||||
model_str = model_str+',"instructions":'+"[{"+self.instructions[0].toString()+"}]"+"}"
|
||||
else:
|
||||
model_str = model_str+',"instructions":'+"[{""}]"+"}" #model_str+"}"
|
||||
print(model_str)
|
||||
model_str = model_str+',"instructions":'+"[]"+"}" #model_str+"}"
|
||||
return model_str
|
||||
|
||||
class CMDInstructReply:
|
||||
|
||||
Reference in New Issue
Block a user