-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdragon_claw.scad
231 lines (197 loc) · 7.09 KB
/
dragon_claw.scad
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
use <mg90s.scad>
use <printed_parts.scad>
use <forward_kinematics.scad>
use <scad-utils/transformations.scad>
use <scad-utils/spline.scad>
$fs=0.2;
$fa=1;
//number of claws
n_claws = 5;
// these arrays are exported via customizer, but they are silently converted to string.
// the xacro parser can't convert the string back into an array, do that manually.
// as of 2021, There are bugs in parsing nested lists in customizer, so editing the json does not allow the model to be altered
//positions and orientations of the knuckle motor bodies relative to the palm origin
knuckle_motor_pos = [
[[34.6192, -62.6912, 7.09054], [0, -65, 110]],
[[63.9572, 16.5083, 4.56162], [0, -75, 205]],
[[25.934, 51.3037, -4.75], [0, -90, 250]],
[[-25.5321, 50.1993, 3.18304], [0, -80, 290]],
[[-62.2403, 10.7078, 12.0905], [0, -65, 335]]
];
//range of the knuckle motors
knuckle_motor_range=[
[-30,30],
[-30,30],
[-30,30],
[-30,30],
[-30,30],
];
//positions and orientations of the finger motor axis relative to the respective knuckle motor shaft
finger_motor_pos = [
[[15,0,20],[90,130,0]],
[[10,0,26],[90,130,0]],
[[10,0,26],[90,130,0]],
[[10,0,26],[90,130,0]],
[[10,0,26],[90,130,0]],
];
//positions and orientations of the claw motor axis relative to the respective finger motor axis
claw_motor_pos = [
[[-43.25,10,0],[0,0,-50]],
[[-41.25,10,0],[0,0,-50]],
[[-45.25,10,0],[0,0,-50]],
[[-41.25,10,0],[0,0,-50]],
[[-37.25,10,0],[0,0,-50]],
];
//positions of the claw points relative to the claw motor axis
claw_point_pos = [
[[-47.25,10,0],[0,0,0]],
[[-55.25,10,0],[0,0,0]],
[[-60.25,10,0],[0,0,0]],
[[-55.25,10,0],[0,0,0]],
[[-50.25,10,0],[0,0,0]],
];
for(i=[0:n_claws-1]){
echo([0,0,0] +
translation(knuckle_motor_pos[i][0]) *
rotation(knuckle_motor_pos[i][1]) *
translation(-mg90s_body_center_pos()) *
[0,0,0,1]
);
}
module assembly(pose = [[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]]){
palm_part(knuckle_motor_pos,knuckle_motor_range);
for(i=[0:n_claws-1]){
translate(knuckle_motor_pos[i][0]) rotate(knuckle_motor_pos[i][1]){
// origin is knuckle motor origin
color("gray")mg90s(a=pose[i][0]); //knuckle motor
translate(mg90s_shaft_pos()) rotate(v=mg90s_shaft_axis(), a=pose[i][0]){
// origin is knuckle shaft
knuckle_bearing_pos(i, finger_motor_pos,knuckle_motor_range){
bearing();
tail_spacer();
}
knuckle_part(i, finger_motor_pos,knuckle_motor_range); // knuckle bracket
translate(finger_motor_pos[i][0]) rotate(finger_motor_pos[i][1]){
// origin is finger axis
rotate(v=-mg90s_shaft_axis(), a=pose[i][1]) {
// origin is finger origin
color("gray")translate([0,0,joint_int_width()/2]) translate(-mg90s_shaft_pos()) mg90s(a=pose[i][1]); //finger motor
finger_part(i, claw_motor_pos); //finger shroud
finger_bearing_pos(i, claw_motor_pos){
bearing();
tail_spacer();
}
translate(claw_motor_pos[i][0]) rotate(claw_motor_pos[i][1]){
// origin is claw shaft
rotate(v=-mg90s_shaft_axis(), a=pose[i][2]){
// origin is claw motor
color("gray")translate([0,0,joint_int_width()/2]) translate(-mg90s_shaft_pos()) mg90s(a=pose[i][2]); //claw motor
claw_part(i, claw_point_pos); //pointy bit
translate(claw_point_pos[i][0]) rotate(claw_point_pos[i][1]){
// the end of the kinematic chain
color("red") sphere(r=3);
}
}
}
}
}
}
}
}
}
module fk_native(
i,
pose
){
translate(knuckle_motor_pos[i][0])
rotate(knuckle_motor_pos[i][1])
translate(mg90s_shaft_pos())
rotate(v=mg90s_shaft_axis(), a=pose[0])
translate(finger_motor_pos[i][0])
rotate(finger_motor_pos[i][1])
rotate(v=-mg90s_shaft_axis(), a=pose[1])
translate(claw_motor_pos[i][0])
rotate(claw_motor_pos[i][1])
rotate(v=-mg90s_shaft_axis(), a=pose[2])
translate(claw_point_pos[i][0])
rotate(claw_point_pos[i][1])
children();
}
module fk_native_marker( i=0,
pose = [0,0,0]){
fk_native(
i,
pose
)sphere(d=5);
}
// describe the kinematic chain for each finger as 4x4 transformation matrices and rotation axis vectors for each motor
function claw_kinematic_chains() = [ for(i=[0:n_claws-1])
[
//links
[
translation(knuckle_motor_pos[i][0]) *
rotation(knuckle_motor_pos[i][1]),
//rotation with pose[0] gets inserted here
translation(finger_motor_pos[i][0])*
rotation(finger_motor_pos[i][1]),
//rotation with pose[1] gets inserted here
translation(claw_motor_pos[i][0]) *
rotation(claw_motor_pos[i][1]) ,
//rotation with pose[2] gets inserted here
translation(claw_point_pos[i][0]) *
rotation(claw_point_pos[i][1])
],
//axes
[
mg90s_shaft_axis(), //axis for pose[0]
-mg90s_shaft_axis(), //axis for pose[1]
-mg90s_shaft_axis(), //axis for pose[2]
]
]
];
//layout of components
module layout(){
palm_part(knuckle_motor_pos,knuckle_motor_range);
for(i=[0:n_claws-1]) translate([-100, 50 *i,0]) {
knuckle_part(i, finger_motor_pos,knuckle_motor_range);
//%translate(-mg90s_shaft_pos())mg90s();
}
for(i=[0:n_claws-1]) translate([-150, 50 *i,finger_tail_bolt_len()/2]){
finger_part(i, claw_motor_pos);
//%mg90s();
}
for(i=[0:n_claws-1]) translate([-250, 50 *i,finger_tail_bolt_len()/2]){
claw_part(i, claw_point_pos);
//%mg90s();
}
}
//render()layout();
assembly([[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]]);
//mg90s();
//mg90s_wire_channel();
//palm_part(knuckle_motor_pos,knuckle_motor_range);
i=0;
//knuckle_part(i, finger_motor_pos,knuckle_motor_range);
//finger_part(i, claw_motor_pos);
//claw_part(i, claw_point_pos);
//tail_spacer();
//check for collisions
/*
intersection(){
i=1;
pose = [[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]];
//finger_part(i, claw_motor_pos); //finger shroud
finger_bearing_pos(i, claw_motor_pos){
//bearing();
tail_spacer();
}
translate(claw_motor_pos[i][0]) rotate(claw_motor_pos[i][1]){
// origin is claw shaft
rotate(v=-mg90s_shaft_axis(), a=pose[i][2]) translate(-mg90s_shaft_pos()) {
// origin is claw motor
//color("gray")mg90s(a=pose[i][2]); //claw motor
claw_part(i, claw_point_pos); //pointy bit
}
}
}
*/