Several small fixes

- Added Visual Studio solution for C client example.
 - Fixed inconsistent indentation in C client example.
 - Changed default behavior in MATLAB client's sendCTRL function to leave unchanged instead of setting default values.
 - Fixed sendPOSI and sendDATA sections of the MATLAB example.
 - Fixed port number in the C and C++ setCONN tests.
This commit is contained in:
Jason Watkins
2015-03-30 13:38:51 -07:00
parent d199bd0089
commit 85fdcbe3dc
8 changed files with 257 additions and 135 deletions

View File

@@ -47,7 +47,7 @@ import XPlaneConnect.*
dataStream = header; %TODO-ADD ACFT
% Deal with position update
control = [0, 0, 0, 0.8, 0, 1];
control = [-998.5, -998.5, -998.5, -998.5, -998.5, -998.5];
for i=1:min(length(ctrl),length(control))
control(i) = ctrl(i);

View File

@@ -12,31 +12,28 @@ disp('xplaneconnect Example Script\n- Setting up Simulation');
Socket = openUDP(49005);
%% Set position of the player aircraft
disp('Setting position');
pauseSim(1);
% Lat Lon Alt Pitch Roll Heading Gear
POSI = [37.524, -122.06899, 2500, 0, 0, 0, 1];
sendPOSI(POSI);
pause(5);
posi(1) = 37.52465; % Move aircraft North a bit
posi(4) = 20; % Set aircraft pitch up 20 degrees
sendPOSI(POSI);
sendPOSI(POSI); % Set own aircraft position
% Lat Lon Alt Pitch Roll Heading Gear
POSI = [37.52465, -122.06899, 2500, 0, 20, 0, 1];
sendPOSI(POSI, 1); % Place another aircraft just north of us
%% Set rates
disp('Setting rates');
data = struct('h',18,'d',[0,-999,0,-999,-999,-999,-999,-999]);
sendDATA(data);
data = struct('h',3,'d',[3,130,130,130,130,-999,-999,-999]);
sendDATA(data);
data = struct('h',16,'d',[16,0,0,0,-999,-999,-999,-999]);
sendDATA(data);
% Alpha Velocity PQR
% data = struct('h',[18, 3, 16],...
% 'd',[[0,-999,0,-999,-999,-999,-999,-999],... % Alpha data
% [3,130,130,130,130,-999,-999,-999],... % Velocity data
% [16,0,0,0,-999,-999,-999,-999]]); % PQR data
% sendDATA(data);
data = struct('h',[18, 3, 16],...
'd',[0,-999,0,-999,-999,-999,-999,-999;... % Alpha data
3,130,130,130,130,-999,-999,-999;... % Velocity data
16,0,0,0,-999,-999,-999,-999]); % PQR data
sendDATA(data);
%% Set CTRL
% Throttle
CTRL = [-999,-999,-999,0.8,-999];
CTRL = [0,0,0.8];
sendCTRL(CTRL);
pause(5);
pauseSim(0);
pause(5) % Run sim for 5 seconds
%% Pause sim
disp('Pausing simulation');