Skip to content

getPOSI

Christopher Teubert edited this page Feb 22, 2017 · 2 revisions

Get position information for an aircraft. Position is returned in the following order: [Lat, Lon, Alt, Pitch, Roll, Yaw, Gear]

Syntax

Language Signature
C int getPOSI(XPCSocket sock, float values[7], char ac);
MATLAB posi = getPOSI(ac, socket)
Java float[] getPOSI(int ac)
Python getPOSI(self, ac = 0)
Parameters

sock (C): The socket used to send the command.

values (C): The array in which the resulting values should be stored.

socket (MATLAB): An optional reference to a socket opened with openUDP that should be used to send the command.

Return value

C: A negative value if an error occurs, otherwise 0.

All others: An array that matches the format of the array passed into sendPOSI.

Exceptions

C Error Code Java Exception Python Error Description
-1 -- OSError The request could not be sent
-2 IOException OSError No response was received
-3 IOException ValueError A response was received, but the length was incorrect
-- -- ValueError The response header was incorrect

Examples

C
#include "xplaneConnect.h"
XPCSocket sock = openUDP(IP);

// Get the current position info for the player aircraft
float posi[7];
getPOSI(sock, posi, 0);

closeUDP(sock);
MATLAB
import XPlaneConnect.*;

% Get the current position info for the player aircraft
posi = getPOSI(0);
Java
import gov.nasa.xpc.XPlaneConnect;

try(XPlaneConnect xpc = new XPlaneConnect())
{
    // Get the current position info for the player aircraft
    float[] posi = xpc.getPOSI(0);
}
Python
import xpc

with xpc.XPlaneConnect() as client:
    # Get the current position info for the player aircraft
    posi = client.getPOSI(0);