-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKinegami_Catapult.m
128 lines (90 loc) · 2.9 KB
/
Kinegami_Catapult.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
% Catapult V1
% Last Edited 9/3/2021 by Lucien Peach
clear
close all
clc
% User Options - Change Prior to Running (if necessary)
% Determines whether the user wishes to use DH parameters ('false') or
% assign the Joint Parameters themselves ('true')
selfassign = 'true';
% Determines whether the user wishes to have elbow joints mirrored ('on')
% or appear normally ('off')
mirror = 'on';
% Determines whether the user wishes to print 3 iterations of the print
% pattern ('triple' - recommended) or 2 ('double')
triple = 'triple';
% Specify the angle modification utilized ([0, 0, 0, 0] recommended)
theta_mod = [0, 0, 0, 0];
% Specify the orientation of the fingertip: 'x', 'y', or 'z'
fingertip = 'x';
% Specify whether DXF generation and save file should occur ('on'/'off')
DXF = 'on';
% Specify whether elbow splitting should occur past pi/2 ('on'/'off')
split = 'on';
% Specify number of sides (polygon)
nsides = 4;
% Specify radius [m]
r = 0.05;
% Specify DH Parameters, if needed
D = [0, pi/2, 0, pi/2; ...
0, pi/2, 0, 0; ...
0.2, 0, 0, 0];
% Specify number of joints
n = 6;
if strcmp(selfassign, 'false') == 1
n = 3;
JointStruct(n) = struct();
for i = 1:n
JointStruct(i).qm = pi;
JointStruct(i).q0 = 0;
JointStruct(i).type = 'R';
end
JointStruct(1).q0 = pi/2;
JointStruct(1).type = 'F';
N = size(JointStruct, 2) - 1;
end
% If the selfassign tag is applied, provide Oc for each joint
% Make sure that Oc(:,4) are all not equal to 0 (x.xxx * 10^-25, etc., is
% acceptable)
if strcmp(selfassign, 'true') == 1
d = 0.1;
JointStruct(n) = struct();
for i = 1:n
JointStruct(i).qm = pi;
JointStruct(i).q0 = 0;
JointStruct(i).type = 'V';
end
JointStruct(5).type = 'R';
JointStruct(5).nz = 1;
JointStruct(6).type = 'F';
N = size(JointStruct, 2) - 1;
TransformStruct(N+1) = struct();
TransformStruct(1).Oc = [1, 0, 0, 0; ...
0, 0, -1, -d; ...
0, 1, 0, 0];
TransformStruct(2).Oc = [0, 0, 1, 2*d; ...
1, 0, 0, 0; ...
0, 1, 0, 0];
TransformStruct(3).Oc = [-1, 0, 0, 0; ...
0, 0, 1, d; ...
0, 1, 0, 0];
TransformStruct(4).Oc = [1, 0, 0, 0; ...
0, 0, -1, 0; ...
0, 1, 0, 0];
TransformStruct(5).Oc = [0, -1, 0, 0.5*d; ...
0, 0, -1, 0; ...
1, 0, 0, d];
TransformStruct(6).Oc = [1/sqrt(2), -1/sqrt(2), 0, 2*d; ...
0, 0, -1, 0; ...
1/sqrt(2), 1/sqrt(2), 0, 2.5*d];
% Here solely to not mess up Kinegami running
D = [0, pi/2, 0, pi/2; ...
0, pi/2, 0, 0; ...
0.2, 0, 0, 0];
else
% Otherwise, do nothing besides initialization
TransformStruct(N+1) = struct();
end
[infostruct, TransformStruct, DataNet] = Kinegami(D, r, nsides, JointStruct, ...
mirror, triple, theta_mod, fingertip, selfassign, TransformStruct, ...
DXF, split);