-
Notifications
You must be signed in to change notification settings - Fork 0
/
DriveUnderWater.m
56 lines (52 loc) · 1.8 KB
/
DriveUnderWater.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
%NOT TESTED
% DriveUnderWater(Robot,Propeller,Rudder,SternPlan,Normalized,Light)
% Drive MARINE Robot Uder Water
% Amirkabir University of Tehran (Tehran Polytechnic)
% Summer 2011
% http://www.mechatronics3d.com
function DriveUnderWater(Robot,Propeller,Rudder,SternPlan,Normalized,Light)
if nargin > 6
error('Too many input arguments');
elseif nargin < 1
error('Too few input arguments');
elseif nargin == 6
Normalized=CheckInput(Normalized);
Light=CheckInput(Light);
Msg=['DRIVE {Propeller ' num2str(Propeller) '} ' ...
'{Rudder ' num2str(Rudder) '} '...
'{SternPlane ' num2str(SternPlan) '} '...
'{Normalized ' Normalized '} '...
'{Light ' Light '}'];
elseif nargin == 5
Normalized=CheckInput(Normalized);
Msg=['DRIVE {Propeller ' num2str(Propeller) '} ' ...
'{Rudder ' num2str(Rudder) '} '...
'{SternPlane ' num2str(SternPlan) '} '...
'{Normalized ' Normalized '}'];
elseif nargin == 4
Msg=['DRIVE {Propeller ' num2str(Propeller) '} ' ...
'{Rudder ' num2str(Rudder) '} '...
'{SternPlane ' num2str(SternPlan) '}'];
elseif nargin == 3
Msg=['DRIVE {Propeller ' num2str(Propeller) '} ' ...
'{Rudder ' num2str(Rudder) '}'];
elseif nargin == 2
Msg=['DRIVE {Propeller ' num2str(Propeller) '}'];
elseif nargin == 1
Msg='DRIVE {Propeller 0}';
end
fprintf(Robot.Connection,Msg);
function Out=CheckInput(In,default)
if ischar(In)
if ~(strcmp(In,'True')||strcmp(In,'False'))
Out=default;
end
else
if In
Out='True';
else
Out='False';
end
end
end
end