Added multiplayer sendCTRL support to MATLAB client
- Also fixed a bug in the message format where gear was sent as a single rather than a byte.
This commit is contained in:
@@ -52,7 +52,10 @@ import XPlaneConnect.*
|
||||
for i=1:min(length(ctrl),length(control))
|
||||
control(i) = ctrl(i);
|
||||
end
|
||||
dataStream = [dataStream, typecast(single(control),'uint8')];
|
||||
dataStream = [dataStream, typecast(single(control(1:4)),'uint8')];
|
||||
dataStream = [dataStream, uint8(control(5))];
|
||||
dataStream = [dataStream, typecast(single(control(6)),'uint8')];
|
||||
dataStream = [dataStream, uint8(acft)];
|
||||
|
||||
% Send DATA
|
||||
status = sendUDP(dataStream, IP, port);
|
||||
|
||||
@@ -22,5 +22,23 @@ for i=1:length(CTRL)-1
|
||||
assert(abs(result{i}(1)-CTRL(i))<1e-4,['CTRLTest: DATA set unsucessful-',num2str(i)]);
|
||||
end
|
||||
|
||||
DREFS = {'sim/multiplayer/position/plane1_yolk_pitch',...
|
||||
'sim/multiplayer/position/plane1_yolk_roll',...
|
||||
'sim/multiplayer/position/plane1_yolk_yaw',...
|
||||
'sim/multiplayer/position/plane1_throttle',...
|
||||
'sim/multiplayer/position/plane1_gear_deploy',...
|
||||
'sim/multiplayer/position/plane1_flap_ratio'};
|
||||
THROT = rand();
|
||||
CTRL = [0.0, 0.0, 1.0, THROT, 0.0, 1.0];
|
||||
|
||||
sendCTRL(CTRL, 1);
|
||||
result = requestDREF(DREFS);
|
||||
|
||||
assert(isequal(length(result),6),'CTRLTest: requestDREF unsucessful-wrong number of elements returned');
|
||||
assert(isequal(length(result{4}),8),'CTRLTest: requestDREF unsucessful- element 1 incorrect size (should be size 8)');
|
||||
for i=1:length(CTRL)-1
|
||||
assert(abs(result{i}(1)-CTRL(i))<1e-4,['CTRLTest: DATA set unsucessful-',num2str(i)]);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user