mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Navigation
This commit is contained in:
parent
792a487eeb
commit
f19c877a11
@ -64,12 +64,14 @@ FLIGHTPLAN = {
|
||||
-- @field #string IFRH Instrument Flying Rules High Altitude.
|
||||
-- @field #string IFRL Instrument Flying Rules Low Altitude.
|
||||
-- @field #string VFR Visual Flight Rules.
|
||||
FLIGHTPLAN.TYPE={
|
||||
FLIGHTPLAN.Type={
|
||||
IFRH="IFR Heigh",
|
||||
IFRL="IFR Low",
|
||||
VFR="VFR",
|
||||
}
|
||||
|
||||
|
||||
|
||||
--- FLIGHTPLAN class version.
|
||||
-- @field #string version
|
||||
FLIGHTPLAN.version="0.0.1"
|
||||
|
||||
176
Moose Development/Moose/Navigation/NavApp.lua
Normal file
176
Moose Development/Moose/Navigation/NavApp.lua
Normal file
@ -0,0 +1,176 @@
|
||||
--- **NAVIGATION** - Template.
|
||||
--
|
||||
-- **Main Features:**
|
||||
--
|
||||
-- * Stuff
|
||||
-- * More Stuff
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ## Example Missions:
|
||||
--
|
||||
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Navigation%20-%20Template).
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Author: **funkyfranky**
|
||||
--
|
||||
-- ===
|
||||
-- @module Navigation.Template
|
||||
-- @image NAVIGATION_Template.png
|
||||
|
||||
|
||||
--- NAVAPP class.
|
||||
-- @type NAVAPP
|
||||
-- @field #string ClassName Name of the class.
|
||||
-- @field #number verbose Verbosity of output.
|
||||
-- @field #string apptype Approach type (ILS, VOR, LOC).
|
||||
-- @field Wrapper.Airbase#AIRBASE airbase Airbase of this approach.
|
||||
-- @field Wrapper.Airbase#AIRBASE.Runway runway Runway of this approach.
|
||||
-- @field #number wpcounter Running number counting the waypoints to generate its UID.
|
||||
-- @list <#NAVAPP.Waypoint> path Path of approach consisting of waypoints.
|
||||
-- @extends Core.Base#BASE
|
||||
|
||||
--- *A fleet of British ships at war are the best negotiators.* -- Horatio Nelson
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # The NAVAPP Concept
|
||||
--
|
||||
-- The NAVAPP class has a great concept!
|
||||
--
|
||||
-- A typical approach has (up to) three segments. It starts with the initial approach segment, followed by the intermediate approach segment, followed
|
||||
-- by the final approach segment.
|
||||
--
|
||||
-- The initial approach segment starts at the initial approach fix (IAF). The segment can contain multiple other fixes, that need to be passed.
|
||||
-- An approach procedure can have more than one segment and IAF.
|
||||
--
|
||||
-- The intermediate approach segment starts at the intermediate fix (IF). The intermediate approach segment blends the initial approach segment into the final approach segment.
|
||||
-- It is the segment in which aircraft configuration, speed, and positioning adjustments are made for entry into the final approach segment.
|
||||
--
|
||||
--
|
||||
-- https://en.wikipedia.org/wiki/Visual_approach
|
||||
-- https://en.wikipedia.org/wiki/Instrument_approach
|
||||
--
|
||||
-- # Basic Setup
|
||||
--
|
||||
-- A new `NAVAPP` object can be created with the @{#NAVAPP.New}() function.
|
||||
--
|
||||
-- myTemplate=NAVAPP:New()
|
||||
-- myTemplate:SetXYZ(X, Y, Z)
|
||||
--
|
||||
-- This is how it works.
|
||||
--
|
||||
-- @field #NAVAPP
|
||||
NAVAPP = {
|
||||
ClassName = "NAVAPP",
|
||||
verbose = 0,
|
||||
wpcounter = 0,
|
||||
}
|
||||
|
||||
--- Type of approach.
|
||||
-- @type NAVAPP.Type
|
||||
-- @field #string VOR VOR
|
||||
-- @field #string NDB NDB
|
||||
NAVAPP.Type={
|
||||
VOR="VOR",
|
||||
ILS="ILS",
|
||||
}
|
||||
|
||||
|
||||
--- Setments of approach.
|
||||
-- @type NAVAPP.Segment
|
||||
-- @field #string INITIAL Initial approach segment.
|
||||
-- @field #string INTERMEDIATE Intermediate approach segment.
|
||||
-- @field #string FINAL Final approach segment.
|
||||
-- @field #string MISSED Missed approach segment.
|
||||
NAVAPP.Segment={
|
||||
INITIAL="Initial",
|
||||
INTERMEDIATE="Intermediate",
|
||||
FINAL="Final",
|
||||
MISSED="Missed",
|
||||
}
|
||||
|
||||
--- Waypoint of the approach.
|
||||
-- @type NAVAPP.Waypoint
|
||||
-- @field #number uid Unique ID of the point.
|
||||
-- @field #string segment The segment this point belongs to.
|
||||
-- @field Navigation.NavFix#NAVFIX navfix The navigation fix that determines the coordinates of this point.
|
||||
|
||||
--- NAVAPP class version.
|
||||
-- @field #string version
|
||||
NAVAPP.version="0.0.1"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- ToDo list
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- TODO: A lot...
|
||||
-- Initial approach segment --> Intermediate approach segment: starts at IF --> Final approach segment
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Constructor
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- Create a new NAVAPP class instance.
|
||||
-- @param #NAVAPP self
|
||||
-- @param #string Type Type of approach (ILS, VOR, LOC).
|
||||
-- @param Wrapper.Airbase#AIRBASE Airbase The airbase or name of the airbase.
|
||||
-- @param Wrapper.Airbase#AIRBASE.Runway Runway The runway or name of the runway.
|
||||
-- @return #NAVAPP self
|
||||
function NAVAPP:New(Type, Airbase, Runway)
|
||||
|
||||
-- Inherit everything from BASE class.
|
||||
self=BASE:Inherit(self, BASE:New()) -- #NAVAPP
|
||||
|
||||
self.apptype=Type
|
||||
|
||||
self.airbase=Airbase
|
||||
|
||||
self.runway=Runway
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- User Functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- Set the primary navigation aid used in the approach.
|
||||
-- @param #NAVAPP self
|
||||
-- @param Navigation.NavAid#NAVAID NavAid The NAVAID.
|
||||
-- @return #NAVAPP self
|
||||
function NAVAPP:SetNavAid(NavAid)
|
||||
|
||||
self.navaid=NavAid
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Add a waypoint to the path of the approach.
|
||||
-- @param #NAVAPP self
|
||||
-- @param Navigation.NavAid#NAVAID NavAid The NAVAID.
|
||||
-- @param #string Segment The approach segment this fix belongs to.
|
||||
-- @return #NAVAPP self
|
||||
function NAVAPP:AddWaypoint(NavFix, Segment)
|
||||
|
||||
self.wpcounter=self.wpcounter+1
|
||||
|
||||
local point={} --#NAVAPP.Waypoint
|
||||
point.uid=self.wpcounter
|
||||
point.segment=Segment
|
||||
point.navfix=NavFix
|
||||
|
||||
table.insert(self.path, point)
|
||||
|
||||
return point
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Private Functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@ -82,10 +82,10 @@ NAVFIX.version="0.0.1"
|
||||
|
||||
--- Create a new NAVFIX class instance.
|
||||
-- @param #NAVFIX self
|
||||
-- @param Core.Point#COORDINATE Coordinate of the fix.
|
||||
-- @param #string Name Name of the fix. Should be unique!
|
||||
-- @param Core.Point#COORDINATE Coordinate of the fix.
|
||||
-- @return #NAVFIX self
|
||||
function NAVFIX:New(Coordinate, Name)
|
||||
function NAVFIX:NewFromCoordinate(Name, Coordinate)
|
||||
|
||||
-- Inherit everything from SCENERY class.
|
||||
self=BASE:Inherit(self, BASE:New()) -- #NAVFIX
|
||||
@ -100,6 +100,28 @@ function NAVFIX:New(Coordinate, Name)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Create a new NAVFIX class instance from a given NavAid.
|
||||
-- @param #NAVFIX self
|
||||
-- @param #string Name Name of the fix. Should be unique!
|
||||
-- @param Navigation.NavFix#NAVFIX NavFix The navigation fix.
|
||||
-- @param #number Distance Distance in nautical miles.
|
||||
-- @param #number Bearing Bearing from the given NavFix to the newly created one.
|
||||
-- @param #boolean Reciprocal If `true` the reciprocal `Bearing` is taken so it specifies the direction from the new navfix to the given one.
|
||||
-- @return #NAVFIX self
|
||||
function NAVFIX:NewFromNavFix(Name, NavFix, Distance, Bearing, Reciprocal)
|
||||
|
||||
local coord=NavFix.coordinate
|
||||
|
||||
local Angle=Bearing-90
|
||||
|
||||
local coord=NavFix.coordinate:Translate(UTILS.NMToMeters(Distance), Angle)
|
||||
|
||||
local self=NAVFIX:NewFromCoordinate(coord, Name)
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- User Functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@ -154,6 +176,11 @@ function NAVFIX:SetIntermediateFix(IntermediateFix)
|
||||
end
|
||||
|
||||
--- Set whether this is an initial approach fix (IAF).
|
||||
-- The IAF is the point where the initial approach segment of an instrument approach begins.
|
||||
-- It is usually a designated intersection, VHF omidirectional range (VOR) non-directional beacon (NDB)
|
||||
-- or distance measuring equipment (DME) fix.
|
||||
-- The IAF may be collocated with the intermediate fix (IF) of the instrument apprach an in such case they designate the
|
||||
-- beginning of the intermediate segment of the approach. When the IAF and the IF are combined, there is no inital approach segment.
|
||||
-- @param #NAVFIX self
|
||||
-- @param #boolean IntermediateFix If `true`, this is an intermediate fix.
|
||||
-- @return #NAVFIX self
|
||||
@ -164,7 +191,7 @@ end
|
||||
|
||||
--- Get the altitude in feet MSL.
|
||||
-- @param #NAVFIX self
|
||||
-- @return #number Altitude in feet MSL. Can be `#nil`
|
||||
-- @return #number Altitude in feet MSL. Can be `nil`, if neither min nor max altitudes have beeen set.
|
||||
function NAVFIX:GetAltitude()
|
||||
|
||||
local alt=nil
|
||||
|
||||
@ -57,9 +57,13 @@ NAVAID = {
|
||||
-- @type NAVAID.Type
|
||||
-- @field #string VOR VOR
|
||||
-- @field #string NDB NDB
|
||||
NAVAID.TYPE={
|
||||
NAVAID.Type={
|
||||
VOR="VOR",
|
||||
NDB="NDB",
|
||||
DME="DME",
|
||||
TACAN="TACAN",
|
||||
LOC="Loc"
|
||||
|
||||
}
|
||||
|
||||
--- NAVAID class version.
|
||||
@ -85,7 +89,7 @@ NAVAID.version="0.0.1"
|
||||
-- @return #NAVAID self
|
||||
function NAVAID:New(ZoneName, SceneryName, Type)
|
||||
|
||||
-- Inherit everything from SCENERY class.
|
||||
-- Inherit everything from BASE class.
|
||||
self=BASE:Inherit(self, BASE:New()) -- #NAVAID
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user