X-Plane Flightplan

Help creating logic scripts for Air Manager Instruments

Moderators: Ralph, russ

Post Reply
Message
Author
marcel_felde
Posts: 140
Joined: Wed May 09, 2018 12:19 am

X-Plane Flightplan

#1 Post by marcel_felde » Fri Feb 26, 2021 3:49 pm

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

stickandrudder
Posts: 44
Joined: Tue Sep 18, 2018 11:25 am

Re: X-Plane Flightplan

#2 Post by stickandrudder » Fri Feb 26, 2021 3:54 pm

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

marcel_felde
Posts: 140
Joined: Wed May 09, 2018 12:19 am

Re: X-Plane Flightplan

#3 Post by marcel_felde » Fri Feb 26, 2021 4:43 pm

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!

User avatar
Keith Baxter
Posts: 2814
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: X-Plane Flightplan

#4 Post by Keith Baxter » Fri Feb 26, 2021 4:57 pm

Hi,

Here is a thought.

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

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Sling
Posts: 4440
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: X-Plane Flightplan

#5 Post by Sling » Fri Feb 26, 2021 10:30 pm

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

marcel_felde
Posts: 140
Joined: Wed May 09, 2018 12:19 am

Re: X-Plane Flightplan

#6 Post by marcel_felde » Fri Feb 26, 2021 10:31 pm

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... :)

stickandrudder
Posts: 44
Joined: Tue Sep 18, 2018 11:25 am

Re: X-Plane Flightplan

#7 Post by stickandrudder » Sun Feb 28, 2021 8:51 pm

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






marcel_felde
Posts: 140
Joined: Wed May 09, 2018 12:19 am

Re: X-Plane Flightplan

#8 Post by marcel_felde » Tue Mar 02, 2021 2:25 am

Thank you so much!

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

stickandrudder
Posts: 44
Joined: Tue Sep 18, 2018 11:25 am

Re: X-Plane Flightplan

#9 Post by stickandrudder » Tue Mar 02, 2021 7:19 am

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.

Post Reply

Who is online

Users browsing this forum: Roxus and 11 guests