mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
FLIGHTCONTROL
- Improved Taxi comms
This commit is contained in:
parent
18581e4a78
commit
321b2d761d
@ -631,7 +631,7 @@ function ASTAR.Pathline(nodeA, nodeB, distmax)
|
|||||||
local seg=segA --Core.Pathline#PATHLINE.Segment
|
local seg=segA --Core.Pathline#PATHLINE.Segment
|
||||||
|
|
||||||
if dist<distmax and (nodeA.pathpoint.uid==seg.p1.uid or nodeA.pathpoint.uid==seg.p2.uid) then
|
if dist<distmax and (nodeA.pathpoint.uid==seg.p1.uid or nodeA.pathpoint.uid==seg.p2.uid) then
|
||||||
env.info(string.format("FF NodeB=%d [pathline=%s] is close to NodeA=%d [pathline=%s] ==> valid neighbour", nodeB.id, nodeB.pathline.name, nodeA.id, nodeA.pathline.name))
|
--env.info(string.format("FF NodeB=%d [pathline=%s] is close to NodeA=%d [pathline=%s] ==> valid neighbour", nodeB.id, nodeB.pathline.name, nodeA.id, nodeA.pathline.name))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -641,7 +641,7 @@ function ASTAR.Pathline(nodeA, nodeB, distmax)
|
|||||||
local seg=segB --Core.Pathline#PATHLINE.Segment
|
local seg=segB --Core.Pathline#PATHLINE.Segment
|
||||||
|
|
||||||
if dist<distmax and (nodeB.pathpoint.uid==seg.p1.uid or nodeB.pathpoint.uid==seg.p2.uid) then
|
if dist<distmax and (nodeB.pathpoint.uid==seg.p1.uid or nodeB.pathpoint.uid==seg.p2.uid) then
|
||||||
env.info(string.format("FF NodeA=%d [pathline=%s] is close to NodeB=%d [pathline=%s] ==> valid neighbour", nodeA.id, nodeA.pathline.name, nodeB.id, nodeB.pathline.name))
|
--env.info(string.format("FF NodeA=%d [pathline=%s] is close to NodeB=%d [pathline=%s] ==> valid neighbour", nodeA.id, nodeA.pathline.name, nodeB.id, nodeB.pathline.name))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -675,8 +675,8 @@ end
|
|||||||
-- @return #number Distance between the two nodes.
|
-- @return #number Distance between the two nodes.
|
||||||
function ASTAR.Dist2D(nodeA, nodeB)
|
function ASTAR.Dist2D(nodeA, nodeB)
|
||||||
local dist=nodeA.coordinate:Get2DDistance(nodeB.coordinate)
|
local dist=nodeA.coordinate:Get2DDistance(nodeB.coordinate)
|
||||||
local text=string.format("FF Cost Dist2D NodeA=%d-->NodeB=%d = %.1f", nodeA.id, nodeB.id, dist)
|
--local text=string.format("FF Cost Dist2D NodeA=%d-->NodeB=%d = %.1f", nodeA.id, nodeB.id, dist)
|
||||||
env.info(text)
|
--env.info(text)
|
||||||
return dist
|
return dist
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -384,8 +384,8 @@ FLIGHTCONTROL.version="0.7.3"
|
|||||||
--- Create a new FLIGHTCONTROL class object for an associated airbase.
|
--- Create a new FLIGHTCONTROL class object for an associated airbase.
|
||||||
-- @param #FLIGHTCONTROL self
|
-- @param #FLIGHTCONTROL self
|
||||||
-- @param #string AirbaseName Name of the airbase.
|
-- @param #string AirbaseName Name of the airbase.
|
||||||
-- @param #number Frequency Radio frequency in MHz. Default 143.00 MHz. Can also be given as a `#table` of multiple frequencies.
|
-- @param #number Frequency Tower radio frequency in MHz. Default 143.00 MHz. Can also be given as a `#table` of multiple frequencies.
|
||||||
-- @param #number Modulation Radio modulation: 0=AM (default), 1=FM. See `radio.modulation.AM` and `radio.modulation.FM` enumerators. Can also be given as a `#table` of multiple modulations.
|
-- @param #number Modulation Tower radio modulation: 0=AM (default), 1=FM. See `radio.modulation.AM` and `radio.modulation.FM` enumerators. Can also be given as a `#table` of multiple modulations.
|
||||||
-- @param #string PathToSRS Path to the directory, where SRS is located.
|
-- @param #string PathToSRS Path to the directory, where SRS is located.
|
||||||
-- @param #number Port Port of SRS Server, defaults to 5002
|
-- @param #number Port Port of SRS Server, defaults to 5002
|
||||||
-- @param #string GoogleKey Path to the Google JSON-Key.
|
-- @param #string GoogleKey Path to the Google JSON-Key.
|
||||||
@ -1395,9 +1395,9 @@ function FLIGHTCONTROL:_CheckQueues()
|
|||||||
|
|
||||||
if isholding then
|
if isholding then
|
||||||
|
|
||||||
--------------------
|
--------------
|
||||||
-- Holding flight --
|
-- Arrivals --
|
||||||
--------------------
|
--------------
|
||||||
|
|
||||||
-- No other flight is taking off and number of landing flights is below threshold.
|
-- No other flight is taking off and number of landing flights is below threshold.
|
||||||
if self:_CheckFlightLanding(flight) then
|
if self:_CheckFlightLanding(flight) then
|
||||||
@ -1451,9 +1451,9 @@ function FLIGHTCONTROL:_CheckQueues()
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
--------------------
|
----------------
|
||||||
-- Takeoff flight --
|
-- Departures --
|
||||||
--------------------
|
----------------
|
||||||
|
|
||||||
-- No other flight is taking off or landing.
|
-- No other flight is taking off or landing.
|
||||||
if self:_CheckFlightTakeoff(flight) then
|
if self:_CheckFlightTakeoff(flight) then
|
||||||
@ -1463,9 +1463,34 @@ function FLIGHTCONTROL:_CheckQueues()
|
|||||||
|
|
||||||
-- Runway.
|
-- Runway.
|
||||||
local runway=self:GetActiveRunwayText(true)
|
local runway=self:GetActiveRunwayText(true)
|
||||||
|
|
||||||
|
local rwy=self:GetActiveRunwayTakeoff()
|
||||||
|
|
||||||
|
local coord=flight:GetCoordinate()
|
||||||
|
local taxipath, taxiways=self.airbase:FindTaxiwaysFromAtoB(coord, rwy.position)
|
||||||
|
|
||||||
|
taxipath:Draw(true)
|
||||||
|
|
||||||
-- Message.
|
-- Message.
|
||||||
local text=string.format("%s, %s, taxi to runway %s, hold short", callsign, self.alias, runway)
|
local text=string.format("%s, %s, taxi to runway %s", callsign, self.alias, runway)
|
||||||
|
|
||||||
|
local taxiroute=""
|
||||||
|
if taxipath and taxiways then
|
||||||
|
taxiroute=taxiroute.." via "
|
||||||
|
for _,_pathline in pairs(taxiways) do
|
||||||
|
local pathline=_pathline --Core.Pathline#PATHLINE
|
||||||
|
local name=UTILS.Split(pathline.name, " ")
|
||||||
|
local name=name[#name]
|
||||||
|
local tw=name
|
||||||
|
if string.len(name)==1 then
|
||||||
|
name=ENUMS.Phonetic[name]
|
||||||
|
end
|
||||||
|
taxiroute=taxiroute..string.format("%s, ", name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
text=text..taxiroute
|
||||||
|
|
||||||
|
text=text..string.format("hold short of runway %s.", runway)
|
||||||
|
|
||||||
if self:GetFlightStatus(flight)==FLIGHTCONTROL.FlightStatus.READYTO then
|
if self:GetFlightStatus(flight)==FLIGHTCONTROL.FlightStatus.READYTO then
|
||||||
text=string.format("%s, %s, cleared for take-off, runway %s", callsign, self.alias, runway)
|
text=string.format("%s, %s, cleared for take-off, runway %s", callsign, self.alias, runway)
|
||||||
@ -1498,7 +1523,7 @@ function FLIGHTCONTROL:_CheckQueues()
|
|||||||
text=text..string.format("runway %s, %s", runway, callsign)
|
text=text..string.format("runway %s, %s", runway, callsign)
|
||||||
|
|
||||||
-- Transmit message.
|
-- Transmit message.
|
||||||
self:TransmissionPilot(text, flight, 10)
|
self:TransmissionPilot(text, flight, 10)
|
||||||
|
|
||||||
-- Remove parking guards.
|
-- Remove parking guards.
|
||||||
for _,_element in pairs(flight.elements) do
|
for _,_element in pairs(flight.elements) do
|
||||||
@ -2165,6 +2190,10 @@ function FLIGHTCONTROL:_InitParkingSpots()
|
|||||||
|
|
||||||
-- Spawn parking guard.
|
-- Spawn parking guard.
|
||||||
self:SpawnParkingGuard(unit)
|
self:SpawnParkingGuard(unit)
|
||||||
|
|
||||||
|
|
||||||
|
local group=unit:GetGroup()
|
||||||
|
FLIGHTGROUP:New(group)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -2524,9 +2553,14 @@ function FLIGHTCONTROL:_CreatePlayerMenu(flight, mainmenu)
|
|||||||
---
|
---
|
||||||
|
|
||||||
if status==FLIGHTCONTROL.FlightStatus.READYTX then
|
if status==FLIGHTCONTROL.FlightStatus.READYTX then
|
||||||
MENU_GROUP_COMMAND:New(group, "Cancel Taxi", rootmenu, self._PlayerAbortTaxi, self, groupname)
|
-- After requesting taxi.
|
||||||
|
MENU_GROUP_COMMAND:New(group, "Confirm Taxi", rootmenu, self._PlayerConfirmTaxi, self, groupname)
|
||||||
|
MENU_GROUP_COMMAND:New(group, "Cancel Taxi", rootmenu, self._PlayerAbortTaxi, self, groupname)
|
||||||
|
elseif status==FLIGHTCONTROL.FlightStatus.TAXIOUT then
|
||||||
|
-- After Confirming Taxi
|
||||||
|
MENU_GROUP_COMMAND:New(group, "Cancel Taxi", rootmenu, self._PlayerAbortTaxi, self, groupname)
|
||||||
else
|
else
|
||||||
MENU_GROUP_COMMAND:New(group, "Request Taxi", rootmenu, self._PlayerRequestTaxi, self, groupname)
|
MENU_GROUP_COMMAND:New(group, "Request Taxi", rootmenu, self._PlayerRequestTaxi, self, groupname)
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif flight:IsTaxiing(player) then
|
elseif flight:IsTaxiing(player) then
|
||||||
@ -3504,12 +3538,11 @@ function FLIGHTCONTROL:_PlayerRequestTaxi(groupname)
|
|||||||
|
|
||||||
-- Tell pilot to wait until cleared.
|
-- Tell pilot to wait until cleared.
|
||||||
local text=string.format("%s, %s, hold position until further notice.", callsign, self.alias)
|
local text=string.format("%s, %s, hold position until further notice.", callsign, self.alias)
|
||||||
|
|
||||||
self:TransmissionTower(text, flight, 10)
|
self:TransmissionTower(text, flight, 10)
|
||||||
|
|
||||||
-- Set flight status to "Ready to Taxi".
|
-- Set flight status to "Ready to Taxi".
|
||||||
self:SetFlightStatus(flight, FLIGHTCONTROL.FlightStatus.READYTX)
|
self:SetFlightStatus(flight, FLIGHTCONTROL.FlightStatus.READYTX)
|
||||||
|
|
||||||
self.airbase:FindTaxiwaysFromAtoB(StartCoord,EndCoord)
|
|
||||||
|
|
||||||
elseif flight:IsTaxiing() then
|
elseif flight:IsTaxiing() then
|
||||||
|
|
||||||
@ -3541,6 +3574,33 @@ function FLIGHTCONTROL:_PlayerRequestTaxi(groupname)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Player confirm taxi.
|
||||||
|
-- @param #FLIGHTCONTROL self
|
||||||
|
-- @param #string groupname Name of the flight group.
|
||||||
|
function FLIGHTCONTROL:_PlayerConfirmTaxi(groupname)
|
||||||
|
|
||||||
|
-- Get flight.
|
||||||
|
local flight=_DATABASE:GetOpsGroup(groupname) --Ops.FlightGroup#FLIGHTGROUP
|
||||||
|
|
||||||
|
if flight then
|
||||||
|
|
||||||
|
-- Get callsign.
|
||||||
|
local callsign=self:_GetCallsignName(flight)
|
||||||
|
|
||||||
|
-- Runway for takeoff.
|
||||||
|
local runway=self:GetActiveRunwayText(true)
|
||||||
|
|
||||||
|
-- Tell pilot to wait until cleared.
|
||||||
|
local text=string.format("Taxi to runway %s, %s", runway, callsign)
|
||||||
|
self:TransmissionPilot(text, flight)
|
||||||
|
|
||||||
|
-- Taxi out.
|
||||||
|
self:SetFlightStatus(flight, FLIGHTCONTROL.FlightStatus.TAXIOUT)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--- Player aborts taxi.
|
--- Player aborts taxi.
|
||||||
-- @param #FLIGHTCONTROL self
|
-- @param #FLIGHTCONTROL self
|
||||||
-- @param #string groupname Name of the flight group.
|
-- @param #string groupname Name of the flight group.
|
||||||
@ -3609,62 +3669,54 @@ function FLIGHTCONTROL:_PlayerRequestTakeoff(groupname)
|
|||||||
|
|
||||||
if flight:IsTaxiing() then
|
if flight:IsTaxiing() then
|
||||||
|
|
||||||
|
-- TODO: Get closest runway
|
||||||
|
local runway=self:GetActiveRunwayTakeoff()
|
||||||
|
|
||||||
|
local runwayName=self:GetActiveRunwayText(true)
|
||||||
|
|
||||||
|
local distToRunway=flight:GetCoordinate():Get2DDistance(runway.position)
|
||||||
|
|
||||||
-- Get callsign.
|
-- Get callsign.
|
||||||
local callsign=self:_GetCallsignName(flight)
|
local callsign=self:_GetCallsignName(flight)
|
||||||
|
|
||||||
-- Pilot request for taxi.
|
if distToRunway < 100 then
|
||||||
local text=string.format("%s, %s, ready for departure. Request takeoff.", self.alias, callsign)
|
|
||||||
self:TransmissionPilot(text, flight)
|
|
||||||
|
|
||||||
-- Get number of flights landing.
|
|
||||||
local Nlanding=self:CountFlights(FLIGHTCONTROL.FlightStatus.LANDING)
|
|
||||||
|
|
||||||
-- Get number of flights taking off.
|
|
||||||
local Ntakeoff=self:CountFlights(FLIGHTCONTROL.FlightStatus.TAKEOFF)
|
|
||||||
|
|
||||||
--[[
|
|
||||||
local text=""
|
|
||||||
if Nlanding==0 and Ntakeoff==0 then
|
|
||||||
text="No current traffic. You are cleared for takeoff."
|
|
||||||
self:SetFlightStatus(flight, FLIGHTCONTROL.FlightStatus.TAKEOFF)
|
|
||||||
elseif Nlanding>0 and Ntakeoff>0 then
|
|
||||||
text=string.format("Negative, we got %d flights inbound and %d outbound ahead of you. Hold position until futher notice.", Nlanding, Ntakeoff)
|
|
||||||
self:SetFlightStatus(flight, FLIGHTCONTROL.FlightStatus.READYTO)
|
|
||||||
elseif Nlanding>0 then
|
|
||||||
if Nlanding==1 then
|
|
||||||
text=string.format("Negative, we got %d flight inbound before it's your turn. Wait until futher notice.", Nlanding)
|
|
||||||
else
|
|
||||||
text=string.format("Negative, we got %d flights inbound. Wait until futher notice.", Nlanding)
|
|
||||||
end
|
|
||||||
self:SetFlightStatus(flight, FLIGHTCONTROL.FlightStatus.READYTO)
|
|
||||||
elseif Ntakeoff>0 then
|
|
||||||
text=string.format("Negative, %d flights ahead of you are waiting for takeoff. Talk to you soon.", Ntakeoff)
|
|
||||||
self:SetFlightStatus(flight, FLIGHTCONTROL.FlightStatus.READYTO)
|
|
||||||
end
|
|
||||||
]]
|
|
||||||
|
|
||||||
-- We only check for landing flights.
|
|
||||||
local text=string.format("%s, %s, ", callsign, self.alias)
|
|
||||||
if Nlanding==0 then
|
|
||||||
|
|
||||||
-- No traffic.
|
|
||||||
text=text.."no current traffic. You are cleared for takeoff."
|
|
||||||
|
|
||||||
-- Set status to "Take off".
|
-- Pilot request for taxi.
|
||||||
self:SetFlightStatus(flight, FLIGHTCONTROL.FlightStatus.TAKEOFF)
|
local text=string.format("%s, %s, ready for departure, runway %s", self.alias, callsign, runwayName)
|
||||||
elseif Nlanding>0 then
|
self:TransmissionPilot(text, flight)
|
||||||
if Nlanding==1 then
|
|
||||||
text=text..string.format("negative, we got %d flight inbound before it's your turn. Hold position until futher notice.", Nlanding)
|
|
||||||
else
|
|
||||||
text=text..string.format("negative, we got %d flights inbound. Hold positon until futher notice.", Nlanding)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Message from tower.
|
-- Get number of flights landing.
|
||||||
self:TransmissionTower(text, flight, 10)
|
local Nlanding=self:CountFlights(FLIGHTCONTROL.FlightStatus.LANDING)
|
||||||
|
|
||||||
|
-- Get number of flights taking off.
|
||||||
|
local Ntakeoff=self:CountFlights(FLIGHTCONTROL.FlightStatus.TAKEOFF)
|
||||||
|
|
||||||
|
-- We only check for landing flights.
|
||||||
|
local text=string.format("%s, %s, ", callsign, self.alias)
|
||||||
|
if Nlanding==0 then
|
||||||
|
|
||||||
|
-- No traffic.
|
||||||
|
text=text.."no current traffic. You are cleared for takeoff."
|
||||||
|
|
||||||
|
-- Set status to "Take off".
|
||||||
|
self:SetFlightStatus(flight, FLIGHTCONTROL.FlightStatus.TAKEOFF)
|
||||||
|
elseif Nlanding>0 then
|
||||||
|
if Nlanding==1 then
|
||||||
|
text=text..string.format("negative, we got %d flight inbound before it's your turn. Hold position until futher notice.", Nlanding)
|
||||||
|
else
|
||||||
|
text=text..string.format("negative, we got %d flights inbound. Hold position until futher notice.", Nlanding)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Message from tower.
|
||||||
|
self:TransmissionTower(text, flight, 10)
|
||||||
|
|
||||||
|
else
|
||||||
|
local text=string.format("%s, you are too far from the active runway. Proceed to runway %s and repeat your request when you are at the holding position", callsign, runwayName)
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
self:TextMessageToFlight(string.format("Negative, you must request TAXI before you can request TAKEOFF!"), flight)
|
self:TextMessageToFlight(string.format("Negative, you must request TAXI before you can request TAKEOFF!"), flight)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|||||||
@ -2279,7 +2279,12 @@ function FLIGHTGROUP:onafterTaxiing(From, Event, To)
|
|||||||
self.flightcontrol:SetFlightStatus(self, FLIGHTCONTROL.FlightStatus.TAKEOFF)
|
self.flightcontrol:SetFlightStatus(self, FLIGHTCONTROL.FlightStatus.TAKEOFF)
|
||||||
else
|
else
|
||||||
-- Human flights go to TAXI OUT queue. They will go to the ready for takeoff queue when they request it.
|
-- Human flights go to TAXI OUT queue. They will go to the ready for takeoff queue when they request it.
|
||||||
self.flightcontrol:SetFlightStatus(self, FLIGHTCONTROL.FlightStatus.TAXIOUT)
|
if self.controlstatus~=FLIGHTCONTROL.FlightStatus.TAXIOUT then
|
||||||
|
self.flightcontrol:SetFlightStatus(self, FLIGHTCONTROL.FlightStatus.TAXIOUT)
|
||||||
|
else
|
||||||
|
-- Update menu. This happens now if we confirmed taxiing and later began to taxi. (in the FLIGHTCONTROL:SetFlightStatus function the menu is only updated, when the controlstatus changed)
|
||||||
|
self:_UpdateMenu(0.2)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -564,6 +564,11 @@ function OPSGROUP:New(group)
|
|||||||
|
|
||||||
-- Set DCS group and controller.
|
-- Set DCS group and controller.
|
||||||
self.dcsgroup=self:GetDCSGroup()
|
self.dcsgroup=self:GetDCSGroup()
|
||||||
|
|
||||||
|
if not self.dcsgroup then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
self.controller=self.dcsgroup:getController()
|
self.controller=self.dcsgroup:getController()
|
||||||
|
|
||||||
-- Category.
|
-- Category.
|
||||||
|
|||||||
@ -1206,6 +1206,8 @@ end
|
|||||||
-- @return #boolean If `true`, silent mode is enabled.
|
-- @return #boolean If `true`, silent mode is enabled.
|
||||||
function AIRBASE:AddTaxiway(TaxiPathline, Name)
|
function AIRBASE:AddTaxiway(TaxiPathline, Name)
|
||||||
|
|
||||||
|
Name=Name or TaxiPathline:GetName()
|
||||||
|
|
||||||
self.taxiways[Name]=TaxiPathline
|
self.taxiways[Name]=TaxiPathline
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -1251,7 +1253,7 @@ end
|
|||||||
--- Find the shortest path using taxiways to get from given parking spot to the starting point of a runway.
|
--- Find the shortest path using taxiways to get from given parking spot to the starting point of a runway.
|
||||||
-- Note that the taxi ways have to be manually added with the `AIRBASE:AddTaxiway()` function.
|
-- Note that the taxi ways have to be manually added with the `AIRBASE:AddTaxiway()` function.
|
||||||
-- @param #AIRBASE self
|
-- @param #AIRBASE self
|
||||||
-- @param #AIRBASE.ParkingSpot ParkingSport Parking spot.
|
-- @param #AIRBASE.ParkingSpot ParkingSpot Parking spot.
|
||||||
-- @param #AIRBASE.Runway Runway The runway. If none is given, we take the active runway for takeoff.
|
-- @param #AIRBASE.Runway Runway The runway. If none is given, we take the active runway for takeoff.
|
||||||
-- @return Core.Pathline#PATHLINE Shortest path on taxiways from `StartCoord` to `EndCoord`.
|
-- @return Core.Pathline#PATHLINE Shortest path on taxiways from `StartCoord` to `EndCoord`.
|
||||||
-- @return #table Table of used taxi way pathlines.
|
-- @return #table Table of used taxi way pathlines.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user