国赛出发前版本
fix: 补充 action 列表检查 pref: 修改 BBALL offset 值 (未同步到其他备份 subtask.py 中) 套用8822参数
This commit is contained in:
@@ -15,7 +15,7 @@ pid_ki = 0
|
|||||||
pid_kd = 0
|
pid_kd = 0
|
||||||
|
|
||||||
[up_tower]
|
[up_tower]
|
||||||
pid_kp = 1.8
|
pid_kp = 1.3
|
||||||
pid_ki = 0
|
pid_ki = 0
|
||||||
pid_kd = 0
|
pid_kd = 0
|
||||||
|
|
||||||
|
|||||||
31
subtask.py
31
subtask.py
@@ -555,7 +555,7 @@ class put_block():
|
|||||||
ret, box = filter.get(tlabel.HOSPITAL)
|
ret, box = filter.get(tlabel.HOSPITAL)
|
||||||
if ret > 0:
|
if ret > 0:
|
||||||
width = box[0][2] - box[0][0]
|
width = box[0][2] - box[0][0]
|
||||||
if width > 125: #135 130 128
|
if width > 125: #FIXME maybe 125 batter
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
def exec(self):
|
def exec(self):
|
||||||
@@ -650,7 +650,7 @@ class get_bball():
|
|||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
for _ in range(3):
|
for _ in range(3):
|
||||||
by_cmd.send_position_axis_z(30, 155)
|
by_cmd.send_position_axis_z(30, 155)
|
||||||
calibrate_right_new(tlabel.BBALL, offset = 18, run = True, run_speed = 5)
|
calibrate_right_new(tlabel.BBALL, offset = 10, run = True, run_speed = 5)
|
||||||
logger.info("抓蓝色球")
|
logger.info("抓蓝色球")
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_angle_claw_arm(45)
|
by_cmd.send_angle_claw_arm(45)
|
||||||
@@ -709,7 +709,7 @@ class up_tower():
|
|||||||
calibrate_new(tlabel.TOWER, offset = 20, run = True)
|
calibrate_new(tlabel.TOWER, offset = 20, run = True)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
# calibrate(tlabel.TOWER, 27, False, 6)
|
# calibrate(tlabel.TOWER, 27, False, 6)
|
||||||
by_cmd.send_distance_x(-10, 100)
|
by_cmd.send_distance_x(-10, 100) # used to be 120
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
# 上古參數
|
# 上古參數
|
||||||
# by_cmd.send_distance_y(-10, 50) # 80
|
# by_cmd.send_distance_y(-10, 50) # 80
|
||||||
@@ -724,10 +724,11 @@ class up_tower():
|
|||||||
# by_cmd.send_speed_y(-10)
|
# by_cmd.send_speed_y(-10)
|
||||||
# time.sleep(0.15)
|
# time.sleep(0.15)
|
||||||
# 8822
|
# 8822
|
||||||
# by_cmd.send_distance_y(-10, 50)
|
by_cmd.send_distance_y(-10, 50)
|
||||||
# 891
|
|
||||||
by_cmd.send_distance_y(-10, 35)
|
|
||||||
time.sleep(0.3)
|
time.sleep(0.3)
|
||||||
|
# 891
|
||||||
|
# by_cmd.send_distance_y(-10, 35)
|
||||||
|
# time.sleep(0.3)
|
||||||
|
|
||||||
by_cmd.send_angle_zhuan(10)
|
by_cmd.send_angle_zhuan(10)
|
||||||
time.sleep(12)
|
time.sleep(12)
|
||||||
@@ -784,11 +785,11 @@ class get_rball():
|
|||||||
# time.sleep(2)
|
# time.sleep(2)
|
||||||
# car_stop()
|
# car_stop()
|
||||||
# 8822 参数
|
# 8822 参数
|
||||||
# by_cmd.send_distance_y(-15, 40)
|
|
||||||
# time.sleep(1.5)
|
|
||||||
# 891 参数
|
|
||||||
by_cmd.send_distance_y(-15, 40)
|
by_cmd.send_distance_y(-15, 40)
|
||||||
time.sleep(0.3)
|
time.sleep(0.5)
|
||||||
|
# 891 参数
|
||||||
|
# by_cmd.send_distance_y(-15, 40)
|
||||||
|
# time.sleep(0.3)
|
||||||
calibrate_new(tlabel.RBALL,offset = 44, run = True)
|
calibrate_new(tlabel.RBALL,offset = 44, run = True)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
logger.info("抓红球")
|
logger.info("抓红球")
|
||||||
@@ -1547,6 +1548,16 @@ class move_area2():
|
|||||||
if len(resp_commands) == 0:
|
if len(resp_commands) == 0:
|
||||||
return
|
return
|
||||||
action_list = resp_commands
|
action_list = resp_commands
|
||||||
|
|
||||||
|
# 先检查一下 action 是否生成正确,如果不正确直接跳过
|
||||||
|
actions_keys = self.action_dict.keys()
|
||||||
|
try:
|
||||||
|
for action in action_list:
|
||||||
|
if not (action.get('action') in actions_keys):
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
# 进入停车区域
|
# 进入停车区域
|
||||||
by_cmd.send_distance_y(10, 450)
|
by_cmd.send_distance_y(10, 450)
|
||||||
time.sleep((450 * 5 / 1000) + 0.5)
|
time.sleep((450 * 5 / 1000) + 0.5)
|
||||||
|
|||||||
@@ -1548,6 +1548,16 @@ class move_area2():
|
|||||||
if len(resp_commands) == 0:
|
if len(resp_commands) == 0:
|
||||||
return
|
return
|
||||||
action_list = resp_commands
|
action_list = resp_commands
|
||||||
|
|
||||||
|
# 先检查一下 action 是否生成正确,如果不正确直接跳过
|
||||||
|
actions_keys = self.action_dict.keys()
|
||||||
|
try:
|
||||||
|
for action in action_list:
|
||||||
|
if not (action.get('action') in actions_keys):
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
# 进入停车区域
|
# 进入停车区域
|
||||||
by_cmd.send_distance_y(10, 450)
|
by_cmd.send_distance_y(10, 450)
|
||||||
time.sleep((450 * 5 / 1000) + 0.5)
|
time.sleep((450 * 5 / 1000) + 0.5)
|
||||||
|
|||||||
@@ -1547,6 +1547,16 @@ class move_area2():
|
|||||||
if len(resp_commands) == 0:
|
if len(resp_commands) == 0:
|
||||||
return
|
return
|
||||||
action_list = resp_commands
|
action_list = resp_commands
|
||||||
|
|
||||||
|
# 先检查一下 action 是否生成正确,如果不正确直接跳过
|
||||||
|
actions_keys = self.action_dict.keys()
|
||||||
|
try:
|
||||||
|
for action in action_list:
|
||||||
|
if not (action.get('action') in actions_keys):
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
# 进入停车区域
|
# 进入停车区域
|
||||||
by_cmd.send_distance_y(10, 450)
|
by_cmd.send_distance_y(10, 450)
|
||||||
time.sleep((450 * 5 / 1000) + 0.5)
|
time.sleep((450 * 5 / 1000) + 0.5)
|
||||||
|
|||||||
@@ -555,7 +555,7 @@ class put_block():
|
|||||||
ret, box = filter.get(tlabel.HOSPITAL)
|
ret, box = filter.get(tlabel.HOSPITAL)
|
||||||
if ret > 0:
|
if ret > 0:
|
||||||
width = box[0][2] - box[0][0]
|
width = box[0][2] - box[0][0]
|
||||||
if width > 130: #135
|
if width > 125: #135
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
def exec(self):
|
def exec(self):
|
||||||
@@ -650,7 +650,7 @@ class get_bball():
|
|||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
for _ in range(3):
|
for _ in range(3):
|
||||||
by_cmd.send_position_axis_z(30, 155)
|
by_cmd.send_position_axis_z(30, 155)
|
||||||
calibrate_right_new(tlabel.BBALL, offset = 18, run = True, run_speed = 5)
|
calibrate_right_new(tlabel.BBALL, offset = 10, run = True, run_speed = 5)
|
||||||
logger.info("抓蓝色球")
|
logger.info("抓蓝色球")
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
by_cmd.send_angle_claw_arm(45)
|
by_cmd.send_angle_claw_arm(45)
|
||||||
@@ -775,7 +775,7 @@ class get_rball():
|
|||||||
by_cmd.send_angle_scoop(20)
|
by_cmd.send_angle_scoop(20)
|
||||||
# 上古參數
|
# 上古參數
|
||||||
# by_cmd.send_distance_y(-15, 50) # 50 # 70
|
# by_cmd.send_distance_y(-15, 50) # 50 # 70
|
||||||
by_cmd.send_istance_y(-15, 40) # 50 # 70
|
by_cmd.send_distance_y(-15, 40) # 50 # 70
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
# 6_9 參數
|
# 6_9 參數
|
||||||
# by_cmd.send_distance_y(-15, 35)
|
# by_cmd.send_distance_y(-15, 35)
|
||||||
@@ -1548,6 +1548,16 @@ class move_area2():
|
|||||||
if len(resp_commands) == 0:
|
if len(resp_commands) == 0:
|
||||||
return
|
return
|
||||||
action_list = resp_commands
|
action_list = resp_commands
|
||||||
|
|
||||||
|
# 先检查一下 action 是否生成正确,如果不正确直接跳过
|
||||||
|
actions_keys = self.action_dict.keys()
|
||||||
|
try:
|
||||||
|
for action in action_list:
|
||||||
|
if not (action.get('action') in actions_keys):
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
# 进入停车区域
|
# 进入停车区域
|
||||||
by_cmd.send_distance_y(10, 450)
|
by_cmd.send_distance_y(10, 450)
|
||||||
time.sleep((450 * 5 / 1000) + 0.5)
|
time.sleep((450 * 5 / 1000) + 0.5)
|
||||||
|
|||||||
Reference in New Issue
Block a user