• 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.

simconnect Attitude Indicator pitch

Messages
4
Country
ca-ontario
I am trying to make sense of the data I am getting back from FSX when using the RequestDataOnSimObject. I am new to FSX and Simconnect and I started by using the Microsoft sample project ESPDataRequest and added the lines:

public double attitude_pitch;

simconnect.AddToDataDefinition(DEFINITIONS.DataRequestStruct, "Attitude Indicator Pitch Degrees", "degrees", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);

and then the following to populate a gui text box:

this.textBox_Attitude_Pitch.Text = userData.attitude_pitch.ToString();

I was under the assumption that I would get a positive angle in degrees when I was pitched up (in a climb) and a negative angle when pitched down (descending) but I am getting the exact opposite. I am also trying to make sense of the angle that I am receiving. I am closely monitoring the FSX Attitude indicator while also monitoring the SimConnect gui displaying the pitch on the attitude indicator. Each horizontal line above the horizon (straight and level) on the AI should represent 5 degrees of pitch however it does not seem to work that way. I am getting about three degrees when on the first line, 7 on the second, 11 on the third, and 15 on the forth.

I am flying the cessna 172 model. Is there something I am missing? I would expect to be seeing 20 degrees on the uppermost line?

Please Advise . . .
 
According to the FSX SDK:

"ATTITUDE INDICATOR PITCH DEGREES AI pitch indication Radians"

Do you want?:

"PLANE PITCH DEGREES Pitch angle, Radians " Although the name mentions degrees the units used are radians
 
Welcome in the world of SDK documentation ;-)
By my experience, it is worth to take the documentation just as a hint and either confirm expected result or investigate difference.
 
I decided to try to request the Attitude Indicator data from FSX in both degrees and radians to see if there was any difference using the following lines:

//Attitude Indicator
simconnect.AddToDataDefinition(DEFINITIONS.DataRequestStruct, "Attitude Indicator Pitch Degrees", "degrees", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
simconnect.AddToDataDefinition(DEFINITIONS.DataRequestStruct, "Attitude Indicator Pitch Degrees", "radians", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);

and then in the last stage convert the radians to degrees mathamatically to compare the data:

this.textBox_Attitude_Pitch_degrees.Text = userData.attitude_pitch_degrees.ToString();
this.textBox_Attitude_pitch_radians.Text = Convert.ToString(userData.attitude_pitch_radians * 57.2957795);

and I am still getting the same data: negative for climb, positive for descent and the angle is still reporting what I feel is incorrect. I am getting about -15.0 degrees for a climb where
the AI dot is at the 20 degrees line.

Not quite sure what to make of it . . . I will try digging into the docs to see if I see anything that explains this strange behaviour.
 
I also forgot to mention that I also tried

"PLANE PITCH DEGREES Pitch angle, Radians "

requesting the data in both degrees and radians. The latter I convert to degrees once again. The Plane Pitch Degrees is giving me the exact same data as the "Attitude Indicator Pitch Degrees"
 
One question - how does your DataRequestStruct looks like?
To which type are you assigning it? Float or Double?
 
I am using Double for my Variables. My structure looks like this:

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
struct DataRequestStruct
{
// this is how you declare a fixed size string
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public String title;
public double latitude;
public double longitude;
public double altitude;
public double headingRadians;
public double airspeed;
public double attitude_pitch_degrees;
public double attitude_pitch_radians;
public double attitude_bank;
public double attitude_bars;
public double plane_pitch;

};

I am developing in C#
 
That should be okay...
Maybe silly one, but just wondered how precise is the AI in the C172. Did you try that in other planes too?
Because the dependency you described looks like something other than wrong angle units.
It's more like coefficient. When I'm not wrong, it looks like 0.6 of wished value at 5 degrees increasing to 0.75 of wished value at 20 degrees.

Also - could you try to set plane pitch and compare it to values you're getting from "Attitude Indicator Pitch Degrees"?
 
The variable seems to be OK for me in C++ using both degrees and radians. It gives -1.8 deg with the default FSX C172 stationary. The position of the aircraft marker is adjustable so the gauge doesn't match to variable.

Code:
SimConnect_AddToDataDefinition(hSimConnect, DATA_TEST_DATA, "PLANE PITCH DEGREES", "Degrees");

Its value has to be negated according to the FS9 Spirit of St Louis pitch_roll_indicator.xml.
<Value Minimum="-90" Maximum="90">(A:Plane pitch degrees,degrees) /-/</Value>

That could be because of the sign convention?
 
The negative-pitch-going-up is just because of FSX's internal coordinate system. Simply negate it for positive-going-up.

The attitude indicator you're using may not match your readings because it's flawed. I've found some default and especially freeware gauges have various bugs like that. It could be reading the wrong variable, or the graphics aren't lined up correctly (such as the lines aren't evenly spaced and it's not using a non-linearity table, or it is but the values are wrong). There are always quirks like that you'll find. Like someone said, welcome to the world of SDK.
 
Back
Top