Re: [Flightgear-devel] GPS find nearest.

2009-12-14 Thread Sébastien MARQUE
Thank you pointing this, I haven't seen it. Here is the patch to correct 
the mistake.


Thanks in advance to commit it.

best regards
seb

Victhor Foster wrote :

Well, since this was a GPS-related thread, I decided to post this here instead 
of creating another thread :-)
The zkv500's "Turnpoint" screen works properly now. However, the navigation 
display won't show the distance to the waypoint.
--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Index: Aircraft/Instruments-3d/zkv500/MainScreens.nas
===
RCS file: /var/cvs/FlightGear-0.9/data/Aircraft/Instruments-3d/zkv500/MainScreens.nas,v
retrieving revision 1.9
diff -r1.9 MainScreens.nas
223c223
< 	dist * dist_conv[0][dist_unit],
---
> 	me.waypoint.getNode("distance-nm",1).getValue() * dist_conv[0][dist_unit],
227c227
< 	me.waypoint.getNode("course-error-nm").getValue() * dist_conv[0][dist_unit],
---
> 	dist * dist_conv[0][dist_unit],
--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] GPS find nearest.

2009-12-14 Thread Victhor Foster
Well, since this was a GPS-related thread, I decided to post this here instead 
of creating another thread :-)
The zkv500's "Turnpoint" screen works properly now. However, the navigation 
display won't show the distance to the waypoint.
--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] GPS find nearest.

2009-12-11 Thread James Turner

On 10 Dec 2009, at 21:41, Scott Hamilton wrote:

> I can't seem to find it in airportinfo(), this is what debug.dump shows;
> 
> { id: 'YMML', elevation: 131.97839, lat: -37.66986124, name: 
> 'Melbourne Intl', has_metar: 1, lon: 144.842831907, runways: { 
> 16: { id: 16, stopway: 60.045599, heading: 171.6, lat: -37.669491, 
> width: 45.1104, lon: 144.837952999, length: 3661.5624, threshold: 0 }, 
> H2: { id: 'H2', stopway: 0, heading: 260.57999, lat: 
> -37.684215, width: 34.137599, lon: 144.856781, length: 
> 34.137599, threshold: 0 }, 
> H3: { id: 'H3', stopway: 0, heading: 206.95999, lat: 
> -37.664935, width: 34.137599, lon: 144.850311, length: 
> 34.137599, threshold: 0 }, 
> 09: { id: 09, stopway: 60.045599, heading: 94.20, lat: 
> -37.661513, width: 45.1104, lon: 144.83517, length: 
> 2278.98960001, threshold: 0 }, 
> 34: { id: 34, stopway: 60.045599, heading: 351.6, lat: -37.669491, 
> width: 45.1104, lon: 144.837952999, length: 3661.5624, threshold: 0 }, 
> 27: { id: 27, stopway: 60.045599, heading: 274.20999, lat: 
> -37.661513, width: 45.1104, lon: 144.83517, length: 
> 2278.98960001, threshold: 0 }, 
> H1: { id: 'H1', stopway: 0, heading: 260.57999, lat: -37.675007, 
> width: 34.137599, lon: 144.844390999, length: 34.137599, 
> threshold: 0 } 
> } }

Whoops, you are quite correct.

However, I shall now *add* that information to airportinfo :)

(One of the outcomes of the past year's navaids / airports work, is that 
runways now have a reference to their associated ILS/LOC, so getting the 
frequency is trivial)

James


--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] GPS find nearest.

2009-12-10 Thread Scott Hamilton
On Wed, 2009-12-09 at 13:54 +, James Turner wrote:


> >  Off-topic is there anyway in Nasal to find the ILS frequencies and 
> > optionally the name, for a particular airport and runway?
> 
> Yes, the airportinfo function returns you a Nasal hash with all this and more.


I can't seem to find it in airportinfo(), this is what debug.dump
shows;

{ id: 'YMML', elevation: 131.97839, lat: -37.66986124, name:
'Melbourne Intl', has_metar: 1, lon: 144.842831907, runways: { 
16: { id: 16, stopway: 60.045599, heading: 171.6, lat:
-37.669491, width: 45.1104, lon: 144.837952999, length: 3661.5624,
threshold: 0 }, 
H2: { id: 'H2', stopway: 0, heading: 260.57999, lat:
-37.684215, width: 34.137599, lon: 144.856781, length:
34.137599, threshold: 0 }, 
H3: { id: 'H3', stopway: 0, heading: 206.95999, lat:
-37.664935, width: 34.137599, lon: 144.850311, length:
34.137599, threshold: 0 }, 
09: { id: 09, stopway: 60.045599, heading: 94.20,
lat: -37.661513, width: 45.1104, lon: 144.83517, length:
2278.98960001, threshold: 0 }, 
34: { id: 34, stopway: 60.045599, heading: 351.6, lat:
-37.669491, width: 45.1104, lon: 144.837952999, length: 3661.5624,
threshold: 0 }, 
27: { id: 27, stopway: 60.045599, heading: 274.20999,
lat: -37.661513, width: 45.1104, lon: 144.83517, length:
2278.98960001, threshold: 0 }, 
H1: { id: 'H1', stopway: 0, heading: 260.57999, lat: -37.675007,
width: 34.137599, lon: 144.844390999, length:
34.137599, threshold: 0 } 
} }

I'll try out GPS nearest scratch area next...

S.

--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] GPS find nearest.

2009-12-10 Thread Sébastien MARQUE

Hi James,

thank you very much for your changes, here is the very first step of a 
vor-to-vor flightplan builder. Let me improve it for more functions and 
capacities.


best regards,
seb

James Turner a ecrit :

On 9 Dec 2009, at 13:47, Scott Hamilton wrote:


   Something I was playing around with a few months back I thought, if only I 
could find the nearest VOR/NDB/FIX/APT to
   some point that I am not at but will be in the near future, unfortunately 
I've forgotten what it was I was trying to do,
   but I'm sure it was a good idea ;) 


Yep, agreed, it's an obvious thing to support. And easy to do, as well!


 Off-topic is there anyway in Nasal to find the ILS frequencies and optionally 
the name, for a particular airport and runway?


Yes, the airportinfo function returns you a Nasal hash with all this and more.

Also, although it's not exposed in the current GPS GUI dialog, when you search 
for an airport, the GPS scratch data contains the runways, including ILS 
frequencies, headings and names. You can see them in the property browser.

James


--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

var gps = props.globals.getNode("/instrumentation/gps/", 1);
var cmd = gps.getNode("command", 1);
var scratch = gps.getNode("scratch");
var flightplan = gps.getNode("flightplan", 1);

scratch.getNode("exact", 1).setBoolValue(0);
var searchType = scratch.getNode("type", 1);
var searchQuery = scratch.getNode("query", 1);
var searchMax = scratch.getNode("max-results", 1);

var flightplan_vector = [];

var copy_wp_infos = func (orig, dest) {
var nodelist = ["latitude-deg", "longitude-deg", "name", "ident", 
"altitude-ft", "frequency-mhz"]; #TODO frequency for NDB in kHz
foreach (var n; nodelist) {
var o = orig.getNode(n);
o != nil or continue;
dest[n] = o.getValue();
}
}

var build = func (from, to) {
var target_lat = from["latitude-deg"] + ((to["latitude-deg"] - 
from["latitude-deg"])/2);
var target_lon = from["longitude-deg"] + ((to["longitude-deg"] - 
from["longitude-deg"])/2);

scratch.getNode("latitude-deg").setDoubleValue(target_lat);
scratch.getNode("longitude-deg").setDoubleValue(target_lon);
searchType.setValue("vor");
searchMax.setIntValue(1);
cmd.setValue("nearest");

var wp = {};
copy_wp_infos(scratch, wp);

var wpcoords   = geo.Coord.new().set_latlon(wp["latitude-deg"], 
wp["longitude-deg"]);
var fromcoords = geo.Coord.new().set_latlon(from["latitude-deg"], 
from["longitude-deg"]);
var tocoords   = geo.Coord.new().set_latlon(to["latitude-deg"], 
to["longitude-deg"]);
#var dist_to = wpcoords.distance_to(tocoords);
#printf("%s -> %s dist_to %s", wp["ident"], to["ident"], dist_to);
#dist_to > 18520 or return;
wpcoords.distance_to(tocoords) > 18520 or return;
#var dist_from = wpcoords.distance_to(fromcoords);
#printf("%s -> %s dist_from %s", from["ident"], wp["ident"], dist_to);
#dist_from > 18520 or return;
wpcoords.distance_to(fromcoords) > 18520 or return;

build(from, wp);
append(flightplan_vector, wp);
build(wp, to);
}

var new_flightplan = func {
flightplan_vector = [];
print("LFBT->LFPT");
searchType.setValue("airport");
searchQuery.setValue("lfbt");
cmd.setValue("search");
var departure = {};
copy_wp_infos(scratch, departure);

searchType.setValue("airport");
searchQuery.setValue("lfpt");
cmd.setValue("search");
var destination = {};
copy_wp_infos(scratch, destination);

print("building flightplan");
if (departure["latitude-deg"] < -9990.0 or destination["latitude-deg"] < 
-9990.0) {
print("I need some yoga exercices...");
return;
}

append(flightplan_vector, departure);

build(departure, destination);

append(flightplan_vector, destination);

for (var i = 0; i < size(flightplan_vector); i += 1) {
foreach (var k; keys(flightplan_vector[i])) {
var content = flightplan_vector[i][k];
var n = flightplan.getNode("wp[" ~ i ~ "]/" ~ k, 1);
if (k == "name" or k == "ident")
n.setValue(content);
else
n.setDoubleValue(content);
}
}

print("flightplan complete");
}
--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] GPS find nearest.

2009-12-09 Thread James Turner

On 9 Dec 2009, at 13:47, Scott Hamilton wrote:

>Something I was playing around with a few months back I thought, if only I 
> could find the nearest VOR/NDB/FIX/APT to
>some point that I am not at but will be in the near future, unfortunately 
> I've forgotten what it was I was trying to do,
>but I'm sure it was a good idea ;) 

Yep, agreed, it's an obvious thing to support. And easy to do, as well!

>  Off-topic is there anyway in Nasal to find the ILS frequencies and 
> optionally the name, for a particular airport and runway?

Yes, the airportinfo function returns you a Nasal hash with all this and more.

Also, although it's not exposed in the current GPS GUI dialog, when you search 
for an airport, the GPS scratch data contains the runways, including ILS 
frequencies, headings and names. You can see them in the property browser.

James


--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] GPS find nearest.

2009-12-09 Thread Scott Hamilton
On Wed, 2009-12-09 at 08:27 +, James Turner wrote:

   I second this.

   Something I was playing around with a few months back I thought, if
only I could find the nearest VOR/NDB/FIX/APT to
   some point that I am not at but will be in the near future,
unfortunately I've forgotten what it was I was trying to do,
   but I'm sure it was a good idea ;) 

   Off-topic is there anyway in Nasal to find the ILS frequencies and
optionally the name, for a particular airport and runway?
   

S.



> On 9 Dec 2009, at 00:25, Sébastien MARQUE wrote:
> 
> > I've got an suggestion for the gps code: a command "nearest-coord" (or 
> > better name) which would give nearest navaid for arbitrary coordinates, 
> > given by scratch/longitude-deg and scratch/latitude-deg. It will allow 
> > to implement a simple navaid-to-navaid flight-plan in a FG session. I 
> > tried already months ago, but I can't get it to work properly.
> 
> This doesn't even need a new command - I shall just update the code so that 
> if you optionally set a valid lat/lon when executing 'nearest', it uses that 
> position instead of the current GPS position. I will hopefully get this into 
> CVS today.
> 
> If it's useful, there's several commands that could be updated to have this 
> behaviour.
> 
> Regards,
> James
> --
> Return on Information:
> Google Enterprise Search pays you back
> Get the facts.
> http://p.sf.net/sfu/google-dev2dev
> ___
> Flightgear-devel mailing list
> Flightgear-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel


--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel