Board index FlightGear Development Tutorials and missions

Flight Path Generator: triggering a point

Interactive in-sim tutorials and missions

Flight Path Generator: triggering a point

Postby statto » Tue Nov 06, 2018 11:48 am

I'm contemplating writing a short mission generation script outside of FlightGear to help me generate ideas for places to fly.

The program would be exterior to FG, probably in Python, where you would select your plane and a starting airport. Once you select a starting airport, a randomised list of possible destinations would pop up. You'd click okay which would pass commands to start fgfs from the command line.

You would select a destination, but I would like to build in a "hook" where the script places a temporary object on a parking space at the destination airport. When the aircraft is stopped over the temporary object, the mission is marked as "complete" by the exterior program and logged as such.

You could do it manually, but I think it would be less fun that way :)

I have a lot of other things going on so may not get to this for awhile, but want to think about how I would go about doing this.
Custom Scenery available from http://www.stattosoftware.com/flightgear
statto
 
Posts: 2106
Joined: Fri Jan 25, 2008 10:57 pm

Re: Flight Path Generator: triggering a point

Postby wlbragg » Tue Nov 06, 2018 9:12 pm

I think that is definitely doable.

I'd look at getting the lat/lon of X parking space at X airport automatically if that is possible, then use a "range" code snip-it (there are examples in AirCrane cargooperations.nas)

see: aircraft_pos.distance_to()

I think you could do the entire thing in Nasal if you wanted to.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7588
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Flight Path Generator: triggering a point

Postby Hooray » Wed Nov 07, 2018 6:00 pm

wlbragg wrote in Tue Nov 06, 2018 9:12 pm:I think you could do the entire thing in Nasal if you wanted to.


Agreed entirely - and probably with much less code, too. I'd say the new addon system would be almost perfect for this kind of extension. Besides, a number of people have been wanting to create a dedicated "mission editor" anyway, i.e. it's a long-standing idea (feature request).

Then again, if this is a learning exercise, using Python is obviously fine - depending on bugman's progress with FGPythonSys, that might be worth taking into account.

Personally, my impression is that any kind of "mission generator" will sooner or later want to deal with internal data structures (files, protocols), so that it does make sense to use a mechanism that is already aware of internal data structures like the property tree, property list xml files, bindings, fgcommands, the GUI etc - otherwise, you'd inevitably need a ton of libraries to get what built-in fgfs scripting via Nasal provides "out of the box".

Thus, I'd definitely suggest looking at related features, i.e. Stuart's tutorial system (including checklists) and Marius_A's work:

http://wiki.flightgear.org/Tutorials
http://wiki.flightgear.org/Missions


http://wiki.flightgear.org/Aircraft_Generation_Wizard
Image


I'd probably use a wizard-oriented approach with a corresponding data structure to partition different parts of the mission and make certain variables configurable (airport, runway, weather) - and use the checklist feature to come up with heuristics for aircraft-specific parameters (think V speeds, required runway length etc)

That way, it would be relatively simple to come up with a pretty flexible "mission generator" that would accept a handful of parameters and generate dozens of different missions.

Subject: Tutorials/Missions/Adventures: requests for features

Hooray wrote:Actually, we have previously talked about coming up with a simple "missions generator" in Nasal space, one where certain aspects of the mission would simply be variables, while other factors may depend on those variables.

For instance, let's say we have a simple SAR mission - the mission generator could ask for an airport to be used as the base for the mission:
KSFO
Next, it could support randomizing the location given a radius around KSFO
30 nm
Next, it could ask for time-of-day to be used:
night-time
Next, it could ask for the weather settings:
CAT III

As can be seen, this would not need to be very difficult, but there is sufficient room to randomize things using some sane defaults.

A while ago, I came up with a simple wizard-like framework that would walk people through creating a custom -set.xml file, the same approach could be used for such a "missions generator":

http://wiki.flightgear.org/Aircraft_Generation_Wizard
Image

These days, I would suggest to use a native Canvas UI to do this, because it is much more flexible.

At this point, I guess it is more important to gather a team of people who know a little about Nasal coding, so that we can prototype a simple generator.
And as a matter of fact, rleibner's recent work on supporting "AI-ATC" via ground-controlled-approaches (GCA) could be considered the foundation for a multi-variable "mission generator":

http://wiki.flightgear.org/Howto:Implem ... GCA_system
Image

As can be seen, this is a simple Canvas GUI dialog, but it takes roughly a 10-12 parameters to configure the GCA, which could be considered "mission variables".
It would be a piece of cake to extend this for other purposes, turn it into an actual wizard and hook it up to some kind of mission/adventure system, possibly in conjunction with the spoken atc addon rleibner is developing: http://wiki.flightgear.org/Spoken_ATC

And actually, once you think about it, using the checklists feature, it would be relatively easy to customize different missions for different aircraft semi-automatically, because the various V-speeds etc are part of the checklist.

I guess that's the kind of approach, I'd use to make sure that a single "mission" could be applied to different locations (airports/runways).

And yeah, I am volunteering to help with prototyping this, because it's something we've been contemplating to do anyway: http://wiki.flightgear.org/Talk:Tutoria ... gnostic.29

So, my suggestion would be that the first "mission/adventure" is indeed a ground-controlled-approach, and make the whole thing sufficiently generic to support arbitrary aircraft/airports and weather settings, and then take it from there :mrgreen:
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU


Return to Tutorials and missions

Who is online

Users browsing this forum: No registered users and 1 guest