This commit is contained in:
2026-01-15 21:57:21 +08:00
parent 085b2032af
commit ec4c06ea8c
+8 -9
View File
@@ -159,9 +159,6 @@ def auto_land_predictive(
status = {'result': 'failed', 'logs': []}
# WAIT 阶段按折减推力估算刹车距离(提前点火,补偿点火/推力建立延迟)
# 低空/接地参数(用于“最后几米慢下来”)
touchdown_vspeed_tol = 0.6 # m/s:认为“软着陆”的竖直速度容差
low_altitude_pid_switch = 10.0 # m:低于该高度切换到竖直速度控制
@@ -244,13 +241,12 @@ def auto_land_predictive(
print(msg)
# 点火条件:进入刹车距离 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:
break
# 确保仍在滑行
vessel.control.throttle = 0.0
time.sleep(0.01)
time.sleep(0.05)
# 燃烧闭环:根据 remaining_alt 反推需要的减速度 -> 油门
while True:
@@ -324,12 +320,13 @@ def auto_land_predictive(
f'srf_speed={srf_speed:.2f} vs={v_speed:.2f} '
f'v_down={v_down:.2f} vf_down={vf_down:.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)
print(msg)
time.sleep(0.01)
time.sleep(0.05)
finally:
try:
@@ -348,6 +345,8 @@ def auto_land_predictive(
return status
if __name__ == "__main__":
xxx = auto_land_predictive(bottom_clearance_margin=20)
xxx = auto_land_predictive(
bottom_clearance_margin=30,
)
print(xxx)
print('done')