Virtual CoPilot
This article is a stub. You can help the wiki by expanding it. |
Work in progress This article or section will be worked on in the upcoming hours or days. See history for the latest developments. |
Problem
Note
|
I am absolutely convinced that these autopilot/copilot tools are a great idea for FG, but I also believe anybody not coding this directly IN FlightGear by using Nasal, is making it more complicated than necessary. So, I will try to support anybody who is actually looking into porting this over to "native FlightGear space" by reimplemting such efforts in Nasal space instead - adding a bunch of extension functions to enrich the API is easy and well documented actually. Anybody knowing C++ (or Java for that matter), should be able to understand what's involved: Howto:Extending_Nasal
|
Background
state machines would be helpful here, IMO, unless you just need something basic. Offtopic, but I've thought a little bit about this and I think a custom syntax (read: DSL) would be helpful... [/egoist] (oh wait, I still need to get it off the ground) But I do not like the idea of using XML at all as I think you (Hooray) might've suggested before, my limit of XML tolerance is FDMs and PropertyList, not scripts, as those tags get comber some. Maybe having something in a Nasal object would be possible as well, something like a pseudo-linked list with loops would not be hard. — Philosopher (Sat Jan 19). Re: Copilot announcements: Nasal don't works!.
(powered by Instant-Cquotes) |
Zakalawe has recently started adding state machine support to SimGear: https://gitorious.org/fg/simgear/commit ... cf79cd0f57 It will probably take a while until this becomes available to Nasal scripts, but Tom has added a module called "cppbind" to SimGear to more easily expose C++ stuff to Nasal scripts (and vice versa). |
Basically, PropertyList XML files already support stateful expressions using the SGCondition syntax. While that's pretty verbose, it's still pretty straightforward. I think the tutorial system uses them, too (? - havent' checked) |
Objective
Runway Overrun Protection System
Some kind of separate Nasal submodule would seem to make - for details, see: Creating_new_Nasal_scripts#Nasal_sub_modules
|
It uses math, geo, and apt, so I guess it should live in Nasal/runway/runway_announcer.nas then.
|
FREDA Announcements
If you want to make changes to it, you can directly fork the script here: http://codepad.org/sSM4Guru
|
Porting FGFSCoPilot to Nasal
I applaud you for actually considering the port now! I'd suggest to use a Nasal sub module, so that you can easily structure your code and use separate Nasal source files for the main features: Nasal_scripting_language#Nasal_sub_modules
|