# XPlaneConnect Toolbox-sendDREF

<-- Back

# sendPosition

Send position and orientation update command to X-Plane over UDP. This requires the X-Plane Connect Plugin to be running

## Inputs

- data: Array of 6 values where:
  - data(1) is the aircraft's Latitude (degrees)
  - data(2) is the aircraft's Longitude (degrees)
  - data(3) is the aircraft's altitude (meters above sea level)
  - data(4) is the aircraft's roll angle (degrees)
  - data(5) is the aircraft's pitch angle (degrees)
  - data(6) is the aircraft's heading/yaw angle (degrees)
- aircraft number (optional): 0=own aircraft
- IP Address (optional): IP Address of the machine that will receive the data as a character array. Default is '127.0.0.1' (local machine)
- port (optional): Port on the receiving machine where the data will be sent. Default is 49009 (XPlaneConnect). In general use 49009 to send to the plugin and 49005 to send to the x-plane udp

## Outputs

- status: If there was an error. status<0 means there was an error.

## Use

1. import XPlaneConnect.*;
2. latlon = [37.4185718,-121.935565]; %Lat,lon of NASA Ames Research Center
3. alt = 500; %meters above sea level
4. orient = [0,20,180]; %Orientation (roll,pitch,yaw/heading). 20 degrees yaw, heading south
5. status = sendPOSI([latlon,alt,orient]); % Set position of own aircraft
6. status2 = sendPOSI([[latlon(1)+0.005,latlon(2)],alt,orient],1); % Set position of aircraft 1

## Change Log

10/02/14: [CT] V0.9 Updated to use new xpcPlugin
06/10/13: [CT] Code created
<-- Back