Nasal Flightplan: Difference between revisions

→‎Waypoint hashes: "Hold" does not seem to work.
(→‎Flightplan methods and variables: Fleshed out some more.)
(→‎Waypoint hashes: "Hold" does not seem to work.)
(13 intermediate revisions by 2 users not shown)
Line 7: Line 7:
== Background ==
== Background ==
The Nasal functions relating to the route manager system include:
The Nasal functions relating to the route manager system include:
* {{func link|flightplan()}}
* {{func link|flightplan()}} - return the active plan.
* {{func link|airwaysRoute()}}
* {{func link|airwaysRoute()}}
* {{func link|createFlightplan()}} - creates new empty plan. A path can be supplied to load a plan from xml.


Flight plans are based on waypoints, which, in C++, inherit from the {{API Link|flightgear|class|FGPositioned}} class.
Flight plans are based on waypoints, which, in C++, inherit from the {{API Link|flightgear|class|FGPositioned}} class.
Line 22: Line 23:
; wp_parent_name : Name of waypoint's parent.
; wp_parent_name : Name of waypoint's parent.
; wp_parent : Waypoint's parent.
; wp_parent : Waypoint's parent.
; fly_type : How to waypoint should be flown over or reacted to. One of "Hold," "flyOver," or "flyBy."
; fly_type : How to waypoint should be flown over or reacted to. One of "flyOver" or "flyBy".
; heading_course : Heading of runway.
; heading_course : Heading of runway.


Line 29: Line 30:
; getWP(index) : Returns the leg for specified index.
; getWP(index) : Returns the leg for specified index.
; currentWP() : Return current active leg.
; currentWP() : Return current active leg.
; nextWP() :  
; nextWP() : Make next waypoint active.
; getPlanSize() : Returns number of waypoints
; getPlanSize() : Returns number of waypoints
; appendWP(leg) : Add a leg to the end of the flightplan.
; appendWP(leg) : Add a leg to the end of the flightplan.
Line 36: Line 37:
; insertWPAfter() :  
; insertWPAfter() :  
; insertWaypoints(vector, index) : Pass a vector of waypoint objects, and the position to insert.
; insertWaypoints(vector, index) : Pass a vector of waypoint objects, and the position to insert.
; cleanPlan() : Clears all waypoints including destination and departure.
; cleanPlan() : Clears all waypoints except destination and departure.
; clearWPType(type) : Supply a type string, it will clear all waypoints of the type.
; clearWPType(type) : Supply a type string, it will clear all waypoints of the type.
; clone() : Return a copy of the flightplan.
; clone() : Return a copy of the flightplan.
; pathGeod() :  
; pathGeod() : This is used for graphical display: it’s an array of coordinates which show the path of the plan. This includes holds, procedure turns, turn anticipation and more.
; finish() :  
; finish() : Finish the plan. (a call to delegate will be made)
; indexOfWP() :
; indexOfWP(wp) : Returns the index of the passed waypoint/leg.
; destination : airport object as destination.
; destination : airport object as destination.
; destination_runway : rwy object as destination and its airport implicit.
; destination_runway : rwy object as destination and its airport implicit.
; departure : airport object as departure.
; departure : airport object as departure.
; departure_runway : rwy object as departure and its airport implicit.
; departure_runway : rwy object as departure and its airport implicit.
; id :
; id : optional name of plan.
; sid : procedure object for SID.
; sid : procedure object for SID.
; star : procedure object for STAR.
; star : procedure object for STAR.
Line 54: Line 55:
; current : Index of current waypoint.
; current : Index of current waypoint.
; aircraftCategory : ICAO aircraft category.
; aircraftCategory : ICAO aircraft category.
; followLegTrackToFix : It controls whether the system will fly on an intersection course (and hence, different track) to the end of the leg, or make a corrective S-turn to get back on the leg track immediately it becomes possible.
; followLegTrackToFix : Specific used by some procedures. It controls whether the system will fly on an intersection course (and hence, different track) to the end of the leg, or make a corrective S-turn to get back on the leg track immediately it becomes possible.
; activate() :
; activate() : This will make the flight plan the default (the one used in route-manager).
; save(path) : Save a plan to xml. Will return true or false for success.


== Leg methods and variables ==
== Leg methods and variables ==
A leg is a wrapper for a waypoint, so it will have all waypoints variables and methods plus what is listed below.
A leg is a wrapper for a waypoint, so it will have all waypoints variables and methods plus what is listed below.
; setSpeed() :
Notice, that a leg you have gotten from a plan, but deleted in the plan, will be invalid and should not be used or modified.
; setAltitude() :
A leg you have gotten from a plan, when modified, will modify the leg inside the plan you got it from.
; path() :
; setSpeed(speed, type) : Sets the speed restriction. Setting nil type, will crash FG, setting empty type is same as setting "at". See below for type list.
; courseAndDistanceFrom() :
; setAltitude(altitude, type) : Sets the altitude restriction. Setting nil type, will crash FG, setting empty type is same as setting "at". See below for type list.
; parents :
; path() : Returns a vector of hashes containing lat and lon variables. These compromise a curved path for long non straight legs.
; index :
; courseAndDistanceFrom(coord) : Return vector with true course and distance. Coord is a geo.Coord.
; alt_cstr : Altitude restriction.
; parents : Nasal parents.
; alt_cstr_type : Altitude restriction type. Can be "at", "above", "below", "mach", "computed", "computed-mach", "delete".
; wp_owner : Will return you the owning route-structure of the WP - this could be an airway, procedure, or the flightplan if the waypoint doesn’t belong to a route structure.
; speed_cstr : Speed restriction.
; index : Returns the index of the leg in the owning route-structure.
; speed_cstr_type : Speed restriction. Can be "at", "above", "below", "mach", "computed", "computed-mach", "delete".
; alt_cstr : Read-only. Altitude restriction.
; leg_distance :
; alt_cstr_type : Read-only. Altitude restriction type. See below for list.
; leg_bearing :
; speed_cstr : Read-only. Speed restriction.
; distance_along_route :
; speed_cstr_type : Read-only. Speed restriction. See below for list.
; leg_distance : Returns distance along the leg, from the preceding waypoint.
; leg_bearing : Returns the bearing along the leg.
; distance_along_route : Return the total distance laterally along the route to the beginning of the leg.
 
For speed restrictions these types can be used:
* "at" = kt should be spot on
* "above" = kt should be higher
* "below" = kt should be under
* "computed" = predicted kt
* "computed-mach" = predicted mach
* "mach" = its in mach instead of kt
* "delete" = Cleared by ATC
 
For altitude restrictions these types can be used:
* "at" = alt should be spot on
* "above" = alt should be higher
* "below" = alt should be below
* "computed" = predicted alt
* "computed-mach" = not used for altitude
* "mach" = not used for altitude
* "delete" = Cleared by ATC


== Procedure methods and variables ==
== Procedure methods and variables ==
Line 150: Line 173:
* [[Route Manager]]
* [[Route Manager]]
* [[Route Manager internals]]
* [[Route Manager internals]]
* [[Howto:Control the route manager in Nasal]]


=== Documentation ===
=== Documentation ===
579

edits