Page 1 of 1

X-Plane Flightplan

Posted: Fri Feb 26, 2021 3:49 pm
by marcel_felde
Hi everyone,

Is there a way to get information of the waypoints of a X-Plane flightplan to show them on a navigation display?

I did a similar thing with AI/MP aircraft for TCAS. But I could not yet find datarefs for the waypoints... searched for keywords like waypoint, flightplan, route with no success...

Greetings and thanks,

Marcel

Re: X-Plane Flightplan

Posted: Fri Feb 26, 2021 3:54 pm
by stickandrudder
I have been looking for the same myself.
my topic on the issue

My solution became SASL. I am not home now, but i can send it to you next week if you need it

Re: X-Plane Flightplan

Posted: Fri Feb 26, 2021 4:43 pm
by marcel_felde
I try to avoid using too much plugins etc. But as a solution until reading those informations directly from XP or getting them via AM, it would be wonderful to use your solution! Thank you very much!

Re: X-Plane Flightplan

Posted: Fri Feb 26, 2021 4:57 pm
by Keith Baxter
Hi,

Here is a thought.

Where should flight plans be stored? Berried within a sim? or easily accessible via AM?

Keith

Re: X-Plane Flightplan

Posted: Fri Feb 26, 2021 10:30 pm
by Sling
Keith,

Not sure it’s really buried so to speak. I think it’s more a case that AM does not implement some features of the Xplane SDK. Flight plans are one such thing. Terrain probing is another such example. As an Xplane user I’d obviously like to see these implemented but I think the reason they are not is that they are for a single sim and I know the guys try to find solutions that will work across sims. This is why a Terrain db will be used as an example. I think if the other sims have a way to do similar then it’s ok to have a different method to obtain the data but the data still needs to be there and available. Xplane gets held back by the other sims in this regard when using AM.

Just my take on it.

Tony

Re: X-Plane Flightplan

Posted: Fri Feb 26, 2021 10:31 pm
by marcel_felde
As far as I understand, the EFIS ND and MFD show the next two waypoints of the flightplan on the screen with lines between them.

You can pretty easily get information of the different AI/MP aircrafts around you to put them on a map TCAS display. The same for the active flightplan and the clouds for a weather radar would be perfect... :)

Re: X-Plane Flightplan

Posted: Sun Feb 28, 2021 8:51 pm
by stickandrudder
Here`s the SASL script. Written right inside main.lua.
If you are not familiar with SASL and just want the whole plugin then PM me and I`ll give you a link.

Code: Select all

		sasl.options.setAircraftPanelRendering ( false )
		sasl.options.set3DRendering ( false )
		sasl.options.setInteractivity ( false )
----------------------------------------------------------------------------------
--Create custom datarefs
----------------------------------------------------------------------------------

		createGlobalPropertyia ( "am/gps/type" , 64 )
		createGlobalPropertyi ( "am/gps/nr_legs" , 0 )
		createGlobalPropertyia ( "am/gps/id" , 64 )
		createGlobalPropertyia ( "am/gps/altitude" , 64 )
		createGlobalPropertyfa ( "am/gps/longitude" , 64 )
		createGlobalPropertyfa ( "am/gps/latitude" , 64 )
		
		fpl_type = globalPropertyia("am/gps/type")
		fpl_nr_legs = globalPropertyi("am/gps/nr_legs")
		fpl_id = globalPropertyia("am/gps/id")
		fpl_altitude = globalPropertyia("am/gps/altitude")
		fpl_longitude = globalPropertyfa("am/gps/longitude")
		fpl_latitude = globalPropertyfa("am/gps/latitude")
				
		
----------------------------------------------------------------------------------
--Write data to datarefs
----------------------------------------------------------------------------------
update_fms_last = 0

function write_flightplan(count)
	print(count)
	set(fpl_nr_legs, count)
	
		for i=0 , (count-1) do
		type , name , id , altitude , latitude , longitude = sasl.getFMSEntryInfo (i)
		set(fpl_type, {type}, i+1, 1)
		set(fpl_id, {id}, i+1, 1)
		set(fpl_altitude, {altitude}, i+1, 1)
		set(fpl_latitude, {latitude}, i+1, 1)
		set(fpl_longitude, {longitude}, i+1, 1)
	
	
		--print("nr: " .. i+1 .. " type: " .. type .. " name: " .. name .. " ID: "  .. tostring(id) .. " altitude: " .. altitude .. " Longitude: " .. longitude .. " Latitude: " .. latitude)
		end

end

----------------------------------------------------------------------------------
--Run function when fms is updated
----------------------------------------------------------------------------------		
		
	
function update()		
	update_fms = sasl.countFMSEntries ()
		if update_fms ~= update_fms_last then
		write_flightplan(update_fms)
		update_fms_last = update_fms
		end
end






Re: X-Plane Flightplan

Posted: Tue Mar 02, 2021 2:25 am
by marcel_felde
Thank you so much!

If I remember right, I did try SASL some years ago. :)

Re: X-Plane Flightplan

Posted: Tue Mar 02, 2021 7:19 am
by stickandrudder
marcel_felde wrote: Tue Mar 02, 2021 2:25 am Thank you so much!

If I remember right, I did try SASL some years ago. :)
Here is the full plugin, its in #general-chat.

https://discord.gg/mdeCNGfgBf

Made some changes.
Here are the datarefs in the new one:

Code: Select all

	"am/gps/type"
        "am/gps/nr_legs"
        "am/gps/name"
        "am/gps/id"
        "am/gps/altitude" 
        "am/gps/longitude"
        "am/gps/latitude"
All are arrays, except "am/gps/name", which is a string that contains all waypoints, divided by ",", and "am/gps/nr_legs" which is a integers containing the number of waypoints in the FMS, this is needed to let AM know how far too loop through the data. If you have one flightplan that is 10 legs, and then create a new one with 6, it does not purge the info written to index 6-9. So if you loop through the whole arrays it may produce junk data.