Compare commits
2 Commits
527fa4b04b
...
de8012a590
| Author | SHA1 | Date | |
|---|---|---|---|
| de8012a590 | |||
| 6205fabf34 |
@@ -1,5 +1,5 @@
|
|||||||
[kick_ass]
|
[lane_mode]
|
||||||
target_person = 3
|
mode_index = 3
|
||||||
|
|
||||||
[task]
|
[task]
|
||||||
Subtask_enable = true
|
Subtask_enable = true
|
||||||
|
|||||||
61
cfg_subtask.toml.7154.bak
Normal file
61
cfg_subtask.toml.7154.bak
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
[get_block]
|
||||||
|
pid_kp = 1.2
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
first_block = "blue"
|
||||||
|
|
||||||
|
[put_block]
|
||||||
|
pid_kp = 1.2
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
|
||||||
|
[get_bball]
|
||||||
|
pid_kp = 1.2
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
|
||||||
|
[up_tower]
|
||||||
|
pid_kp = 1
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
|
||||||
|
[get_rball]
|
||||||
|
pid_kp = 1.2
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
|
||||||
|
[put_bball]
|
||||||
|
pid_kp = 2
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
|
||||||
|
[put_hanoi1]
|
||||||
|
pid_kp = 0.7
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
|
||||||
|
[put_hanoi2]
|
||||||
|
pid_kp = 1
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
pos_gap = 160
|
||||||
|
first_target = "mp"
|
||||||
|
|
||||||
|
[put_hanoi3]
|
||||||
|
pid_kp = 2.5
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
|
||||||
|
[move_area]
|
||||||
|
pid_kp = 1.2
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
llm_enable = false
|
||||||
|
|
||||||
|
[kick_ass]
|
||||||
|
pid_kp = 0.8
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
pos_gap1 = 150
|
||||||
|
pos_gap2 = 80
|
||||||
|
target_person = 1
|
||||||
61
cfg_subtask.toml.raw.bak
Normal file
61
cfg_subtask.toml.raw.bak
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
[get_block]
|
||||||
|
pid_kp = 1.2
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
first_block = "blue"
|
||||||
|
|
||||||
|
[put_block]
|
||||||
|
pid_kp = 1.2
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
|
||||||
|
[get_bball]
|
||||||
|
pid_kp = 1.2
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
|
||||||
|
[up_tower]
|
||||||
|
pid_kp = 1.0
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
|
||||||
|
[get_rball]
|
||||||
|
pid_kp = 1.2
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
|
||||||
|
[put_bball]
|
||||||
|
pid_kp = 1.8
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
|
||||||
|
[put_hanoi1]
|
||||||
|
pid_kp = 0.7
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
|
||||||
|
[put_hanoi2]
|
||||||
|
pid_kp = 1.0
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
pos_gap = 160
|
||||||
|
first_target = "mp"
|
||||||
|
|
||||||
|
[put_hanoi3]
|
||||||
|
pid_kp = 1.5
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
|
||||||
|
[move_area]
|
||||||
|
pid_kp = 1.2
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
llm_enable = false
|
||||||
|
|
||||||
|
[kick_ass]
|
||||||
|
pid_kp = 0.8
|
||||||
|
pid_ki = 0
|
||||||
|
pid_kd = 0
|
||||||
|
pos_gap1 = 150
|
||||||
|
pos_gap2 = 80
|
||||||
|
target_person = 1
|
||||||
@@ -67,6 +67,7 @@ class main_task():
|
|||||||
error_abs = abs(self.lane_error)
|
error_abs = abs(self.lane_error)
|
||||||
|
|
||||||
if error_abs > 50:
|
if error_abs > 50:
|
||||||
|
# speed = 11
|
||||||
speed = 13
|
speed = 13
|
||||||
elif error_abs > 45:
|
elif error_abs > 45:
|
||||||
speed = 15
|
speed = 15
|
||||||
|
|||||||
12
subtask.py
12
subtask.py
@@ -1439,7 +1439,7 @@ class kick_ass():
|
|||||||
logger.info("扫黑除暴初始化")
|
logger.info("扫黑除暴初始化")
|
||||||
self.pos_gap1 = cfg['kick_ass']['pos_gap1']
|
self.pos_gap1 = cfg['kick_ass']['pos_gap1']
|
||||||
self.pos_gap2 = cfg['kick_ass']['pos_gap2']
|
self.pos_gap2 = cfg['kick_ass']['pos_gap2']
|
||||||
self.target_person = cfg_args['kick_ass']['target_person']
|
self.target_person = cfg_args['lane_mode']['mode_index']
|
||||||
|
|
||||||
# by_cmd.send_angle_claw(15)
|
# by_cmd.send_angle_claw(15)
|
||||||
by_cmd.send_position_axis_x(1, 160)
|
by_cmd.send_position_axis_x(1, 160)
|
||||||
@@ -1477,6 +1477,16 @@ class kick_ass():
|
|||||||
by_cmd.send_position_axis_x(1, 120)
|
by_cmd.send_position_axis_x(1, 120)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
logger.debug("結束任務,前進四")
|
logger.debug("結束任務,前進四")
|
||||||
|
|
||||||
|
filter.switch_camera(2)
|
||||||
|
for _ in range(3):
|
||||||
|
by_cmd.send_speed_x(15)
|
||||||
|
while True:
|
||||||
|
ret, box = filter.get(tlabel.BASE)
|
||||||
|
if ret:
|
||||||
|
error = (box[0][2] + box[0][0] - 320) / 2
|
||||||
|
by_cmd.send_speed_omega(-error * 0.8)
|
||||||
|
time.sleep(0.02)
|
||||||
# by_cmd.send_speed_x(25)
|
# by_cmd.send_speed_x(25)
|
||||||
# time.sleep(4)
|
# time.sleep(4)
|
||||||
pass
|
pass
|
||||||
|
|||||||
255
subtask_69.py
255
subtask_69.py
@@ -118,7 +118,7 @@ def calibrate_right_new(label, offset, run = True, run_speed = 3.5):
|
|||||||
logger.info(f"calibrate_right_new:停车后的误差是{error}")
|
logger.info(f"calibrate_right_new:停车后的误差是{error}")
|
||||||
if abs(error) > 8:
|
if abs(error) > 8:
|
||||||
logger.info(f"calibrate_right_new:停车后的误差大于 8 使用 distance 校准")
|
logger.info(f"calibrate_right_new:停车后的误差大于 8 使用 distance 校准")
|
||||||
error = error * 3
|
error = error * 1.5
|
||||||
if error > 0:
|
if error > 0:
|
||||||
by_cmd.send_distance_x(-10, int(error))
|
by_cmd.send_distance_x(-10, int(error))
|
||||||
else:
|
else:
|
||||||
@@ -241,6 +241,49 @@ def explore_calibrate_new(label, offset, run_direc ,run_speed = 3.5):
|
|||||||
break
|
break
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
# 对准应知道是左还是右,右侧需在过滤器中进行翻转
|
||||||
|
# flipv 为垂直翻转标志,转右侧开启
|
||||||
|
def hanoi_calibrate(target_label, error_label, offset, run_direc ,run_speed = 3.5):
|
||||||
|
stop_error = 0
|
||||||
|
error_record = CountRecord(10)
|
||||||
|
if run_direc == 1:
|
||||||
|
by_cmd.send_speed_x(run_speed)
|
||||||
|
else:
|
||||||
|
by_cmd.send_speed_x(-run_speed)
|
||||||
|
|
||||||
|
if target_label == tlabel.TPLATFORM:
|
||||||
|
stop_error = 8
|
||||||
|
else:
|
||||||
|
stop_error = 15
|
||||||
|
while True:
|
||||||
|
ret1, ret2, box = filter.get_two_hanoi(target_label, error_label, utils.direction == tlabel.RMARK)
|
||||||
|
while not ret1:
|
||||||
|
# 如果找不到目标且跳过任务队列非空 (即指令跳过)
|
||||||
|
if not global_skip_queue.empty():
|
||||||
|
_ = global_skip_queue.get()
|
||||||
|
logger.error("跳过 hanoi_calibrate")
|
||||||
|
return False
|
||||||
|
# 如果找不到目标且发现错误目标 (上次放置任务失败)
|
||||||
|
if ret2:
|
||||||
|
# 如果连续计数超过阈值,则直接返回
|
||||||
|
if error_record(ret2):
|
||||||
|
return False
|
||||||
|
ret1, ret2, box = filter.get_two_hanoi(target_label, error_label, utils.direction == tlabel.RMARK)
|
||||||
|
|
||||||
|
error = (box[0][2] + box[0][0] - 320) / 2 + offset
|
||||||
|
if ret1:
|
||||||
|
# 校准速度越大 停车的条件越宽泛 20 15
|
||||||
|
if abs(error) <= stop_error:
|
||||||
|
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
|
||||||
|
logger.info(f"停车后像素误差:{error}")
|
||||||
|
break
|
||||||
|
return True
|
||||||
# 任务类
|
# 任务类
|
||||||
class task:
|
class task:
|
||||||
def __init__(self, name, task_template, find_counts=10, enable=True):
|
def __init__(self, name, task_template, find_counts=10, enable=True):
|
||||||
@@ -406,7 +449,7 @@ class get_block1():
|
|||||||
else:
|
else:
|
||||||
var.first_block = tlabel.BBLOCK
|
var.first_block = tlabel.BBLOCK
|
||||||
var.second_block = tlabel.RBLOCK
|
var.second_block = tlabel.RBLOCK
|
||||||
calibrate_new(var.first_block, offset = 15, run = True, run_speed = 5)
|
calibrate_new(var.first_block, offset = 16, run = True, run_speed = 5)
|
||||||
logger.info("抓取块")
|
logger.info("抓取块")
|
||||||
|
|
||||||
by_cmd.send_position_axis_z(30, 60)
|
by_cmd.send_position_axis_z(30, 60)
|
||||||
@@ -421,20 +464,21 @@ class get_block1():
|
|||||||
|
|
||||||
by_cmd.send_angle_claw_arm(175)
|
by_cmd.send_angle_claw_arm(175)
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
by_cmd.send_position_axis_x(1, 120)
|
by_cmd.send_position_axis_x(1, 100)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
by_cmd.send_position_axis_z(30, 70)
|
by_cmd.send_position_axis_z(30, 70)
|
||||||
time.sleep(0.1)
|
time.sleep(0.5)
|
||||||
by_cmd.send_angle_claw(63)
|
by_cmd.send_angle_claw(63)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
by_cmd.send_position_axis_z(30, 130)
|
by_cmd.send_position_axis_z(30, 130)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
by_cmd.send_position_axis_x(1, 140)
|
by_cmd.send_position_axis_x(1, 140)
|
||||||
by_cmd.send_angle_claw_arm(220)
|
by_cmd.send_angle_claw_arm(225)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_angle_storage(55)
|
# by_cmd.send_angle_storage(55)
|
||||||
time.sleep(1)
|
# time.sleep(1)
|
||||||
|
by_cmd.send_position_axis_z(30, 60)
|
||||||
|
|
||||||
pass
|
pass
|
||||||
def nexec(self):
|
def nexec(self):
|
||||||
@@ -463,13 +507,12 @@ class get_block2():
|
|||||||
return False
|
return False
|
||||||
def exec(self):
|
def exec(self):
|
||||||
car_stop()
|
car_stop()
|
||||||
calibrate_new(var.second_block, offset = 15, run = True, run_speed = 5)
|
calibrate_new(var.second_block, offset = 16, run = True, run_speed = 5)
|
||||||
logger.info("抓取块")
|
logger.info("抓取块")
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_angle_claw_arm(220)
|
by_cmd.send_angle_claw_arm(225)
|
||||||
by_cmd.send_angle_claw(63)
|
by_cmd.send_angle_claw(63)
|
||||||
by_cmd.send_position_axis_z(30, 60)
|
time.sleep(0.1)
|
||||||
time.sleep(1)
|
|
||||||
by_cmd.send_position_axis_x(1, 20)
|
by_cmd.send_position_axis_x(1, 20)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
by_cmd.send_angle_claw(25)
|
by_cmd.send_angle_claw(25)
|
||||||
@@ -521,7 +564,7 @@ class put_block():
|
|||||||
|
|
||||||
# 放置第二個塊
|
# 放置第二個塊
|
||||||
by_cmd.send_angle_storage(20)
|
by_cmd.send_angle_storage(20)
|
||||||
by_cmd.send_position_axis_x(1, 130)
|
by_cmd.send_position_axis_x(1, 110)
|
||||||
by_cmd.send_position_axis_z(30, 120)
|
by_cmd.send_position_axis_z(30, 120)
|
||||||
time.sleep(1.5)
|
time.sleep(1.5)
|
||||||
by_cmd.send_angle_claw_arm(180)
|
by_cmd.send_angle_claw_arm(180)
|
||||||
@@ -535,7 +578,7 @@ class put_block():
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
by_cmd.send_position_axis_z(30, 110)
|
by_cmd.send_position_axis_z(30, 110)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
by_cmd.send_angle_claw_arm(220)
|
by_cmd.send_angle_claw_arm(225)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
by_cmd.send_position_axis_z(30, 0)
|
by_cmd.send_position_axis_z(30, 0)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
@@ -554,7 +597,7 @@ class put_block():
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
while by_cmd.send_position_axis_x(1, 0) == -1:
|
while by_cmd.send_position_axis_x(1, 0) == -1:
|
||||||
pass
|
pass
|
||||||
while by_cmd.send_angle_claw_arm(36) == -1:
|
while by_cmd.send_angle_claw_arm(45) == -1:
|
||||||
pass
|
pass
|
||||||
# 任务检查间隔
|
# 任务检查间隔
|
||||||
# time.sleep(2)
|
# time.sleep(2)
|
||||||
@@ -569,7 +612,7 @@ class get_bball():
|
|||||||
# time.sleep(0.5)
|
# time.sleep(0.5)
|
||||||
# by_cmd.send_position_axis_x(1, 0)
|
# by_cmd.send_position_axis_x(1, 0)
|
||||||
# time.sleep(2)
|
# time.sleep(2)
|
||||||
# by_cmd.send_angle_claw_arm(36)
|
# by_cmd.send_angle_claw_arm(45)
|
||||||
|
|
||||||
while (by_cmd.send_angle_storage(0) == -1):
|
while (by_cmd.send_angle_storage(0) == -1):
|
||||||
by_cmd.send_angle_storage(0)
|
by_cmd.send_angle_storage(0)
|
||||||
@@ -582,13 +625,14 @@ class get_bball():
|
|||||||
self.record = CountRecord(5)
|
self.record = CountRecord(5)
|
||||||
def find(self):
|
def find(self):
|
||||||
# 目标检测蓝球
|
# 目标检测蓝球
|
||||||
ret = filter.find(tlabel.BBALL)
|
# ret = filter.find(tlabel.BBALL)
|
||||||
|
ret = filter.find_mult([tlabel.BBALL, tlabel.YBALL])
|
||||||
# ret = filter.find(tlabel.BBALL) or filter.find(tlabel.YBALL)
|
# ret = filter.find(tlabel.BBALL) or filter.find(tlabel.YBALL)
|
||||||
# TODO 此处使用连续检出判断感觉不是很好,黄球放置远时停车较晚,可能跟请求速度相关
|
# TODO 此处使用连续检出判断感觉不是很好,黄球放置远时停车较晚,可能跟请求速度相关
|
||||||
# if ret:
|
# if ret:
|
||||||
# if self.record(tlabel.BBALL):
|
# if self.record(tlabel.BBALL):
|
||||||
# return True
|
# return True
|
||||||
if ret:
|
if ret[0] or ret[1]:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
def exec(self):
|
def exec(self):
|
||||||
@@ -596,10 +640,10 @@ class get_bball():
|
|||||||
car_stop()
|
car_stop()
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
for _ in range(3):
|
for _ in range(3):
|
||||||
calibrate_right_new(tlabel.BBALL, offset = 16, run = True, run_speed = 5)
|
calibrate_right_new(tlabel.BBALL, offset = 18, run = True, run_speed = 5)
|
||||||
logger.info("抓蓝色球")
|
logger.info("抓蓝色球")
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_angle_claw_arm(36)
|
by_cmd.send_angle_claw_arm(45)
|
||||||
by_cmd.send_angle_claw(54)
|
by_cmd.send_angle_claw(54)
|
||||||
by_cmd.send_position_axis_x(1, 160)
|
by_cmd.send_position_axis_x(1, 160)
|
||||||
time.sleep(1.2)
|
time.sleep(1.2)
|
||||||
@@ -615,7 +659,7 @@ class get_bball():
|
|||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_angle_claw(54)
|
by_cmd.send_angle_claw(54)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_angle_claw_arm(36)
|
by_cmd.send_angle_claw_arm(45)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
by_cmd.send_position_axis_z(30, 135)
|
by_cmd.send_position_axis_z(30, 135)
|
||||||
# 继续向前走
|
# 继续向前走
|
||||||
@@ -834,30 +878,40 @@ class put_hanoi1():
|
|||||||
logger.info("应该向左转")
|
logger.info("应该向左转")
|
||||||
|
|
||||||
|
|
||||||
# # 校准 omega
|
# 校准 omega
|
||||||
# if error > 0:
|
for _ in range(10):
|
||||||
# by_cmd.send_angle_omega(-20,abs(var.lane_error))
|
ret, box = filter.get(utils.direction)
|
||||||
# else:
|
if ret:
|
||||||
# by_cmd.send_angle_omega(20,abs(var.lane_error))
|
error = (box[0][2] + box[0][0] - 320) / 2
|
||||||
# time.sleep(0.5)
|
by_cmd.send_speed_omega(-error * 0.8)
|
||||||
# car_stop()
|
time.sleep(0.2)
|
||||||
# time.sleep(0.5)
|
|
||||||
# by_cmd.send_distance_x(10, 200)
|
|
||||||
|
|
||||||
# by_cmd.send_distance_x(10, 180)
|
|
||||||
by_cmd.send_distance_x(10, 250)
|
|
||||||
time.sleep(1)
|
|
||||||
car_stop()
|
car_stop()
|
||||||
|
|
||||||
|
|
||||||
|
# 前进
|
||||||
|
# by_cmd.send_distance_x(10, 200)
|
||||||
|
# by_cmd.send_distance_x(10, 180)
|
||||||
|
# by_cmd.send_distance_x(10, 180)
|
||||||
|
# time.sleep(1.5)
|
||||||
|
# car_stop()
|
||||||
|
|
||||||
|
while True:
|
||||||
|
by_cmd.send_speed_x(8.5)
|
||||||
|
ret, box = filter.get(utils.direction)
|
||||||
|
if ret:
|
||||||
|
if abs(box[0][2] - box[0][0]) > 41:
|
||||||
|
car_stop()
|
||||||
|
break
|
||||||
|
|
||||||
# 根据方向初始化执行器位置
|
# 根据方向初始化执行器位置
|
||||||
if utils.direction is tlabel.RMARK:
|
if utils.direction is tlabel.RMARK:
|
||||||
# FIXME 右侧的爪子会被 storage 挡住
|
# FIXME 右侧的爪子会被 storage 挡住
|
||||||
by_cmd.send_position_axis_x(1, 0)
|
by_cmd.send_position_axis_x(1, 0)
|
||||||
by_cmd.send_angle_claw_arm(36)
|
by_cmd.send_angle_claw_arm(45)
|
||||||
by_cmd.send_angle_storage(0)
|
by_cmd.send_angle_storage(0)
|
||||||
else:
|
else:
|
||||||
by_cmd.send_position_axis_x(1, 150)
|
by_cmd.send_position_axis_x(1, 150)
|
||||||
by_cmd.send_angle_claw_arm(220)
|
by_cmd.send_angle_claw_arm(225)
|
||||||
by_cmd.send_angle_storage(55)
|
by_cmd.send_angle_storage(55)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
@@ -866,16 +920,20 @@ class put_hanoi1():
|
|||||||
if utils.direction_right > utils.direction_left:
|
if utils.direction_right > utils.direction_left:
|
||||||
utils.direction = tlabel.RMARK
|
utils.direction = tlabel.RMARK
|
||||||
# by_cmd.send_angle_omega(-25,430)
|
# by_cmd.send_angle_omega(-25,430)
|
||||||
by_cmd.send_angle_omega(-45,238)
|
|
||||||
# by_cmd.send_angle_omega(-55,194)
|
# by_cmd.send_angle_omega(-55,194)
|
||||||
|
# by_cmd.send_angle_omega(-45,238)
|
||||||
|
# by_cmd.send_angle_omega(-45,252)
|
||||||
|
by_cmd.send_angle_omega(-45,260)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
while (by_cmd.send_angle_camera(90) == -1):
|
while (by_cmd.send_angle_camera(90) == -1):
|
||||||
by_cmd.send_angle_camera(90)
|
by_cmd.send_angle_camera(90)
|
||||||
else:
|
else:
|
||||||
utils.direction = tlabel.LMARK
|
utils.direction = tlabel.LMARK
|
||||||
# by_cmd.send_angle_omega(25,430)
|
# by_cmd.send_angle_omega(25,430)
|
||||||
by_cmd.send_angle_omega(45,238)
|
|
||||||
# by_cmd.send_angle_omega(55,194)
|
# by_cmd.send_angle_omega(55,194)
|
||||||
|
# by_cmd.send_angle_omega(45,238)
|
||||||
|
# by_cmd.send_angle_omega(45,252)
|
||||||
|
by_cmd.send_angle_omega(45,260)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
while (by_cmd.send_angle_camera(0) == -1):
|
while (by_cmd.send_angle_camera(0) == -1):
|
||||||
by_cmd.send_angle_camera(0)
|
by_cmd.send_angle_camera(0)
|
||||||
@@ -884,11 +942,17 @@ class put_hanoi1():
|
|||||||
def nexec(self):
|
def nexec(self):
|
||||||
pass
|
pass
|
||||||
def after(self):
|
def after(self):
|
||||||
var.pid_turning.set(cfg["put_hanoi1"]["pid_kp"], cfg["put_hanoi1"]["pid_ki"], cfg["put_hanoi1"]["pid_kd"])
|
# var.switch_lane_model = True
|
||||||
|
if utils.direction == tlabel.RMARK:
|
||||||
|
var.pid_turning.set(cfg["put_hanoi1"]["pid_kp"] - 0.3, cfg["put_hanoi1"]["pid_ki"], cfg["put_hanoi1"]["pid_kd"])
|
||||||
|
else:
|
||||||
|
var.pid_turning.set(cfg["put_hanoi1"]["pid_kp"], cfg["put_hanoi1"]["pid_ki"], cfg["put_hanoi1"]["pid_kd"])
|
||||||
pass
|
pass
|
||||||
|
# time.sleep(1.5)
|
||||||
|
|
||||||
class put_hanoi2():
|
class put_hanoi2():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
if cfg['put_hanoi2']['first_target'] == "lp":
|
if cfg['put_hanoi2']['first_target'] == "lp":
|
||||||
self.target_label = tlabel.LPILLER
|
self.target_label = tlabel.LPILLER
|
||||||
elif cfg['put_hanoi2']['first_target'] == "mp":
|
elif cfg['put_hanoi2']['first_target'] == "mp":
|
||||||
@@ -897,20 +961,25 @@ class put_hanoi2():
|
|||||||
self.target_label = tlabel.SPILLER
|
self.target_label = tlabel.SPILLER
|
||||||
def init(self):
|
def init(self):
|
||||||
logger.info("物资盘点 2 初始化")
|
logger.info("物资盘点 2 初始化")
|
||||||
|
var.task_speed = 8.5
|
||||||
if utils.direction == tlabel.RMARK:
|
if utils.direction == tlabel.RMARK:
|
||||||
# 15
|
# 15
|
||||||
self.offset = 19
|
self.offset = 14
|
||||||
# self.platform_offset = -25
|
# self.platform_offset = -25
|
||||||
self.platform_offset = -10
|
# self.platform_offset = -19
|
||||||
else:
|
|
||||||
self.offset = 10
|
|
||||||
#self.platform_offset = -30
|
|
||||||
self.platform_offset = -15
|
self.platform_offset = -15
|
||||||
|
else:
|
||||||
|
self.offset = 14
|
||||||
|
# self.platform_offset = -30
|
||||||
|
# self.platform_offset = -19
|
||||||
|
self.platform_offset = -15
|
||||||
|
# 延时,防止过早看到 tplatform(虽然此现象相当少见且诡异)
|
||||||
|
time.sleep(1.5)
|
||||||
|
|
||||||
def find(self):
|
def find(self):
|
||||||
# ret, box = filter.get(self.target_label)
|
# ret, box = filter.get(self.target_label)
|
||||||
ret, box = filter.get(tlabel.TPLATFORM)
|
ret, box = filter.get(tlabel.TPLATFORM)
|
||||||
if ret:
|
if ret:
|
||||||
var.task_speed = 8.5
|
|
||||||
error = (box[0][2] + box[0][0] - 320) / 2 + self.platform_offset
|
error = (box[0][2] + box[0][0] - 320) / 2 + self.platform_offset
|
||||||
if error > 0:
|
if error > 0:
|
||||||
return True
|
return True
|
||||||
@@ -935,12 +1004,12 @@ class put_hanoi2():
|
|||||||
logger.info("抓大平台")
|
logger.info("抓大平台")
|
||||||
if utils.direction is tlabel.RMARK:
|
if utils.direction is tlabel.RMARK:
|
||||||
by_cmd.send_position_axis_z(30, 10)
|
by_cmd.send_position_axis_z(30, 10)
|
||||||
by_cmd.send_position_axis_x(1, 130)
|
by_cmd.send_position_axis_x(1, 150)
|
||||||
by_cmd.send_angle_claw(63)
|
by_cmd.send_angle_claw(63)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
by_cmd.send_angle_claw(40)
|
by_cmd.send_angle_claw(40)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_distance_axis_z(30, 20)
|
by_cmd.send_distance_axis_z(30, 30)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_position_axis_x(1, 10)
|
by_cmd.send_position_axis_x(1, 10)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
@@ -952,7 +1021,7 @@ class put_hanoi2():
|
|||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
by_cmd.send_angle_claw(40)
|
by_cmd.send_angle_claw(40)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_distance_axis_z(30, 20)
|
by_cmd.send_distance_axis_z(30, 30)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_position_axis_x(1, 160)
|
by_cmd.send_position_axis_x(1, 160)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
@@ -964,15 +1033,15 @@ class put_hanoi2():
|
|||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
logger.info("放大平台")
|
logger.info("放大平台")
|
||||||
if utils.direction is tlabel.RMARK:
|
if utils.direction is tlabel.RMARK:
|
||||||
by_cmd.send_position_axis_x(1, 130)
|
by_cmd.send_position_axis_x(1, 150)
|
||||||
time.sleep(1.5)
|
time.sleep(1.5)
|
||||||
by_cmd.send_distance_axis_z(30, -20)
|
by_cmd.send_distance_axis_z(30, -20)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
by_cmd.send_angle_claw(81)
|
by_cmd.send_angle_claw(81)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_angle_claw(63)
|
|
||||||
time.sleep(0.5)
|
|
||||||
by_cmd.send_position_axis_x(1, 10)
|
by_cmd.send_position_axis_x(1, 10)
|
||||||
|
time.sleep(0.5)
|
||||||
|
by_cmd.send_angle_claw(63)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@@ -982,9 +1051,9 @@ class put_hanoi2():
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
by_cmd.send_angle_claw(81)
|
by_cmd.send_angle_claw(81)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_angle_claw(63)
|
|
||||||
time.sleep(0.5)
|
|
||||||
by_cmd.send_position_axis_x(1, 160)
|
by_cmd.send_position_axis_x(1, 160)
|
||||||
|
time.sleep(0.5)
|
||||||
|
by_cmd.send_angle_claw(63)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
ret = explore_calibrate_new(tlabel.MPILLER, offset = self.offset, run_direc = 1, run_speed = 5)
|
ret = explore_calibrate_new(tlabel.MPILLER, offset = self.offset, run_direc = 1, run_speed = 5)
|
||||||
@@ -995,8 +1064,8 @@ class put_hanoi2():
|
|||||||
logger.info("抓中平台")
|
logger.info("抓中平台")
|
||||||
if utils.direction is tlabel.RMARK:
|
if utils.direction is tlabel.RMARK:
|
||||||
by_cmd.send_position_axis_z(30, 10)
|
by_cmd.send_position_axis_z(30, 10)
|
||||||
by_cmd.send_position_axis_x(1, 130)
|
by_cmd.send_position_axis_x(1, 150)
|
||||||
by_cmd.send_angle_claw(63)
|
by_cmd.send_angle_claw(55)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
by_cmd.send_angle_claw(35)
|
by_cmd.send_angle_claw(35)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
@@ -1008,7 +1077,7 @@ class put_hanoi2():
|
|||||||
else:
|
else:
|
||||||
by_cmd.send_position_axis_z(30, 10)
|
by_cmd.send_position_axis_z(30, 10)
|
||||||
by_cmd.send_position_axis_x(1, 40)
|
by_cmd.send_position_axis_x(1, 40)
|
||||||
by_cmd.send_angle_claw(63)
|
by_cmd.send_angle_claw(55)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
by_cmd.send_angle_claw(35)
|
by_cmd.send_angle_claw(35)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
@@ -1017,32 +1086,33 @@ class put_hanoi2():
|
|||||||
by_cmd.send_position_axis_x(1, 160)
|
by_cmd.send_position_axis_x(1, 160)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
pass
|
pass
|
||||||
ret = explore_calibrate_new(tlabel.LPILLER, offset = self.offset, run_direc = -1, run_speed = 5)
|
# 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:
|
if not ret:
|
||||||
logger.error("跳过物资盘点 2 exec")
|
logger.error("在放中平台的时候出现问题 跳过物资盘点 2 exec")
|
||||||
return
|
return
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
logger.info("放中平台")
|
logger.info("放中平台")
|
||||||
if utils.direction is tlabel.RMARK:
|
if utils.direction is tlabel.RMARK:
|
||||||
by_cmd.send_position_axis_z(30, 100)
|
by_cmd.send_position_axis_z(30, 120)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
by_cmd.send_position_axis_x(1, 130)
|
by_cmd.send_position_axis_x(1, 150)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
by_cmd.send_distance_axis_z(30, -20)
|
by_cmd.send_distance_axis_z(30, -20)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_angle_claw(65)
|
by_cmd.send_angle_claw(55)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_position_axis_x(1, 10)
|
by_cmd.send_position_axis_x(1, 10)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
by_cmd.send_position_axis_z(30, 100)
|
by_cmd.send_position_axis_z(30, 120)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
by_cmd.send_position_axis_x(1, 40)
|
by_cmd.send_position_axis_x(1, 40)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
by_cmd.send_distance_axis_z(30, -20)
|
by_cmd.send_distance_axis_z(30, -20)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_angle_claw(65)
|
by_cmd.send_angle_claw(55)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_position_axis_x(1, 160)
|
by_cmd.send_position_axis_x(1, 160)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
@@ -1055,15 +1125,15 @@ class put_hanoi2():
|
|||||||
logger.info("抓小平台")
|
logger.info("抓小平台")
|
||||||
if utils.direction is tlabel.RMARK:
|
if utils.direction is tlabel.RMARK:
|
||||||
by_cmd.send_position_axis_z(30, 10)
|
by_cmd.send_position_axis_z(30, 10)
|
||||||
by_cmd.send_position_axis_x(1, 130)
|
by_cmd.send_position_axis_x(1, 150)
|
||||||
by_cmd.send_angle_claw(50)
|
by_cmd.send_angle_claw(50)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
by_cmd.send_angle_claw(27)
|
by_cmd.send_angle_claw(27)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
by_cmd.send_distance_axis_z(30, 10)
|
by_cmd.send_distance_axis_z(30, 10)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_position_axis_x(1, 10)
|
by_cmd.send_position_axis_x(1, 0)
|
||||||
time.sleep(1)
|
time.sleep(2)
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
by_cmd.send_position_axis_z(30, 10)
|
by_cmd.send_position_axis_z(30, 10)
|
||||||
@@ -1074,19 +1144,20 @@ class put_hanoi2():
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
by_cmd.send_distance_axis_z(30, 10)
|
by_cmd.send_distance_axis_z(30, 10)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_position_axis_x(1, 160)
|
by_cmd.send_position_axis_x(1, 170)
|
||||||
time.sleep(1)
|
time.sleep(2)
|
||||||
pass
|
pass
|
||||||
ret = explore_calibrate_new(tlabel.MPILLER, offset = self.offset, run_direc = -1, run_speed = 5)
|
# 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)
|
||||||
if not ret:
|
if not ret:
|
||||||
logger.error("跳过物资盘点 2 exec")
|
logger.error("在放小平台的时候出现问题 跳过物资盘点 2 exec")
|
||||||
return
|
return
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
logger.info("放小平台")
|
logger.info("放小平台")
|
||||||
if utils.direction is tlabel.RMARK:
|
if utils.direction is tlabel.RMARK:
|
||||||
by_cmd.send_position_axis_z(30, 170)
|
by_cmd.send_position_axis_z(30, 190) # 170
|
||||||
time.sleep(1.5)
|
time.sleep(1.5)
|
||||||
by_cmd.send_position_axis_x(1, 130)
|
by_cmd.send_position_axis_x(1, 150)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
by_cmd.send_distance_axis_z(30, -20)
|
by_cmd.send_distance_axis_z(30, -20)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
@@ -1094,12 +1165,13 @@ class put_hanoi2():
|
|||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_position_axis_x(1, 10)
|
by_cmd.send_position_axis_x(1, 10)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
by_cmd.send_speed_y(15)
|
|
||||||
time.sleep(0.1)
|
# by_cmd.send_speed_y(10)
|
||||||
car_stop()
|
# time.sleep(0.12)
|
||||||
|
# car_stop()
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
by_cmd.send_position_axis_z(30, 170)
|
by_cmd.send_position_axis_z(30, 190)
|
||||||
time.sleep(1.5)
|
time.sleep(1.5)
|
||||||
by_cmd.send_position_axis_x(1, 40)
|
by_cmd.send_position_axis_x(1, 40)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
@@ -1111,11 +1183,17 @@ class put_hanoi2():
|
|||||||
time.sleep(1.5)
|
time.sleep(1.5)
|
||||||
# while True:
|
# while True:
|
||||||
# pass
|
# pass
|
||||||
|
by_cmd.send_speed_x(12)
|
||||||
|
time.sleep(1.5)
|
||||||
def nexec(self):
|
def nexec(self):
|
||||||
pass
|
pass
|
||||||
def after(self):
|
def after(self):
|
||||||
var.pid_turning.set(cfg["put_hanoi2"]["pid_kp"], cfg["put_hanoi2"]["pid_ki"], cfg["put_hanoi2"]["pid_kd"])
|
# var.switch_lane_model = False
|
||||||
|
if utils.direction is tlabel.RMARK:
|
||||||
|
var.pid_turning.set(cfg["put_hanoi2"]["pid_kp"], cfg["put_hanoi2"]["pid_ki"], cfg["put_hanoi2"]["pid_kd"])
|
||||||
|
else:
|
||||||
|
var.pid_turning.set(cfg["put_hanoi2"]["pid_kp"], cfg["put_hanoi2"]["pid_ki"], cfg["put_hanoi2"]["pid_kd"])
|
||||||
|
# time.sleep(2)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class put_hanoi3():
|
class put_hanoi3():
|
||||||
@@ -1130,10 +1208,10 @@ class put_hanoi3():
|
|||||||
while by_cmd.send_position_axis_x(1, 0) == -1:
|
while by_cmd.send_position_axis_x(1, 0) == -1:
|
||||||
pass
|
pass
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
# while by_cmd.send_angle_claw_arm(220) == -1:
|
# while by_cmd.send_angle_claw_arm(225) == -1:
|
||||||
# pass
|
|
||||||
# while by_cmd.send_angle_claw(90) == -1:
|
|
||||||
# pass
|
# pass
|
||||||
|
while by_cmd.send_angle_claw(85) == -1:
|
||||||
|
pass
|
||||||
def find(self):
|
def find(self):
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
return True
|
return True
|
||||||
@@ -1209,7 +1287,7 @@ class move_area1():
|
|||||||
# 任务检查间隔
|
# 任务检查间隔
|
||||||
by_cmd.send_position_axis_x(1, 150)
|
by_cmd.send_position_axis_x(1, 150)
|
||||||
# time.sleep(1)
|
# time.sleep(1)
|
||||||
by_cmd.send_angle_claw_arm(220)
|
by_cmd.send_angle_claw_arm(225)
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -1361,7 +1439,7 @@ class kick_ass():
|
|||||||
logger.info("扫黑除暴初始化")
|
logger.info("扫黑除暴初始化")
|
||||||
self.pos_gap1 = cfg['kick_ass']['pos_gap1']
|
self.pos_gap1 = cfg['kick_ass']['pos_gap1']
|
||||||
self.pos_gap2 = cfg['kick_ass']['pos_gap2']
|
self.pos_gap2 = cfg['kick_ass']['pos_gap2']
|
||||||
self.target_person = cfg_args['kick_ass']['target_person']
|
self.target_person = cfg_args['lane_mode']['mode_index']
|
||||||
|
|
||||||
# by_cmd.send_angle_claw(15)
|
# by_cmd.send_angle_claw(15)
|
||||||
by_cmd.send_position_axis_x(1, 160)
|
by_cmd.send_position_axis_x(1, 160)
|
||||||
@@ -1387,17 +1465,28 @@ class kick_ass():
|
|||||||
else:
|
else:
|
||||||
target_distance = self.pos_gap1 + (self.target_person - 1) * self.pos_gap2 + (self.target_person - 1) * 10
|
target_distance = self.pos_gap1 + (self.target_person - 1) * self.pos_gap2 + (self.target_person - 1) * 10
|
||||||
by_cmd.send_distance_x(10, target_distance)
|
by_cmd.send_distance_x(10, target_distance)
|
||||||
|
|
||||||
logger.info(f"target distance {target_distance}")
|
logger.info(f"target distance {target_distance}")
|
||||||
time.sleep(1.5 + (self.target_person - 1) * 0.7 )
|
time.sleep(1.5 + (self.target_person - 1) * 0.7 )
|
||||||
car_stop()
|
car_stop()
|
||||||
|
|
||||||
# by_cmd.send_angle_claw_arm(220)
|
# by_cmd.send_angle_claw_arm(225)
|
||||||
# time.sleep(0.5)
|
# time.sleep(0.5)
|
||||||
by_cmd.send_position_axis_x(1, 20)
|
by_cmd.send_position_axis_x(1, 20)
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
by_cmd.send_position_axis_x(1, 120)
|
by_cmd.send_position_axis_x(1, 120)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
logger.debug("結束任務,前進四")
|
logger.debug("結束任務,前進四")
|
||||||
|
|
||||||
|
filter.switch_camera(2)
|
||||||
|
for _ in range(3):
|
||||||
|
by_cmd.send_speed_x(15)
|
||||||
|
while True:
|
||||||
|
ret, box = filter.get(tlabel.BASE)
|
||||||
|
if ret:
|
||||||
|
error = (box[0][2] + box[0][0] - 320) / 2
|
||||||
|
by_cmd.send_speed_omega(-error * 0.8)
|
||||||
|
time.sleep(0.02)
|
||||||
# by_cmd.send_speed_x(25)
|
# by_cmd.send_speed_x(25)
|
||||||
# time.sleep(4)
|
# time.sleep(4)
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -1367,7 +1367,7 @@ class kick_ass():
|
|||||||
logger.info("扫黑除暴初始化")
|
logger.info("扫黑除暴初始化")
|
||||||
self.pos_gap1 = cfg['kick_ass']['pos_gap1']
|
self.pos_gap1 = cfg['kick_ass']['pos_gap1']
|
||||||
self.pos_gap2 = cfg['kick_ass']['pos_gap2']
|
self.pos_gap2 = cfg['kick_ass']['pos_gap2']
|
||||||
self.target_person = cfg_args['kick_ass']['target_person']
|
self.target_person = cfg_args['lane_mode']['mode_index']
|
||||||
|
|
||||||
# by_cmd.send_angle_claw(15)
|
# by_cmd.send_angle_claw(15)
|
||||||
by_cmd.send_position_axis_x(1, 160)
|
by_cmd.send_position_axis_x(1, 160)
|
||||||
|
|||||||
@@ -1360,7 +1360,7 @@ class kick_ass():
|
|||||||
logger.info("扫黑除暴初始化")
|
logger.info("扫黑除暴初始化")
|
||||||
self.pos_gap1 = cfg['kick_ass']['pos_gap1']
|
self.pos_gap1 = cfg['kick_ass']['pos_gap1']
|
||||||
self.pos_gap2 = cfg['kick_ass']['pos_gap2']
|
self.pos_gap2 = cfg['kick_ass']['pos_gap2']
|
||||||
self.target_person = cfg_args['kick_ass']['target_person']
|
self.target_person = cfg_args['lane_mode']['mode_index']
|
||||||
|
|
||||||
# by_cmd.send_angle_claw(15)
|
# by_cmd.send_angle_claw(15)
|
||||||
by_cmd.send_position_axis_x(1, 160)
|
by_cmd.send_position_axis_x(1, 160)
|
||||||
|
|||||||
1487
subtask_7154.py
Normal file
1487
subtask_7154.py
Normal file
File diff suppressed because it is too large
Load Diff
1496
subtask_raw.py
Normal file
1496
subtask_raw.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -34,15 +34,16 @@ def signal_handler(sig, frame):
|
|||||||
|
|
||||||
offset = 0
|
offset = 0
|
||||||
signal.signal(signal.SIGTERM, signal_handler)
|
signal.signal(signal.SIGTERM, signal_handler)
|
||||||
|
cmd_py_obj.send_speed_x(15)
|
||||||
while True:
|
while True:
|
||||||
time.sleep(0.2)
|
|
||||||
ret, box = filter.get(tlabel.LMARK)
|
time.sleep(0.02)
|
||||||
if ret:
|
ret, box = filter.get(tlabel.BASE)
|
||||||
# 宽度大于 41 停车
|
|
||||||
print(f"width: {box[0][2] - box[0][0]} height: {box[0][3] - box[0][1]}")
|
|
||||||
# if ret:
|
# if ret:
|
||||||
# error = (box[0][2] + box[0][0] - 320) / 2 + offset
|
# 宽度大于 41 停车
|
||||||
# print(error)
|
# print(f"width: {box[0][2] - box[0][0]} height: {box[0][3] - box[0][1]}")
|
||||||
|
if ret:
|
||||||
# cmd_py_obj.send_speed_omega(-error * 0.8)
|
error = (box[0][2] + box[0][0] - 320) / 2 + offset
|
||||||
|
print(error)
|
||||||
|
cmd_py_obj.send_speed_omega(-error * 0.8)
|
||||||
car_stop()
|
car_stop()
|
||||||
@@ -16,18 +16,18 @@ socket.connect("tcp://localhost:6667")
|
|||||||
logger.info("subtask yolo client init")
|
logger.info("subtask yolo client init")
|
||||||
|
|
||||||
filter = label_filter(socket)
|
filter = label_filter(socket)
|
||||||
filter.switch_camera(1)
|
filter.switch_camera(2)
|
||||||
|
|
||||||
|
|
||||||
find_counts = 0
|
# find_counts = 0
|
||||||
offset = 19
|
# offset = 19
|
||||||
label = [tlabel.LPILLER, tlabel.MPILLER, tlabel.SPILLER]
|
# label = [tlabel.LPILLER, tlabel.MPILLER, tlabel.SPILLER]
|
||||||
label = tlabel.TPLATFORM
|
# label = tlabel.TPLATFORM
|
||||||
while True:
|
while True:
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
ret, box = filter.get(tlabel.TPLATFORM)
|
ret, box = filter.get(tlabel.BASE)
|
||||||
if ret:
|
if ret:
|
||||||
error = (box[0][2] + box[0][0] - 320) / 2 + offset
|
error = (box[0][2] + box[0][0] - 320) / 2
|
||||||
logger.error(error)
|
logger.error(error)
|
||||||
|
|
||||||
# label = tlabel.HOSPITAL
|
# label = tlabel.HOSPITAL
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ task_speed = 0
|
|||||||
pid_argv = {"kp" : 1.2, "ki" : 0, "kd" : 0} # 1.2
|
pid_argv = {"kp" : 1.2, "ki" : 0, "kd" : 0} # 1.2
|
||||||
|
|
||||||
# 转向 pid 对象
|
# 转向 pid 对象
|
||||||
pid_turning = PidWrap(pid_argv["kp"], pid_argv["ki"], pid_argv["kd"], output_limits=60) # FIXME 6_9 模型为 50
|
# pid_turning = PidWrap(pid_argv["kp"], pid_argv["ki"], pid_argv["kd"], output_limits=70) # FIXME 6_9 模型为 60
|
||||||
|
pid_turning = PidWrap(pid_argv["kp"], pid_argv["ki"], pid_argv["kd"], output_limits=60) # FIXME 6_9 模型为 60
|
||||||
|
|
||||||
llm_text = ''
|
llm_text = ''
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user