Reorganize flight planning.

Previously we were trying to make every potential flight plan look
just like a strike mission's flight plan. This led to a lot of special
case behavior in several places that was causing us to misplan TOTs.

I've reorganized this such that there's now an explicit `FlightPlan`
class, and any specialized behavior is handled by the subclasses.

I've also taken the opportunity to alter the behavior of CAS and
front-line CAP missions. These no longer involve the usual formation
waypoints. Instead the CAP will aim to be on station at the time that
the CAS mission reaches its ingress point, and leave at its egress
time. Both flights fly directly to the point with a start time
configured for a rendezvous.

It might be worth adding hold points back to every flight plan just to
ensure that non-formation flights don't end up with a very low speed
enroute to the target if they perform ground ops quicker than
expected.
This commit is contained in:
Dan Albert
2020-10-30 15:54:20 -07:00
parent d94c57afd6
commit 88b9ed29ba
17 changed files with 1033 additions and 669 deletions

View File

@@ -157,10 +157,10 @@ class FlightPlanBuilder:
self._format_time(waypoint.waypoint.departure_time),
])
def _format_time(self, time: Optional[int]) -> str:
def _format_time(self, time: Optional[datetime.timedelta]) -> str:
if time is None:
return ""
local_time = self.start_time + datetime.timedelta(seconds=time)
local_time = self.start_time + time
return local_time.strftime(f"%H:%M:%S")
def _waypoint_distance(self, waypoint: FlightWaypoint) -> str:
@@ -189,8 +189,8 @@ class FlightPlanBuilder:
distance = meter_to_nm(self.last_waypoint.position.distance_to_point(
waypoint.position
))
duration = (waypoint.tot - last_time) / 3600
return f"{int(distance / duration)} kt"
duration = waypoint.tot - last_time
return f"{int(distance / duration.total_seconds())} kt"
def build(self) -> List[List[str]]:
return self.rows