Status of AI in FlightGear: Difference between revisions

Jump to navigation Jump to search
m
Line 211: Line 211:
     |author=<nowiki>Hooray</nowiki>
     |author=<nowiki>Hooray</nowiki>
     |date=<nowiki>Thu Aug 02</nowiki>
     |date=<nowiki>Thu Aug 02</nowiki>
  }}
}}
== Controlling the main Airplane ==
{{FGCquote
  |I'd suggest to get started by looking at the tanker.nas script instead - fox2.nas, the f14b demo and the bombable script are much more sophisticated, while tanker.nas is really pretty simple and straightforward: [https://gitorious.org/fg/fgdata/source/01781f83715d90b6bf2df5c6210f766d0090083d:Nasal/tanker.nas https://gitorious.org/fg/fgdata/source/ ... tanker.nas]
  |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=190358#p190358
    |title=<nowiki>Re: How would I go about controlling an airplane with nasal?</nowiki>
    |author=<nowiki>Hooray</nowiki>
    |date=<nowiki>Thu Sep 19</nowiki>
  }}
}}
{{FGCquote
  |hat would be great - but you'll probably want to look at tanker.nas for now, and look up the various APIs used there (see the wiki).<br/>
The other examples are a little more involved.<br/>
<br/>
Also, it will be important if you are going to control the main aircraft, or some form of AI aircraft - because properties may differ then ...
  |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=190358#p190358
    |title=<nowiki>Re: How would I go about controlling an airplane with nasal?</nowiki>
    |author=<nowiki>Hooray</nowiki>
    |date=<nowiki>Thu Sep 19</nowiki>
  }}
}}
{{FGCquote
  | you can simply look at the autopilot dialog of your aircraft (e.g. c172p, b1900d or 777) - sometimes, looking at the cockpit panel may also make sense (MCP) - otherwise, you can then simply use the autopilot system to control the aircraft, which also includes support for flying complete routes via the built-in route manager, for details, see:<br/>
<br/>
[[File:Autopilot.jpg|250px]]<br/>
[[File:Custom-autopilot-dialog.png|250px]]<br/>
[[Autopilot]]<br/>
<br/>
These are just XML files (GUI dialogs in $FG_ROOT/gui/dialogs or somewhere in $FG_AIRCRAFT - if customized) - so you can simply open those files and look up the properties for the various autopilot modes that you want to use (heading hold, wings level, altitude hold etc).<br/>
<br/>
Equally, the route manager is well-documented: <br/>
[[Route_Manager]]<br/>
[[Route_manager_internals]]<br/>
<br/>
So, basically, you really only need to set properties via setprop/prop.nas to control the route manager and/or autopilot, which will in turn allow you to control the main aircraft - this is much more straightforward than controlling AI traffic, because all these hooks aren't currently exposed yet.
  |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=190385#p190385
    |title=<nowiki>Re: How would I go about controlling an airplane with nasal?</nowiki>
    |author=<nowiki>Hooray</nowiki>
    |date=<nowiki>Fri Sep 20</nowiki>
   }}
   }}
}}
}}

Navigation menu