<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>Aircraft/c172p/tutorial/startup</audio-dir>
  <timeofday>morning</timeofday>
  <presets>
    <airport-id>KLVK</airport-id>
    <on-ground>1</on-ground>
    <runway>12</runway>
    <altitude-ft>-9999</altitude-ft>
    <latitude-deg>37.6952</latitude-deg>
    <longitude-deg>-121.8167</longitude-deg>
    <heading-deg>175.0</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>
  </presets>

  <targets>
    <j1>
      <!-- Turn right onto taxiway -->
      <longitude-deg>-121.81664</longitude-deg>
      <latitude-deg>37.6949</latitude-deg>
    </j1>

    <j2>
      <!-- Mention differential braking -->
      <longitude-deg>-121.82258</longitude-deg>
      <latitude-deg>37.6949</latitude-deg>
    </j2>

    <j3>
      <!-- Left turn in taxiway -->
      <longitude-deg>-121.8250</longitude-deg>
      <latitude-deg>37.69498</latitude-deg>
    </j3>

    <a1>
      <!-- Right turn onto taxiway A -->
      <longitude-deg>-121.8251</longitude-deg>
      <latitude-deg>37.694616</latitude-deg>
    </a1>

    <a2>
      <!-- Runup aread -->
      <longitude-deg>-121.8294</longitude-deg>
      <latitude-deg>37.69459</latitude-deg>
    </a2>

  </targets>

  <init>
    <set>
      <property>/controls/gear/brake-parking</property>
      <value>1</value>
    </set>
    <set>
      <property>/controls/flight/flaps</property>
      <value>0.0</value>
    </set>
    <set>
      <property>/controls/engines/engine/magnetos</property>
      <value>3</value>
    </set>
    <set>
      <property>/controls/engines/engine/throttle</property>
      <value>0.2</value>
    </set>
    <set>
      <property>/controls/engines/engine/starter</property>
      <value>true</value>
    </set>
    <set>
      <property>/instrumentation/adf/frequencies/selected-khz</property>
      <value>340</value>
    </set>
    <set>
      <property>/environment/weather-scenario</property>
      <value>Fair weather</value>
    </set>
    <set>
      <property>/controls/flight/elevator-trim</property>
      <value>0.17</value>
    </set>
  </init>

  <step>
    <message>In this lesson we'll taxi the aircraft from its parking position infront of the FBO,
       along taxiways Juliet and Alpha to the run-up area near runway 07L.</message>
    <nasal>
      <script>

      # Script to simulate holding down the starter button until the engine starts
      var starter = func() {
        setprop("/controls/engines/engine/starter", 1);
        if (! getprop("/engines/engine/running")) {
          settimer(starter, 0);
        }
      };

      # The FDM resets the starter property on each FDM cycle.  By effectively starting
      # a number of threads to continually keep setting the starter to true, we can
      # get around this and give the engine the opportunity to catch.
      starter();
      starter();
      starter();
      starter();
      starter();
      </script>
    </nasal>
  </step>

  <step>
    <set>
      <property>/controls/engines/engine/starter</property>
      <value>false</value>
    </set>
    <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>/controls/gear/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>/controls/gear/brake-parking</property>
            <value>0</value>
          </equals>
          <less-than>
            <property>/controls/engines/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>/controls/gear/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>/controls/gear/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. Make a right turn onto taxiway Juliet.</message>
    <wait>5</wait>
    <error>
      <message>That's left, not right.</message>
      <condition>
        <or>
          <less-than>
            <property>/sim/tutorials/targets/j2/direction-deg</property>
            <value>-135.0</value>
          </less-than>
          <greater-than>
            <property>/sim/tutorials/targets/j2/direction-deg</property>
            <value>135.0</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/j2/direction-deg</property>
            <value>20.0</value>
          </less-than>
          <greater-than>
            <property>/sim/tutorials/targets/j2/direction-deg</property>
            <value>-20.0</value>
          </greater-than>
        </and>
      </condition>

    </exit>
  </step>

  <step>
    <message>Continue taxiing along taxiway Juliet. Keep the nosewheel on the yellow line. Don't allow the aircraft to go too fast - use b to brake if you need to. </message>
    <error>
      <message>
        You're straying off the taxiway. Keep heading on taxiway Juliet, keeping your nosewheel on the yellow line.
      </message>
      <condition>
        <or>
          <less-than>
            <property>/sim/tutorials/targets/j2/direction-deg</property>
            <value>-20.0</value>
          </less-than>
          <greater-than>
            <property>/sim/tutorials/targets/j2/direction-deg</property>
            <value>20.0</value>
          </greater-than>
        </or>
      </condition>
    </error>
    <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>10.0</value>
        </greater-than>
      </condition>
    </error>
    <exit>
      <condition>
        <less-than>
          <property>/sim/tutorials/targets/j2/distance-m</property>
          <value>150.0</value>
        </less-than>
      </condition>
    </exit>
  </step>

  <step>
    <message>If you need to turn very tightly, you can apply differential braking, and only brake one wheel, by pressing ',' for the left, or '.' for the right.</message>
    <error>
      <message>
        You're straying off the taxiway. Keep your nosewheel on the yellow line.
      </message>
      <condition>
        <or>
          <less-than>
            <property>/sim/tutorials/targets/j3/direction-deg</property>
            <value>-20.0</value>
          </less-than>
          <greater-than>
            <property>/sim/tutorials/targets/j3/direction-deg</property>
            <value>20.0</value>
          </greater-than>
        </or>
      </condition>
    </error>
    <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>10.0</value>
        </greater-than>
      </condition>
    </error>
    <exit>
      <condition>
        <less-than>
          <property>/sim/tutorials/targets/j3/distance-m</property>
          <value>100.0</value>
        </less-than>
      </condition>
    </exit>
  </step>

  <step>
    <message>The taxiway turns left here. Slow down by applying some brakes (b) and follow it round.</message>
    <error>
      <message>
        You're straying off the taxiway. Turn left.
      </message>
      <condition>
        <or>
          <less-than>
            <property>/sim/tutorials/targets/a1/direction-deg</property>
            <value>-45.0</value>
          </less-than>
          <greater-than>
            <property>/sim/tutorials/targets/a1/direction-deg</property>
            <value>45.0</value>
          </greater-than>
        </or>
      </condition>
    </error>
    <exit>
      <condition>
        <less-than>
          <property>/sim/tutorials/targets/a1/distance-m</property>
          <value>25.0</value>
        </less-than>
      </condition>
    </exit>
  </step>

  <step>
    <message>We're now at the intersection of taxiways Juliet, Golf and Alpha. Turn right onto taxiway Alpha.</message>
    <error>
      <message>That's left, not right.</message>
      <condition>
        <or>
          <less-than>
            <property>/sim/tutorials/targets/a2/direction-deg</property>
            <value>-135.0</value>
          </less-than>
          <greater-than>
            <property>/sim/tutorials/targets/a2/direction-deg</property>
            <value>135.0</value>
          </greater-than>
        </or>
      </condition>
    </error>
    <exit>
      <condition>
        <and>
          <less-than>
            <property>/sim/tutorials/targets/a2/direction-deg</property>
            <value>20.0</value>
          </less-than>
          <greater-than>
            <property>/sim/tutorials/targets/a2/direction-deg</property>
            <value>-20.0</value>
          </greater-than>
        </and>
      </condition>
    </exit>
  </step>

  <step>
    <message>Continue taxiing along taxiway Alpha to the end of the taxiway. </message>
    <error>
      <message>
        You're straying off the taxiway. Keep heading on taxiway Alpha, keeping your nosewheel on the yellow line.
      </message>
      <condition>
        <or>
          <less-than>
            <property>/sim/tutorials/targets/a2/direction-deg</property>
            <value>-15.0</value>
          </less-than>
          <greater-than>
            <property>/sim/tutorials/targets/a2/direction-deg</property>
            <value>15.0</value>
          </greater-than>
        </or>
      </condition>
    </error>
    <exit>
      <condition>
        <less-than>
          <property>/sim/tutorials/targets/a2/distance-m</property>
          <value>60.0</value>
        </less-than>
      </condition>
    </exit>
  </step>

  <step>
    <message>We've reached the run-up area. Brake slowly to a stop and set the parking brake (shift-b).</message>
    <exit>
      <condition>
        <equals>
          <property>/controls/gear/brake-parking</property>
          <value>1</value>
        </equals>
      </condition>
    </exit>
  </step>

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