P3D External Sim Driven Aircraft

For topics related to the creation of simulation objects (SimObjects). This includes development of aircraft, ground, and maritime vehicles.
Post Reply
Tadghostal
Posts: 14
Joined: Mon Jan 27, 2020 10:18 pm

P3D External Sim Driven Aircraft

Post by Tadghostal »

Basically, I am trying to use an in house simulator to drive P3D. Following the linuxsimulation example in the PDK samples I was able to get our simulator to send UDP packets to P3D and drive the position and orientation of the aircraft in P3D. So now I am attempting to get this to work with the F-35A model included with P3D, and I did this by copying the files to the simobject in the add-on folder for the simulator interface I made and changed stuff in the aircraft.cfg to give it unique names and make it load properly.

So it works, partially. It will load up the aircraft and the aircraft will move according to the inputs from the external sim. However, none of the virtual cockpit stuff will work and neither does the MFD panel. Really what I need to get working is the MFD panel while being driven by the external sim. I am sure that I need to implement more stuff in my DLL, but I am not sure where to start, considering I am pretty new to development on P3D. If anyone could point me in the correct direction I would greatly appreciate the help.
Mike Schroeter
Lockheed Martin
Posts: 341
Joined: Thu Jan 12, 2012 7:05 pm

Re: P3D External Sim Driven Aircraft

Post by Mike Schroeter »

The SDK’s SimpleAirplane sample has some good examples of how to do this. Gauges and animations are generally configured using properties or simulation variables. Most of the simulation variables defined in the SDK are for the default aircraft implementation, so you will have to “register” your own using RegisterProperty. Similarly, inputs can be registered. ISimObjectManager::RegisterProperty() allows you to register a property string name and it’s corresponding callback method. The string name is what is used in the gauges and animations. There are different overloads of RegisterProperty depending on whether the property is an input or query-able state, as well as the type of data (string, floating point value, vector).

SimpleAirplane is a working sample that should help illustrate how to interface your simobject state with P3D.

Hope this helps,
Mike
Tadghostal
Posts: 14
Joined: Mon Jan 27, 2020 10:18 pm

Re: P3D External Sim Driven Aircraft

Post by Tadghostal »

Great, thanks Mike for pointing me in the right direction. I will see what I can get working.
Tadghostal
Posts: 14
Joined: Mon Jan 27, 2020 10:18 pm

Re: P3D External Sim Driven Aircraft

Post by Tadghostal »

Mike, that worked out great for getting me going.

However, no I am running into a weird issue. I am developing the modified MFD on one computer and we are deploying it on a second computer. For a while it was working fine on both computers, but now on the computer I am developing on I get the error "Failed to Startup flight model" whenever I select the vehicle and then press the OK button on the Prepar3d Scenario screen. Also when I select the aircraft on the select vehicle screen it says no preview available on the window where the preview should show up. The weird part is it still functions fine on the deployment computer and I copied the same files between the two computers and the development computer still isn't working.

Looking up the error code, it says that message appears when it can't load the .air file. Well I definitely made sure the two computers had the same .air files for my object and that didn't fix it. I have tried fully uninstalling Prepar3d and removing any files left behind and then reinstalling. I have swapped the .air files with the F-35 base model included with Prepar3d (since that is what I am using for my custom F-35), and I just can't get it to work. I can't see what is different between the two computers, and why when it worked before on the development computer, it doesn't work now.

Any help would be greatly appreciated.
Tadghostal
Posts: 14
Joined: Mon Jan 27, 2020 10:18 pm

Re: P3D External Sim Driven Aircraft

Post by Tadghostal »

Never mind I am an idiot. I had hard coded a path looking for a configuration file that would return an E_FAIL result if it wasn't found, problem is I changed hard drives on the development computer and created a new user for myself but it was different from the default user we use here. So long story short, it couldn't find my configuration file, so it would fail and the aircraft would not load...
Post Reply