<?xml version="1.0"?>

<PropertyList>

    <name>Taxiing</name>

    <description>
    This tutorial covers moving the aircraft around on the ground, from the parking position to the run-up area.

For more information on taxiing, see Section 2-9 of the FAA Airplane Flying Handbook available at http://www.faa.gov/library/manuals/aircraft/airplane_handbook/.
    </description>

    <audio-dir>Tutorials/taxiing</audio-dir>
    <timeofday>morning</timeofday>
    <presets>
        <airport-id>PHTO</airport-id>
        <on-ground>1</on-ground>
        <altitude-ft>-9999</altitude-ft>
        <latitude-deg>19.71731272</latitude-deg>
        <longitude-deg>-155.0597483</longitude-deg>
        <heading-deg>125</heading-deg>
        <airspeed-kt>0</airspeed-kt>
        <glideslope-deg>0</glideslope-deg>
        <offset-azimuth-deg>0</offset-azimuth-deg>
        <offset-distance-nm>0</offset-distance-nm>
        <airport-requested>true</airport-requested>
        <runway-requested>true</runway-requested>
        <parking-requested>true</parking-requested>
    </presets>

    <targets>
        <taxi1>
            <!-- forward to taxiway
            -->
            <latitude-deg>19.71717163</latitude-deg>
            <longitude-deg>-155.0594903</longitude-deg>
        </taxi1>
        <taxi2>
            <!-- continue along yellow line
            -->
            <latitude-deg>19.720517</latitude-deg>
            <longitude-deg>-155.0561934</longitude-deg>
        </taxi2>
        <taxi3>
            <!-- stop
            -->
            <latitude-deg>19.72419733</latitude-deg>
            <longitude-deg>-155.052821</longitude-deg>
        </taxi3>

    </targets>

    <step>
        <set>
            <property>/instrumentation/adf/frequencies/selected-khz</property>
            <value>332</value> <!-- PAHOA NDB -->
        </set>
        <set>
            <property>/environment/weather-scenario</property>
            <value>Fair weather</value>
        </set>
        <set>
            <property>/sim/model/c172p/brake-parking</property>
            <value>1</value>
        </set>
        <set>
            <property>/controls/switches/master-bat</property>
            <value>true</value>
        </set>
        <set>
            <property>/controls/switches/master-alt</property>
            <value>true</value>
        </set>
        <set>
            <property>/controls/switches/master-avionics</property>
            <value>true</value>
        </set>
        <set>
            <property>/controls/flight/flaps</property>
            <value>0.0</value>
        </set>
        <set>
            <property>/controls/flight/elevator-trim</property>
            <value>0.17</value>
        </set>
        <set>
            <property>/controls/switches/magnetos</property>
            <value>3</value>
        </set>
        <set>
            <property>/controls/engines/current-engine/throttle</property>
            <value>0.2</value>
        </set>
        <set>
            <property>/controls/engines/engine/primer</property>
            <value>4</value>
        </set>
        <set>
            <property>/sim/model/c172p/securing/chock</property>
            <value>false</value>
        </set>
        <set>
            <property>/sim/model/c172p/securing/cowl-plugs-visible</property>
            <value>false</value>
        </set>
        <set>
            <property>/sim/model/c172p/securing/tiedownL-visible</property>
            <value>false</value>
        </set>
        <set>
            <property>/sim/model/c172p/securing/tiedownR-visible</property>
            <value>false</value>
        </set>
        <set>
            <property>/sim/model/c172p/securing/tiedownT-visible</property>
            <value>false</value>
        </set>
        <set>
            <property>/sim/model/c172p/securing/pitot-cover-visible</property>
            <value>false</value>
        </set>
        <set>
            <property>/sim/model/c172p/cockpit/control-lock-placed</property>
            <value>false</value>
        </set>
        <set>
            <property>/sim/model/c172p/cockpit/control-lock-visible</property>
            <value>false</value>
        </set>
        <nasal>
            <script>
                setprop("/controls/engines/current-engine/mixture", 1.0);
                setprop("/controls/switches/starter", 1);
            </script>
        </nasal>
        <message></message>
        <view>
            <heading-offset-deg>0.0</heading-offset-deg>
            <pitch-offset-deg>-12</pitch-offset-deg>
            <roll-offset-deg>0.0</roll-offset-deg>
            <x-offset-m>-0.21</x-offset-m>
            <y-offset-m>0.19</y-offset-m>
            <field-of-view>73.6</field-of-view>
        </view>
    </step>

    <step>
        <message>In this lesson we'll taxi the aircraft from its parking position
       via the taxiway Charlie to the holding pont of runway 21</message>
        <nasal>
            <script>
                var listeners = std.Vector.new();

                listeners.append(setlistener("/engines/active-engine/running", func (node) {
                    if (node.getBoolValue()) {
                        setprop("/controls/switches/starter", 0);
                        foreach (var listener; listeners.vector) {
                            removelistener(listener);
                        }
                        listeners.clear();
                    }
                }, 1, 0));
            </script>
        </nasal>
    </step>

    <step>
        <message>I've already started the engine. Press Shift-B to release the parking brake. Throttle up to about
      20% to move forward slightly, then hold b to check that the normal brakes work.</message>

        <error>
            <message>The parking brake is still on. Release it by pressing Shift-B.</message>
            <condition>
                <equals>
                    <property>/sim/model/c172p/brake-parking</property>
                    <value>1</value>
                </equals>
            </condition>
        </error>
        <error>
            <message>Throttle up to about 20% to move forward slightly.</message>
            <condition>
                <and>
                    <equals>
                        <property>/sim/model/c172p/brake-parking</property>
                        <value>0</value>
                    </equals>
                    <less-than>
                        <property>/controls/engines/current-engine/throttle</property>
                        <value>0.15</value>
                    </less-than>
                </and>
            </condition>
        </error>
        <error>
            <message>Apply the brakes by pressing b.</message>
            <condition>
                <and>
                    <equals>
                        <property>/sim/model/c172p/brake-parking</property>
                        <value>0</value>
                    </equals>
                    <equals>
                        <property>/controls/gear/brake-left</property>
                        <value>0</value>
                    </equals>
                    <equals>
                        <property>/controls/gear/brake-left</property>
                        <value>0</value>
                    </equals>
                </and>
            </condition>
        </error>

        <exit>
            <condition>
                <and>
                    <equals>
                        <property>/sim/model/c172p/brake-parking</property>
                        <value>0</value>
                    </equals>
                    <equals>
                        <property>/controls/gear/brake-left</property>
                        <value>1</value>
                    </equals>
                    <equals>
                        <property>/controls/gear/brake-left</property>
                        <value>1</value>
                    </equals>
                </and>
            </condition>
        </exit>
    </step>

    <step>
        <message>Keep applying the brakes. You can steer the aircraft on the ground by either using 0/Enter on the
      numeric keypad, or using the mouse in yoke mode (+) with the left mouse button held down. If you need to slow
      down, just press b to apply the brakes.</message>
        <wait>10</wait>

        <error>
            <message>Keep the brakes on until I tell you to start taxiing.</message>
            <condition>
                <or>
                    <equals>
                        <property>/controls/gear/brake-left</property>
                        <value>0</value>
                    </equals>
                    <equals>
                        <property>/controls/gear/brake-left</property>
                        <value>0</value>
                    </equals>
                </or>
            </condition>
        </error>
    </step>

    <step>
        <message>Release the brakes and taxi forwards.  You may need to apply a little throttle to get going.</message>
        <wait>5</wait>

        <error>
            <message>You're driving curves. To meet the taxiway you have to taxi straight!</message>
            <condition>
                <or>
                    <less-than>
                        <property>/sim/tutorials/targets/taxi1/direction-deg</property>
                        <value>-100</value>
                    </less-than>
                    <greater-than>
                        <property>/sim/tutorials/targets/taxi1/direction-deg</property>
                        <value>100</value>
                    </greater-than>
                </or>
            </condition>
        </error>

        <error>
            <message>Apply a little throttle to get going, but then reduce it once you're moving.</message>
            <condition>
                <less-than>
                    <property>/velocities/groundspeed-kt</property>
                    <value>1.0</value>
                </less-than>
            </condition>
        </error>

        <exit>
            <condition>
                <and>
                    <less-than>
                        <property>/sim/tutorials/targets/taxi1/distance-m</property>
                        <value>30.0</value>
                    </less-than>
                    <greater-than>
                        <property>/sim/tutorials/targets/taxi1/distance-m</property>
                        <value>-30.0</value>
                    </greater-than>
                </and>
            </condition>
        </exit>
    </step>

    <step>
        <message>Turn left and continue along the centreline.</message>
        <wait>5</wait>

        <error>
            <message>You're driving curves. To meet the taxiway you have to taxi straight!</message>
            <condition>
                <or>
                    <less-than>
                        <property>/sim/tutorials/targets/taxi2/direction-deg</property>
                        <value>-100</value>
                    </less-than>
                    <greater-than>
                        <property>/sim/tutorials/targets/taxi2/direction-deg</property>
                        <value>100</value>
                    </greater-than>
                </or>
            </condition>
        </error>
        <error>
            <message>Apply a little throttle to get going, but then reduce it once you're moving.</message>
            <condition>
                <less-than>
                    <property>/velocities/groundspeed-kt</property>
                    <value>1.0</value>
                </less-than>
            </condition>
        </error>

        <exit>
            <condition>
                <and>
                    <less-than>
                        <property>/sim/tutorials/targets/taxi1/distance-m</property>
                        <value>30.0</value>
                    </less-than>
                    <greater-than>
                        <property>/sim/tutorials/targets/taxi1/distance-m</property>
                        <value>-30.0</value>
                    </greater-than>
                </and>
            </condition>
        </exit>
    </step>

    <step>
        <message>Continue along Charlie and cross the inactive runway.</message>

        <error>
            <message>You're going too fast. Reduce your throttle slightly and apply your brakes.</message>
            <condition>
                <greater-than>
                    <property>/velocities/groundspeed-kt</property>
                    <value>15.0</value>
                </greater-than>
            </condition>
        </error>

        <exit>
            <condition>
                <less-than>
                    <property>/sim/tutorials/targets/taxi2/distance-m</property>
                    <value>50.0</value>
                </less-than>
            </condition>
        </exit>
    </step>

    <step>
        <message>Keep going along the taxiway.</message>

        <error>
            <message>You're going too fast. Reduce your throttle slightly and apply your brakes.</message>
            <condition>
                <greater-than>
                    <property>/velocities/groundspeed-kt</property>
                    <value>15.0</value>
                </greater-than>
            </condition>
        </error>

        <exit>
            <condition>
                <less-than>
                    <property>/sim/tutorials/targets/taxi3/distance-m</property>
                    <value>50.0</value>
                </less-than>
            </condition>
        </exit>
    </step>

    <step>
        <message>Set the throttle to idle and apply the parking brake</message>
        <view>
            <heading-offset-deg>0.0</heading-offset-deg>
            <pitch-offset-deg>-19.7</pitch-offset-deg>
            <roll-offset-deg>0.0</roll-offset-deg>
            <x-offset-m>-0.2</x-offset-m>
            <y-offset-m>0.2</y-offset-m>
            <z-offset-m>0.4</z-offset-m>
            <field-of-view>85.0</field-of-view>
        </view>

        <error>
            <message>We now have to execute the run-up checks and therefore you need to stop. Set the parking brake!</message>
            <condition>
                <not-equals>
                    <property>/sim/model/c172p/brake-parking</property>
                    <value>1</value>
                </not-equals>
            </condition>
        </error>

        <error>
            <message>Set the throttle to idle!</message>
            <condition>
                <greater-than>
                    <property>/controls/engines/current-engine/throttle</property>
                    <value>0.05</value>
                </greater-than>
            </condition>
        </error>

        <exit>
            <condition>
                <and>
                    <equals>
                        <property>/sim/model/c172p/brake-parking</property>
                        <value>1</value>
                    </equals>
                    <less-than-equals>
                        <property>/controls/engines/current-engine/throttle</property>
                        <value>0.05</value>
                    </less-than-equals>
                    <less-than>
                        <property>/velocities/groundspeed-kt</property>
                        <value>1</value>
                    </less-than>
                </and>
            </condition>
        </exit>
    </step>

    <step>
        <message>We've reached the run-up area. Well done.</message>
    </step>

</PropertyList>