Board index FlightGear Development Aircraft Systems

Runway overrun protection system

Modeling aircraft systems, like electrical stuff, hydraulics, pneumatics? Feel free to ask support.

Runway overrun protection system

Postby FGRS » Thu Nov 07, 2013 10:09 pm

Hey everyone, I would like to ask is it possible to add one interesting system to our lovely FG aircarft? The system works quite similar to the GPWS,with the difference that is counting the runway length on landing,and it call-out the reaming legth of the rw,like 400m remaining ,300m remaining and so on. In this video ,you hear it,it's quite interesting.

http://www.youtube.com/watch?v=59ymnKUi49A

Cheers :D
Last edited by FGRS on Thu Feb 06, 2014 12:49 pm, edited 1 time in total.
FGRS
 
Posts: 96
Joined: Sat Nov 02, 2013 3:04 pm
Location: LQBK
Callsign: UAV001
Version: 2.8
OS: Win XP

Re: Runway legth counter

Postby Hooray » Thu Nov 07, 2013 10:15 pm

Hi & welcome,

I didn't look at the video, but what you describe can be accomplished with less than 50 lines of scripted Nasal code.
In pseudo code:

  • look up runway length (5 lines of code)
  • wait for touchdown, WoW property - weight on wheels (5 lines)
  • note lat/lon coordinates of touchdown (5 lines)
  • keep track of groundspeed/direction and distance traveled per second (10 lines)
  • compute the difference between runway_length - touchdown_point - distance since touchdown (5 lines)
  • convert feet to meters (or vice versa) (1 line)
  • announce the whole thing, either through a text message or through text to speech (5 lines)

You can do all of this by using existing FlightGear features - and you'll even learn how to implement new features along the way :D
And if you're getting stuck, we're are here to help you.

To get started, see:

http://wiki.flightgear.org/Nasal_Console
http://wiki.flightgear.org/Howto:Create ... sal_module
http://wiki.flightgear.org/List_of_Nasa ... ct_Queries

All the calculations can be handled via geo.nas and math.nas
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11376
Joined: Tue Mar 25, 2008 8:40 am

Re: Runway legth counter

Postby Philosopher » Fri Nov 08, 2013 12:15 am

Several airliners already have GPWS (I can't recall which one(s), but good ones to look at would be the Citation-X, 787, 777, 747, and others). Using those audio files, you could of course use them for different purposes, as Hooray described, you'll just have to clarify a bit what you want (it isn't called "Systems" for nothing ;)).
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: Runway legth counter

Postby FGRS » Fri Nov 08, 2013 11:08 am

I 'm glad to see that people are interested in this system. But the problem is that I'm not a FG aircraft developer or anything like it,not even close. I will try to do something but,really not sure how to do it,simply because I have never done that. Anyway ,thanks for the tips,I think this is worth trying.

Cheers.
FGRS
 
Posts: 96
Joined: Sat Nov 02, 2013 3:04 pm
Location: LQBK
Callsign: UAV001
Version: 2.8
OS: Win XP

Re: Runway legth counter

Postby Hooray » Fri Nov 08, 2013 11:39 am

the problem is that I'm not a FG aircraft developer or anything like it,not even close.


You don't need to be an aircraft developer or FG contributor to make such changes - you just need to have a text editor like wordpad and a working FlightGear installation - and probably a rainy weekend (or two) to learn a bit about FlightGear's built-in scripting capabilities, or some patience to ask lots of questions here to get this started. It's possible, even if you have never done any coding or scripting - you'll be asking questions, we'll be answering them and posting code snippets that you can play with.

I will try to do something but,really not sure how to do it,simply because I have never done that. Anyway ,thanks for the tips,I think this is worth trying.

That's what we're for here - to provide all support that you need, now it's up to you to decide if you're willing to learn a new thing or two ..

http://wiki.flightgear.org/Nasal_Console
http://wiki.flightgear.org/Nasal_Hello_World
http://wiki.flightgear.org/Howto:Create ... sal_module
http://wiki.flightgear.org/Creating_new_Nasal_scripts

These are very simple tutorials to get you started playing around with FlightGear, e.g. to make it print something to the terminal window.

For example, open the Nasal console (see above), and paste this:
Code: Select all
var distance  = 100;
print ("Remaining distance: ", distance);


And then click "run".

Next, to make this a little more interesting, here's a snippet that calculates something:

Code: Select all
var runway_length_m = 3000;
var touchdown_point_m = 600;
var remaining_m = runway_length_m - touchdown_point_m;
print ("Remaining distance: ", remaining_m);


Next, add some speed to the whole thing:


Code: Select all
var groundspeed_kmh = 180;
var runway_length_m = 3000;
var touchdown_point_m = 600;
var remaining_m = runway_length_m - touchdown_point_m;

var groundspeed_mph = groundspeed_kmh * 1000;
var groundspeed_m_per_minute = groundspeed_mph / 60;
var groundspeed_m_per_second =  groundspeed_m_per_minute / 60;

var remaining_secs = remaining_m / groundspeed_m_per_second;

print ("Remaining distance: ", remaining_m);
print("Remaining time: ", remaining_secs);


Now, these are all static numbers obviously - but once you have the basic steps in place, it's pretty trivial to replace these numbers with values coming from the simulator instead.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11376
Joined: Tue Mar 25, 2008 8:40 am

Re: Runway legth counter

Postby dede » Fri Nov 08, 2013 12:55 pm

Hello

Do you want to define something which is similar to the Runway Overrun Protection / Warning ?
dede
 
Posts: 30
Joined: Sun Aug 11, 2013 9:56 am
Location: Toulouse
Version: 2.10
OS: Linux

Runway Overrun Protection / Warning

Postby FGRS » Fri Nov 08, 2013 6:53 pm

Hooray: No way...this coding stuff is just way out of my league. :) It really is but I will try to do something.

dede: I think so. In the video that I have posted the link to,is that system working. The aircraft is the Boeing 733.

It's off topic completely,but one thing is making me mad with my FGFS . The TerraSync. On my PC and my FGFS installation,that thing is not working ,at all... When I try to enable it ,in FG Wizard,after clicking on "Run" ,all I get is this: "Access is denied" . Without enabling of it at the FG Wizard,when I go to TerraSync in FG Run,it's all disabled and ...let's call it blurred.

Cheers
FGRS
 
Posts: 96
Joined: Sat Nov 02, 2013 3:04 pm
Location: LQBK
Callsign: UAV001
Version: 2.8
OS: Win XP

Re: Runway Overrun Protection / Warning

Postby Johan G » Sat Nov 09, 2013 7:45 pm

FGRS wrote in Fri Nov 08, 2013 6:53 pm:Hooray: No way...this coding stuff is just way out of my league. :) It really is but I will try to do something.

You could start easy. Learning to program is a bit like learning a new language. However, one way to start without all that grammar (syntax in programming terms) and remembering vocabularies is to start looking in existing aircraft.

Head into your $FG_DATA/Aircraft directory and simply explore the directory structure at first, then try see how the various files are interconnected (hint: start with the <Aircraft>-set.xml file). Then as a last step have a look into the $FG_DATA/Aircraft/<Aircraft>/Nasal directory and try figure out how things work in nasal, while at the same time writing down and/or looking up the things you do not yet understand. Oh, and most important: It will take some time (well, at least for me).

I find some things in nasal are very different from languages I have tried earlier (Basic, Pascal, and the one I have actually done anything useful with, Python).

FGRS wrote:It's off topic completely,but one thing is making me mad with my FGFS . The TerraSync. On my PC and my FGFS installation,that thing is not working ,at all... When I try to enable it ,in FG Wizard,after clicking on "Run" ,all I get is this: "Access is denied" . Without enabling of it at the FG Wizard,when I go to TerraSync in FG Run,it's all disabled and ...let's call it blurred.

Sounds like the problem might be that there is something wrong with what directory FGRun expect the TerraSync scenery to be in. On the very first page in FGRun (you might need to click a back button first) would there happen to be a small yellow triangle on the right of any field?
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 5546
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit

Re: Runway legth counter

Postby FGRS » Sun Nov 10, 2013 11:22 am

I will talk to a friend of mine here,he's all about programing and stuff...I hope he will have some time to explain to me some things about it. I 'm aware how powerful the Nasal is,and it's a challenge to get to know it and to tinker with it.

Regarding the TerraSync...no yellow triangles at all. Just checked. :?
FGRS
 
Posts: 96
Joined: Sat Nov 02, 2013 3:04 pm
Location: LQBK
Callsign: UAV001
Version: 2.8
OS: Win XP

Re: Runway legth counter

Postby Hooray » Sun Nov 10, 2013 11:47 am

you should look again at the snippet I posted - it's trivial, really - assuming you passed elementary school, you can understand what's going on:

Code: Select all
# this defines a new variable named sum and assigns the result of evaluating 1+3
var sum = 1 +  3;
# this prints the sum
print( sum );


the snippet is doing anything else, it's just using longer variable names that may be confusing you.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11376
Joined: Tue Mar 25, 2008 8:40 am

Re: Runway legth counter

Postby FGRS » Thu Feb 06, 2014 12:44 pm

hey everyone.
I want to ask ,is it possible to crate this system ,the Runway Overrun Protection / Warning just by using the xml for coding? I'm asking cause for me it's much easier to write it that way.Nasal is too complicated for me right now,but I will try to learn it ,as I'm doing now with xml.

I want to really do something with this system and to integrate it into some of the aircraft ,which are in development now. Si,is it possible to create this system by using the .xml?

Cheers
FGRS
 
Posts: 96
Joined: Sat Nov 02, 2013 3:04 pm
Location: LQBK
Callsign: UAV001
Version: 2.8
OS: Win XP

Re: Runway overrun protection system

Postby Hooray » Thu Feb 06, 2014 8:44 pm

a purely-XML based approach would require some creative workarounds,
you could implement this using the tutorial system or property rules.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11376
Joined: Tue Mar 25, 2008 8:40 am

Re: Runway overrun protection system

Postby onox » Fri Aug 15, 2014 1:48 pm

FGRS wrote in Thu Nov 07, 2013 10:09 pm:Hey everyone, I would like to ask is it possible to add one interesting system to our lovely FG aircarft? The system works quite similar to the GPWS,with the difference that is counting the runway length on landing,and it call-out the reaming legth of the rw,like 400m remaining ,300m remaining and so on. In this video ,you hear it,it's quite interesting.


So you want something like this:

Code: Select all
var on_runway = func (runway) {
    var message = sprintf("On runway %s", runway.getValue());
    betty_say(message);
};

var approaching_runway = func (runway) {
    var message = sprintf("Approaching runway %s", runway.getValue());
    betty_say(message);
};

var remaining_distance = func (distance) {
    var message = sprintf("%d remaining", distance.getValue());
    betty_say(message);
};

var vacated_runway = func (runway) {
    var message = sprintf("Vacated runway %s", runway.getValue());
    betty_say(message);

    landing_announcer.stop();
    takeoff_announcer.set_mode("taxi");
};

var landed_runway = func (runway) {
    var message = sprintf("Touchdown on runway %s", runway.getValue());
    betty_say(message);
};

var landed_outside_runway = func {
    var message = sprintf("We did not land on a runway!");
    copilot_say(message);

    landing_announcer.stop();
    takeoff_announcer.set_mode("taxi");
};

var takeoff_config = { parents: [runway.TakeoffRunwayAnnounceConfig] };

var takeoff_announcer = runway.TakeoffRunwayAnnounceClass.new(takeoff_config);
takeoff_announcer.connect("on-runway", on_runway);
takeoff_announcer.connect("approaching-runway", approaching_runway);

var landing_config = { parents: [runway.LandingRunwayAnnounceConfig] };

var landing_announcer = runway.LandingRunwayAnnounceClass.new(landing_config);
landing_announcer.connect("remaining-distance", remaining_distance);
landing_announcer.connect("vacated-runway", vacated_runway);
landing_announcer.connect("landed-runway", landed_runway);
landing_announcer.connect("landed-outside-runway", landed_outside_runway);


?
onox
Retired
 
Posts: 431
Joined: Fri Jun 20, 2014 2:45 pm

Re: Runway overrun protection system

Postby Hooray » Fri Aug 15, 2014 2:07 pm

@onox, as a proof-of-concept this is looking pretty good - but for the sake of simplicity, you could simply use function generators to get rid of quite a bit of redundant code, e.g. see the pseudo code below:

http://wiki.flightgear.org/Using_Nasal_ ... concept.29
Code: Select all
var make_notification_cb = func(status, action=nil) {
 return func(data=nil) {
 if(data != nil)
   var message = sprintf("%s %s", status, data.getValue());
 else
   var message = status;
 betty_say(message);

  if(typeof(action)!='nil') action();
 };

};

var stop_announcer = func() {
 landing_announcer.stop();
 takeoff_announcer.set_mode("taxi");
};

var takeoff_config = { parents: [runway.TakeoffRunwayAnnounceConfig] };

var takeoff_announcer = runway.TakeoffRunwayAnnounceClass.new(takeoff_config);
takeoff_announcer.connect("on-runway", make_notification_cb("On runway") );
takeoff_announcer.connect("approaching-runway", make_notification_cb("Approaching runway"));

var landing_config = { parents: [runway.LandingRunwayAnnounceConfig] };

var landing_announcer = runway.LandingRunwayAnnounceClass.new(landing_config);
landing_announcer.connect("remaining-distance", make_notification_cb("%d remaining"));
landing_announcer.connect("vacated-runway", make_notification_cb("Vacated runway", stop_announcer ));
landing_announcer.connect("landed-runway", make_notification_cb("Touchdown on runway"));
landing_announcer.connect("landed-outside-runway", make_notification_cb("We did not land on a runway!", stop_announcer ));


Please feel free to extend your code accordingly i.e. to turn it into a tutorial for the wiki/newsletter.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11376
Joined: Tue Mar 25, 2008 8:40 am

Re: Runway overrun protection system

Postby onox » Sat Aug 16, 2014 10:00 pm

Hooray wrote in Fri Aug 15, 2014 2:07 pm:@onox, as a proof-of-concept this is looking pretty good - but for the sake of simplicity, you could simply use function generators to get rid of quite a bit of redundant code


Yeah, the example was a bit redundant. I've modified the generator a bit to use status as the format string, otherwise
Code: Select all
make_notification_cb("%d remaining")
isn't going to work.
onox
Retired
 
Posts: 431
Joined: Fri Jun 20, 2014 2:45 pm

Next

Return to Systems

Who is online

Users browsing this forum: No registered users and 1 guest