USNA X-Plane Machine Learning Plugin XML Documentation

How to use the XML to get the most out of X-Plane

The xml needs the XML header and a open plugin tag to start and needs a close plugin tag to close

<?xml version="1.0">
<plugin>
	...
	... All of the XML goes in here
	...
</plugin>

The settings tag is one of the most important in the whole file

  • name: the string the X-Plane displays representing the plugin
  • recordRate: how often will the plugin make a measurement, sample an action, or perform a learned action
  • stepRate: how often will the plugin modify the world without recording or taking one of the sampling actions (needs to be smaller than recordRate)
  • reloadEveryRun: tell X-Plane to reload the XML to check for changes every-time the plane crashes or resets
  • debug: tell X-Plane to print the data that the XML is reading in
	<settings name="xmlPluginTest" recordRate="1.0" stepRate=".03125" 
		reloadEveryRun="true" debug="false">
	</settings>

Inside the measures tag the user lists every datapoint that is to be recorded at the recordRate interval. Each individual data point needs to be in a measure tag.

	<measures>
		<measure>elevation</measure>
		<measure>speed</measure>
		<measure>pitch</measure>
		<measure>sim/flightmodel/controls/elv_trim</measure>
	</measures>

The runresets, recordresets, and stepresets tag hold a list of reset tags each of which have two attributes "dataref" and "value". The mentioned dataref is set to the provided value at the run, record, and step interval respectively.

	<runresets>
		<reset dataref="roll"  value="0"> </reset>
	</runresets>
	<recordresets>
		<reset dataref="sim/cockpit2/controls/rudder_trim" value="0"> </reset>
	</recordresets>
	<stepresets>
		<reset dataref="sim/flightmodel/controls/sbrkrat"   value="0"> </reset>
	</stepresets>

The samples tag holds a list of samples that hold a dataref attribute. These datarefs will be set to one of the options under the listoptions tag at random every record interval.

	<samples>
		<sample dataref="sim/flightmodel/controls/elv_trim">
			<listoptions>
				<option>-1</option>
				<option>-0.5</option>
				<option>0.0</option>
				<option>0.5</option>
				<option>1</option>
			</listoptions>
		</sample>
	</samples>

The runbuttons, recordbuttons, stepbuttons, runkeys, recordkeys, and stepkeys tags hold a list of buttons or keys that are pressed at the respective interval.

	<runbuttons>
	</runbuttons>
	<recordbuttons>
		<button>xplm_joy_throt_up</button>
	</recordbuttons>
	<stepbuttons>
		<button>xplm_joy_rud_cntr</button>
		<button>xplm_joy_tim_reset</button>
	</stepbuttons>
	<runkeys>
		<key>xplm_key_brakesreg</key>
	</runkeys>
	<recordkeys>
	</recordkeys>
	<stepkeys>
	</stepkeys>

The learned tag holds a list of learn tags. The learned tags are how learned policies can be written into the XML. Each learned tag has a "dataref" attribute that holds the dataref that is supposed to be changed according to the policy. The learned tag then has three children tags listref, listoptions, and listsweights. The listref tag lists measure tags each with a dataref. The value of these datarefs that are the ones used to make the decision of what action to take. The listoptions list a set of option tags each which hold a value to which the dataref in the learned tag can be set. The listsweights is where the learned policy is entered. For each option in the earlier listoptions tag, there is a set of weights for each measure in listref tag.

	<learned>
		<learn dataref="sim/flightmodel/controls/elv_trim">
			<listref>
				<measure>elevation</measure>
				<measure>speed</measure>
				<measure>pitch</measure>
				<measure>sim/flightmodel/controls/elv_trim</measure>
			</listref>
			<listoptions>
				<option>-1</option>
				<option>-.5</option>
				<option>0.0</option>
				<option>.5</option>
				<option>1</option>
			</listoptions>
			<listsweights>
				<weights>
					<weight>10.538238</weight><weight>42.576692</weight>
					<weight>39.775909</weight><weight>-43.085447</weight>
				</weights>
				<weights>
					<weight>10.800214</weight><weight>42.667697</weight>
					<weight>34.833414</weight><weight>-35.141343</weight>
				</weights>
				<weights>
					<weight>11.200617</weight><weight>42.688221</weight>
					<weight>41.517732</weight><weight>-39.328462</weight>
				</weights>
				<weights>
					<weight>11.385997</weight><weight>43.219353</weight>
					<weight>52.707823</weight><weight>-31.414259</weight>
				</weights>
				<weights>
					<weight>11.565604</weight><weight>44.825834</weight>
					<weight>60.415289</weight><weight>-45.859525</weight>
				</weights>

			</listsweights>
		</learn>
	</learned>

External Links

USNA Links