修改飞机没有回到起点的问题
This commit is contained in:
parent
d647ab17bc
commit
d9e5a77a28
@ -1593,11 +1593,12 @@ class AircraftRouteManager:
|
||||
|
||||
route_completed = follower.update_position_on_route(aircraft, speed, elapsed_time)
|
||||
if route_completed:
|
||||
# 进港完成后重新开始
|
||||
# 进港完成后重新开始,立即跳转到起点
|
||||
follower.start_route("arrival")
|
||||
if follower.route_points:
|
||||
aircraft["latitude"] = follower.route_points[0][0]
|
||||
aircraft["longitude"] = follower.route_points[0][1]
|
||||
logging.info(f"航空器 {aircraft.get('flightNo')} 进港完成,重新开始从起点: ({follower.route_points[0][0]:.6f}, {follower.route_points[0][1]:.6f})")
|
||||
|
||||
def _update_departure_only_aircraft(self, aircraft: dict[str, Any], follower: AircraftRouteFollower,
|
||||
speed: float, elapsed_time: float):
|
||||
@ -1611,11 +1612,12 @@ class AircraftRouteManager:
|
||||
|
||||
route_completed = follower.update_position_on_route(aircraft, speed, elapsed_time)
|
||||
if route_completed:
|
||||
# 出港完成后重新开始
|
||||
# 出港完成后重新开始,立即跳转到起点
|
||||
follower.start_route("departure")
|
||||
if follower.route_points:
|
||||
aircraft["latitude"] = follower.route_points[0][0]
|
||||
aircraft["longitude"] = follower.route_points[0][1]
|
||||
logging.info(f"航空器 {aircraft.get('flightNo')} 出港完成,重新开始从起点: ({follower.route_points[0][0]:.6f}, {follower.route_points[0][1]:.6f})")
|
||||
|
||||
|
||||
# 创建全局路径跟随管理器
|
||||
@ -1625,13 +1627,13 @@ route_manager = AircraftRouteManager()
|
||||
# CA1234:纯出港模式,模拟出港飞机
|
||||
route_manager.add_aircraft("CA1234", {
|
||||
'primary_behavior': 'departure',
|
||||
'speed': 30.0
|
||||
'speed': 50.0
|
||||
})
|
||||
|
||||
# MU5123:纯进港模式,使用真实进港路由
|
||||
route_manager.add_aircraft("MU5123", {
|
||||
'primary_behavior': 'arrival',
|
||||
'speed': 30.0
|
||||
'speed': 50.0 # 设置速度为50 km/h,约45秒完成一个周期
|
||||
})
|
||||
|
||||
# 初始化飞机数据
|
||||
@ -1654,7 +1656,7 @@ def initialize_aircraft_data():
|
||||
"time": int(time.time() * 1000),
|
||||
"altitude": 0.0,
|
||||
"trackNumber": 1001,
|
||||
"speed": 30.0,
|
||||
"speed": 50.0,
|
||||
"use_route_following": True
|
||||
},
|
||||
{
|
||||
@ -1664,7 +1666,7 @@ def initialize_aircraft_data():
|
||||
"time": int(time.time() * 1000),
|
||||
"altitude": 0.0,
|
||||
"trackNumber": 1002,
|
||||
"speed": 30.0,
|
||||
"speed": 50.0,
|
||||
"use_route_following": True
|
||||
}
|
||||
]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user