Debian Codegraph @

Docs/AI_doc.html

raw symbols SCIP
1 <HTML>
2 <HEAD></HEAD>
3 <BODY>
4 <h3>Using AI objects in FlightGear</h3><hr>
5 <br><br>
6 Starting with FlightGear version 0.9.4 you can place AI objects in the "FlightGear world".
7 In version 0.9.4 the AI objects can be defined in the <b><tt>preferences.xml</tt></b> file, or
8 in an airplane's <b><tt>*-set.xml</tt></b> file. In later versions of FlightGear they are
9 defined in a "scenario file" only. Types of AI objects available are ships, airplanes,
10 thunderstorms, thermals, aircraft carriers, static and ballistic objects.
11 <BR><BR>
12
13 AI objects have some things in common: The have a location in the "FlightGear world",
14 they can have an associated exterior 3D model, and they can move according to an internal
15 FDM (flight dynamics model). As of now, these objects are created at simulator start-up
16 by adding some XML code to a scenario file. The scenario file must be in the
17 <b><tt>data/Data/AI</tt></b> directory. You select which scenario file you want to use by naming
18 it in the <b><tt>preferences.xml</tt></b> file. (Note: As with everything in the
19 <b><tt>preferences.xml</tt></b> file, the entries can be overridden by an aircraft's
20 <b><tt>*-set.xml</tt></b> file, or at the command line.) The <b><tt>preferences.xml</tt></b>
21 file has an entry that looks like this (FlightGear versions newer than 0.9.4):
22 <BR><BR>
23
24 <b><tt>
25 &#60;ai><br>
26 &nbsp; &#60;enabled type="bool">true&#60;/enabled><br>
27 &nbsp; &#60;scenario>demo_scenario&#60;/scenario><br>
28 &#60;/ai><br>
29 </tt></b>
30 <BR><BR>
31
32 The scenario contains one entry for each AI object. The entry specifies what kind of
33 object to create, what it's initial conditions will be, and optionally (for aircraft and
34 ships) a flight plan.
35 <BR><BR><BR>
36
37 <h3>Ships</h3><hr>
38 The entry to create a sailboat would look like this:
39 <br><br>
40
41 <b><tt>
42 &#60;entry><br>
43 &nbsp; &#60;type>ship&#60;/type><br>
44 &nbsp; &#60;path>AI/Aircraft/sailboat1/sailboat.xml&#60;/path><br>
45 &nbsp; &#60;speed type="double">12.0&#60;/speed><br>
46 &nbsp; &#60;altitude type="double">0.0&#60;/altitude><br>
47 &nbsp; &#60;longitude type="double">-122.33333&#60;/longitude><br>
48 &nbsp; &#60;latitude type="double">37.61667&#60;/latitude><br>
49 &nbsp; &#60;heading type="double">20.0&#60;/heading><br>
50 &nbsp; &#60;rudder type="double">-3.0&#60;/rudder><br>
51 &#60;/entry><br>
52 </tt></b>
53 <BR><BR>
54
55 Most of the entries are self-explanatory. The "type" of object can be one of "aircraft",
56 "ship", "storm", "thermal", "carrier", "static" or "ballistic". The rest of the items
57 give the AI object a model, a starting location, and a starting speed and direction. You
58 use the <b>&#60;path&#62;</b> item to give the object any valid exterior model. You can even
59 make the ship look like an airplane if you want! The "ship" type can also have a
60 <b>&#60;rudder&#62;</b> value specified, which will cause the ship to move in a circle
61 (HINT: use small values, five degrees or less, and right rudder is positive).
62 <BR><BR>
63
64 <h3>Aircraft</h3><hr>
65 Here is an example of how to create an aircraft AI object:
66 <BR><BR>
67
68 <b><tt>
69 &#60;!-- puts an A-4 north of KSFO, orbiting at 7000 ft --><br>
70 &#60;entry><br>
71 &nbsp; &#60;type>aircraft&#60;/type><br>
72 &nbsp; &#60;class>jet_fighter&#60;/class><br>
73 &nbsp; &#60;path>Aircraft/a4/Models/a4-blue.xml&#60;/path><br>
74 &nbsp; &#60;speed type="double">320.0&#60;/speed><br>
75 &nbsp; &#60;altitude type="double">7000.0&#60;/altitude><br>
76 &nbsp; &#60;longitude type="double">-122.6&#60;/longitude><br>
77 &nbsp; &#60;latitude type="double">37.9&#60;/latitude><br>
78 &nbsp; &#60;heading type="double">210.0&#60;/heading><br>
79 &nbsp; &#60;roll type="double">-15.0&#60;/roll><br>
80 &#60;/entry>
81 </tt></b>
82 <BR><BR>
83
84 It looks much the same as the ship AI code. There are two differences, the
85 <b>&#60;class&#62;</b> item and the <b>&#60;roll&#62;</b> item. If the class is set to
86 "tanker" the airplane will allow you to refuel if you can get close behind it (so far
87 supported by JSBSim only) The "roll" will cause the airplane to fly in a circle. In the
88 above example the A-4 will be orbiting to the left at 15 degrees of bank. You can also
89 create a ship or airplane with a flight plan. In this case the object will follow the
90 flight plan and then delete itself when it reaches the end, or (new since version 0.9.8)
91 the object can be set to endlessly repeat a flight plan. The flight plans are located in
92 <b><tt>data/Data/AI/FlightPlans</tt></b>. To create an airplane with a flightplan do this:
93 <BR><BR>
94
95 <b><tt>
96 &#60;entry><br>
97 &nbsp; &#60;type>aircraft&#60;/type><br>
98 &nbsp; &#60;class>jet-transport&#60;/class><br>
99 &nbsp; &#60;path>Aircraft/737/Models/737.xml&#60;/path><br>
100 &nbsp; &#60;flightplan>KSFO_ILS28L.xml&#60;/flightplan><br>
101 &#60;/entry><br>
102 </tt></b>
103 <BR><BR>
104
105
106 In this case you don't need to specify initial conditions because they are already defined
107 in the flight plan. The AI aircraft objects can be displayed on radar. See the
108 <b><tt>Aircraft/Instruments/radar.xml</tt></b> file for details.
109
110 <BR><BR>
111 <h3>Thunderstorms</h3><hr>
112 <BR>
113 To make a thunderstorm, use this:
114 <BR><BR>
115
116 <b><tt>
117 &#60;!-- puts a thunderstorm overhead OSI (Woodside VOR) --><br>
118 &#60;entry><br>
119 &nbsp; &#60;type>storm&#60;/type><br>
120 &nbsp; &#60;path>Models/Geometry/thunderstorm.xml&#60;/path><br>
121 &nbsp; &#60;speed type="double">20.0&#60;/speed><br>
122 &nbsp; &#60;altitude type="double">4000.0&#60;/altitude><br>
123 &nbsp; &#60;latitude type="double">37.3917&#60;/latitude><br>
124 &nbsp; &#60;longitude type="double">-122.2817&#60;/longitude><br>
125 &nbsp; &#60;heading type="double">90&#60;/heading><br>
126 &#60;/entry><br>
127 </tt></b>
128 <BR><BR>
129
130 There's not much to it. No, they don't turn :) New since version 0.9.8 is the ability
131 to add lightning and turbulence to a thunderstorm. For an example of this see the scenario
132 file called "bigstorm_demo.xml". The AI storm objects can be displayed on weather radar. See the
133 <b><tt>Aircraft/Instruments/wxradar.xml</tt></b> file for details.
134
135 <br><br>
136 <h3>Thermals</h3><hr>
137 <BR>
138 To create a thermal, use this:
139 <BR><BR>
140
141 <b><tt>
142 &#60;!-- puts a thermal over the control tower at KSFO --><br>
143 &#60;entry><br>
144 &nbsp; &#60;type>thermal&#60;/type><br>
145 &nbsp; &#60;latitude type="double">37.61633&#60;/latitude><br>
146 &nbsp; &#60;longitude type="double">-122.38334&#60;/longitude><br>
147 &nbsp; &#60;strength-fps type="double">8.33&#60;/strength-fps><br>
148 &nbsp; &#60;diameter-ft type="double">4000.0&#60;/diameter-ft><br>
149 &nbsp; &#60;height-msl type="double">6000.0&#60;/height-msl><br>
150 &#60;/entry><br>
151 </tt></b>
152 <BR><BR>
153
154 The AI thermals don't move, they are invisible, and they don't "lean" downwind.
155 The <b>&#60;strength-fps&#62;</b> defines the maximum vertical velocity of the airmass
156 at the center of the thermal. The strength decreases to zero at the thermal's edge.
157 <b>&#60;height-msl&#62;</b> defines the top of the thermal.
158
159
160 <br><br>
161 <h3>Ballistic objects</h3><hr>
162 <br>
163 A ballistic AI object starts with an initial location, azimuth, elevation and speed, then
164 follows a ballistic path from there (with air resistance included). Try this:
165 <BR><BR>
166
167 <b><tt>
168 &#60;entry><br>
169 &nbsp; &#60;type>ballistic&#60;/type><br>
170 &nbsp; &#60;path>Models/Geometry/rocket.xml&#60;/path><br>
171 &nbsp; &#60;speed type="double">500.0&#60;/speed><br>
172 &nbsp; &#60;altitude type="double">50.0&#60;/altitude><br>
173 &nbsp; &#60;longitude type="double">-122.39&#60;/longitude><br>
174 &nbsp; &#60;latitude type="double">37.62&#60;/latitude><br>
175 &nbsp; &#60;heading type="double">200.0&#60;/heading><br>
176 &nbsp; &#60;azimuth type="double">70.0&#60;/azimuth><br>
177 &nbsp; &#60;elevation type="double">45.0&#60;/elevation><br>
178 &#60;/entry><br>
179 </tt></b>
180 <BR><BR>
181
182 There is not much call for rocket launches in FlightGear, but the ballistic AI object is
183 the basis for FlightGear's <a href="README.submodels">submodels</a> system.
184
185 <BR><BR><BR>
186 <h3>Aircraft Carriers</h3><hr>
187 <br>
188 The aircraft carrier AI object is based on the "ship" object but is much more complicated.
189 See the scenario file called <b><tt>nimitz_demo.xml</tt></b> for details.
190 <BR><BR><BR>
191 <hr>
192 Dave Culp, updated 23 Oct 2005<br>
193 [email protected]
194 </BODY>
195 </HTML>