-
Notifications
You must be signed in to change notification settings - Fork 277
sendPOSI
Sets position information on the specified aircraft.
In the C client, the psendPOSI
function omits the ac
parameter and sets
the position information of the player aircraft.
In other clients, the ac
parameter is optional and defaults to 0
(the player
aircraft).
Language | Signature |
---|---|
C | int sendPOSI(XPCSocket sock, float values[], int size, char ac) |
MATLAB | sendPOSI( posi, ac, socket ) |
Java | void sendPOSI(float[] values, int ac) |
Python | sendPOSI(self, values, ac = 0) |
sock
(C): The socket used to send the command.
values
: The position values to set. values
is a array containing up to 7
elements. If less than 7 elements are specified or any element is set to
-998
, those values will not be changed. The elements in values
correspond
to the following:
- Latitude (deg)
- Longitude (deg)
- Altitude (m above MSL)
- Pitch (deg)
- Roll (deg)
- True Heading (deg)
- Gear (0=up, 1=down)
size
(C): The number of elements in values
.
ac
: The aircraft to set the control surfaces of. 0 is the main/player aircraft.
socket
(MATLAB): An optional reference to a socket opened with openUDP
that
should be used to send the command.
C: A negative value if an error occurs, otherwise 0.
C Error Code | Java Exception | Python Error | Description |
---|---|---|---|
-1 | IllegalArgumentException | ValueError | The specified aircraft number is invalid |
-2 | IllegalArgumentException | ValueError | The number of values specified is too large |
-3 | IOException | OSError | The client was unable to send the command |
#include "xplaneConnect.h"
XPCSocket sock = aopenUDP("127.0.0.1", 49007);
// Set position above south San Francisco bay
float values[] = { 37.524F, -122.06899F, 2500, 0, 0, 0, 1 };
sendPOSI(sock, values, 7, 0);
closeUDP(sock);
import XPlaneConnect.*
% Set position above south San Francisco bay
values = { 37.524F, -122.06899F, 2500, 0, 0, 0, 1 };
sendPOSI(values, 0);
import gov.nasa.xpc.XPlaneConnect;
try(XPlaneConnect xpc = new XPlaneConnect())
{
// Set control surfaces for level flight
float values[] = { 37.524F, -122.06899F, 2500, 0, 0, 0, 1 };
xpc.sendPOSI(values, 0);
}
import xpc
with xpc.XPlaneConnect() as client:
# Set control surfaces for level flight
values = [37.524F, -122.06899F, 2500, 0, 0, 0, 1]
client.sendPOSI(values, 0)