72
edits
No edit summary |
No edit summary |
||
Line 15: | Line 15: | ||
The Runway Advisory and Awareness System can give a number of advisories: | The Runway Advisory and Awareness System can give a number of advisories: | ||
* Advisory when approaching a runway while taxiing | * Advisory when approaching a runway while taxiing if groundspeed is less than 40 knots | ||
* Advisory when the aircraft is on the runway and aligned within 20 degrees with runway | * Advisory when the aircraft is on the runway and aligned within 20 degrees with runway | ||
Line 121: | Line 121: | ||
var copilot_say = func (message) { | var copilot_say = func (message) { | ||
setprop("/sim/messages/copilot", message); | setprop("/sim/messages/copilot", message); | ||
logger.info(sprintf("Announcing '%s'", message)); | |||
}; | }; | ||
Line 161: | Line 135: | ||
var stop_announcer = func { | var stop_announcer = func { | ||
landing_announcer.stop(); | landing_announcer.stop(); | ||
logger.warn("Stopping landing | logger.warn("Stopping landing announcer"); | ||
takeoff_announcer.set_mode("taxi-and-takeoff"); | takeoff_announcer.set_mode("taxi-and-takeoff"); | ||
Line 173: | Line 147: | ||
takeoff_announcer.set_mode("takeoff"); | takeoff_announcer.set_mode("takeoff"); | ||
logger.warn(sprintf("Takeoff mode: %s", takeoff_announcer.mode)); | logger.warn(sprintf("Takeoff mode: %s", takeoff_announcer.mode)); | ||
landing_announcer.set_mode("takeoff"); | |||
landing_announcer.start(); | |||
logger.warn(sprintf("Starting landing (%s) announcer", landing_announcer.mode)); | |||
} | } | ||
}; | }; | ||
Line 186: | Line 164: | ||
# Let the announcer emit the "approaching-runway" signal if the | # Let the announcer emit the "approaching-runway" signal if the | ||
# aircraft comes within | # nose of the aircraft comes within 120 meters of the runway | ||
takeoff_config.distance_edge_max_m = | takeoff_config.distance_edge_max_m = 150; | ||
var takeoff_announcer = runway.TakeoffRunwayAnnounceClass.new(takeoff_config); | var takeoff_announcer = runway.TakeoffRunwayAnnounceClass.new(takeoff_config); | ||
takeoff_announcer.connect("on-runway", | takeoff_announcer.connect("on-runway", runway.make_betty_cb(copilot_say, "On runway %s", switch_to_takeoff)); | ||
takeoff_announcer.connect("on-short-runway", | takeoff_announcer.connect("on-short-runway", runway.make_betty_cb(copilot_say, on_short_runway_format, switch_to_takeoff)); | ||
takeoff_announcer.connect("approaching-runway", | takeoff_announcer.connect("approaching-runway", runway.make_betty_cb(copilot_say, "Approaching runway %s")); | ||
var landing_config = { parents: [runway.LandingRunwayAnnounceConfig] }; | var landing_config = { parents: [runway.LandingRunwayAnnounceConfig] }; | ||
Line 201: | Line 179: | ||
var landing_announcer = runway.LandingRunwayAnnounceClass.new(landing_config); | var landing_announcer = runway.LandingRunwayAnnounceClass.new(landing_config); | ||
landing_announcer.connect("remaining-distance", | landing_announcer.connect("remaining-distance", runway.make_betty_cb(copilot_say, remaining_distance_format)); | ||
landing_announcer.connect("vacated-runway", | landing_announcer.connect("vacated-runway", runway.make_betty_cb(copilot_say, "Vacated runway %s", stop_announcer)); | ||
landing_announcer.connect("landed-runway", | landing_announcer.connect("landed-runway", runway.make_betty_cb(copilot_say, "Touchdown on runway %s")); | ||
landing_announcer.connect("landed-outside-runway", | landing_announcer.connect("landed-outside-runway", runway.make_betty_cb(nil, nil, stop_announcer)); | ||
var have_been_in_air = 0; | var have_been_in_air = 0; | ||
Line 239: | Line 196: | ||
takeoff_announcer.set_mode(""); | takeoff_announcer.set_mode(""); | ||
landing_announcer.set_mode("landing"); | |||
landing_announcer.start(); | landing_announcer.start(); | ||
logger.warn(sprintf("Starting landing (%s) announcer", landing_announcer.mode)); | |||
} | |||
else { | |||
takeoff_announcer.set_mode("taxi-and-takeoff"); | |||
} | } | ||
takeoff_announcer.start(); | |||
logger.warn(sprintf("Starting takeoff (%s) announcer", takeoff_announcer.mode)); | |||
} | } | ||
else { | else { | ||
takeoff_announcer.stop(); | takeoff_announcer.stop(); | ||
logger.warn("Stopping takeoff | logger.warn("Stopping takeoff announcer"); | ||
landing_announcer.stop(); | landing_announcer.stop(); | ||
logger.warn("Stopping landing | logger.warn("Stopping landing announcer"); | ||
if (have_been_in_air == 0) { | if (have_been_in_air == 0) { | ||
Line 258: | Line 220: | ||
var init_announcers = func { | var init_announcers = func { | ||
setlistener("/gear/ | setlistener("/gear/on-ground", func (node) { | ||
test_on_ground( | test_on_ground(node.getBoolValue()); | ||
}, startup=1, runtime=0); | }, startup=1, runtime=0); | ||
}; | }; | ||
setlistener("/sim/signals/fdm-initialized", func { | setlistener("/sim/signals/fdm-initialized", func { | ||
var timer = maketimer(5.0, func init_announcers()); | var timer = maketimer(5.0, func init_announcers()); | ||
timer.singleShot = 1; | timer.singleShot = 1; | ||
Line 276: | Line 232: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{Note|In this | {{Note|In this example the /gear/on-ground property is used to detect whether the aircraft is on the ground or in the air. Make sure to use a <logic> element in a <autopilot> XML file to set this to true or false depending on your gears' wow values.}} | ||
{{Note|It is your responsibility to start and stop the announcers and to set the correct modes. Therefore it is necessary to connect to signals like landed-outside-runway and vacated-runway, even if they appear to be useless for your specific aircraft. The example of runway.nas above already does this for you.}} | {{Note|It is your responsibility to start and stop the announcers and to set the correct modes. Therefore it is necessary to connect to signals like landed-outside-runway and vacated-runway, even if they appear to be useless for your specific aircraft. The example of runway.nas above already does this for you.}} | ||
Line 317: | Line 273: | ||
# The unit to use for the remaining distance of short runways. Can | # The unit to use for the remaining distance of short runways. Can | ||
# be "meter" or "feet". | # be "meter" or "feet". | ||
groundspeed_max_kt: 40, | |||
# Maximum groundspeed in knots for approaching runway callouts | |||
</syntaxhighlight> | </syntaxhighlight> | ||
edits