Debian Codegraph @

Aircraft/ufo/ufo-autopilot.xml

raw symbols SCIP
1 <?xml version="1.0"?>
2
3 <!-- UFO Autopilot -->
4 <!-- Copyright (c) 2022 Josh Davidson (Octal450) -->
5
6 <PropertyList>
7
8 <!-- Logic -->
9 <logic> <!-- Roll channel active -->
10 <input>
11 <or>
12 <equals>
13 <property>/autopilot/locks/heading</property>
14 <value>wing-leveler</value>
15 </equals>
16 <equals>
17 <property>/autopilot/locks/heading</property>
18 <value>dg-heading-hold</value>
19 </equals>
20 <equals>
21 <property>/autopilot/locks/heading</property>
22 <value>true-heading-hold</value>
23 </equals>
24 <equals>
25 <property>/autopilot/locks/heading</property>
26 <value>nav1-hold</value>
27 </equals>
28 </or>
29 </input>
30 <output>/autopilot/internal/roll-active</output>
31 </logic>
32
33 <logic> <!-- Basic pitch hold active -->
34 <input>
35 <equals>
36 <property>/autopilot/locks/altitude</property>
37 <value>pitch-hold</value>
38 </equals>
39 </input>
40 <output>/autopilot/internal/pitch-hold-active</output>
41 </logic>
42
43 <logic> <!-- Pitch channel active -->
44 <input>
45 <or>
46 <equals>
47 <property>/autopilot/locks/altitude</property>
48 <value>vertical-speed-hold</value>
49 </equals>
50 <equals>
51 <property>/autopilot/locks/altitude</property>
52 <value>pitch-hold</value>
53 </equals>
54 <equals>
55 <property>/autopilot/locks/altitude</property>
56 <value>altitude-hold</value>
57 </equals>
58 <equals>
59 <property>/autopilot/locks/altitude</property>
60 <value>agl-hold</value>
61 </equals>
62 <equals>
63 <property>/autopilot/locks/altitude</property>
64 <value>gs1-hold</value>
65 </equals>
66 </or>
67 </input>
68 <output>/autopilot/internal/pitch-active</output>
69 </logic>
70
71 <logic> <!-- Fpm channel active -->
72 <input>
73 <or>
74 <equals>
75 <property>/autopilot/locks/altitude</property>
76 <value>vertical-speed-hold</value>
77 </equals>
78 <equals>
79 <property>/autopilot/locks/altitude</property>
80 <value>altitude-hold</value>
81 </equals>
82 <equals>
83 <property>/autopilot/locks/altitude</property>
84 <value>agl-hold</value>
85 </equals>
86 <equals>
87 <property>/autopilot/locks/altitude</property>
88 <value>gs1-hold</value>
89 </equals>
90 </or>
91 </input>
92 <output>/autopilot/internal/vs-active</output>
93 </logic>
94
95 <logic> <!-- Throttle channel active -->
96 <input>
97 <equals>
98 <property>/autopilot/locks/speed</property>
99 <value>speed-with-throttle</value>
100 </equals>
101 </input>
102 <output>/autopilot/internal/throttle-active</output>
103 </logic>
104
105 <filter> <!-- Heading error computer -->
106 <name>Heading/Nav Error Deg</name>
107 <type>gain</type>
108 <gain>1.0</gain>
109 <input>
110 <condition>
111 <equals>
112 <property>/autopilot/locks/heading</property>
113 <value>nav1-hold</value>
114 </equals>
115 </condition>
116 <property>/instrumentation/nav[0]/radials/target-auto-hdg-deg</property>
117 <offset>
118 <property>/orientation/heading-deg</property>
119 <scale>-1.0</scale>
120 </offset>
121 </input>
122 <input>
123 <condition>
124 <equals>
125 <property>/autopilot/locks/heading</property>
126 <value>true-heading-hold</value>
127 </equals>
128 </condition>
129 <property>/autopilot/settings/true-heading-deg</property>
130 <offset>
131 <property>/orientation/heading-deg</property>
132 <scale>-1.0</scale>
133 </offset>
134 </input>
135 <input>
136 <condition>
137 <equals>
138 <property>/autopilot/locks/heading</property>
139 <value>dg-heading-hold</value>
140 </equals>
141 </condition>
142 <property>/autopilot/settings/heading-bug-deg</property>
143 <offset>
144 <property>/orientation/heading-magnetic-deg</property>
145 <scale>-1.0</scale>
146 </offset>
147 </input>
148 <input>0</input>
149 <output>/autopilot/internal/heading-error-deg</output>
150 <period>
151 <min>-180</min>
152 <max>180</max>
153 </period>
154 </filter>
155
156 <filter> <!-- Clamp glideslope target fpm -->
157 <name>G/S FPM Calc</name>
158 <type>gain</type>
159 <gain>1.0</gain>
160 <input>/instrumentation/nav[0]/gs-rate-of-climb-fpm</input>
161 <output>/autopilot/internal/nav1-rate-of-climb-fpm</output>
162 <min>-10000</min>
163 <max>0</max>
164 </filter>
165
166 <!-- Roll Axis -->
167 <filter> <!-- Copy target roll angle, 0 by default for wingn leveller -->
168 <name>IT-CONTROLLER: Roll Deg/Wings Level</name>
169 <type>gain</type>
170 <gain>1.0</gain>
171 <enable>
172 <condition>
173 <equals>
174 <property>/autopilot/locks/heading</property>
175 <value>wing-leveler</value>
176 </equals>
177 </condition>
178 </enable>
179 <input>/autopilot/settings/target-roll-deg</input>
180 <output>/autopilot/internal/target-roll-deg</output>
181 </filter>
182
183 <filter> <!-- Compute target roll angle from heading error -->
184 <name>IT-CONTROLLER: Heading</name>
185 <type>gain</type>
186 <gain>0.5</gain>
187 <enable>
188 <condition>
189 <or>
190 <equals>
191 <property>/autopilot/locks/heading</property>
192 <value>dg-heading-hold</value>
193 </equals>
194 <equals>
195 <property>/autopilot/locks/heading</property>
196 <value>true-heading-hold</value>
197 </equals>
198 <equals>
199 <property>/autopilot/locks/heading</property>
200 <value>nav1-hold</value>
201 </equals>
202 </or>
203 </condition>
204 </enable>
205 <input>/autopilot/internal/heading-error-deg</input>
206 <reference>0</reference>
207 <output>/autopilot/internal/target-roll-deg</output>
208 <min>-90</min>
209 <max>90</max>
210 </filter>
211
212 <filter> <!-- Smooth engagement by syncing when disabled -->
213 <name>System Command: Roll Target Inactive Sync</name>
214 <type>gain</type>
215 <gain>1.0</gain>
216 <enable>
217 <condition>
218 <not><property>/autopilot/internal/roll-active</property></not>
219 </condition>
220 </enable>
221 <input>/orientation/roll-deg</input>
222 <output>/autopilot/internal/target-roll-deg</output>
223 <min>-90</min>
224 <max>90</max>
225 </filter>
226
227 <filter> <!-- Aileron elevator controller -->
228 <name>System Command: Aileron</name>
229 <type>noise-spike</type>
230 <feedback-if-disabled>true</feedback-if-disabled>
231 <initialize-to>output</initialize-to>
232 <enable>
233 <condition>
234 <property>/autopilot/internal/roll-active</property>
235 </condition>
236 </enable>
237 <input>
238 <expression>
239 <div>
240 <property>/autopilot/internal/target-roll-deg</property>
241 <value>90</value>
242 </div>
243 </expression>
244 </input>
245 <output>/controls/flight/aileron</output>
246 <max-rate-of-change>1.2</max-rate-of-change>
247 </filter>
248
249 <!-- Pitch Axis -->
250 <filter> <!-- Compute target fpm from altitude error -->
251 <name>IT-CONTROLLER: Altitude Capture/Hold</name>
252 <type>gain</type>
253 <gain>-20</gain>
254 <input>/position/altitude-ft</input>
255 <reference>/autopilot/settings/target-altitude-ft</reference>
256 <output>/autopilot/internal/target-fpm-alt</output>
257 </filter>
258
259 <filter> <!-- Compute target fpm from agl error -->
260 <name>IT-CONTROLLER: AGL Capture/Hold</name>
261 <type>gain</type>
262 <gain>-20</gain>
263 <input>/position/altitude-agl-ft</input>
264 <reference>/autopilot/settings/target-agl-ft</reference>
265 <output>/autopilot/internal/target-fpm-agl</output>
266 </filter>
267
268 <filter> <!-- Copy target pitch angle -->
269 <name>IT-CONTROLLER: Pitch Deg</name>
270 <type>gain</type>
271 <gain>1.0</gain>
272 <enable>
273 <condition>
274 <property>/autopilot/internal/pitch-hold-active</property>
275 </condition>
276 </enable>
277 <input>/autopilot/settings/target-pitch-deg</input>
278 <output>/autopilot/internal/target-pitch-deg</output>
279 </filter>
280
281 <filter> <!-- Select target vertical speed -->
282 <name>Target FPM</name>
283 <type>gain</type>
284 <gain>1.0</gain>
285 <input>
286 <condition>
287 <equals>
288 <property>/autopilot/locks/altitude</property>
289 <value>altitude-hold</value>
290 </equals>
291 </condition>
292 <property>/autopilot/internal/target-fpm-alt</property>
293 </input>
294 <input>
295 <condition>
296 <equals>
297 <property>/autopilot/locks/altitude</property>
298 <value>agl-hold</value>
299 </equals>
300 </condition>
301 <property>/autopilot/internal/target-fpm-agl</property>
302 </input>
303 <input>
304 <condition>
305 <equals>
306 <property>/autopilot/locks/altitude</property>
307 <value>gs1-hold</value>
308 </equals>
309 </condition>
310 <property>/autopilot/internal/nav1-rate-of-climb-fpm</property>
311 </input>
312 <input>/autopilot/settings/vertical-speed-fpm</input>
313 <output>/autopilot/internal/target-fpm</output>
314 </filter>
315
316 <filter> <!-- Main fpm controller -->
317 <name>IT-CONTROLLER: FPM Hold</name>
318 <type>gain</type>
319 <gain>1.0</gain>
320 <enable>
321 <condition>
322 <property>/autopilot/internal/vs-active</property>
323 </condition>
324 </enable>
325 <input> <!-- Reversed from UFO.cxx -->
326 <expression>
327 <rad2deg>
328 <asin>
329 <div>
330 <div>
331 <div>
332 <property>/autopilot/internal/target-fpm</property>
333 <value>60</value> <!-- Fps to fpm -->
334 </div>
335 <value>3.28084</value> <!-- Meters to feet -->
336 </div>
337 <max>
338 <product>
339 <property>/velocities/airspeed-kt</property>
340 <value>0.514444</value> <!-- Knots to meters/sec -->
341 </product>
342 <value>0.0000001</value> <!-- Prevent divide by 0 -->
343 </max>
344 </div>
345 </asin>
346 </rad2deg>
347 </expression>
348 </input>
349 <output>/autopilot/internal/target-pitch-deg</output>
350 </filter>
351
352 <filter> <!-- Smooth engagement by syncing when disabled -->
353 <name>System Command: Pitch Target Inactive Sync</name>
354 <type>gain</type>
355 <gain>1.0</gain>
356 <enable>
357 <condition>
358 <not><property>/autopilot/internal/pitch-active</property></not>
359 </condition>
360 </enable>
361 <input>/orientation/pitch-deg</input>
362 <output>/autopilot/internal/target-pitch-deg</output>
363 <min>-90</min>
364 <max>90</max>
365 </filter>
366
367 <filter> <!-- Main elevator controller -->
368 <name>System Command: Elevator</name>
369 <type>noise-spike</type>
370 <feedback-if-disabled>true</feedback-if-disabled>
371 <initialize-to>output</initialize-to>
372 <enable>
373 <condition>
374 <property>/autopilot/internal/pitch-active</property>
375 </condition>
376 </enable>
377 <input>
378 <expression>
379 <div>
380 <property>/autopilot/internal/target-pitch-deg</property>
381 <value>-90</value>
382 </div>
383 </expression>
384 </input>
385 <output>/controls/flight/elevator</output>
386 <max-rate-of-change>1.2</max-rate-of-change>
387 </filter>
388
389 <!-- Throttle Axis -->
390 <filter> <!-- Main throttle controller -->
391 <name>System Command: Throttle</name>
392 <type>noise-spike</type>
393 <feedback-if-disabled>true</feedback-if-disabled>
394 <initialize-to>output</initialize-to>
395 <enable>
396 <condition>
397 <property>/autopilot/internal/throttle-active</property>
398 </condition>
399 </enable>
400 <input>
401 <expression>
402 <div>
403 <product>
404 <property>/autopilot/settings/target-speed-kt</property>
405 <value>0.514444</value> <!-- Knots to meters/sec -->
406 </product>
407 <max>
408 <property>/engines/engine[0]/speed-max-mps</property>
409 <value>0.0000001</value> <!-- Prevent divide by 0 -->
410 </max>
411 </div>
412 </expression>
413 </input>
414 <output>/controls/engines/engine[0]/throttle</output>
415 <max-rate-of-change>0.3</max-rate-of-change>
416 </filter>
417
418 <!-- Trim Axis -->
419 <filter> <!-- Centers all the trims otherwise the system can't work -->
420 <name>System Command: Trim</name>
421 <type>gain</type>
422 <gain>0.0</gain>
423 <enable>
424 <condition>
425 <property>/autopilot/internal/pitch-active</property>
426 </condition>
427 </enable>
428 <input>0</input>
429 <output>
430 <property>/controls/flight/aileron-trim</property>
431 <property>/controls/flight/elevator-trim</property>
432 <property>/controls/flight/rudder-trim</property>
433 </output>
434 <min>-1.0</min>
435 <max>1.0</max>
436 </filter>
437
438 </PropertyList>