FGFSCopilot

From FlightGear wiki
Jump to: navigation, search

FGFSCopilot is an addon designed to greatly enhance existing flight automation systems in FlightGear.

History

This project began on May 4, 2011, and was originally released under the name "FGFSFMC" for "FlightGear Flight Simulator Flight Management Computer". The original intention was to enhance fuel efficiency in climbs and descents in passenger jets. It was inspired by an addon for the default 747-400 in FSX, called Flight Management Automation (FMA). FMA truly automates flying in FSX. Simply punch some numbers in, line up on the runway, activate it, rotate, and wait till touchdown at the other airport. The downside to it is that it only works on one plane. I wanted to fix that issue in the program I was making for FlightGear. To do this, however, would require that I make it possible for users to input some performance info about their jet. Very shortly after I got started, I decided to make it work with prop-driven planes as well. I decided that I wanted to make this addon work for nearly all planes. The first version was released the day after the project was started. Functionality included assisted takeoff (auto rotation once Vr is reached), climb management, descent management, and automatic ILS interception.

Shortly after the first release of FGFSFMC, I decided that, to make this truly universal, I would want to make it work with helicopters as well. I got to work on making such implementations, and fixed some bugs. I also implemented an autolander. Version 2 was released on May 8, 2011. Unfortunately, the GUI broke, so labels telling the user what to put into the text fields were scattered all over the place. As a temporary fix, I filled the text fields with simple descriptions of what information is required to be placed in them. After this, several more releases were made as I removed bugs.

About a week and a half later, someone alerted me to the fact that the jets are put into landing configuration rather early, about 20 nm out from the airport. This cancelled out any gain from powering down early and waiting until the airspeed is down to 200 kts before lowering any flaps and the gear. To fix this, I decreased the distance from the arrival airport at which jets are slowed down from 250 KIAS to their approach speed. That same user also complained that he had no way of knowing what the program was doing at a particular time. To fix this, I added voice cues. Unfortunately, even at the time of this writing, some of them have issues with repeating a few times.

At about the same time, it was brought to my attention that FGFSFMC was now way smarter than a real FMC. I realized I was left with two choices: remove some functions to make it more like a real FMC, or keep the functionality and change the name. I decided to change the name to FGFSCopilot, since, while the FMC could make calculations faster than a human being, the human being is ultimately smarter than a computer.

On September 12, 2011, a new, faster version of FGFSCopilot, FGFSCopilot 12, was released. It is twice as fast as before, and is much better at landing the planes. Version 13 came out the next day with a correctly-functioning heli option, so that it can fly helicopters again, though not as gracefully as the planes.

On September 19, 2011, a new, special version was released, designed specifically for flying in ATC environments such as VATSIM. This version is called FGFSCopilotATCEdition, and will NOT fully automate flights. It simply automates climbs and descents, as well as takeoffs and landings. Whatever the pilot punches into the AP in FG determines how this program will cause the plane to behave. A second download link for this special version has been provided below in the Download section.

The next day version 15 was completed and uploaded, featuring step climb functionality. Later that day, FGFSCopilot 16 and FGFSCopilotATEdition 2 were released with a fix to the step climb system.

On September 25, 2011, FGFSCopilot 17 and FGFSCopilotATEdition were released, featuring automated non-precision approaches. No autolanding for non-precision approaches. The program exits when you are 2.5 nm away from the runway. At which point you should be at about 1000 ft above the airport, and have it in sight if the weather permits.

On January 29, 2012, some more things were tweaked. The autoland system was improved, and the newest releases (FGFSCopilot18 and FGFSCopilotATCEdition4) finally include the voice cues.

Starting November 5, 2012, I made several failed attempts to integrate FGFSCopilot with FlightGear both partially and completely, and eventually dropped the project in frustration.

On July 18, 2013, I began to rewrite the entire program, shortly after learning how to run Java methods on separate threads. This means that starting the flight automation process will no longer freeze the GUI, which means, if the user makes a mistake, he/she can click a button to stop it, make the correction, and start it back up again. The codename was FGFSCopilotX, as I wanted to change my version numbering system; however, I was not sure what the system would, and wanted to focus on the code first. The latest version is simplified as much as possible, with a huge focus on execution speed. The old version ran about once every five seconds on my system before. The latest version tends to run much faster, on the same system, with a more recent version of FG, at a speed of about two to four times per second. To accomplish this some things have been removed. Helicopters are no longer supported, and it can complete a flight only if ILS is used for the approach. Furthermore, voice cues have been removed, and replaced with an updating status in the GUI, also made possible through the use of a background thread. The new version numbering system I have adopted is to simply use the date at which the code was exported into a JAR file. The latest version, as of July 24, 2013 is FGFSCopilot v07242013.

Using FGFSCopilot

Simply download and extract to a convenient location, add the command --telnet=9321 (or another port number of your choice) to FG, start FG, then double-click. More instructions can be found by clicking the "Instructions" button. Just make sure that when the dialog box pops up, the port number in it matches the port number you told FG to listen on, so long as it's not a common/well-known port number (anything less than 1500).

Upon successfully starting the program, the user will find a graphic user interface (GUI) on their screen. It will appear as it does to the right:

The GUI for FGFSCopilot v07242013

If you're flying an airliner, the default fuel load is unlikely to be appropriate for your flight. Since this is designed to be universal, and not all planes use the same amounts of fuel tanks or even the same sizes of fuel tanks, you will have to enter your fuel load as a percentage of the aircraft's total fuel capacity. Then, press the Load Fuel button. Note that FGFSCopilot does NOT know where the CG needs to be, and will simply fill all of the tanks to the same percentage of load entered in the text field. For planes with better FDMs that are strongly affected by nose or tail-heaviness, manual adjustments will need to be made.

The start and end buttons are used to start and end the flight automation functions respectively. In this version, the program will not only check to make sure something has been entered in the text fields, but will also verify that the values entered make sense, and will present the user with error messages when an invalid input is found upon pressing the start button. The error checking is a bit crude, simply checking to make sure that the field does not contain an empty String, nor the default String of text used to label it. Typing a random string of letters and symbols where numbers are expected will cause problems. The error messages are more than just error messages, though. Not only will they tell the user where he/she made an invalid input, but it will also give the user a choice to either continue with the default value for that field, which will be a number that should come close to a typical value used for a jetliner, or enter a value in an input dialog, which will be transferred to the GUI, and stored as a variable for later use.

In the second row, the user will need to enter performance data, which consists entirely of speed values. In the field labeled "rotate", the user will enter the Vr speed for their plane. The field labeled "kias" is for the climb/cruise speed in KIAS. Mach is for the cruising mach number, and vRef for the final approach speed. In the third row, the user will enter their cruise altitude in feet in the field labeled "crzalt", and will enter their climb power in either N1 or RPMs in the field labeled "clbpwr". This version of FGFSCopilot uses the climb power entry to determine whether the user is flying a jet or a prop. N1 values must never exceed 3 characters, or else they will be read as RPM values. Note that mach is NOT ignored when the aircraft is determined to be prop-driven. If the mach speed is high enough that it will never be reached, then the program will not need to use it anyway, so, when flying GA with this program, feel free to use the default value, which is set at 0.8.

The bottom row is for navigation purposes. FGFSCopilot can create a simple route that will take you directly to an automatically-generated intercept point, which will be close to, but unlikely to be within, the ILS feather, and down to the runway of your destination. It checks to see if you already have a route first, to prevent unwanted overwrite or other weird alterations of an already-existing route; however, all of this information is mandatory at this time. The information includes the ICAO code of the airport that you are departing from, the runway used for departure, the ICAO code of the airport that you are flying to, the runway you plan to land on, that runway's heading, and its touchdown zone elevation in feet.

Note that you do not have to be on the ground to start FGFSCopilot. It has been written to figure out what phase of flight the aircraft is in at the press of the start button, and then remember that phase so that it will only need to check to see if it has reached the next phase as it runs. You should also notice the word "Ready" in the top-right corner of the GUI. That is the status of FGFSCopilot. It says "Ready" when it is ready to start. When running, it will say what phase it is flying. As before, the whole flight is completely automated, except for keeping the plane on the center line during takeoff and landing rollout. Furthermore, thrust reversers must be applied manually. The flare has been greatly improved from before, programmed to mimic how a human pilot would flare manually: by raising the nose slightly above the horizon, and then reducing power slowing to gently fly the plane to the runway, while maintaining back pressure to keep the nose up. The touchdown is smoother now as well. Just like when landing by hand, it maintains back pressure after touchdown, while using light braking force at first, to gently fly the nose gear down to the runway as well. Expect to touchdown at about -60 fpm every time. Unlike before, the program does not self-terminate completely after your airspeed drops below 40 kts after landing. Instead, it stops flight automation, but the GUI stays open, in case you want to use it again for another flight right away.

Download

The latest version of FGFSCopilot can be found at http://www.filefactory.com/file/ln3wimy69n/n/FGFSCopilot_v07242013_jar

Future Developments

As of July 24, 2013, no plans for further future developments exist. Unless I am able to figure out how I can override non-generic autopilot systems, and force aircraft to use a special autopilot created just for FGFSCopilot by becoming an expert in Nasal/XML or Canvas, then this will be the final release.

Questions and Bugs?

Questions, bug reports, complaints, comments, etc. can be directed to http://forum.flightgear.org/viewtopic.php?f=6&t=11895