State overlay system: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
No edit summary
Line 22: Line 22:
* cruise (cruise configuration)
* cruise (cruise configuration)
* approach (approach configuration)
* approach (approach configuration)
* carrier-approach (approach configuration for an aircraft carrier landing)
* carrier-take-off (take-off configuration for an aircraft carrier take-off, typically via catapult)


== Implementation ==
== Implementation ==

Revision as of 13:28, 3 April 2020

This article is a stub. You can help the wiki by expanding it.


Choosing state

To start FlightGear with an existing overlay add --state=statename to you command line.

Elsewise in the launchers main tab, you can choose which state you want to start with:

States dropdown box in launcher

If you choose the Automatic state, Flightgear will try to guess which state you want.

That guess is based on the name (inside the state file). It will look for these names:

  • parked (meaning cold and dark)
  • take-off (standing on the runway with take-off configuration)
  • cruise (cruise configuration)
  • approach (approach configuration)
  • carrier-approach (approach configuration for an aircraft carrier landing)
  • carrier-take-off (take-off configuration for an aircraft carrier take-off, typically via catapult)

Implementation

overlay file

To add state overlays to your aircraft, create a folder for example called states. In there you can put your $state-overlay.xml. In the beginning your overlay.xml should look like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<PropertyList>
  <name type="string" n="1">parked</name>
  <overlay>

  </overlay>
</PropertyList>

Now you can put your items, which need to be set between the overlay tags. You only need to put properties in there, which differ from your default setup.

Another rule of thumb is that you use the hierarchy of the property-tree's root. It speeded up my research by quite a bit, when I found out, it's possible to dump the PropertyTree with a nasal command. Open up the Nasal-console from the developer-menu and put in the following: io.write_properties( path: "/home/myName/.fgfs/Export/PropTree.xml", prop: "/" );

Beware! This outputs the entire PropertyTree! This is several thousand lines long. You might want to dump only single folders of the PropertyTree by changing the "/" to sth like "/controls" or whatever folder you want to dump. Now you can simply delete everything from that file, that you don't need and copy&paste it into your overlay.xml.

include

Now you need to include your overlay.xml in your $Aircraft-set.xml file like this:

<PropertyList>
  <sim>
    ...
    <state include="states/parked-overlay.xml" n="0" />
    <state include="states/taxi-overlay.xml" n="1" />
    ...
  </sim>
</PropertyList>

Background

Wayne Bragg has been working a bit with James on the state overly system.[1]

At this moment, the Citation, the Saab 37 Viggen, the J3 Cub, the Cessna 182s and the Tu-144 have this implemented.

Motivation

Related

References

References