Page 1 of 1

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

Posted: Mon Jun 03, 2019 7:41 am
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??

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

Posted: Mon Jun 03, 2019 7:55 am
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.

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

Posted: Tue Jun 04, 2019 12:39 pm
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.