FSX:SE Not getting SIM ON GROUND

#1
Hello,

I'm trying to obtain SimConnect's SIM ON GROUND property, but it keeps returning as false (0) even if I am clearly down and stationary on a runway. I think I have everything set up properly:

Event is set up as:

Code:
hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_OBJECT_DATA, "SIM ON GROUND",                  "Bool");
And my DEFINITION_OBJECT_DATA contains a boolean member.

Then, I call:

Code:
hr = SimConnect_RequestDataOnSimObject(hSimConnect, REQUEST_OBJECT_DATA, DEFINITION_OBJECT_DATA, SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD_ONCE);

And trap it:

Code:
        case SIMCONNECT_RECV_ID_SIMOBJECT_DATA:
        {
            SIMCONNECT_RECV_SIMOBJECT_DATA *pObjData = (SIMCONNECT_RECV_SIMOBJECT_DATA*)pData;
           switch(pObjData->dwRequestID)
            {
                case REQUEST_OBJECT_DATA:
                {

                    DWORD ObjectID = pObjData->dwObjectID;
                    structObjectData *pS = (structObjectData*)&pObjData->dwData;

                    // testing
                    printf("SIM ON GROUND: %s\n", pS->SimOnGround? "TRUE":"FALSE");

However, I always get "SIM ON GROUND: FALSE" no matter where the aircraft is. I have other vars in DEFINITION_OBJECT_DATA and they are all sent from the sim correct and accurate.

Has anyone noticed this, and/or been able to obtain the correct value?

thanks,
 
#2
I tried to do this using managed code with C++/CLI :yikes: and after a brief test, it appears to work.

I declared this variable in a struct: double on_ground;

This is my data definition:
Code:
simconnect->AddToDataDefinition(DEFINITIONS::Struct1, "SIM ON GROUND", "Bool", SIMCONNECT_DATATYPE::FLOAT64, 0, SimConnect::SIMCONNECT_UNUSED);
This is where I receive it:
Code:
void simconnect_OnRecvSimobjectDataBytype(SimConnect^ sender, SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE^ data)
{
   switch ((DATA_REQUESTS)data->dwRequestID)
   {
       case DATA_REQUESTS::REQUEST_1:
       {  Struct1^ s1 = (Struct1^)data->dwData[0];
           displayText("Sim on ground?  " + s1->on_ground);
Unfortunately, I haven't got a clue what this code should look like in "normal" C++, but maybe this will give you some idea for what you would like to do.
 
#3
Thanks! Unfortunately, C++ doesn't have the equivalent of simconnect_OnRecvSimobjectDataBytype.

However, upon further looking into it, It turns out that I was checking for it at the wrong location (Inside "choose aircraft" UI). What's confusing is that the default flight is the Aircreation Trike at Friday Harbour, and THAT "location" is in the air (not on ground... I wish we still had our old Meigs field startup location :( ). When choosing another location (runway), I was expecting that the location would be reflected and updated, but it doesn't, until you actually enter the sim.

I changed the default "Choose Aircraft" FLT into one that's on ground, and BINGO, it started showing "SimOnGround" as true.
 
#5
I'm suprised it even works inside the UI. I'd certainly want to wait for the sim to load until getting the vars.
It does, but it is a legacy setting from within the sim (or, more precisely, the currently loaded FLT). It looks like sim is always running, but while in UI, it is paused. So, it looks like the sim at startup first loads DEFAULT.FLT (Friday harbour with trike), where SimOnGround is FALSE. If the sim goes into UI at startup (instead directly into flight), you can select Aircraft/Location in "Free Flight" menu, but SimOnGround does NOT get set to TRUE (because you can only start on the ground, on a runway) until you actually accept the setting and go into sim.

Makes sense, but I didn't at first understand the sequence of events. ;)
 
#6
Watch out here though. I don't have a sim on my hand now, so I can't go and verify, but I think there is an option to disable default flight preload. I remember using it on a laptop to make sim load faster.

Either way I know from my own mistakes it's not a good idea to manipulate sim world before you get a note that it's actually started.

Sent from my XT1635-02 using Tapatalk
 
#7
Hmmmm... there is an option to skip UI at startup: (FSX.CFG, OR, through FSX Menu "Settings:General:Show Opening Screen )
[STARTUP]
SHOW_OPENING_SCREEN=0

and load and fly any FLT you previously labelled as "make this the default flight":

[USERINTERFACE]
SITUATION=c:\users\<user>\documents\flight simulator x\MySavedFlight

if this entry is missing or empty, It will be defaulted to:
SITUATION=FLIGHTS\OTHER\FLTSIM

However, if you go into UI as you start FSX,

[STARTUP]
SHOW_OPENING_SCREEN=1

and go into "free flight" section, it will offer you aircraft and location specified in "SITUATION=..."

If the location in "SITUATION=..." FLT is not on the runway, the closest runway is offered in the dialog. If the location is far from any runway, the system seems to default to Seattle Tacoma Itl.

At least those have been my obserevations...
 
#9
I'm talking about this parameter:

[Main]
DisablePreload=1

Not sure it's properly documented anywhere
Oh yes, I'm using this. All it does is prevents loading SCENERY while in UI, so that while you browse through aircraft, it doesn't give you stutters while system simultaneously loads aircraft and trying to load scenery specified in the default FLT. Documented here. However, this "saved" time will be "lost" once you commit to going into flight, as the scenery has to eventually load.

It still DOES load aircraft and location (and other parameters such as SimOnGround) from the default FLT file.
 
Top