update 更新一键投料,优化设置文字,添加平滑,假装解决闪退
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import math
|
||||
|
||||
from Constant import position_accuracy
|
||||
from Constant import position_accuracy_command
|
||||
from Constant import position_accuracy_action
|
||||
class Position:
|
||||
def __init__(self):
|
||||
self.X = 0.0
|
||||
@ -10,18 +11,19 @@ class Position:
|
||||
self.V = 0.0
|
||||
self.W = 0.0
|
||||
|
||||
def compare(self,position):
|
||||
def compare(self,position,is_action=False):
|
||||
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:
|
||||
if distance<=(position_accuracy_action if is_action else position_accuracy_command):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
# def compare(self,position):
|
||||
# if self.X-position.X<position_accuracy and \
|
||||
# self.Y-position.Y<position_accuracy and \
|
||||
@ -74,5 +76,8 @@ class Real_Position(Position):
|
||||
self.W = W
|
||||
return self
|
||||
|
||||
# def init_position(self, position):
|
||||
# return self.init_position(position.X,position.Y,position.Z,position.U,position.V,position.W)
|
||||
|
||||
def to_string(self):
|
||||
return "X:{:.3f},Y:{:.3f},Z:{:.3f},U:{:.3f},V:{:.3f},W:{:.3f}".format(self.X,self.Y,self.Z,self.U,self.V,self.W)
|
||||
Reference in New Issue
Block a user