• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Detect takeoff/landing

Messages
2
Country
brazil
Hey guys, how are you?
I'm trying to detect the exact moment when the user aircraft has take-off or landed, but since "ON GROUND" isn't a Simconnect event, I'm stuck on this...
What I already tried is to make a "eternal" loop, validating if the "SIM ON GROUND" variable has changed, but of course, the application almost crashed (probably due to the lack of memory).

Do you have any approaches on this?
My objective is to register the takeoff weight/fuel and landing weight/fuel with fpm on touchdown.

Thanks and happy hollidays!
 
You could possibly detect undercarriage compression, or tire rotation as a transition event.
 
ON GROUND not working in SimConnect is a major PITA. Another thought is to track 'SIM ON GROUND' in a gauge and send the result to your SimConnect module via a Client Event. Needs a C-gauge though.
 
I'm rewriting the app to use FSUIPC instead of SimConnect, since with this I'll be able to receive data from a variety of sims (not only P3D x64).
Thank you very much for the replies!
 
I'm glad that the OP has found a good solution to his problem.

So FWIW.

In managed code it is possible to check for SIM ON GROUND using SimConnect, at least with the FSX SP2 SDK.

The easiest way to try this, IMO, is to add this check to the SDK Managed Data Request sample and see what you get when the plane is on the ground or in the air.
 
I can confirm it works fine with Simconnect on C++ (using QT). But, of course, you need to Query regularly the sim, no specific Event for it (like in Xml gauges).
 
I know it's an old thread, but there is a nice solution to this that nobody has mentioned: use the SIM ON GROUND simconnect variable, but don't poll it as the OP did. Instead, when you call `RequestDataOnSimObject`, set the Flags parameter to CHANGED and set the Period parameter to PER SIM SECOND, or if you want more precision, PER SIM FRAME. What that means is you will receive notifications whenever that variable changes value, so it functions a lot like an event. To see some sample code, look at the Tagged Data sample.
 
this works

simconnect.AddToDataDefinition(DEFINITIONS.OnceTakeOff, "SIM ON GROUND", "bool", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);

simconnect.RegisterDataDefineStruct<OnceTakeOff>(DEFINITIONS.OnceTakeOff);

simconnect.RequestDataOnSimObject(DATA_REQUESTS.OnceTakeOff, DEFINITIONS.OnceTakeOff, SimConnect.SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD.SECOND, SIMCONNECT_DATA_REQUEST_FLAG.CHANGED, 0, 0, 0);
 
Last edited:
Back
Top