Merge pull request #5 from nasa/Completing_Matlab

Completing Matlab Functions
This commit is contained in:
Christopher Teubert
2014-11-24 12:18:22 -08:00
27 changed files with 830 additions and 115 deletions

10
.gitignore vendored Normal file
View File

@@ -0,0 +1,10 @@
*.m~
xpcPlugin/xpcPlugin.xcodeproj/project.xcworkspace/xcuserdata/cteubert.xcuserdatad/UserInterfaceState.xcuserstate
xpcPlugin/xpcPlugin.xcodeproj/project.xcworkspace/xcshareddata/xpcPlugin.xccheckout
xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/xpcPlugin.hmap
xpcPlugin/xpcPlugin.xcodeproj/project.xcworkspace/xcshareddata/xpcPlugin.xccheckout

View File

@@ -140,7 +140,7 @@ BASIC FUNCTIONS
9. requestDREF Request the value of specific dref(s). Dataref list found at http://www.xsquawkbox.net/xpsdk/docs/DataRefs.html
INPUT:
outSocket (xpcSocket): Socket to use to send the command
inSocket (xpcSocket): Socket to use to send the command
inSocket (xpcSocket): Socket to use to receive the result
DREFArray (char[][100]): Array of DataRefs to be requested
DREFSizes (int[]): Array of string lengths for each DataRef in DREFArray
listLength (short): Number of DataRefs in DREFArray

View File

@@ -37,22 +37,6 @@
// CONTACT
// For questions email Christopher Teubert (christopher.a.teubert@nasa.gov)
//
// VERSION HISTORY
// 06.24.14 (V0.23): (CT) General Fixes for Windows compatability
// 05.23.14 (V0.22): (CT) Combined request/readDREF
// -fixed readPOSI (gear issue)
// 05.21.14 (V0.2175): (CT) Added Throttle to CTRL
// 05.12.14 (V0.215): (CT) Read/Parse/Send Control
// 05.07.14 (V0.21): (CT) Read/Parse/Send Position
// 04.29.14 (V0.205): (CT) Added check that data was received in read functions
// 03.15.14 (V0.2): (CT) General performance updates, added preconditions
// 02.04.14 (V0.11): (CT) Fixed problem that caused for loops not to work with some compilers. General Stability Improvements, added readRequest, readDREF
// 01.27.14 (V0.1): (CT) First Beta: sendDATA, sendDREF, requestDREF, pauseSim, readDATA
// 11.10.13 (V0.0): (CT) First Version
//
// CONTRIBUTORS
// CT: Christopher Teubert (christopher.a.teubert@nasa.gov)
//
// TO DO
// 1. Update SelectData
// 2. RequestDREF: look into removing DREFSizes

View File

@@ -5,41 +5,36 @@
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>2D8FADF5-8504-4A76-A99F-91CA115CE4E3</string>
<string>FBE0AA36-6228-4D09-93D5-9640D5AD126A</string>
<key>IDESourceControlProjectName</key>
<string>xpcExample</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>D7B4D224-FE26-406E-A48F-C604A5BE6975</key>
<string>https://babelfish.arc.nasa.gov/svn/pcoe/cteubert/xplaneconnect</string>
<key>C03F0B00-9A73-4E8C-88E5-1BC53A92AE34</key>
<string>https://github.com/nasa/XPlaneConnect.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>C/xpcExample/xpcExample.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>D7B4D224-FE26-406E-A48F-C604A5BE6975</key>
<key>C03F0B00-9A73-4E8C-88E5-1BC53A92AE34</key>
<string>../../../..</string>
</dict>
<key>IDESourceControlProjectRepositoryRootDictionary</key>
<dict>
<key>D7B4D224-FE26-406E-A48F-C604A5BE6975</key>
<string>https://babelfish.arc.nasa.gov/svn/pcoe</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://babelfish.arc.nasa.gov/svn/pcoe/cteubert/xplaneconnect/C/xpcExample/xpcExample.xcodeproj</string>
<string>https://github.com/nasa/XPlaneConnect.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>D7B4D224-FE26-406E-A48F-C604A5BE6975</string>
<string>C03F0B00-9A73-4E8C-88E5-1BC53A92AE34</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.subversion</string>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>D7B4D224-FE26-406E-A48F-C604A5BE6975</string>
<string>C03F0B00-9A73-4E8C-88E5-1BC53A92AE34</string>
<key>IDESourceControlWCCName</key>
<string>xplaneconnect</string>
<string>XPlaneConnect</string>
</dict>
</array>
</dict>

View File

@@ -24,7 +24,7 @@ int main() {
float POSI[9] = {0.0};
float CTRL[5] = {0.0};
float gear;
char IP[16] = "143.232.73.41";//"127.0.0.1";//;// //IP Address of computer running X-Plane
char IP[16] = "127.0.0.1";// //IP Address of computer running X-Plane
short PORT = 49009; //xpcPlugin Receiving port (usually 49009)
printf("xplaneconnect Example Script\n- Setting up Simulation\n");

View File

@@ -1,4 +1,4 @@
function status = requestDREF( DREFArray, varargin )
function result = requestDREF( DREFArray, varargin )
%requestDREF request the value of a specific DataRef from X-Plane over UDP
% Version 0.25
%
@@ -8,31 +8,25 @@ function status = requestDREF( DREFArray, varargin )
% 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
%
%Outputs
% status: If there was an error. Status<0 means there was an error.
% result: cell array of resulting data where
%
%Use
% 1. import XPlaneConnect.*;
% 2. DREFArray = {'sim/cockpit2/controls/yoke_heading_ratio','sim/cockpit2/controls/yoke_roll_ratio'};
% 3. status = requestDREF( DREFArray, '172.0.100.54' );
%
%Change Log
% 10/02/14: [CT] V0.25: Updated to work with updated xpcPlugin
% 04/19/14: [CT] V0.2: First Created
% 3. result = requestDREF( DREFArray, '172.0.100.54' );
%
% Contributors
% [CT] Christopher Teubert (SGT, Inc.)
% christopher.a.teubert@nasa.gov
%
% To Do
% 1. Complete- Receive response
%
%BEGIN CODE
disp('This Function is not functional yet-use the C version. Sorry for any inconvenience')
import XPlaneConnect.*
message = zeros(1,6);
len = 7;
socket = openUDP(49008);
status = -1; %#ok<NASGU> % no data
%% Handle Input
p = inputParser;
@@ -55,5 +49,22 @@ parse(p,DREFArray,varargin{:});
% Send UDP
status = sendUDP(message, p.Results.IP, p.Results.port);
% Look for response
for i=1:40
data = readUDP(socket);
if length(data) > 1 % Received Data
status = 0;
counter = 7;
nArrays = data(6);
result = cell(nArrays,1);
for j=1:nArrays
sizeArray = data(counter);
result{j} = typecast(uint8(data(counter+1:counter+sizeArray*4))','single');
counter = counter + 1 + sizeArray * 4;
end
break;
end
end
closeUDP(socket);
end

Binary file not shown.

View File

@@ -1,5 +1,5 @@
//
// XPCPlugin Version 0.25 Beta
// XPCPlugin Beta
//
// DESCRIPTION
// XPCPlugin Facilitates Communication to and from the XPlane
@@ -43,28 +43,6 @@
// CONTACT
// For questions email Christopher Teubert (christopher.a.teubert@nasa.gov)
//
// VERSION HISTORY
// 10.16.14: (CT) Added Notices and Disclaimers
// 08.21.14 (V0.24): (CT) Changed setPOSI to handle multiple aircraft
// - Better handling of reaching maxconn
// 08.04.14 (V0.23): (CT) Fixed CTRL invalid dref message
// - Added message buffer, type XPCMessage
// 05.21.14 (V0.22): (CT) Updated to use new xpcSocket Struct
// - Fixed gear for POSI message.
// - Completed SetFlaps
// - Forwards certain commands + Unknown DATA DREFs to UDP
// 05.12.14 (V0.215): (CT) Completed CTRL Option, added flap handle DREF
// 05.07.14 (V0.21): (CT) Added more DATA DREFS
// - Moved handleDREFSIM to tools file
// - Created setORIENT,setPOSI, setGEAR, setDREF functions;
// 04.30.14 (V0.205): (CT) Added NaN data handling (DATA,DREF,CONN,SIMU)
// - Added up to 5 signal reading per loop + run every cycle
// 04.15.14 (V0.2): (CT) Added benchmarking tools, Expanded DATA, added ability to send velocity magnitude, created xpcPluginTools
// 03.21.14 (V0.18): (CT) Added ability to set pause instead of toggle. Expanded DATA.
// 02.13.14 (V0.17): (CT) Completed GETD option, saved connections, added ability to receive dref w/o sim/ preceeding it (saves 4 bytes/request), general stability improvements
// 1.28.14 (V0.1): (CT) First Beta: DATA (11.0-2, 14.0-1, 16.0-2, 17.0-2, 20.0-2, 21.0-5, 25.0), SIMU, DREF
// 12.10.13 (V0.0): (CT) First Version
//
// CONTRIBUTORS
// CT: Christopher Teubert (christopher.a.teubert@nasa.gov)
//
@@ -804,8 +782,8 @@ int handleGETD(char buf[])
char the_message[5000];
char header[5] = {0};
int count = 6;
float values[40] = {-998};
int intArray[40] = {-998};
float values[100] = {-998};
int intArray[100] = {-998};
int DREFSizes[100] = {0};
char *DREFArray[100];
@@ -871,12 +849,12 @@ int handleGETD(char buf[])
{case 8: //Float Array
length = XPLMGetDatavf(connectionList[current_connection].XPLMRequestedDRefs[i],NULL,0,8); //find size of array
XPLMGetDatavf(connectionList[current_connection].XPLMRequestedDRefs[i],values,0,length);
XPLMGetDatavf(connectionList[current_connection].XPLMRequestedDRefs[i],values,0,fminl(length,100));
break;}
{case 16: //Integer Array
length = XPLMGetDatavi(connectionList[current_connection].XPLMRequestedDRefs[i],NULL,0,8); //find size of array
XPLMGetDatavi(connectionList[current_connection].XPLMRequestedDRefs[i],intArray,0,length);
XPLMGetDatavi(connectionList[current_connection].XPLMRequestedDRefs[i],intArray,0,fminl(length,100));
for (k=0; k < length; k++) {
values[k]=(float) intArray[k];
}

View File

@@ -1,7 +1,7 @@
dependencies: \
/Users/cteubert/Documents/XPlaneConnect/xpcPlugin/XPCPlugin.cpp \
/Users/cteubert/Documents/XPC\ Project/XPlaneConnect/xpcPlugin/XPCPlugin.cpp \
SDK/CHeaders/XPLM/XPLMProcessing.h SDK/CHeaders/XPLM/XPLMDefs.h \
SDK/CHeaders/XPLM/XPLMGraphics.h \
/Users/cteubert/Documents/XPlaneConnect/xpcPlugin/xpcPluginTools.h \
/Users/cteubert/Documents/XPlaneConnect/C/src/xplaneConnect.h \
/Users/cteubert/Documents/XPC\ Project/XPlaneConnect/xpcPlugin/xpcPluginTools.h \
/Users/cteubert/Documents/XPC\ Project/XPlaneConnect/C/src/xplaneConnect.h \
SDK/CHeaders/XPLM/XPLMDataAccess.h

View File

@@ -1,4 +1,4 @@
/Users/cteubert/Documents/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/xplaneConnect.o
/Users/cteubert/Documents/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/XPCPlugin.o
/Users/cteubert/Documents/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/xpcPluginTools.o
/Users/cteubert/Documents/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/xpcPlugin_vers.o
/Users/cteubert/Documents/XPC Project/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/xplaneConnect.o
/Users/cteubert/Documents/XPC Project/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/XPCPlugin.o
/Users/cteubert/Documents/XPC Project/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/xpcPluginTools.o
/Users/cteubert/Documents/XPC Project/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/xpcPlugin_vers.o

View File

@@ -1,5 +1,5 @@
dependencies: \
/Users/cteubert/Documents/XPlaneConnect/xpcPlugin/xpcPluginTools.cpp \
/Users/cteubert/Documents/XPlaneConnect/xpcPlugin/xpcPluginTools.h \
/Users/cteubert/Documents/XPlaneConnect/C/src/xplaneConnect.h \
/Users/cteubert/Documents/XPC\ Project/XPlaneConnect/xpcPlugin/xpcPluginTools.cpp \
/Users/cteubert/Documents/XPC\ Project/XPlaneConnect/xpcPlugin/xpcPluginTools.h \
/Users/cteubert/Documents/XPC\ Project/XPlaneConnect/C/src/xplaneConnect.h \
SDK/CHeaders/XPLM/XPLMDataAccess.h SDK/CHeaders/XPLM/XPLMDefs.h

View File

@@ -1,3 +1,3 @@
dependencies: \
/Users/cteubert/Documents/XPlaneConnect/C/src/xplaneConnect.c \
/Users/cteubert/Documents/XPlaneConnect/C/src/xplaneConnect.h
/Users/cteubert/Documents/XPC\ Project/XPlaneConnect/C/src/xplaneConnect.c \
/Users/cteubert/Documents/XPC\ Project/XPlaneConnect/C/src/xplaneConnect.h

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,8 +1,13 @@
e248099e4ca69aab39e09933db0e8224 40338ed41bc50608816db4b997bf9225 ffffffffffffffffffffffffffffffff 0 /Users/cteubert/Documents/xplaneconnect/xpcPlugin/xpcPlugin.xpl
e248099e4ca69aab39e09933db0e8224 d28616f568184b038b5993957344c0e5 ffffffffffffffffffffffffffffffff 42268 /Applications/X-Plane 10/Resources/plugins/xpcPlugin.xpl
e248099e4ca69aab39e09933db0e8224 aab92ad79f7970566adbcaa7382fae5a ffffffffffffffffffffffffffffffff 42268 /Users/cteubert/Documents/FDzProject/flightdeckz/connections/src/xplaneconnect/xpcPlugin.xpl
00000000543ffd340000000000004c61 8ce0fc6b718cfd197db7b19ece32fb43 ffffffffffffffffffffffffffffffff 16047 /Users/cteubert/Documents/FDzProject/flightdeckz/connections/src/xplaneconnect/xplaneConnect.c
ffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff 3170 /Users/cteubert/Documents/FDzProject/flightdeckz/connections/src/xplaneconnect/xplaneConnect.h
3cf9e0e2c3d7330be62f82980f61a614 af5f4e247ee72a2fd8605a86129cde95 ffffffffffffffffffffffffffffffff 42268 /Users/cteubert/Documents/xplaneconnect/xpcPlugin/xpcPlugin.xpl
3cf9e0e2c3d7330be62f82980f61a614 276eb2237c95a27242c61e05f0ff8fe0 ffffffffffffffffffffffffffffffff 42268 /Applications/X-Plane 10/Resources/plugins/xpcPlugin.xpl
3cf9e0e2c3d7330be62f82980f61a614 ecd54abeb6f6cd3905769ac71bfbe480 ffffffffffffffffffffffffffffffff 42268 /Users/cteubert/Documents/FDzProject/flightdeckz/connections/src/xplaneconnect/xpcPlugin.xpl
00000000546fbb1800000000000048db cfce26aca1b989e457eb5cf2b59c3bd8 ffffffffffffffffffffffffffffffff 18651 /Users/cteubert/Documents/FDzProject/flightdeckz/connections/src/xplaneconnect/xplaneConnect.c
00000000546fbb190000000000000c62 539e31d610b4d465fec71d36139c86a2 ffffffffffffffffffffffffffffffff 3170 /Users/cteubert/Documents/FDzProject/flightdeckz/connections/src/xplaneconnect/xplaneConnect.h
00000000002e7bb100000000000edaee 3cf9e0e2c3f948bae62f82980f6f7cfa ffffffffffffffffffffffffffffffff 48748 /Users/cteubert/Documents/XPC Project/XPlaneConnect/xpcPlugin/Mac/xpcPlugin.xpl
ffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff 2768 /Users/cteubert/Documents/XPC Project/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/xpcPlugin_vers.o
000000000611f1150000000000004746 8374b21db9901f2d5dac9c15376e9125 ffffffffffffffffffffffffffffffff 29532 /Users/cteubert/Documents/XPC Project/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/xpcPluginTools.o
000000005215308c0000000000002679 a62798d4eca3e9394feb35c4591b436a ffffffffffffffffffffffffffffffff 45876 /Users/cteubert/Documents/XPC Project/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/XPCPlugin.o
0000000006367b2c000000000000477f 9f15938943d0aea354fb2acfa5f38eb5 ffffffffffffffffffffffffffffffff 29288 /Users/cteubert/Documents/XPC Project/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/xplaneConnect.o
e7479fe596e29344f39bbebeb9c0282d 050f967bda4409efca7b278d62ceaa09 ffffffffffffffffffffffffffffffff 48676 /Users/cteubert/Documents/XPlaneConnect/xpcPlugin/Mac/xpcPlugin.xpl
000000000611f0d40000000000000f6a f229aeb77cc342b388dcfe8c1c35f733 ffffffffffffffffffffffffffffffff 2768 /Users/cteubert/Documents/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/xpcPlugin_vers.o
000000000672cad60000000000004746 844d4d17e49cda80fc37de6e01f9deaa ffffffffffffffffffffffffffffffff 29484 /Users/cteubert/Documents/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/xpcPluginTools.o

View File

@@ -0,0 +1,10 @@
e248099e4ca69aab39e09933db0e8224 40338ed41bc50608816db4b997bf9225 ffffffffffffffffffffffffffffffff 0 /Users/cteubert/Documents/xplaneconnect/xpcPlugin/xpcPlugin.xpl
e248099e4ca69aab39e09933db0e8224 d28616f568184b038b5993957344c0e5 ffffffffffffffffffffffffffffffff 42268 /Applications/X-Plane 10/Resources/plugins/xpcPlugin.xpl
e248099e4ca69aab39e09933db0e8224 aab92ad79f7970566adbcaa7382fae5a ffffffffffffffffffffffffffffffff 42268 /Users/cteubert/Documents/FDzProject/flightdeckz/connections/src/xplaneconnect/xpcPlugin.xpl
00000000543ffd340000000000004c61 8ce0fc6b718cfd197db7b19ece32fb43 ffffffffffffffffffffffffffffffff 16047 /Users/cteubert/Documents/FDzProject/flightdeckz/connections/src/xplaneconnect/xplaneConnect.c
ffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff 3170 /Users/cteubert/Documents/FDzProject/flightdeckz/connections/src/xplaneconnect/xplaneConnect.h
e7479fe596e29344f39bbebeb9c0282d 050f967bda4409efca7b278d62ceaa09 ffffffffffffffffffffffffffffffff 48676 /Users/cteubert/Documents/XPlaneConnect/xpcPlugin/Mac/xpcPlugin.xpl
000000000611f0d40000000000000f6a f229aeb77cc342b388dcfe8c1c35f733 ffffffffffffffffffffffffffffffff 2768 /Users/cteubert/Documents/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/xpcPlugin_vers.o
000000000672cad60000000000004746 844d4d17e49cda80fc37de6e01f9deaa ffffffffffffffffffffffffffffffff 29484 /Users/cteubert/Documents/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/xpcPluginTools.o
00000000066639050000000000008b55 dc672190d23b96b0fb74dd44110cd5de ffffffffffffffffffffffffffffffff 45756 /Users/cteubert/Documents/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/XPCPlugin.o
0000000006663d0000000000000043c5 4d445dd5da8587137c044318b50237d6 ffffffffffffffffffffffffffffffff 29224 /Users/cteubert/Documents/XPlaneConnect/xpcPlugin/build/xpcPlugin.build/Debug/xpcPlugin.build/Objects-normal/x86_64/xplaneConnect.o

View File

@@ -17,5 +17,21 @@
endingLineNumber = "12">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "XPCPlugin.cpp"
timestampString = "438549105.218957"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "890"
endingLineNumber = "890"
landmarkName = "handleGETD(char buf[])"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>