-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInitialization.m
336 lines (288 loc) · 11.9 KB
/
Initialization.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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
function Initialization
global robot obstacles;
eval(['InitRobot_',num2str(robot.dim),num2str(robot.model)]);
eval(['InitObs_',num2str(robot.dim),num2str(robot.model),num2str(obstacles.model),num2str(obstacles.type)]);
function InitRobot_21()
% Two-segment planar robotic manipulator
robot.N_DOF = 2; % Number of robot degrees of freedom
robot.N_links = 2; % Number of robot links
robot.DH_table = [ % DH table: d, a, alpha
0 1 0
0 1 0];
robot.offsets = [0; 0]; % Offset of angle theta
robot.range = [-pi, pi; -pi, pi]; % Range/limit for each joint
robot.radii = [0; 0]; % Radii of all enclosing cylinder
robot.weights = [2; 1]; % Weights in criterial function for optimal planning
end
function InitRobot_22()
% Four-segment planar robotic manipulator
robot.N_DOF = 4; % Number of robot degrees of freedom
robot.N_links = 4; % Number of robot links
robot.DH_table = [ % DH table: d, a, alpha
0 1 0
0 1 0
0 1 0
0 1 0];
robot.offsets = [0; 0; 0; 0]; % Offsets of angle theta
robot.range = [-pi*ones(robot.N_DOF,1), pi*ones(robot.N_DOF,1)]; % Range for each segment
robot.radii = [0; 0; 0; 0]; % Radii of all enclosing cylinder
robot.weights = [4; 3; 2; 1]; % Weights in criterial function for optimal planning
end
function InitRobot_23()
% Ten-segment planar robotic manipulator
robot.N_DOF = 10;
robot.N_links = 10;
robot.DH_table = [zeros(robot.N_DOF,1), ones(robot.N_DOF,1), zeros(robot.N_DOF,1)];
robot.offsets = zeros(robot.N_DOF,1);
robot.range = [-pi*ones(robot.N_DOF,1), pi*ones(robot.N_DOF,1)];
robot.radii = zeros(robot.N_DOF,1);
robot.weights = [robot.N_links:-1:1]';
end
function InitRobot_31()
% Anthropomorphic arm with spherical wrist
robot.DH_table = [ % d, a, alpha
1 0 pi/2
0 1 0
0 0 pi/2
1 0 -pi/2
0 0 pi/2
1 0 0];
robot.offsets = zeros(6,1);
robot.N_DOF = 6; % Number of robot degrees of freedom
robot.N_links = 4; % Number of robot links
robot.range = [-pi*ones(robot.N_DOF,1), pi*ones(robot.N_DOF,1)];
robot.radii = zeros(4,1);
end
function InitRobot_32()
% xArm6
robot.DH_table = [ % d, a, alpha
0.2670 0 -pi/2
0 0.2895 0
0 0.0775 -pi/2
0.3425 0 pi/2
0 0.0760 -pi/2
0.0970 0 0];
robot.offsets = [0; -1.3849179; 1.3849179; 0; 0; 0];
robot.N_DOF = 6; % Number of robot degrees of freedom
robot.N_links = 6; % Number of robot links
robot.range = [-pi*ones(robot.N_DOF,1), pi*ones(robot.N_DOF,1)];
robot.radii = [0.1552; 0.1881; 0.1623; 0.1623; 0.106; 0.076]/2; % Radii of all enclosing cylinders
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function InitObs_2111()
obstacles.loc = [1.5 0.7 0 0.4]'; % [x_c y_c z_c r]
robot.q_init = [-2;-2.5];
robot.q_goal = [2; 2.5];
end
function InitObs_2112()
obstacles.loc = [1.5 0.7 0 0.4; 1.5 -0.7 0 0.4]';
robot.q_init = [-2;-2.5];
robot.q_goal = [2; 2.5];
end
function InitObs_2113()
obstacles.loc = [1.5 0.7 0 0.4; 1.5 -0.7 0 0.4; -1.5 -0.7 0 0.4; -1.5 0.7 0 0.4]';
robot.q_init = [-2;-2.5];
robot.q_goal = [2; 2.5];
end
function InitObs_2114()
obstacles.loc = [1.5 0.7 0 0.4; 1.5 -0.7 0 0.4; -1.5 -0.7 0 0.4; -1.5 0.7 0 0.4;
0.6 1.5 0 0.4; 0.6 -1.5 0 0.4; -0.6 1.5 0 0.4; -0.6 -1.5 0 0.4]';
robot.q_init = [-2;-2.5];
robot.q_goal = [2; 2.5];
end
function InitObs_2115()
obstacles.loc= [0.65 0.7 0 0.2; -0.65 0.7 0 0.2; 0.65 1.3 0 0.1; -0.65 1.3 0 0.1]';
robot.q_init = [1.8; 1.25];
robot.q_goal = [pi-1.8; -1.25];
end
function InitObs_2116()
obstacles.loc = [-3 0 0 1; 8 8 0 3; 7 -7 0 2; -7 -8 0 2]';
robot.q_init = [-2;-2.5];
robot.q_goal = [2; 2.5];
end
function InitObs_2117()
B = 5; r = rand(B,1)*sum(L)./(sum(L)+0.5)+0.5; fi = rand(B,1)*2*pi;
obstacles.loc = [r.*cos(fi), r.*sin(fi), rand(B,1)*0.2+0.1]';
robot.q_init = [-2;-2.5];
robot.q_goal = [2; 2.5];
end
function InitObs_2121()
obstacles.loc = [1 0.5 0 1.5 1 0]'; % [x_min y_min z_min x_max y_max z_max]
robot.q_init = [-2;-2.5];
robot.q_goal = [2; 2.5];
end
function InitObs_2122()
obstacles.loc = [1 0.5 0 1.5 1 0; 1 -1 0 1.5 -0.5 0]';
robot.q_init = [-2;-2.5];
robot.q_goal = [2; 2.5];
end
function InitObs_2123()
obstacles.loc = [1 0.5 0 1.5 1 0; 1 -1 0 1.5 -0.5 0; -1.5 0.5 0 -1 1 0; -1.5 -1 0 -1 -0.5 0]';
robot.q_init = [-2;-2.5];
robot.q_goal = [2; 2.5];
end
function InitObs_2124()
obstacles.loc = [];
dim= [0.5, 0.5, 0];
trans= [1.5, 0.7, 0];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.5, 0.5, 0];
trans= [1.5, -0.7, 0];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.5, 0.5, 0];
trans= [-1.5, -0.7, 0];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.5, 0.5, 0];
trans= [-1.5, 0.7, 0];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.5, 0.5, 0];
trans= [0.6, 1.5, 0];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.5, 0.5, 0];
trans= [0.6, -1.5, 0];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.5, 0.5, 0];
trans= [-0.6, 1.5, 0];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.5, 0.5, 0];
trans= [-0.6, -1.5, 0];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
robot.q_init = [-2; -2.5];
robot.q_goal = [2; 2.5];
end
function InitObs_2125()
obstacles.loc = [];
dim= [0.3, 0.3, 0];
trans= [0.65, 0.7, 0];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.3, 0.3, 0];
trans= [-0.65, 0.7, 0];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.1, 0.1, 0];
trans= [0.65, 1.3, 0];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.1, 0.1, 0];
trans= [-0.65, 1.3, 0];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
robot.q_init = [1.8; 1.25];
robot.q_goal = [pi-1.8; -1.25];
end
function InitObs_2221()
obstacles.loc = [-1.2 0.5 0 -0.8 2 0; -1.2 -2 0 -0.8 -0.5 0; -2.5 1.5 0 -1.2 2 0;
-2.5 -2 0 -1.2 -1.5 0; -4 -2 0 -2.5 2 0]'; % [x_min y_min z_min x_max y_max z_max]
robot.q_init = [-2;-2.5; pi/2; pi/2];
robot.q_goal = [2; 2.5; -pi/2; -pi/2];
end
function InitObs_2321()
obstacles.loc = [
-2 4 0 -1 6 0; -2 -6 0 -1 -4 0;
-8 5 0 -2 6 0; -8 -6 0 -2 -5 0; -8 -6 0 -7 6 0]';
robot.q_init = [-0.99*pi; linspace(pi/12,0.5,4)'; -linspace(pi/12,1.5,5)'];
robot.q_goal = [0.99*pi; -linspace(pi/12,0.5,4)'; linspace(pi/12,1.5,5)'];
end
function InitObs_3111()
obstacles.loc = [1.5 0.7 1 0.5]';
robot.q_init = [-2*pi/3; -2*pi/3; pi/2; 0; 0; 0];
robot.q_goal = [pi/3; 2*pi/3; pi/2; 0; 0; 0];
end
function InitObs_3112()
obstacles.loc = [1.5 0.7 1 0.5; -1.5 0.7 1 0.5]';
robot.q_init = [-2*pi/3; -2*pi/3; pi/2; 0; pi; 0];
robot.q_goal = [pi/3; 2*pi/3; pi/2; 0; pi; 0];
end
function InitObs_3113()
obstacles.loc = [-3 0 0 0.5; 2 2 2 0.5; 2 -2 1 1; -1 -2 2 0.5]';
robot.q_init = [-pi/2; pi/6; pi/4; 0; 5*pi/4; 0];
robot.q_goal = [pi/2; pi/6; pi/4; 0; 5*pi/4; 0];
end
function InitObs_3114()
obstacles.loc = [1.5 0.7 0 0.4; 1.5 -0.7 0 0.4; -1.5 -0.7 0 0.4; -1.5 0.7 0 0.4; 0.6 1.5 0 0.4;
-0.6 1.5 0 0.4; 0.6 -1.5 0 0.4; -0.6 -1.5 0 0.4]';
robot.q_init = [-2*pi/3; -2*pi/3; pi/2; 0; pi; 0];
robot.q_goal = [pi/3; 2*pi/3; pi/2; 0; pi; 0];
end
function InitObs_3121()
obstacles.loc = [1 1 0, 2 2 2; 1 -2 0, 2 -1 2; -2 1 0, -1 2 2; -2 -2 0, -1 -1 2]';
robot.q_init = [-2*pi/3; -2*pi/3; pi/2; 0; 0; 0];
robot.q_goal = [pi/3; 2*pi/3; pi/2; 0; 0; 0];
end
function InitObs_3122()
obstacles.loc = [-2 2 -2, 2 4 0; -2 -4 2, 2 -2 4]';
robot.q_init = [-2*pi/3; -2*pi/3; pi/2; 0; pi; 0];
robot.q_goal = [pi/3; 2*pi/3; pi/2; 0; pi; 0];
end
function InitObs_3123()
obstacles.loc = [-1 0.5 0.5, 1 1 1.5; 0.5 -1 0.5, 1 1 1.5; -1 -1 0.5, 1 -0.5 1.5; -1 -1 0.5, -0.5 1 1.5]';
robot.q_init = [-2*pi/3; -2*pi/3; pi/2; 0; pi; 0];
robot.q_goal = [pi/3; 2*pi/3; pi/2; 0; pi; 0];
end
function InitObs_3124()
obstacles.loc = [-1 0.5 0.5, 1 1 1.5; 0.5 -1 0.5, 1 1 1.5; -1 -1 0.5, 1 -0.5 1.5; -1 -1 0.5, -0.5 1 1.5;
-3 -3 3, -1 -1 3.1; -3 -3 -1.1, -1 -1 -1]';
robot.q_init = [-2*pi/3; -2*pi/3; pi/2; 0; pi; 0];
robot.q_goal = [pi/3; 2*pi/3; pi/2; 0; pi; 0];
end
function InitObs_3125()
obstacles.loc = [-1 1 0.5, -0.5 4 2.5; 0.5 1 0.5, 1 4 2.5; -0.5 1 2, 0.5 4 2.5; -0.5 1 0.5, 0.5 4 1;
-1 -4 0.5, -0.5 -2 2.5; 0.5 -4 0.5, 1 -2 2.5; -0.5 -4 2, 0.5 -2 2.5; -0.5 -4 0.5, 0.5 -2 1]';
robot.q_init = [-pi/2; pi/6; pi/3; 0; pi; 0];
robot.q_goal = [pi/2; pi/6; pi/3; 0; pi; 0];
end
function InitObs_3211()
obstacles.loc = [1.5 0.7 1 0.5]';
robot.q_init = [-2*pi/3; -2*pi/3; pi/2; 0; 0; 0];
robot.q_goal = [pi/3; 2*pi/3; pi/2; 0; 0; 0];
end
function InitObs_3221()
obstacles.loc = [0.3 0.3 0, 0.8 0.8 1; 0.3 -0.8 0, 0.8 -0.3 1; -0.8 0.3 0, -0.3 0.8 1; -0.8 -0.8 0, -0.3 -0.3 1]';
robot.q_init = [pi/2; pi/2; -3*pi/4; 0; 0; 0];
robot.q_goal = [-pi/2; 0; -3*pi/4; 0; 0; 0];
end
function InitObs_3222()
obstacles.loc = [-0.5 0 -0.5, 0.5 1 0.5; -0.5 -1 0, 0.5 0 1]';
robot.q_init = [pi/2; pi/2; -3*pi/4; 0; 0; 0];
robot.q_goal = [-pi/2; 0; -3*pi/4; 0; 0; 0];
end
function InitObs_3223()
obstacles.loc = [-1 0.5 0.5, 1 1 1.5; 0.5 -1 0.5, 1 1 1.5; -1 -1 0.5, 1 -0.5 1.5; -1 -1 0.5, -0.5 1 1.5]';
robot.q_init = [-2*pi/3; -2*pi/3; pi/2; 0; pi; 0];
robot.q_goal = [pi/3; 2*pi/3; pi/2; 0; pi; 0];
end
function InitObs_3224()
obstacles.loc = [-1 0.5 0.5, 1 1 1.5; 0.5 -1 0.5, 1 1 1.5; -1 -1 0.5, 1 -0.5 1.5; -1 -1 0.5, -0.5 1 1.5;
-3 -3 3, -1 -1 3.1; -3 -3 -1.1, -1 -1 -1]';
robot.q_init = [-2*pi/3; -2*pi/3; pi/2; 0; pi; 0];
robot.q_goal = [pi/3; 2*pi/3; pi/2; 0; pi; 0];
end
function InitObs_3225()
% obstacles.loc = [-0.35 0.5 0, -0.25 1 0.7; 0.25 0.5 0, 0.35 1 0.7; -0.25 0.5 0.6, 0.25 1 0.7; -0.25 0.5 0, 0.25 1 0.1;
% -0.35 -1 0, -0.25 -0.6 0.7; 0.25 -1 0, 0.35 -0.6 0.7; -0.25 -1 0.6, 0.25 -0.6 0.7; -0.25 -1 0, 0.25 -0.6 0.1]';
robot.q_init = [pi/2; pi/2-0.1859; pi+0.1859; pi/2; 0; 0];
robot.q_goal = [-pi/2; pi/2-0.1859; pi+0.1859; pi/2; 0; 0];
obstacles.loc = [];
dim= [0.1, 0.5, 0.7];
trans= [-0.3, 0.75, 0.35];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.1, 0.5, 0.7];
trans= [0.3, 0.75, 0.35];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.5, 0.5, 0.1];
trans= [0, 0.75, 0.65];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.5, 0.5, 0.1];
trans= [0, 0.75, 0.05];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.1, 0.4, 0.7];
trans= [-0.3, -0.8, 0.35];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.1, 0.4, 0.7];
trans= [0.3, -0.8, 0.35];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.5, 0.4, 0.1];
trans= [0, -0.8, 0.65];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
dim= [0.5, 0.4, 0.1];
trans= [0, -0.8, 0.05];
obstacles.loc = [obstacles.loc, [trans-dim/2, trans+dim/2]'];
end
end