update
This commit is contained in:
@@ -159,9 +159,6 @@ def auto_land_predictive(
|
|||||||
|
|
||||||
status = {'result': 'failed', 'logs': []}
|
status = {'result': 'failed', 'logs': []}
|
||||||
|
|
||||||
# WAIT 阶段按折减推力估算刹车距离(提前点火,补偿点火/推力建立延迟)
|
|
||||||
|
|
||||||
|
|
||||||
# 低空/接地参数(用于“最后几米慢下来”)
|
# 低空/接地参数(用于“最后几米慢下来”)
|
||||||
touchdown_vspeed_tol = 0.6 # m/s:认为“软着陆”的竖直速度容差
|
touchdown_vspeed_tol = 0.6 # m/s:认为“软着陆”的竖直速度容差
|
||||||
low_altitude_pid_switch = 10.0 # m:低于该高度切换到竖直速度控制
|
low_altitude_pid_switch = 10.0 # m:低于该高度切换到竖直速度控制
|
||||||
@@ -244,13 +241,12 @@ def auto_land_predictive(
|
|||||||
print(msg)
|
print(msg)
|
||||||
|
|
||||||
# 点火条件:进入刹车距离 or 推力未知(inf)但高度很低
|
# 点火条件:进入刹车距离 or 推力未知(inf)但高度很低
|
||||||
should_ignite = (remaining_alt <= braking_dist) or (braking_dist == float('inf') and remaining_alt < 200.0)
|
should_ignite = (remaining_alt <= braking_dist + v_speed) or (braking_dist == float('inf') and remaining_alt < 200.0)
|
||||||
if should_ignite:
|
if should_ignite:
|
||||||
break
|
break
|
||||||
|
|
||||||
# 确保仍在滑行
|
# 确保仍在滑行
|
||||||
vessel.control.throttle = 0.0
|
time.sleep(0.05)
|
||||||
time.sleep(0.01)
|
|
||||||
|
|
||||||
# 燃烧闭环:根据 remaining_alt 反推需要的减速度 -> 油门
|
# 燃烧闭环:根据 remaining_alt 反推需要的减速度 -> 油门
|
||||||
while True:
|
while True:
|
||||||
@@ -325,11 +321,12 @@ def auto_land_predictive(
|
|||||||
f'v_down={v_down:.2f} vf_down={vf_down:.2f} '
|
f'v_down={v_down:.2f} vf_down={vf_down:.2f} '
|
||||||
f'a_req_up={a_req_up:.2f} throttle={throttle:.2f} '
|
f'a_req_up={a_req_up:.2f} throttle={throttle:.2f} '
|
||||||
f'landed={int(is_landed)} '
|
f'landed={int(is_landed)} '
|
||||||
|
f'current_thrust={vessel.thrust:.1f}kN'
|
||||||
)
|
)
|
||||||
status['logs'].append(msg)
|
status['logs'].append(msg)
|
||||||
print(msg)
|
print(msg)
|
||||||
|
|
||||||
time.sleep(0.01)
|
time.sleep(0.05)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
try:
|
try:
|
||||||
@@ -348,6 +345,8 @@ def auto_land_predictive(
|
|||||||
return status
|
return status
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
xxx = auto_land_predictive(bottom_clearance_margin=20)
|
xxx = auto_land_predictive(
|
||||||
|
bottom_clearance_margin=30,
|
||||||
|
)
|
||||||
print(xxx)
|
print(xxx)
|
||||||
print('done')
|
print('done')
|
||||||
Reference in New Issue
Block a user