update: 更新891/8822/raw的subtask文件

This commit is contained in:
bmy
2024-08-17 01:59:00 +08:00
parent 91d6491f64
commit 7dd0d6677e
4 changed files with 79 additions and 67 deletions

View File

@@ -10,7 +10,6 @@ import toml
import zmq
import time
import variable as var
import action as act
import re
import math
import json
@@ -116,7 +115,7 @@ def calibrate_right_new(label, offset, run = True, run_speed = 3.5):
ret, error = filter.aim_right(label)
error += offset
# if ret:
if abs(error) <= 8:
if abs(error) <= 10:
car_stop()
logger.info("calibrate_right_new:行进时 误差小于 8 直接停车")
ret, error = filter.aim_right(label)
@@ -233,10 +232,10 @@ def explore_calibrate_new(label, offset, run_direc ,run_speed = 3.5):
car_stop()
logger.info("explore_calibrate_new:行进时 误差小于 15 直接停车")
ret, box = filter.get(label)
while not ret:
ret, box = filter.get(label)
error = (box[0][2] + box[0][0] - 320) / 2 + offset
# ret, box = filter.get(label)
# while not ret:
# ret, box = filter.get(label)
# error = (box[0][2] + box[0][0] - 320) / 2 + offset
logger.info(f"停车后像素误差:{error}")
# logger.info(f"explore_calibrate_new:停车后的误差大于 8 使用 distance 校准")
@@ -288,10 +287,10 @@ def hanoi_calibrate(target_label, error_label, offset, run_direc ,run_speed = 3.
car_stop()
logger.info("explore_calibrate_new:行进时 误差小于 15 直接停车")
ret, box = filter.get(target_label)
while not ret:
ret, box = filter.get(target_label)
error = (box[0][2] + box[0][0] - 320) / 2 + offset
# ret, box = filter.get(target_label)
# while not ret:
# ret, box = filter.get(target_label)
# error = (box[0][2] + box[0][0] - 320) / 2 + offset
logger.info(f"停车后像素误差:{error}")
break
return True
@@ -426,8 +425,7 @@ class task_queuem(task):
class get_block1():
def init(self):
var.task_speed = 15
act.cmd.camera(0)
act.cmd.z2(20, 60, 0)
by_cmd.send_angle_camera(0)
filter.switch_camera(1)
# if cfg['get_block']['first_block'] == "blue":
# self.target_label = tlabel.BBLOCK
@@ -464,7 +462,7 @@ class get_block1():
logger.info("抓取块")
by_cmd.send_position_axis_z(30, 80)
time.sleep(1)
time.sleep(1.5)
by_cmd.send_angle_claw(63)
by_cmd.send_position_axis_x(1, 20)
time.sleep(1)
@@ -557,7 +555,7 @@ class put_block():
ret, box = filter.get(tlabel.HOSPITAL)
if ret > 0:
width = box[0][2] - box[0][0]
if width > 128: #135 130
if width > 125: #135 130 128
return True
return False
def exec(self):
@@ -651,6 +649,7 @@ class get_bball():
car_stop()
time.sleep(0.5)
for _ in range(3):
by_cmd.send_position_axis_z(30, 155)
calibrate_right_new(tlabel.BBALL, offset = 18, run = True, run_speed = 5)
logger.info("抓蓝色球")
time.sleep(0.5)
@@ -672,7 +671,7 @@ class get_bball():
time.sleep(0.5)
by_cmd.send_angle_claw_arm(45)
time.sleep(1)
by_cmd.send_position_axis_z(30, 155)
# by_cmd.send_position_axis_z(30, 155)
# 继续向前走
# by_cmd.send_speed_x(4)
pass
@@ -710,7 +709,7 @@ class up_tower():
calibrate_new(tlabel.TOWER, offset = 20, run = True)
time.sleep(1)
# calibrate(tlabel.TOWER, 27, False, 6)
by_cmd.send_distance_x(-10, 120)
by_cmd.send_distance_x(-10, 100)
time.sleep(1)
# 上古參數
# by_cmd.send_distance_y(-10, 50) # 80
@@ -788,7 +787,7 @@ class get_rball():
# by_cmd.send_distance_y(-15, 40)
# time.sleep(1.5)
# 891 参数
by_cmd.send_distance_y(-15, 30)
by_cmd.send_distance_y(-15, 40)
time.sleep(0.3)
calibrate_new(tlabel.RBALL,offset = 44, run = True)
time.sleep(1)