-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharmSimGUI.m
230 lines (155 loc) · 8.51 KB
/
armSimGUI.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
classdef armSimGUI < matlab.apps.AppBase
properties (Access = public)
UIFigure matlab.ui.Figure
LogsTextArea matlab.ui.control.TextArea
LogsTextAreaLabel matlab.ui.control.Label
StateLamp matlab.ui.control.Lamp
StateLampLabel matlab.ui.control.Label
Switch matlab.ui.control.Switch
SimulateButton matlab.ui.control.Button
SimulationConfigurationPanel matlab.ui.container.Panel
NumofSampleEditField matlab.ui.control.NumericEditField
NumofSampleEditFieldLabel matlab.ui.control.Label
CircleConfigurationPanel matlab.ui.container.Panel
CircleradiusEditField matlab.ui.control.NumericEditField
CircleradiusEditFieldLabel matlab.ui.control.Label
CircleCenterxEditField matlab.ui.control.NumericEditField
CircleCenterxEditFieldLabel matlab.ui.control.Label
CircleCenteryEditField matlab.ui.control.NumericEditField
CircleCenteryEditFieldLabel matlab.ui.control.Label
ArmConfigurationPanel matlab.ui.container.Panel
Link2lengthEditField matlab.ui.control.NumericEditField
Link2lengthEditFieldLabel matlab.ui.control.Label
Link1lengthEditField matlab.ui.control.NumericEditField
Link1lengthEditFieldLabel matlab.ui.control.Label
UIAxesTheta2 matlab.ui.control.UIAxes
UIAxesTheta1 matlab.ui.control.UIAxes
UIAxes matlab.ui.control.UIAxes
end
methods (Access = private)
function SimulateButtonPushed(app, event)
armSim(app, event);
end
end
methods (Access = private)
function createComponents(app)
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [100 100 1103 562];
app.UIFigure.Name = 'MATLAB App';
app.UIAxes = uiaxes(app.UIFigure);
title(app.UIAxes, '2 DOF arm Simulation')
xlabel(app.UIAxes, 'X')
ylabel(app.UIAxes, 'Y')
zlabel(app.UIAxes, 'Z')
app.UIAxes.XGrid = 'on';
app.UIAxes.YGrid = 'on';
app.UIAxes.Box = 'on';
app.UIAxes.Position = [269 104 444 431];
app.UIAxesTheta1 = uiaxes(app.UIFigure);
title(app.UIAxesTheta1, 'Theta 1 vs Time')
xlabel(app.UIAxesTheta1, 'Time')
ylabel(app.UIAxesTheta1, 'rad')
zlabel(app.UIAxesTheta1, 'Z')
app.UIAxesTheta1.XGrid = 'on';
app.UIAxesTheta1.YGrid = 'on';
app.UIAxesTheta1.Position = [751 325 323 210];
app.UIAxesTheta2 = uiaxes(app.UIFigure);
title(app.UIAxesTheta2, 'Theta 2 vs Time')
xlabel(app.UIAxesTheta2, 'Time')
ylabel(app.UIAxesTheta2, 'rad')
zlabel(app.UIAxesTheta2, 'Z')
app.UIAxesTheta2.XGrid = 'on';
app.UIAxesTheta2.YGrid = 'on';
app.UIAxesTheta2.Position = [750 104 324 202];
app.ArmConfigurationPanel = uipanel(app.UIFigure);
app.ArmConfigurationPanel.Title = 'Arm Configuration';
app.ArmConfigurationPanel.Position = [37 409 185 118];
app.Link1lengthEditFieldLabel = uilabel(app.ArmConfigurationPanel);
app.Link1lengthEditFieldLabel.HorizontalAlignment = 'right';
app.Link1lengthEditFieldLabel.Position = [15 54 73 22];
app.Link1lengthEditFieldLabel.Text = 'Link 1 length';
app.Link1lengthEditField = uieditfield(app.ArmConfigurationPanel, 'numeric');
app.Link1lengthEditField.Limits = [0 Inf];
app.Link1lengthEditField.Position = [102 54 68 22];
app.Link1lengthEditField.Value = 3;
app.Link2lengthEditFieldLabel = uilabel(app.ArmConfigurationPanel);
app.Link2lengthEditFieldLabel.HorizontalAlignment = 'right';
app.Link2lengthEditFieldLabel.Position = [15 13 73 22];
app.Link2lengthEditFieldLabel.Text = 'Link 2 length';
app.Link2lengthEditField = uieditfield(app.ArmConfigurationPanel, 'numeric');
app.Link2lengthEditField.Limits = [0 Inf];
app.Link2lengthEditField.Position = [102 13 68 22];
app.Link2lengthEditField.Value = 4;
app.CircleConfigurationPanel = uipanel(app.UIFigure);
app.CircleConfigurationPanel.Title = 'Circle Configuration';
app.CircleConfigurationPanel.Position = [37 226 185 163];
app.CircleCenteryEditFieldLabel = uilabel(app.CircleConfigurationPanel);
app.CircleCenteryEditFieldLabel.HorizontalAlignment = 'right';
app.CircleCenteryEditFieldLabel.Position = [10 58 84 22];
app.CircleCenteryEditFieldLabel.Text = 'Circle Center y';
app.CircleCenteryEditField = uieditfield(app.CircleConfigurationPanel, 'numeric');
app.CircleCenteryEditField.Limits = [0 Inf];
app.CircleCenteryEditField.Position = [108 58 68 22];
app.CircleCenteryEditField.Value = 2;
app.CircleCenterxEditFieldLabel = uilabel(app.CircleConfigurationPanel);
app.CircleCenterxEditFieldLabel.HorizontalAlignment = 'right';
app.CircleCenterxEditFieldLabel.Position = [10 99 84 22];
app.CircleCenterxEditFieldLabel.Text = 'Circle Center x';
app.CircleCenterxEditField = uieditfield(app.CircleConfigurationPanel, 'numeric');
app.CircleCenterxEditField.Limits = [0 Inf];
app.CircleCenterxEditField.Position = [108 99 68 22];
app.CircleCenterxEditField.Value = 3;
app.CircleradiusEditFieldLabel = uilabel(app.CircleConfigurationPanel);
app.CircleradiusEditFieldLabel.HorizontalAlignment = 'right';
app.CircleradiusEditFieldLabel.Position = [16 18 72 22];
app.CircleradiusEditFieldLabel.Text = 'Circle radius';
app.CircleradiusEditField = uieditfield(app.CircleConfigurationPanel, 'numeric');
app.CircleradiusEditField.Limits = [0 Inf];
app.CircleradiusEditField.Position = [108 18 68 22];
app.CircleradiusEditField.Value = 2;
app.SimulationConfigurationPanel = uipanel(app.UIFigure);
app.SimulationConfigurationPanel.Title = 'Simulation Configuration';
app.SimulationConfigurationPanel.Position = [38 122 185 80];
app.NumofSampleEditFieldLabel = uilabel(app.SimulationConfigurationPanel);
app.NumofSampleEditFieldLabel.HorizontalAlignment = 'right';
app.NumofSampleEditFieldLabel.Position = [4 16 88 22];
app.NumofSampleEditFieldLabel.Text = 'Num of Sample';
app.NumofSampleEditField = uieditfield(app.SimulationConfigurationPanel, 'numeric');
app.NumofSampleEditField.Limits = [0 Inf];
app.NumofSampleEditField.Position = [106 16 68 22];
app.NumofSampleEditField.Value = 99;
app.SimulateButton = uibutton(app.UIFigure, 'push');
app.SimulateButton.ButtonPushedFcn = createCallbackFcn(app, @SimulateButtonPushed, true);
app.SimulateButton.Position = [41 45 100 23];
app.SimulateButton.Text = 'Simulate';
app.Switch = uiswitch(app.UIFigure, 'slider');
app.Switch.Position = [173 47 40 18];
app.StateLampLabel = uilabel(app.UIFigure);
app.StateLampLabel.HorizontalAlignment = 'right';
app.StateLampLabel.Position = [305 45 33 22];
app.StateLampLabel.Text = 'State';
app.StateLamp = uilamp(app.UIFigure);
app.StateLamp.Position = [353 45 20 20];
app.StateLamp.Color = [1 1 0];
app.LogsTextAreaLabel = uilabel(app.UIFigure);
app.LogsTextAreaLabel.HorizontalAlignment = 'right';
app.LogsTextAreaLabel.Position = [412 62 31 22];
app.LogsTextAreaLabel.Text = 'Logs';
app.LogsTextArea = uitextarea(app.UIFigure);
app.LogsTextArea.Position = [458 26 215 60];
app.UIFigure.Visible = 'on';
end
end
methods (Access = public)
function app = armSimGUI
createComponents(app)
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
function delete(app)
delete(app.UIFigure)
end
end
end