Jump to content

You're browsing the 2004-2023 VATSIM Forums archive. All content is preserved in a read-only fashion.
For the latest forum posts, please visit https://forum.vatsim.net.

Need to find something? Use the Google search below.

Feature request: Traffic information exposed to Plugins


Mark Barnes
 Share

Recommended Posts

Mark Barnes
Posted
Posted

I'm looking to inject TCAS data into PSX, please could you consider exposing aircraft Lat/Lon/Alt/Hdg of all aircraft that you're injecting into simconnect?

Link to comment
Share on other sites

Ross Carlson
Posted
Posted

Sure, I could do that. I'm thinking that the plugin broker could raise an event whenever a position update is received from the network. So the plugin would have its event handler called once every 5 seconds for each aircraft. There would also be events for when the aircraft is added to or removed from the sim. Would that work?

Developer: vPilot, VRC, vSTARS, vERAM, VAT-Spy

Senior Controller, Boston Virtual ARTCC

Link to comment
Share on other sites

Mark Barnes
Posted
Posted

That would be perfect - I was thinking of the same combination of 3 events. I can just maintain a List<> or ConcurrentDictionary<,> from those events then apply my filtering criteria to determine which ones to inject into PSX TCAS.

 

(I am wondering if I might gain any benefit from the smoothed data vPilot is doing internally... but I'm happy to try the 5 second rate first)

 

Partially related question: Does vPilot have a way of syncing traffic objects on 3 P3D instances? At the moment I'm pulling out the vehicle data from 1 P3D instance (the one that vPilot injects into) and injecting those vehicles into the other 2 instances. It works (with a decent sync across the boundary of 2 projector screens) but I'm just thinking about how I could make this easier...

Link to comment
Share on other sites

Ross Carlson
Posted
Posted
(I am wondering if I might gain any benefit from the smoothed data vPilot is doing internally... but I'm happy to try the 5 second rate first)

 

I thought about raising a position update event every time vPilot does its position interpolation, but that would result in a LOT of events, because each aircraft is interpolated every sim frame. All events are currently raised on the UI thread, and I'd be concerned about possibly saturating the message queue when there are dozens of aircraft in range. It might be just fine, too ...

 

Partially related question: Does vPilot have a way of syncing traffic objects on 3 P3D instances? At the moment I'm pulling out the vehicle data from 1 P3D instance (the one that vPilot injects into) and injecting those vehicles into the other 2 instances. It works (with a decent sync across the boundary of 2 projector screens) but I'm just thinking about how I could make this easier...

 

No, there's no way to do that currently. I've thought about developing a "slave" mode that just handles traffic injection and smoothing for secondary sim instances, but haven't had enough demand for it yet.

 

Just curious, but if you're already syncing traffic, couldn't you use that same data to feed the TCAS?

Developer: vPilot, VRC, vSTARS, vERAM, VAT-Spy

Senior Controller, Boston Virtual ARTCC

Link to comment
Share on other sites

Mark Barnes
Posted
Posted
Just curious, but if you're already syncing traffic, couldn't you use that same data to feed the TCAS?

 

That's what I'm doing currently - I've got some software that syncs the non-user vehicles amongst 3 instances of P3D (one is the 'master' and the other 2 are 'slaves' which isn't completely ideal - I'd like a single 'reference' source and 3 slave instances for absolute sync) and does the TCAS injection in one binary.

I'm looking to separate these features so that I can release a vPilot plugin to the PSX community that just does TCAS injection, and keep the current multi-P3D-instance syncing private (as it would be a support nightmare) until I can make it easier to configure for users.

 

As a stretch goal - I could do another vPilot plugin that does the multi-P3D-instance syncing *if* I had the smoothed position datastream (or a copy of the smoothing algorithm to use in my async plugin thread) *and* the ability to turn off the vPilot vehicle injection into P3D (also having the ability to turn off simconnect completely as I can get radio freq/transponder state/ident direct from PSX and use the plugin interface to set these).

I've already got a P3D plugin that subscribes to a NetMQ publisher and injects the vehicles based on the data coming from the publisher, so it would just be a case of NetMQ publishing the vehicle data from a vPilot plugin and have my 3 instances of P3D subscribe to that datastream and inject traffic.

 

By the way, if you've got a Slack/other method of collaboration, I'd be happy to talk in-depth technical and share code for multi-P3D syncing otherwise we'll stick with this thread. If we can get all the relevant support in the plugin interface to [Mod - Happy Thoughts]ist me in this, I'd release it. I like the idea of keeping it as a plugin rather than make it core vPilot functionality - modularity is a wonderful thing.

 

I thought about raising a position update event every time vPilot does its position interpolation, but that would result in a LOT of events, because each aircraft is interpolated every sim frame. All events are currently raised on the UI thread, and I'd be concerned about possibly saturating the message queue when there are dozens of aircraft in range. It might be just fine, too ...

 

I'd agree with keeping events as a low-volume mechanism. I'd either be looking to reproduce the smoothing algorithm or perhaps the plugin interface could expose a BlockingCollection<> that I can read from.

(If you're not familiar - BlockingCollection enables thread-safe producer-consumer architectures. You can bound the depth of it to a maximum number of items and use a non-blocking TryAdd() call so if the plugin isn't using it, it'll just fill up initially and then stay filled up. I use these all the time along with TPL Tasks to make very clean bug-free multi-threaded code.)

Link to comment
Share on other sites

Ross Carlson
Posted
Posted

Sounds good, I'll go ahead and add the events for add/remove aircraft and 5 second position updates. I'll also consider a way to make the interpolated aircraft positions available to plugins, but I think that's going to be quite a bit more involved due to how the SimConnect stuff (including the interpolation) is isolated from the rest of the system.

 

I'm also thinking you might want to do your own interpolation for the slaves, on each slave. The reason I say this is because the way I was able to get smooth movement is by subscribing to the frame event in SimConnect, and each time that event fires, I iterate all aircraft and calculate their interpolated positions and call the SimConnect function to update their positions in the sim. That's all done synchronously when the frame event fires. So each aircraft's position changes in sync with the frame rate of the sim, and fluctuations in the frame rate have no negative effect. Introducing any network latency into the process could result in jerky movement on the slaves.

 

Back during development of the first version of vPilot, the interpolation worked great as long as the user was running vPilot on the same machine as the sim. As soon as it was run on a remote machine, the movement was very jerky due to the network lag of the SimConnect position update commands now having to traverse the network. That's why I wrote the TrafficProxy. The TrafficProxy runs on the same machine as the sim and gets the 5 second position updates from vPilot using a SimConnect client data area. It does its own position interpolation (reacting to the frame event) locally on the sim machine.

 

Let me know if you'd like to explore that option (having each slave do its own interpolation) and I'll describe the interpolation algorithm in more detail.

 

Regarding turning off SimConnect completely, that would also require some pretty significant changes to the core system, and the plugin would have to do more than supply the radio stack state. It would also have to provide the user aircraft's location, altitude, attitude, gear/flaps/lights/engine states, etc. I've thought about abstracting that out so that vPilot could work with non-SimConnect simulators via different plugins, but that hasn't happened yet ... it's entirely coupled to SimConnect as it stands now.

Developer: vPilot, VRC, vSTARS, vERAM, VAT-Spy

Senior Controller, Boston Virtual ARTCC

Link to comment
Share on other sites

Mark Barnes
Posted
Posted
Sounds good, I'll go ahead and add the events for add/remove aircraft and 5 second position updates.

 

Let's start with this and then when I've got something released & I've used the plugin interface in a bit more detail... we can evaluate everything else I've discussed at that point.

 

Please let me know when the beta is out - it'll take me just a couple of hours to pull in a load of existing code into a new DLL project and test it all. Should be easy.

 

Edit: Could I get the ability to at least turn off the simconnect calls doing the traffic injection? A method to enable/disable perhaps? Then I'll be able to start experimenting.

Link to comment
Share on other sites

  • 4 weeks later...
Mark Barnes
Posted
Posted

Any ideas when the next beta with these events will be available?

(Approximately... I'm a volunteer developer myself so know the score)

Link to comment
Share on other sites

Ross Carlson
Posted
Posted

No idea, but it'll be a while I imagine. I'm about to move to a new house and then I've got some work travel coming up in the middle of April that I need to prepare for, so my VATSIM work is taking a back seat for now.

Developer: vPilot, VRC, vSTARS, vERAM, VAT-Spy

Senior Controller, Boston Virtual ARTCC

Link to comment
Share on other sites

Ira Robinson
Posted
Posted

Gentlemen, this sounds incredible. It is a pleasure listening to the two of you discuss the possibility of new features for one of our core software products! If I may allowed just one question....?

 

What the heck are you guys talking about!! lol

Really. For those of us who grew up using a good old fashioned black steel cased Royal Typewriter, the project and the results of it that you are discussing are so far from my comprehension that you may as well have been speaking a different language. Actually, now that I think of it, you were. So if you would like to translate this, because I have to tell you that if you implement this.... this wonderful [sic] idea, I probably won't even know that you added something to the program!

 

So seriously now, how about a brief, very quick explanation of what it is you are attempting to do here? One sentence should do it I think, with not so many words in it

__________

Ira Robinson

Link to comment
Share on other sites

Kirk Christie
Posted
Posted

Ira,

 

PSX is the software by aerowinx for cockpit builders for the 747, one thing to note is that it can be run on a PC without a cockpit, i have some friends that use it without a cockpit, cause of its shared cockpit functionality.

 

The set up that I know of in my area also uses 3 computers each running their own instance of P3D for each projector.

Kirk Christie - VATPAC C3

VATPAC Undercover ATC Agent

Worldflight Perth 737-800 Crew Member

956763

Link to comment
Share on other sites

Ira Robinson
Posted
Posted

Thank you Kirk. That was simple enough that even I understood it

__________

Ira Robinson

Link to comment
Share on other sites

Mark Barnes
Posted
Posted

Ira; as mentioned by Kirk - Aerowinx PSX is a 747-400 virtual cockpit.

 

It's so versatile, you can run it purely on screens like:

or use it to drive a full cockpit:

https://www.youtube.com/watch?v=wz1mKIpQU34

 

We're using it to drive a full sim with 3 projectors, 8 (maybe more, I've lost count) PCs & mostly genuine parts.

 

What I'm asking Ross for is the VATSIM traffic data (the position/speed/type of all the aircraft nearby) so I can inject this data into PSX where it will use it in the TCAS system to show the other aircraft on the flight display(s).

Link to comment
Share on other sites

Ira Robinson
Posted
Posted

Thank you Mark, for the explanation. Now I understand what it is you were discussing. At least i think i do. When you folks think of these new concepts and ideas it certainly makes this a more interesting place to be. I am amazed at some of the stuff you all come up with, and it 's great to be able to come along for the ride! Anyway, thanks for taking the time.

__________

Ira Robinson

Link to comment
Share on other sites

  • 4 weeks later...
Ross Carlson
Posted
Posted

Mark, 2.1.4 is now available in the Beta update channel, and the new events have been added.

Developer: vPilot, VRC, vSTARS, vERAM, VAT-Spy

Senior Controller, Boston Virtual ARTCC

Link to comment
Share on other sites

 Share