-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDriveAerial.m
84 lines (80 loc) · 2.47 KB
/
DriveAerial.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
% DriveOmniWheel(Robot,Wheels,Speeds,Steers)
% Drive Robots like Lisa!
% Amirkabir University of Tehran (Tehran Polytechnic)
% Summer 2011
% http://www.mechatronics3d.com
function DriveAerial(Robot,Altitude,Linear,Lateral,Rotational,Normalized)
if nargin > 6
error('Too many input arguments');
elseif nargin < 2
error('Too few input arguments');
elseif nargin == 6
Msg='DRIVE';
if ~ischar(Altitude)
Msg=[Msg ' {AltitudeVelocity ' num2str(Altitude) '}'];
end
if ~ischar(Linear)
Msg=[Msg ' {LinearVelocity ' num2str(Linear) '}'];
end
if ~ischar(Lateral)
Msg=[Msg ' {LateralVelocity ' num2str(Lateral) '}'];
end
if ~ischar(Rotational)
Msg=[Msg ' {RotationalVelocity ' num2str(Rotational) '}'];
end
Normalized=CheckInput(Normalized);
Msg=[Msg ' {Normalized ' Normalized '}'];
elseif nargin == 5
Msg='DRIVE';
if ~ischar(Altitude)
Msg=[Msg ' {AltitudeVelocity ' num2str(Altitude) '}'];
end
if ~ischar(Linear)
Msg=[Msg ' {LinearVelocity ' num2str(Linear) '}'];
end
if ~ischar(Lateral)
Msg=[Msg ' {LateralVelocity ' num2str(Lateral) '}'];
end
if ~ischar(Rotational)
Msg=[Msg ' {RotationalVelocity ' num2str(Rotational) '}'];
end
elseif nargin == 4
Msg='DRIVE';
if ~ischar(Altitude)
Msg=[Msg ' {AltitudeVelocity ' num2str(Altitude) '}'];
end
if ~ischar(Linear)
Msg=[Msg ' {LinearVelocity ' num2str(Linear) '}'];
end
if ~ischar(Lateral)
Msg=[Msg ' {LateralVelocity ' num2str(Lateral) '}'];
end
elseif nargin == 3
Msg='DRIVE';
if ~ischar(Altitude)
Msg=[Msg ' {AltitudeVelocity ' num2str(Altitude) '}'];
end
if ~ischar(Linear)
Msg=[Msg ' {LinearVelocity ' num2str(Linear) '}'];
end
elseif nargin == 2
Msg='DRIVE';
if ~ischar(Altitude)
Msg=[Msg ' {AltitudeVelocity ' num2str(Altitude) '}'];
end
end
fprintf(Robot.Connection,Msg);
function Out=CheckInput(In)
if ischar(In)
if ~(strcmp(In,'True')||strcmp(In,'False'))
Out='False';
end
else
if In
Out='True';
else
Out='False';
end
end
end
end