update
This commit is contained in:
@@ -99,6 +99,9 @@ def auto_land_predictive(host='localhost', port=50000, target_altitude=0.5, targ
|
||||
|
||||
status = {'result': 'failed', 'logs': []}
|
||||
|
||||
# WAIT 阶段按折减推力估算刹车距离(提前点火,补偿点火/推力建立延迟)
|
||||
thrust_discount_wait = 0.9
|
||||
|
||||
def _get_g(local_vessel):
|
||||
try:
|
||||
body = local_vessel.orbit.body
|
||||
@@ -153,7 +156,6 @@ def auto_land_predictive(host='localhost', port=50000, target_altitude=0.5, targ
|
||||
pass
|
||||
|
||||
# 倒计时/等待点火
|
||||
ignited = False
|
||||
last_log_t = 0.0
|
||||
while True:
|
||||
alt, srf_speed, v_speed, mass, avail_thrust, g_local, situation_name = _read_state()
|
||||
@@ -164,10 +166,11 @@ def auto_land_predictive(host='localhost', port=50000, target_altitude=0.5, targ
|
||||
vf = max(0.0, abs(float(target_vspeed)))
|
||||
|
||||
# 若推力不可用,直接点火尝试(避免永远等不到)
|
||||
if mass <= 0 or avail_thrust <= 1e-6:
|
||||
avail_thrust_wait = float(avail_thrust) * float(thrust_discount_wait)
|
||||
if mass <= 0 or avail_thrust_wait <= 1e-6:
|
||||
a_max_up = 0.0
|
||||
else:
|
||||
a_max_up = max(0.0, avail_thrust / mass - g_local)
|
||||
a_max_up = max(0.0, avail_thrust_wait / mass - g_local)
|
||||
|
||||
if a_max_up <= 1e-6:
|
||||
braking_dist = float('inf')
|
||||
@@ -185,7 +188,7 @@ def auto_land_predictive(host='localhost', port=50000, target_altitude=0.5, targ
|
||||
msg = (
|
||||
f'WAIT alt={alt:.1f} rem={remaining_alt:.1f} '
|
||||
f'srf_speed={srf_speed:.2f} vs={v_speed:.2f} '
|
||||
f'a_max_up={a_max_up:.2f} braking={braking_dist:.1f} '
|
||||
f'a_max_up={a_max_up:.2f} braking={braking_dist:.1f} thr_disc={thrust_discount_wait:.2f} '
|
||||
f'countdown={(countdown if countdown is not None else float("nan")):.2f}'
|
||||
)
|
||||
status['logs'].append(msg)
|
||||
@@ -208,7 +211,6 @@ def auto_land_predictive(host='localhost', port=50000, target_altitude=0.5, targ
|
||||
vessel.control.activate_next_stage()
|
||||
except Exception:
|
||||
pass
|
||||
ignited = True
|
||||
|
||||
# 燃烧闭环:根据 remaining_alt 反推需要的减速度 -> 油门
|
||||
while True:
|
||||
|
||||
Reference in New Issue
Block a user