IT-AUTOFLIGHT: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 149: Line 149:
* '''vs''': Adjust the Kp for the FPM/FPS PID. (V/S)
* '''vs''': Adjust the Kp for the FPM/FPS PID. (V/S)
* '''fpa''': Adjust the Kp for the FPA PID.
* '''fpa''': Adjust the Kp for the FPA PID.
* '''flch''': Adjust the Kp for the FLCH PID. (Tune FPM/FPS PID FIRST!)
* '''gs''': Adjust the Kp for the G/S PID.
* '''gs''': Adjust the Kp for the G/S PID.


Line 186: Line 187:
Important Note: Most of the time, CMD tuning is not required to be changed. Only adjust CMD if the controllers do not work optimally.
Important Note: Most of the time, CMD tuning is not required to be changed. Only adjust CMD if the controllers do not work optimally.
* Adjust the values in cmd Next. To see what each value does, see Tuning and Configuration above.  
* Adjust the values in cmd Next. To see what each value does, see Tuning and Configuration above.  
* Tune V/S First, then ALT CAP/HLD, then HDG SEL/HLD/LNAV. FLCH is tuned by V/S.
* Tune V/S First, then FLCH, then ALT CAP/HLD, then HDG SEL/HLD/LNAV. FLCH is tuned by V/S.
* Once those are all working, tune LOC and G/S. Easy way to test: KNUQ RW32R, takeoff runway hdg, climb 2000ft. ILS: 109.55. ARM ILS once above 250ft. Aircraft should intercept ILS.
* Once those are all working, tune LOC and G/S. Easy way to test: KNUQ RW32R, takeoff runway hdg, climb 2000ft. ILS: 109.55. ARM ILS once above 250ft. Aircraft should intercept ILS.
* Once LOC and G/S are working, tune the Autoland. Most of the time, you can just use the "roll/kp", for "autoland/roll-kp". The "autoland/pitch-kp" is for the LAND/FLARE modes. Lastly, "autoland/rudder-kp" is for the Rudder LOC track.
* Once LOC and G/S are working, tune the Autoland. Most of the time, you can just use the "roll/kp", for "autoland/roll-kp". The "autoland/pitch-kp" is for the LAND/FLARE modes. Lastly, "autoland/rudder-kp" is for the Rudder LOC track.

Revision as of 21:56, 29 April 2017

Note  This page contains information about the standard, Airliner-style of IT-AUTOFLIGHT. For the GA version, see IT-AUTOFLIGHT/GA
IT-AUTOFLIGHT
Started in March 2016
Description Advanced Autopilot System
Contributor(s) it0uchpods
Status Beta
The latest IT-AUTOFLIGHT GUI. The CWS button does indeed work, but it is disabled in the aircraft I took this shot with.

IT-AUTOFLIGHT is a modular, light, and advanced Airliner Autoflight system for FlightGear.

Download IT-AUTOFLIGHT V3.0.0 Beta from here!

The changelog for IT-AUTOFLIGHT V3.0.0 can be viewed here!

History/Information

The standard version of IT-AUTOFLIGHT, modeled after complex jet airliner autopilots.

Version 1.0

IT-AUTOFLIGHT was first User:it0uchpods's attempt of making the autoflight system in the MD-88 more advanced. It used a modified Generic Autopilot, and a simple nasal logic controller which decided if the modes were active or not, and put them all under one switch. Here is the very first Nasal controller for IT-AUTOFLIGHT. It would print modes into the console mainly for later debug. It was designed to put engaging/disengaging under one switch because User:it0uchpods didn't know alot about the <enable> tags yet, and did not know complex conditions could be used (like the latest it-autoflight.xml does). This went on for a while, with User:it0uchpods refining it and adding things like LOC ARM/G/S ARM. Then User:it0uchpods decided to install the system into other aircraft. This required property moving, and adding new logic for the thrust system, due to the way it had been integrated.

Version 2.0

IT-AUTOFLIGHT got a new nasal file in Version 2.0. It was used to get rid of buttons in the cockpit and dialog having 10 or 12 bindings. Here is logic file for V2. This made integration into other planes alot easier. It still had fully generic controllers. Update 2.7 included automatic altitude capturing. After realasing some stability updates for update 2.9, User:it0uchpods finally decided to get rid of the generic controllers, and use custom ones. With JWOCKY's help, User:it0uchpods learned alot about PID Controllers, and installed his own based off the SYS8 controllers. 2 builds were released, V2.10, and V2.11. These included a major update to the dialog, FLCH mode, more advanced logic, and more. However, both were very unstable, and had alot of problems. They were quickly abandoned and replaced with the first V3.0 in development build.

Version 3.0

IT-AUTOFLIGHT Version 3.0 was a major update for the system. It had fixed all the stability issues from V2.10, and V2.11. It also moved the engage logic mostly to the <enable> in the PID Controllers. The active modes, however, are still controlled in the nasal file. The 2 nasal files merged into one, and the Autothrottle moved to a seperate XML file, so that custom autothrottle systems (like A320Family, and MD-88/90) can be used. You can now tune the controllers from the -set or -main file, and keep the ability to drop in updates, without needing to retune anything. It also includes a custom pitch system which used the elevator to set pitch, and the trim to keep the yoke as centered as possible. Version 3.0 also has a completely redone filesystem. All the properties are grouped, and renamed for easier understanding. Later on the FLCH controller was changed to 2 PIDs, for better control. VNAV is also in progress. Version 3.X will be the final version of IT-AUTOFLIGHT, as it will include all features of a current airliner Autoflight System. It is still in development at this time, so there is not much more to write yet.

Development status (V3.0.0)

  • Magnetic Heading Hold/Select Done Done
  • True Heading Hold/Select Done Done
  • LNAV 90}% completed
  • VOR/LOC Done Done
  • VOR/LOC Backcourse 70}% completed
  • Altitude Hold/Capture 100}% completed
  • Vertical Speed Hold 100}% completed
  • IAS/Mach with Pitch (FLCH) 100}% completed
  • G/S Hold Done Done
  • IAS/Mach with Throttle Done Done
  • Climb Thrust/Idle Thrust Done Done
  • A/T Retard Done Done
  • Dual APs Done Done
  • Flight Director Done Done
  • Control Wheel Steering 90}% completed
  • Custom Pitch System 100}% completed
  • Takeoff Go Around (TOGA) Mode 100}% completed
  • Flight Path Angle Hold 100}% completed
  • Autoland Land 90}% completed
  • Autoland Rollout 10}% completed
  • VNAV Logic 50}% completed
  • VNAV SPD/HLD 90}% completed
  • VNAV PTH 20}% completed
  • For more information, see the changelog here

Installation Instructions

Installing

This guide will teach you how to install IT-AUTOFLIGHT to an aircraft. Every time you see XXX written, replace this text with the name of the aircraft folder.

Before you Begin

Download the latest version of IT-AUTOFLIGHT V3.0.0 Beta from here. Extract the Archive with WinRAR, 7Zip, or similar.

Step One

  • Copy the Systems and Nasal folders from the IT-AUTOFLIGHT folder to the aircraft's folder. The only file which may overwrite another file is the autopilot-dlg.xml file.
  • Open the -set file of the aircraft, and find the <systems> area inside <sim></sim>.
  • Add the following inside <systems></systems>
<autopilot>
    <name>IT-AUTOFLIGHT</name>
    <path>Systems/it-autoflight.xml</path>
</autopilot>

If you wish to use the IT-AUTOFLIGHT Default Autothrottle, add the following inside <systems></systems>:

<autopilot>
    <name>IT-AUTOTHRUST</name>
    <path>Systems/it-autothrust.xml</path>
</autopilot>
  • If you do not add this, the A/T button in the IT-AUTOFLIGHT GUI Dialog will do nothing, and in PITCH mode, the pilot must adjust the throttles accordingly. You do NOT need to add this if your aircraft uses a customized autothrottle, as long as that autothrottle is compatible with IT-AUTOFLIGHT. See Interfacing section below for more information.
  • Find the <nasal> area, which is outside <sim></sim>.
  • Add the following inside <nasal></nasal>:
<itaf>
    <file>Nasal/it-autoflight.nas</file>
</itaf>
======================================================================================
  • Finally, add the following anywhere outside <sim></sim>:
  • Copy and Paste from this file, start at line 5.
  • ITAF CONFIG.txt.
  • This is the default IT-AUTOFLIGHT Configuration. We will be adjusting this later.
======================================================================================

Step Two

  • Open any nasal file. I recommend systems.nas, or a file with the aircraft name.
setlistener("/sim/signals/fdm-initialized", func {
    itaf.ap_init();
    var autopilot = gui.Dialog.new("sim/gui/dialogs/autopilot/dialog", "Aircraft/XXX/Systems/autopilot-dlg.xml");
});
  • Make sure you change XXX to the aircraft's folder name.

Complete

You have finished installing IT-AUTOFLIGHT. However, I highly suggest to go over the Tuning and Configuration section below, to tune the PIDs to your aircraft, and set up the settings. If you want to connect IT-AUTOFLIGHT to a PFD or MCP, see Interfacing.

Tuning and Configuration

Below is listed each area of the IT-AUTOFLIGHT Config Module, and what it is used for. We will also discuss how to tune IT-AUTOFLIGHT efficiently.

You can view the Config Module here.

This area is for the tuning of the PID controllers used. These are not hard coded, so users can update IT-AUTOFLIGHT without needing to edit any files. You can also adjust these in the property browser, and they take affect immediately, without needing to reload anything.

config/roll

These adjust the parameters for the Aileron PID Controller.

  • umin: Adjust the u_min.
  • umax: Adjust the u_max.
  • kp: Adjust the Kp in HDG and LNAV modes.
  • kp-vloc: Adjust the Kp in VOR/LOC mode.
  • ti: Adjust the Ti.
  • td: Adjust the Td.
  • kp-cws: Adjust the Kp in CWS mode.
config/pitch

These adjust the parameters for the Elevator PID Controller. You cannot adjust the Automatic Elevator Trim Controller at this time.

  • umin: Adjust the u_min.
  • umax: Adjust the u_max.
  • kp: Adjust the Kp.
  • ti: Adjust the Ti.
  • td: Adjust the Td.
  • kp-cws: Adjust the Kp in CWS mode.
config/cmd

These adjust the parameters for the Command PID Controllers.

  • roll-kp: Adjust the Kp for HDG/LNAV PID.
  • roll-scale: Adjust the Gain Scale for the HDG/LNAV PID Input. (This changes when the aircraft will begin to level, by changing the difference amount.)
  • vorloc: Adjust the Kp for the VORLOC PID.
  • alt: Adjust the Kp for the ALT CAP/HLD PID.
  • vs: Adjust the Kp for the FPM/FPS PID. (V/S)
  • fpa: Adjust the Kp for the FPA PID.
  • flch: Adjust the Kp for the FLCH PID. (Tune FPM/FPS PID FIRST!)
  • gs: Adjust the Kp for the G/S PID.
config/autoland

These adjust the parameters for the PIDs uses for Autoland. Tune the Roll, Pitch, and CMD first.

  • kp-roll: Adjust the Kp for the Aileron PID when it is in ALIGN Mode. (Wings Level)
  • kp-pitch: Adjust the Kp for the LAND 3/FLARE PID Controller. (Feeds into PITCH)
  • kp-rudder: Adjust the Kp for the Rudder VOR/LOC PID Controller.

settings

  • default-bank-limit: Adjust the default bank limit. (15 - 30)
  • enable-cws: Disable (0) or Enable (1) CWS.
  • flare-altitude: Adjust the altitude for when Autoland Flares the aircraft.
  • land-enable: Disable (0) or Enable (1) the Autoland System.
  • land-flap: This defines the landing flap for the aircraft. If the flaps are set to less than this, Autoland will not work. (0 - 1)
  • retard-ft: Adjust the altitude for when the Autothrottle goes into RETARD mode.
  • retard-enable: Disable (0) or Enable (1) Autothrottle RETARD.
  • togaspd: Define the V2+15 Speed for T/O CLB SPD by Pitch.
  • lat-agl-ft: Define the altitude when the roll mode changes from T/O to HDG or LNAV, whichever is armed.
  • reduc-agl-ft: Define the altitude when the pitch mode changes from T/O CLB to SPD CLB or VNAV if it is armed, and when the thrust should be reduced to CLB thrust.

How to Tune

So, now that IT-AUTOFLIGHT is installed, how do you tune it to the aircraft? IT-AUTOFLIGHT uses a config module, so you can drop in update to the system, with minor changes required. This also means you can tune IT-AUTOFLIGHT while FGFS is running, no need to reload anything! So lets get started!

  • First, you need to adjust the area of the config module "settings". Once this is done, start FGFS.
  • Takeoff normally. Once airborne, pause the sim (p)
  • I highly recommend following this tuning guide in order, as IT-AUTOFLIGHT uses cascading controllers, tuning out of order may cause system instabilities.

Roll and Pitch

  • Open the Property Browser (/), navigate to "/it-autoflight/output/"
  • Set "lat" and "vert" to 9.
  • Now engage AP1 or AP2.
  • Now you can adjust "/it-autoflight/internal/target-roll-deg" and "/it-autoflight/internal/target-pitch-deg".
  • Navigate to "/it-autoflight/config" and tune roll, and pitch, using the "target-roll-deg" and "target-pitch-deg" properties to test the configuration. It should be able to handle pitch changes from 5deg at once, to 10deg at once, and roll changes by 15, and 30 degrees. Once roll and pitch are stable, move on. (Adjust Kp values by -0.01/0.01, or -0.005/0.005, Do not adjust Ti and Td unless you know what they do. ROLL ONLY: Remember that vloc uses a different Kp. I recommend to use the same as regular Kp, unless specially needed.)

CMD and Autoland

Important Note: Most of the time, CMD tuning is not required to be changed. Only adjust CMD if the controllers do not work optimally.

  • Adjust the values in cmd Next. To see what each value does, see Tuning and Configuration above.
  • Tune V/S First, then FLCH, then ALT CAP/HLD, then HDG SEL/HLD/LNAV. FLCH is tuned by V/S.
  • Once those are all working, tune LOC and G/S. Easy way to test: KNUQ RW32R, takeoff runway hdg, climb 2000ft. ILS: 109.55. ARM ILS once above 250ft. Aircraft should intercept ILS.
  • Once LOC and G/S are working, tune the Autoland. Most of the time, you can just use the "roll/kp", for "autoland/roll-kp". The "autoland/pitch-kp" is for the LAND/FLARE modes. Lastly, "autoland/rudder-kp" is for the Rudder LOC track.

Complete

The tuning is now complete. VNAV modes use ALT CAP/HLD, VS, and FLCH controllers. If those are tuning, VNAV works just fine. Remember to check the CHANGELOG.txt after each IT-AUTOFLIGHT Update, to make sure, nothing needs to be retuned.

SDK

This section will discuss the inputs and outputs of IT-AUTOFLIGHT. These can be used for PFD/MCP interfacing, or building a custom autothrottle, or any other need for communicating with IT-AUTOFLIGHT. I will also list what types of inputs are allowed. (BOOL, INT, etc.)

Inputs: /it-autoflight/input

  • kts-mach: Switches between Speed (0) and Mach mode (1). BOOL
  • ap1: Switches the Autopilot 1 Off (0) and On (1). BOOL
  • ap2: Switches the Autopilot 2 Off (0) and On (1). BOOL
  • athr: Switches the Autothrottle Off (0) and On (1). BOOL
  • cws: Switches the CWS Off (0) and On (1). BOOL
  • fd1: Switches the Flight Director 1 Off (0) and On (1). BOOL
  • fd2: Switches the Flight Director 2 Off (0) and On (1). BOOL
  • spd-kts: Adjusts the Target Airspeed in Knots (100 - 400). DOUBLE (Note: IT-AUTOFLIGHT can use higher/lower Airspeed, but it is not recommended.)
  • spd-mach: Adjusts the Target Mach (0.4 - 0.99). DOUBLE (Note: IT-AUTOFLIGHT can use higher/lower Mach, but it is not recommended.)
  • hdg: Adjusts the Target Heading in Degrees (1 - 360, or 0 - 359). DOUBLE
  • alt: Adjusts the Target Altitude in Feet (0 - 60000). DOUBLE (Note: IT-AUTOFLIGHT can fly higher than 60,000 feet, but it is not recommended.)
  • vs: Adjusts the Target Vertical Speed in Feet Per Minute (-6000 - 6000). DOUBLE (Note: IT-AUTOFLIGHT can use higher/lower FPM, but it is not recommended.)
  • fpa: Adjusts the Target Flight Path Angle in Degrees (-20.9 - 20.9). FLOAT (Note: IT-AUTOFLIGHT can use higher/lower FPA, but it is not recommended.)
  • lat: Changes the roll mode to HDG SEL (0), LNAV (1), VOR/LOC (2), or HDG HLD (3). INT (Note: Mode 4 and Mode 5 exist, but you should not set this value to 4, or 5. Doing so may cause unexpected functionality.)
  • lat-arm: Set by IT-AUTOFLIGHT Logic. Do not adjust this property. Use the property "lat" instead, and this property will only be set if the roll mode needs to be armed, and not set active.
  • vert: Changes the pitch mode to ALT HLD (0), V/S (1), ILS (2), FLCH (4), FPA (5), or VNAV (8). INT (Note: Mode 3, Mode 6, and Mode 7 exist, but you should not set this value to 3, 6, or 7. Doing so may cause unexpected functionality.)
  • prof-arm: Set by IT-AUTOFLIGHT Logic. Do not adjust this property. Set "vert" to (8) instead, and this property will only be set if the VNAV mode needs to be armed, and not set active.
  • bank-limit: Adjusts the Target Bank Limit for HDG mode only. (5 - 30) (Note: LNAV and VOR/LOC use automatic bank limits.) When implemented, the auto button will enable automatic bank limit. For now, use this binding/command:
<binding>
    <command>nasal</command>
    <script>
    var dbl = getprop("/it-autoflight/settings/default-bank-limit");
    setprop("/it-autoflight/input/bank-limit", dbl);
    </script>
</binding>
  • trk: Switches between Magentic Heading (0) and True Heading (1). BOOL
  • toga: Engage Takeoff or Go Around Mode (1). BOOL (Note: Do not change this value back to (0). The IT-AUTOFLIGHT Logic will do this automatically when necessary.

Outputs: /it-autoflight/output

Note: DO NOT set ANY of these values!!! This WILL cause a malfunction! Only read from them. These values are the output of the logic controller, if a value you need is not here, then it does not go through the logic controller.

  • ap1: Autopilot 1: Off (0), or On (1)
  • ap2: Autopilot 2: Off (0), or On (1)
  • athr: Autothrottle: Off (0), or On (1)
  • cws: CWS: Off (0), or On (1)
  • fd1: Flight Director 1: Off (0), or On (1)
  • fd2: Flight Director 2: Off (0), or On (1)
  • loc-armed: VOR/LOC: Disarmed (0), or Armed (1)
  • appr-armed: ILS: Disarmed (0), or Armed (1)
  • thr-mode: Thrust System Mode: THRUST (0), PITCH Idle (1), or PITCH Thrust Limit (2) (Note: PITCH Idle commands the Autothrottle to Idle limit thrust, and PITCH Thrust Limit commands the Autothrottle to use set the thrust to the active thrust limit, like CLB, MCT, TOGA, etc.)
  • retard: Retard Status: Inactive (0), or Active (1) (Note: When Retard is active, the throttle should go to 0, no matter the idle limit.)
  • lat: Active Roll Mode: HDG HLD/SEL (0), LNAV (1), VOR/LOC Active (2), Align (4), or T/O LVL (5) (Note: Mode 3 is not used.)
  • vert: Active Pitch Mode: ALT HLD/CAP (0), V/S (1), G/S Active (2), FLCH (4), FPA (5), LAND 3/FLARE (6), T/O or G/A CLB (7), or VNAV (8) (Note: Mode 3 is not used.)
  • prof-vert: Active VNAV Pitch Mode: VNAV CAP/HLD (0), VNAV PTH (1), VNAV SPD (4)

Text Outputs: /it-autoflight/mode

  • thr: Thrust System Mode: [THRUST - PITCH - RETARD]
  • arm: Armed Roll Mode: [HDG - LNV - LOC] or VOR/LOC and G/S Armed: [ILS]
  • lat: Active Roll Mode: [HDG - LNAV - LOC - ALGN - T/O]
  • vert: Active Pitch MOde: [ALT HLD - V/S - G/S - ALT CAP - SPD DES - SPD CLB - FPA - LAND 3 - FLARE - T/O CLB - G/A CLB - VNAV]
  • prof-vert: [NONE - VNAV HLD - VNAV PTH - VNAV CAP - VNAV SPD]