feat: 增加 hanoi 跳过过滤条件(存在问题)

This commit is contained in:
bmy
2024-07-14 13:34:18 +08:00
parent b1300fc8f1
commit 1edd292ac6
7 changed files with 215 additions and 28 deletions

View File

@@ -242,7 +242,7 @@ def explore_calibrate_new(label, offset, run_direc ,run_speed = 3.5):
return True
def hanoi_calibrate(target_label, error_label, offset, run_direc ,run_speed = 3.5):
stop_error = 0
error_record = CountRecord(3)
error_record = CountRecord(10)
if run_direc == 1:
by_cmd.send_speed_x(run_speed)
else:
@@ -940,7 +940,7 @@ class put_hanoi1():
else:
var.pid_turning.set(cfg["put_hanoi1"]["pid_kp"], cfg["put_hanoi1"]["pid_ki"], cfg["put_hanoi1"]["pid_kd"])
pass
time.sleep(1.5)
# time.sleep(1.5)
class put_hanoi2():
def __init__(self):
@@ -958,13 +958,15 @@ class put_hanoi2():
# 15
self.offset = 14
# self.platform_offset = -25
self.platform_offset = -19
# self.platform_offset = -19
self.platform_offset = -15
else:
self.offset = 14
#self.platform_offset = -30
self.platform_offset = -19
# self.platform_offset = -30
# self.platform_offset = -19
self.platform_offset = -15
# 延时,防止过早看到 tplatform虽然此现象相当少见且诡异
time.sleep(0.5)
time.sleep(1.5)
def find(self):
# ret, box = filter.get(self.target_label)
@@ -999,7 +1001,7 @@ class put_hanoi2():
time.sleep(2)
by_cmd.send_angle_claw(40)
time.sleep(0.5)
by_cmd.send_distance_axis_z(30, 20)
by_cmd.send_distance_axis_z(30, 30)
time.sleep(0.5)
by_cmd.send_position_axis_x(1, 10)
time.sleep(1)
@@ -1011,7 +1013,7 @@ class put_hanoi2():
time.sleep(2)
by_cmd.send_angle_claw(40)
time.sleep(0.5)
by_cmd.send_distance_axis_z(30, 20)
by_cmd.send_distance_axis_z(30, 30)
time.sleep(0.5)
by_cmd.send_position_axis_x(1, 160)
time.sleep(1)
@@ -1029,9 +1031,9 @@ class put_hanoi2():
time.sleep(1)
by_cmd.send_angle_claw(81)
time.sleep(0.5)
by_cmd.send_angle_claw(63)
time.sleep(0.5)
by_cmd.send_position_axis_x(1, 10)
time.sleep(0.5)
by_cmd.send_angle_claw(63)
time.sleep(1)
pass
else:
@@ -1041,9 +1043,9 @@ class put_hanoi2():
time.sleep(1)
by_cmd.send_angle_claw(81)
time.sleep(0.5)
by_cmd.send_angle_claw(63)
time.sleep(0.5)
by_cmd.send_position_axis_x(1, 160)
time.sleep(0.5)
by_cmd.send_angle_claw(63)
time.sleep(1)
ret = explore_calibrate_new(tlabel.MPILLER, offset = self.offset, run_direc = 1, run_speed = 5)
@@ -1055,7 +1057,7 @@ class put_hanoi2():
if utils.direction is tlabel.RMARK:
by_cmd.send_position_axis_z(30, 10)
by_cmd.send_position_axis_x(1, 150)
by_cmd.send_angle_claw(63)
by_cmd.send_angle_claw(60)
time.sleep(2)
by_cmd.send_angle_claw(35)
time.sleep(0.5)
@@ -1067,7 +1069,7 @@ class put_hanoi2():
else:
by_cmd.send_position_axis_z(30, 10)
by_cmd.send_position_axis_x(1, 40)
by_cmd.send_angle_claw(63)
by_cmd.send_angle_claw(60)
time.sleep(2)
by_cmd.send_angle_claw(35)
time.sleep(0.5)
@@ -1079,7 +1081,7 @@ class put_hanoi2():
# ret = explore_calibrate_new(tlabel.LPILLER, offset = self.offset, run_direc = -1, run_speed = 5)
ret = hanoi_calibrate(tlabel.LPILLER, tlabel.TPLATFORM, offset = self.offset, run_direc = -1, run_speed = 5)
if not ret:
logger.error("跳过物资盘点 2 exec")
logger.error("在放中平台的时候出现问题 跳过物资盘点 2 exec")
return
time.sleep(0.5)
logger.info("放中平台")
@@ -1122,8 +1124,8 @@ class put_hanoi2():
time.sleep(1)
by_cmd.send_distance_axis_z(30, 10)
time.sleep(0.5)
by_cmd.send_position_axis_x(1, 10)
time.sleep(1)
by_cmd.send_position_axis_x(1, 0)
time.sleep(2)
pass
else:
by_cmd.send_position_axis_z(30, 10)
@@ -1134,13 +1136,13 @@ class put_hanoi2():
time.sleep(1)
by_cmd.send_distance_axis_z(30, 10)
time.sleep(0.5)
by_cmd.send_position_axis_x(1, 160)
time.sleep(1)
by_cmd.send_position_axis_x(1, 170)
time.sleep(2)
pass
# ret = explore_calibrate_new(tlabel.MPILLER, offset = self.offset, run_direc = -1, run_speed = 5)
ret = hanoi_calibrate(tlabel.MPILLER, tlabel.LPILLER, offset = self.offset, run_direc = -1, run_speed = 5)
ret = hanoi_calibrate(tlabel.MPILLER, tlabel.LPILLER, offset = self.offset, run_direc = -1, run_speed = 5, )
if not ret:
logger.error("跳过物资盘点 2 exec")
logger.error("在放小平台的时候出现问题 跳过物资盘点 2 exec")
return
time.sleep(0.5)
logger.info("放小平台")