Whether aircraft information can be obtained and sent out in a 10ms cycle??

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Post Reply
UserLYMForP3D1218
Posts: 3
Joined: Tue Dec 18, 2018 3:05 am

Whether aircraft information can be obtained and sent out in a 10ms cycle??

Post by UserLYMForP3D1218 »

Hello everyone,

We are trying to control another aircraft in real time (a 10 ms cycle) to enable it to fly in formation with the aircraft. And the following is the step we used:

a> get informatioin from our own plane . SimConnect_RequestDataOnSimObjectType

b> create an AI aircraft . SimConnect_AICreateObjectWithExternalSim or SimConnect_AICreateNonATCAircraft

c> set the data we get from step a to the AI aircraft . SetDataOnSimObject

But the aircraft we created kept shaking in the view relative to our own plane . So we found that the time to get data from Prepar3D is not stable.

Is there anyway for us to get data for Prepar3D in a stable time? Or are there other ways to stabilize the airplane in the view??

And if I go one step further, how about create an AI aircraft on another computer's Prepar3D??
JB3DG
Posts: 609
Joined: Mon Jan 09, 2012 6:44 pm

Re: Whether aircraft information can be obtained and sent out in a 10ms cycle??

Post by JB3DG »

You can make a dummy data request on that object and set the request interval to sim frame. That's the closest you will get to being in sync with the sim. See this to get time delta between frames: https://www.fsdeveloper.com/wiki/index. ... %2B_timers

Also try turning your framerate slider off unlimited. Putting it at unlimited is known to make any AI object jitter.
Jonathan Bleeker
Milviz systems dev

Formerly known as Naruto-kun
User avatar
Prepar3DGuy
Posts: 7
Joined: Thu Nov 23, 2017 7:22 pm

Re: Whether aircraft information can be obtained and sent out in a 10ms cycle??

Post by Prepar3DGuy »

UserLYMForP3D1218 wrote: Mon Jun 03, 2019 7:41 am We are trying to control another aircraft in real time (a 10 ms cycle) to enable it to fly in formation with the aircraft. And the following is the step we used:
You can implement IAIBehaviourWingmanFormationV01 interface from PDK for another aircraft or SimObject in the wingman. (Required Professional Plus)

Another variant with PDK (not SimConnect) is to get information from current position of user aircrfat through ISimObjectManagerV440::GetUserObject and IBaseObjectV450::GetPosition. Create another aircrafts (simobjects) using ISimObjectManagerV440 and set desired position for them using SetPosition when you need to update it. If you want the fixed position related to user object use AttachObject method, no shaking at all.
PDK gives you many options. How about creating Simulation behaviour by your own and apply it on another aircraft using RegisterSimulation. Why not to implement AI that will make some maneuvers to create and release formation flight.
UserLYMForP3D1218 wrote: Mon Jun 03, 2019 7:41 am But the aircraft we created kept shaking in the view relative to our own plane . So we found that the time to get data from Prepar3D is not stable.
Is there anyway for us to get data for Prepar3D in a stable time? Or are there other ways to stabilize the airplane in the view??
Look at the description of this method. Controlling sim rates for both simobjects may prevent jitter (shaking) that you have.
UserLYMForP3D1218 wrote: Mon Jun 03, 2019 7:41 am And if I go one step further, how about create an AI aircraft on another computer's Prepar3D??
I think that you don't need it.
Post Reply