API AirplaneState - feature requests

Hey there,

I’m tinkering around on a “copilot” type app (see here) and have already found the following attributes on “AirplaneState” which I can request via the API:

“AccelerationX”
“AccelerationY”
“AccelerationZ”
“AltitudeAGL”
“AltitudeMSL”
“Bank”
“CourseTrue”
“GForce”
“GearState”
“GroundSpeed”
“GroundSpeedKts”
“HeadingMagnetic”
“HeadingTrue”
“IndicatedAirspeed”
“IndicatedAirspeedKts”
“IsAutopilotOn”
“IsBraking”
“IsCrashed”
“IsLanded”
“IsOnGround”
“IsOverLandingWeight”
“IsOverTakeoffWeight”
“IsPushbackActive”
“Location”
“Latitude”
“Longitude”
“MachNumber”
“MagneticDeviation”
“Pitch”
“ReverseThrustState”
“SideForce”
“SpoilersPosition”
“StallProximity”
“StallWarning”
“Stalling”
“TrueAirspeed”
“Velocity”
“VerticalSpeed”
“Weight”
“WeightPercentage”

These are already very helpful and seem to work great, but I’d like to request the following ones as well since they would be very helpful for that app (Laura asked me to post these requests here):

  • FlapsPosition
  • IsSeatBeltLightOn
  • IsNoSmokingLightOn
  • IsOnRunway
  • IsStrobeLightsOn
  • IsBeaconLightsOn
  • IsNavLightsOn
  • IsLandingLightsOn

I’m assuming those should be incredibly easy to add and they would really help apps like the one I’m trying to build. Thanks!


A few more

This may not be quite AS simple as those boolean properties, but these would also be really nice for the GPWS warnings (not to mention other cool possibilities this would open up 😉):

  • IsGlidescopeActive
  • GlidescopeDeviationVertical
  • GlidescopeDeviationHorizontal
  • AutopilotHeading
  • AutopilotSpeed
  • AutopilotVS
  • AutopilotAPPR

Let me know, API experts (looking at you @Cameron) if there is already some way to access any of this info.


One more

  • IsInReplayMode so my copilot doesn’t get all confused when replaying stuff :-)
30 Likes

All apart from the IsOnRunway should be available already. I mean I’ve seen @Cameron use all of the others in LiveFlight already. Maybe he used some magic to do it: He should be able to help you out maybe.

2 Likes

That’d be great if that is the case. In his open source files I could only find where he changes those things. But what I’m looking for is to be able to request the state of those things, which is different.

But maybe @cameron can clear things up, maybe I’m just missing some API somewhere. :-)

1 Like

I guess you’re right: I only remember the button to change flaps. For the lights though I think he did have the button glowing when on so he must have been able to pull the state from somewhere (unless he was just assuming the lights are not touched in game and therefore have a specific state when starting the flight). I could be very wrong though.

1 Like

You are correct these are not yet exposed in the API. I assume you’ve been looking at the liveflight connect code. I added a bunch of aircraft state stuff to the windows version you can look at to double check, but very certain the things you require are not yet exposed.

2 Likes

Shouldn’t the isOnRunway be there? With the idle warning

1 Like

In the app itself, but not exposed through the API.

1 Like

The requested api’s would be pretty useful. isOnRunway especially…

1 Like

I think it could be possible to add it to the API because the system knows the difference as we get the 35 knots max. ground speed warning on Live.

3 Likes

Nope, I don’t use any of these. There are ways for the IsOnRunway using some geographical interpolation, but it’s probably overkill for what @epaga is looking for.

Just throwing this out there, obviously it’s depending on what the runway flag is needed for, but perhaps you can probably test for positive acceleration + a ∆ altitude AGL if you’re only needing a low-accuracy solution.

Yeah that’s how I’m currently doing the taxi speed warning: accelerationZ being low enough while on the ground and not braking / reverse thrust. Good enough.
But it would sure be nice to have that flag, would make things a lot easier.

Added a few more requests up top:

IsGlidescopeActive
GlidescopeDeviationVertical
GlidescopeDeviationHorizontal
AutopilotHeading
AutopilotSpeed
AutopilotVS
AutopilotAPPR

Let me know, API experts (looking at you @Cameron) if there is already some way to access any of this info.

1 Like

Hmm. I’d probably geographically interpolate this as well (using nav data) if it was something I really needed. Other than that, find a way to motivate Laura to do it ;-)

2 Likes

The advantage of using nav data is you could implement a speech when entering a specific runway “Approaching Runway 3-4” and “On Runway 3-4” ;)

3 Likes

I’m strangely motivated to do this… :)

13 Likes

Those are already available, check this part of the IFCTest Sample:

        private void checkbox_Checked(object sender, RoutedEventArgs e)
    {
        var checkbox = sender as CheckBox;

        if (checkbox.Equals(altitudeStateCheckbox))
            client.ExecuteCommand("Commands.Autopilot.SetAltitudeState", new CallParameter[] { new CallParameter { Value = checkbox.IsChecked.ToString() } });
        if (checkbox.Equals(headingStateCheckbox))
            client.ExecuteCommand("Commands.Autopilot.SetHeadingState", new CallParameter[] { new CallParameter { Value = checkbox.IsChecked.ToString() } });
        if (checkbox.Equals(verticalSpeedStateCheckbox))
            client.ExecuteCommand("Commands.Autopilot.SetVSState", new CallParameter[] { new CallParameter { Value = checkbox.IsChecked.ToString() } });
        if (checkbox.Equals(speedStateCheckbox))
            client.ExecuteCommand("Commands.Autopilot.SetSpeedState", new CallParameter[] { new CallParameter { Value = checkbox.IsChecked.ToString() } });
        if (checkbox.Equals(apprStateCheckbox))
            client.ExecuteCommand("Commands.Autopilot.SetApproachModeState", new CallParameter[] { new CallParameter { Value = checkbox.IsChecked.ToString() } });
    }

    private void speedTextBlock_TextChanged(object sender, TextChangedEventArgs e)
    {
        var textBlock = sender as TextBox;

        if (textBlock.Equals(speedTextBlock))
            client.ExecuteCommand("Commands.Autopilot.SetSpeed", new CallParameter[] { new CallParameter { Value = textBlock.Text.ToString() } });
        if (textBlock.Equals(altitudeTextBlock))
            client.ExecuteCommand("Commands.Autopilot.SetAltitude", new CallParameter[] { new CallParameter { Value = textBlock.Text.ToString() } });
        if (textBlock.Equals(verticalSpeedTextBlock))
            client.ExecuteCommand("Commands.Autopilot.SetVS", new CallParameter[] { new CallParameter { Value = textBlock.Text.ToString() } });
        if (textBlock.Equals(headingTextBlock))
            client.ExecuteCommand("Commands.Autopilot.SetHeading", new CallParameter[] { new CallParameter { Value = textBlock.Text.ToString() } });

    }
6 Likes

Just added a few things:

Aircraft.GetInfo will return some data about the current airplane:
Example:
{
“Result”: 0,
“Type”: “Fds.IFAPI.APIAircraftInfo”,
“FlapsConfiguration”: [
{
“FlapsAngle”: 0,
“Name”: “0%”,
“ShortName”: “0%”,
“SlatsAngle”: 0
},
{
“FlapsAngle”: 7,
“Name”: “20%”,
“ShortName”: “20%”,
“SlatsAngle”: 7
},
{
“FlapsAngle”: 17.5,
“Name”: “50%”,
“ShortName”: “50%”,
“SlatsAngle”: 17.5
},
{
“FlapsAngle”: 35,
“Name”: “100%”,
“ShortName”: “100%”,
“SlatsAngle”: 35
}
],
“HasAutopilot”: true,
“Name”: “C-130H”,
“SpoilerType”: 1
}

Also added 2 a few new fields in AirplaneState, ex:
“ApproachAirportICAO”: “KONT”,
“ApproachDistance”: 1135.53833,
“ApproachHorizontalAngle”: -0.0279764552,
“ApproachRunway”: “08L”,
“ApproachVerticalAngle”: -0.637350857,

About IsOnRunway, why do you guys need this one? Isn’t IsOnGround sufficient?


Laura

10 Likes

Awesome. That could be useful. Thanks.

I think IsOnRunway may be used if app wants to differentiate between taxiing too fast and on takeoff roll.

Just committed a few things to the project:

Some of the features in there are not working (console, text, and the stuff in the global tab).

What’s working is GetWeather and the new things we discussed above.

7 Likes

Laura,

The weather works for me but I do not see any of the new mentioned fields added to AircraftState. I assume those would not work anyway until the app is updated to expose them unless you have some way of exposing it already.

Thanks!