AI Scenarios

From FlightGear wiki
Jump to: navigation, search

Demo scenarios

This is a list of the demo scenarios, distributed with Flightgear 2.10

To find additional scenarios, take a look at unofficial hangars.

Nimitz

Places 2 Nimitz-class Carriers in the environment:

USS Nimitz - in the Pacific Ocean off San Fransisco

USS Eisenhower in the Mediterranean off Toulon

Eisenhower_demo

Sets up USS Eisenhower in operating an operating box off Norfolk VA.

Seahawk Wingman Demo

A Seahawk wingman.

PS. The plane must be installed in data/aircraft folder.

ballon_demo

Spawns some hotair ballons close to where you start.

ICE3_demo

A german train from Frankfurt to Essen. Select Frankfurt (EDDF) airport, hang about a bit, The ICE3 runs close to the main terminal, and is relatively easy to spot.

Steamtrain

A steamtrain operating in North Yorkshire Moors, UK.

To find it start at EGXZ - TOPCLIFFE and fly 084 degrees magnetic

KRHV_towing_demo

J3 takeoff from runway 31L at KRHV for aerotowing.

KSFO_airtrain

Trains drive around on elevated rails in KSFO.

bigstorm_demo

Big thunderstrom over San Fransisco.

lead-aircraft

A 737 tanker at 3000 circling above KSFO.

Wingman_demo

One british twin engine Bucaneer acts as wingman. This only works if its installed into data/Aircraft folder.

Wingman2_demo

Two british twin engine Bucaneer acts as wingmen. This only works if they are installed into data/Aircraft folder.

Wingman_b29_3_demo

4 B29 act as wingmen.

PS. It assumes the b29 is put in default FG aircraft folder.

Vinson_demo

Puts a carrier at: <latitude>37.8</latitude> <longitude>-123.6</longitude>

Thermal_demo

Thermal winds over KSFO.

Sanantonio_demo

Puts a carrier at: <latitude>32.75</latitude> <longitude>-117.34</longitude>

Clemen Ceau

Puts a carrier at: <latitude>42.800</latitude> <longitude>6.325</longitude>

Load_demo

This was a first try to create an external cargo, which could be carried/ towed by a helicopter or any other aircraft. The goal was to simulate realistic slung loads and winching operation. The file places an AI ballistic object at 28R KSFO. The object can be easily controlled by applying forces, which are defined in terms of Magnitude (lbf), Azimuth (deg, North = O) and Elevation (deg, up = 90). When released it behaves like any other ballistic AI-Object. Like any AI-object it can be hooked. To make it workable, the forces on the hook must be applied and transformed to the AI Object. Weight, slug mass and aerodynamic drag of the object can be defined in the file. This project has been stopped due problems which couldn't be solved at this time.

Nethertheless with little effort, the problems could be solved today and would have many advantages over the current approach described in http://forum.flightgear.org/viewtopic.php?f=23&t=23996. As an example you could also create more easily AI missiles or rockets, or carrying a Space Shuttle which could be released and controlled to get landed on an airport, everything without much lines of nasal scripts. For more infos and the developing background: http://sourceforge.net/p/flightgear/mailman/message/15801723/ The file load_demo.xml itself gives information in how to use.

PAVictoria

Ferry will depart from port near KNOW.

aircraft_demo

737 takeoff from runway 28L at KSFO and fly the Porte Departure to the south

droptank_demo

Ties droptanks to the aircraft. This is a ballistic AI object, once released it will follow a ballistic curve.

droptank_hunter_demo

Ties droptanks to the aircraft. This is a ballistic AI object, once released it will follow a ballistic curve.

foch_demo

Puts a carrier at: <latitude>42.830</latitude> <longitude>6.325</longitude>

railway_demo

This scenario runs a variety of trains and buses along tracks or roads near Wakefield, Yorkshire, UK

Select Leeds-Bradford (EGNM) airport, fly 165 deg until you get to Wakefield. Look around: there is a railway line to the south of the city, and one to the east. The bus runs out to the west. Look carefully - the trains and bus are very hard to pick out.

refueling_demo

Puts an 737 aerial tanker in orbit over KSFO at 3000 ft AGL.

refueling_demo_1

Puts an KC-135 aerial tanker in a N/S towline starting over KSFO at 8000 ft AGL.

refueling_demo_2

Puts an KC-135 aerial tanker in a N/S towline starting over KSFO at 8000 ft AGL.

ship_demo

Puts a sailboat in the bay just east of KSFO

Flightplan scenario

AI flightplan scenarios are very simple. Simply tie a flightplan to a model, and you have a scenario. Below, I'm going to go explain exactly how this is done.

Flightplans and Their Waypoints

Flightplans have a basic structure that you must adhere to in order to create one successfully. They are in XML, and consist of several waypoints. So, you have the XML header at the top followed by a PropertyList tag and a flightplan tag, followed by a series of waypoints, a final waypoint with no coordinates, called EOF (end of flight), and the end tags for PropertyList and flightplan.

Each waypoint has eight parameters. They tend to be written in the following order: name, lat, lon, alt, ktas, on-ground, gear-down, flaps-down. All waypoints, except EOF, must have these, or the scenario may behave unpredictably. Furthermore, all waypoints are tagged with a wpt tag. Now, to go through the different parameters.

  • name: can consist of anything. If you want to use a word or a number, it doesn't matter so long as the characters in it are allowed in XML.
  • lat: the model's latitude at the waypoint.
  • lon: the model's longitude at the waypoint.
  • alt: the model's altitude.
  • ktas: Knots True AirSpeed of the model.
  • on-ground: a boolean value expressed as an integer value of either 1 or 0.
  • gear-down: a boolean value expressed as an integer value of either 1 or 0.
  • flaps-down: a float value expressed a value between 0 and 1.
  • on-ground need not necessarily be placed correctly. In the example, you will see that, for all waypoints, this value is set to zero. You may want to play around with this one. If you set it to 1 too early (for a landing), the aircraft will be thrust onto the ground sharply. If you set it late, then things should be okay. Or, it may appear to hover if you’ve set the altitude a bit high.


SFOBridges1.pngSFOBridges2.png

Once completed, be sure to save as an XML file in the AI/flightplans directory.

Tying Things Together

Next, you need to create the scenario XML file. For the example, I will simply borrow an existing one, and make modifications to it. I’ll choose aircraft_demo.xml. As you will see, you need PropertyList and scenario tags. A description is optional, but recommended. Then, there’s an entry for a model. It starts with an entry tag. Then, it’s given a callsign. The type is aircraft. There are different types you can specify for different kinds of scenarios; however, we’re just going to focus on the aircraft type. There are various classes as well. This one is set to jet transport. I think there’s a light class as well, but they all seem to behave the same to me. If someone else, more knowledgeable in this area could clarify things that would be helpful. Next is the model. Just set the path to the aircraft of your choice. It’s recommended that you use a low-poly aircraft from the AI directory, but a regular aircraft works fine as well. After that is the flightplan parameter. Simply set the path to your flightplan. Finally, there is an option to set your scenario to either simply terminate or repeat once completed. Enter a 1 for repeat, a 0 for no repeat. Remember to add all your end-tags when you have finished, and save it with a name other than the one you modified (if you chose to modify an existing scenario).

Special Tools

There are two great tools for making flight plans. You can use Oscar’s Flightplan Generator or redneck’s Flightplan Generator. They work very differently, but can be used together to further enhance your AI scenarios. Oscar’s Flightplan Generator uses a Google Maps interface in which you simply click on the location you want to place a waypoint at, and enter the rest of the data (speed, altitude, on-ground, etc.). redneck’s Flightplan Generator is a custom FlightGear logger. Simply start FG with the logger, using the --generic=file,out,0.1,path/to/flightplan/file,dgrecord2 command. If you have named the logger something other than dgrecord2, then subsitute the actual name for dgrecord2. This won’t work in FGRun’s interface, so just tack it on to the executable line, being sure to add a space between the executable and the command. Then, just fly the flight you want the AI aircraft to fly. Once finished, close FG, and check the flightplan file. You will find your once blank file is suddenly filled with all the necessary data, plus some useless data points. You will need to trim off the waypoints with KTAS < 10 so that your AI model can get off the ground in some reasonable amount of time. Both tools can be found at the Official FlightGear Forum.

http://forum.flightgear.org/viewtopic.php?f=23&t=9151&hilit=Oscar%E2%80%99s+Flightplan+Generator

http://oscar.bouwmans.name/FlightGear/aiscenario/

Common Issues

I believe I have created the flightplan correctly, yet, when I run the scenario, the plane doesn’t follow the route as expected. There are a few possible reasons for this.

1. AI scenarios are flown with turn anticipation. Therefore, the aircraft will rarely fly all the way to the waypoint, especially if it’s at a turning point. You may want to adjust for this by setting the entry point of the turn a little late. You can do this by changing the coordinates of the problem waypoint.

2. Is your plane doing flat loops? Perhaps you have set your waypoints too close together. The AI aircraft in the scenario always goes from the first waypoint to the next nearest waypoint, regardless of what order you put your waypoints in. Therefore, it’s important that you avoid making circles or any kind of flight that starts and ends at roughly the same location.

3. Another possibility is that you are expecting the aircraft to turn tighter than the AI scenario will allow it to turn. Write your flightplans to use gentle turns to correct this, or a slower speed.

Related content