A
1000
WIZARD
# Watch the pitch—make sure the user lowers the nose, but not too much
# NOTE: This is ASYNCHRONOUS with the rest of the code
# <START|STOP> <id> <dref>
<operand> <value> <timeout> <message>
WATCHDOG START pitch_up sim/cockpit2/gauges/indicators/pitch_vacuum_deg_pilot
< -15 2.0 Raise the nose—you don’t want it pointed so far down.
WATCHDOG START pitch_down sim/cockpit2/gauges/indicators/pitch_vacuum_deg_pilot
> 5 2.0 Lower the nose—you want it pointed down a bit below the
horizon.
#### Pitch nose down ####
MSG_MODAL OK As we approach, you'll want to keep the plane's nose pointed down just
a bit so the runway is above the cockpit glare shield. Go ahead and try it.
WAIT TIMEOUT 3.0
WAIT DATAREF sim/cockpit2/gauges/indicators/pitch_vacuum_deg_pilot < -3
MSG_POINT Looks good!
WAIT TIMEOUT 3.0
MSG_CLEAR
########### Start slowing down ###########
COACH WIDGET throttle
MSG_POINT Next, let's reduce the throttle to about 30%. This will cause us to start
slowly descending...ideally around 500fpm.
WAIT DATAREF sim/cockpit2/engine/actuators/throttle_ratio_all < 0.5
COACH CLEAR
WAIT TIMEOUT 2
MSG_CLEAR
WAIT TIMEOUT 1.0
########### Pull in first detent of flaps ###########
IF DATAREF sim/flightmodel2/controls/flap_handle_deploy_ratio > 0 THEN
GOTO Post_Flaps
ENDIF
COACH WIDGET flaps
IF IS_BOUND flaps_down THEN
MSG_POINT Go ahead and lower a notch of flaps—you can press ‘[flaps_down]’. This
will slow us down a bit as we descend. We want to be slower than 90kts.
ELSE
MSG_POINT Go ahead and lower a notch of flaps—you can use the flap lever in the
cockpit. This will slow us down a bit as we descend. We want to be slower than
90kts.
ENDIF
WAIT DATAREF sim/flightmodel2/controls/flap_handle_deploy_ratio > 0
COACH CLEAR
WAIT TIMEOUT 2
MSG_CLEAR
Post_Flaps:
WATCHDOG START speed_up sim/flightmodel/position/indicated_airspeed < 60 1.0 Add
some power to speed up a bit—you don’t want to drop below 60 kts until we’re over
the runway.
WATCHDOG START speed_down sim/flightmodel/position/indicated_airspeed > 90 1.0
You’re coming in too fast. Reduce the power a bit. We want to be slower than 90kts.
########### Tell them the game plan ###########
WAIT TIMEOUT 3.0
MSG_POINT From here on out, we just need to keep the plane lined up with the runway
as we slowly descend.
WAIT TIMEOUT 6.0
MSG_CLEAR
########### Start watchdogs for angle of descent ###########
# does this still work on desktop? #
WATCHDOG START waveoff_high iphone/indicators/descent_angle_deg > 3.5 2.0 Our
altitude is a bit higher than it should be. Lower the nose and reduce the throttle
to increase our rate of descent.
WATCHDOG START alt_good iphone/indicators/descent_angle_deg == 3.0 2.0 Our
altitude is right on track! Let’s hold this angle of descent.
WATCHDOG START waveoff_low iphone/indicators/descent_angle_deg < 2.5 2.0 Our
altitude is a bit lower than it should be. Raise the nose and add some throttle to
slow our descent.
IF DATAREF sim/flightmodel2/controls/flap_handle_deploy_ratio > 0.7 THEN
GOTO Too_Much_Flaps
ELSE
GOTO Monitor_Speed
ENDIF
Too_Much_Flaps:
IF IS_BOUND flaps_up THEN
MSG_POINT Whoa, that’s a bit much. Let’s retract a notch of flaps—just press
‘[flaps_up]’.
ELSE
MSG_POINT Whoa, that’s a bit much. Let’s retract a notch of flaps.
ENDIF
WAIT DATAREF sim/flightmodel2/controls/flap_handle_deploy_ratio < 0.7
GOTO Monitor_Speed
########### Watch our speed ###########
Monitor_Speed:
WAIT TIMEOUT 3.0
# If we're below 300 feet AGL, exit this wizard (need to go to the touchdown
wizard)
IF DATAREF sim/flightmodel/position/y_agl < 91.44 THEN
GOTO End
ENDIF
IF DATAREF sim/flightmodel/position/indicated_airspeed < 60 THEN
GOTO Increase_Speed
ENDIF
IF DATAREF sim/flightmodel/position/indicated_airspeed > 85 THEN
GOTO Flaps_Second_Detent
ENDIF
GOTO Monitor_Speed
Increase_Speed:
MSG_POINT Your speed is a little low. Try pitching the airplane down just a bit.
GOTO Monitor_Speed
########### Pull in 2nd detent of flaps at 1500 ft. AGL ###########
Flaps_Second_Detent:
# If we're too high, go back to the monitoring phase...
IF DATAREF sim/flightmodel/position/y_agl >= 457.2 THEN
GOTO Monitor_Speed
ENDIF
IF IS_BOUND flaps_down THEN
MSG_POINT Let's lower a notch of flaps—press ‘[flaps_down]’ just like you did
before. This will slow us down more, and allow us to fly slower and descend at the
correct rate.
ELSE
MSG_POINT Let's lower a notch of flaps just like you did before. This will slow us
down more, and allow us to fly slower and descend at the correct rate.
ENDIF
WAIT DATAREF sim/flightmodel2/controls/flap_handle_deploy_ratio > 0.5
COACH CLEAR
MSG_CLEAR
GOTO Monitor_Speed
End:
# A couple watchdogs to get the user to the start of the next wizard
WATCHDOG START speed_up_end sim/flightmodel/position/indicated_airspeed < 60 1.0
Add some power to speed up a bit—you don’t want to drop below 60 kts until we’re
over the runway.
WATCHDOG START speed_down_end sim/flightmodel/position/indicated_airspeed > 80 1.0
Make sure your throttle is at idle and your flaps are fully extended. You want to
slow down to about 60 knots by the time you touch down.
# Keep the wizard around for the sake of the watchdogs
# Don't worry, wizards are automatically killed at a phase transition
WAIT TIMEOUT 100000000