AI Systems: Difference between revisions

Jump to navigation Jump to search
Line 22: Line 22:
== AI Models ==
== AI Models ==


Starting with FlightGear version 0.9.4 you can place AI objects in the "FlightGear world". In version 0.9.4 the AI objects can be defined in the preferences.xml file, or in an airplane's *-set.xml file. In later versions they are defined in a "scenario file" only. The types of AI objects you can have are airplanes, ships, thunderstorms, thermals and ballistic objects. AI objects have some things in common: The have a location in the "FlightGear world", they can have an associated exterior 3D model, and they can move according to an internal FDM (flight dynamics model). As of now, these objects are created at simulator start-up by adding some XML code to a scenario file. The scenario file must be in the data/AI directory. You select which scenario files you want to use by naming it in the preferences.xml file. The preferences.xml file has an entry that looks like this (FlightGear versions newer than 0.9.4, including CVS):  
Starting with FlightGear version 0.9.4 you can place AI objects in the "FlightGear world". In version 0.9.4 the AI objects can be defined in the preferences.xml file, or in an airplane's *-set.xml file. In later versions they are defined in a "scenario file" only. The types of AI objects you can have are airplanes, ships, thunderstorms, thermals/sinks, static and ballistic objects. AI objects have some things in common: The have a location in the "FlightGear world", they can have an associated exterior 3D model, and they can move according to an internal FDM (flight dynamics model). As of now, these objects are created at simulator start-up by adding some XML code to a scenario file. The scenario file must be in the data/AI directory. You select which scenario files you want to use by naming it in the preferences.xml file. The preferences.xml file has an entry that looks like this (FlightGear versions newer than 0.9.4, including CVS):  


  <AI>
  <AI>
Line 45: Line 45:




Most of the parameters are self-explanitory. The "type" of object can be one of "aircraft", "ship", "storm", "thermal", "ballistic" or "static". The rest of the items give the AI object a model, a starting location, and a starting speed and direction. You use the <MODEL> item to give the object any valid exterior model. You can even make the ship look like an airplane if you want! The "ship" type can also have a <RUDDER> value specified, which will cause the ship to move in a circle (HINT: use small values, five degrees or less, and right rudder is positive). Here is an example of how to create an aircraft AI object:
Most of the parameters are self-explanitory. The "type" of object can be one of "aircraft", "ship", "carrier", "thunderstorm", "thermal", "ballistic" or "static". The rest of the items give the AI object a model, a starting location, and a starting speed and direction. You use the <MODEL> item to give the object any valid exterior model. You can even make the ship look like an airplane if you want! Note that the speed of the AI object is true airspeed, and since AI aircraft and ships don't feel wind or current then this also the ground speed. The "ship" type can also have a <RUDDER> value specified, which will cause the ship to move in a circle (HINT: use small values, five degrees or less, and right rudder is positive). Here is an example of how to create an aircraft AI object:


  <!-- puts an A-4 north of KSFO, orbiting at 7000 ft -->   
  <!-- puts an A-4 north of KSFO, orbiting at 7000 ft -->   
Line 52: Line 52:
   <CLASS>light</CLASS>  
   <CLASS>light</CLASS>  
   <MODEL>Aircraft/a4/Models/a4-blue.xml</MODEL>  
   <MODEL>Aircraft/a4/Models/a4-blue.xml</MODEL>  
   <SPEED-KTAStype="double">320.0</SPEED-KTAS>  
   <SPEED-KTAS type="double">320.0</SPEED-KTAS>  
   <ALTITUDE-FT type="double">7000.0</ALTITUDE-FT>  
   <ALTITUDE-FT type="double">7000.0</ALTITUDE-FT>  
   <LONGITUDE type="double">-122.6</LONGITUDE>  
   <LONGITUDE type="double">-122.6</LONGITUDE>  
Line 99: Line 99:
model can be assigned to the thermal, and usually this will be a small cloud to mark the thermal's location.  To create a sink, just give a "thermal" a negative strength, and give it a null model.  Please see the demo scenario (thermal_demo.xml) for examples.   
model can be assigned to the thermal, and usually this will be a small cloud to mark the thermal's location.  To create a sink, just give a "thermal" a negative strength, and give it a null model.  Please see the demo scenario (thermal_demo.xml) for examples.   


A ballistic AI object starts with an initial azimuth, elevation and speed, then follows a ballistic path from there (with air resistance included). Try this:
A ballistic AI object starts with an initial azimuth, elevation and speed, then follows a ballistic path from there (with air resistance and wind included). Try this:


  <ENTRY>
  <ENTRY>
Line 113: Line 113:
  </ENTRY>
  </ENTRY>


The AI storm objects can be displayed on weather radar. See the Aircraft/Instruments/wxradar.xml file for details. The AI aircraft objects can be displayed on radar. See the Aircraft/Instruments/radar.xml file for details, or fly the T-38 for a demo.
Note that the speed is now in feet per second.
 
The AI storm objects can be displayed on weather radar. See the Aircraft/Instruments/wxradar.xml file for details. The AI aircraft objects can be displayed on radar. See the Aircraft/Instruments/radar.xml file for details.
 
You can make your own AI scenario file, called say my_scenario.xml, and cut/paste entries from the other scenario files to build an AI scenario as complicated as you like.
 
 
The following how-to shows you how to animate a tail-dragger airplane so that its pitch attitude looks proper for the AI aircraft's airpeed.  This is not needed for aircraft with tricycle landing gear.


=== Using Interpolation Tables ===
=== Using Interpolation Tables ===
1

edit

Navigation menu