-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflyeye.scad
291 lines (249 loc) · 7.79 KB
/
flyeye.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
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
make_odm360("bottom");
module bottom_lens(){
translate([0,0,33]){
rotate([90,0,0]){
union(){
// Lens
translate([0,0,0]){
rotate([90,0,0])
{cylinder(r=22.8832/2, h=40);}
}
// Cone of lens view
translate([0,-22,0]){
rotate([90,0,0])
{cylinder(r1=0, r2=45.568/2*2, h=19.727*2);}
}
}
}
}
}
module make_odm360(type="top"){
if(type=="top") {
camera_base_top();
}
else if(type=="bottom"){
camera_base_bottom();
}
else if(type=="nut"){
nut_whole();
}
}
// Define dimensions. All in mm
num_cams = 8;
edge_thickness = 4; // Thickness of the raised edge where the holes are
edge_width_from_hole = 7; // Width of the edge, material on each side of the hole
hole_diameter = 6; // bolt hole diameter
bolthead_d = 12; // bolt head countersink diameter
bolthead_h = 2; // bolt head height (for countersink depth)
radius_to_hole = 50; // Distance from center to the center of the mounting holes
downangle = 45; // Angle in degrees cameras face downward
cord_hole_length = 20;
cord_hole_width = 10;
cord_hole_offset = 20;
// Alignment indent in edge
// picam base width is 13.5
picam_base_width = 14.1375;
// picam base thickness is 11.5, optimum size is
// 12.1375, but we want to give a little space for
// bad drilling and it's better to index against
// the side
picam_base_thickness = 12.2;
indent_depth = 2;
offset_of_hole = 0; // If the mounting bolt hole isn't centered you can adjust it
// Don't touch
rotate_angle = 360/num_cams;
module picam(){
translate([14.5,17,8.15]){
rotate([0, 0, 90 ]){
import("raspicam.stl", convexity=10);
}
}
}
module lenswcone() {
translate([14.5,17,5.15]){
rotate([0, 0, 90 ]){
union(){
// Lens
translate([0,0,33]){
rotate([90,0,0])
{cylinder(r=22.8832/2, h=40);}
}
// Cone of lens view
translate([0,-22,33]){
rotate([90,0,0])
{cylinder(r1=0, r2=45.568/2*2, h=19.727*2);}
}
}
}
}
}
module lens() {
translate([14.5,17,5.15]){
rotate([0, 0, 90 ]){
union(){
// Lens
translate([0,0,33]){
rotate([90,0,0])
{cylinder(r=22.8832/2, h=36);}
}
}
}
}
}
// Holy Cameras Batman
// Camera lens loop
module camera_lenses() {
for (cam = [1 : num_cams]){
rotate([0,0,cam * rotate_angle + (360/num_cams)]){
translate([radius_to_hole, -picam_base_width/2, edge_thickness - indent_depth]){
rotate([0, downangle, rotate_angle ]){
union(){
translate([-picam_base_thickness / 2, -picam_base_width / 2, 0]){
//picam();
lens();
}
}
}
}
}
}
}
module picams() {
for (cam = [1 : num_cams]){
rotate([0,0,cam * rotate_angle + (360/num_cams)]){
translate([radius_to_hole, -picam_base_width/2, edge_thickness - indent_depth]){
rotate([0, downangle, rotate_angle ]){
union(){
translate([-picam_base_thickness / 2, -picam_base_width / 2, 0]){
picam();
lens();
}
}
}
}
}
}
}
module camera_holeswcone() {
for (cam = [1 : num_cams]){
rotate([0,0,cam * rotate_angle + (360/num_cams)]){
translate([radius_to_hole, -picam_base_width/2, edge_thickness - indent_depth]){
rotate([0, downangle, rotate_angle ]){
union(){
translate([-picam_base_thickness / 2, -picam_base_width / 2, 0]){
//picam();
lenswcone();
}
}
}
}
}
}
}
num_sides = 36;
rotate_angle_sides = 360/num_sides;
// Camera Base
module camera_base() {
mirror([0,1,0]){
difference(){
minkowski(){
hull(){
for (cam = [1 : num_cams]){
rotate([0,0,cam * rotate_angle + (360/num_cams)]){
translate([radius_to_hole, -picam_base_width/2, edge_thickness - indent_depth]){
rotate([0, downangle, -rotate_angle]){
translate([-picam_base_thickness / 2, -picam_base_width / 2, 0]){
cube([picam_base_thickness, picam_base_width, indent_depth]);
}
}
}
}
}
}
sphere(3, $fn=36);
}
// Camera mount holes loop
camera_mount_holes();
}
}
}
module camera_mount_holes(){
for (cam = [1 : num_cams]){
rotate([0,0,cam * rotate_angle + (360/num_cams)]){
translate([radius_to_hole, -picam_base_width/2, edge_thickness - indent_depth]){
rotate([0, downangle, -rotate_angle]){
union(){
translate([-picam_base_thickness / 2, -picam_base_width / 2, 0]){
cube([picam_base_thickness, picam_base_width, indent_depth + 10]);
}
translate([0, 0, -(bolthead_h * 2 + 10)]){
cylinder(r = hole_diameter / 2, h = edge_thickness * 3 + 10, $fn = 64);
cylinder(r = bolthead_d / 2 + 0.1, h = bolthead_h + 10, $fn = 64);
}
}
}
}
}
}
}
module camera_hull() {
hull(){
camera_lenses();
camera_base();
translate([0,0,90]){
rotate([0,180,45]){
//mirror([0,1,0]){
//union(){
camera_base();
camera_lenses();
//picams();
//camera_base();
//}
//}
}
}
}
}
module cover() {
difference(){
translate([0,0,90]){
rotate([0,180,45]){
difference() {
minkowski() {
camera_hull();
sphere(2, $fn=36);
}
camera_hull();
cube([1000,1000,60],center=true);
translate([0,0,90]){
rotate([0,180,45]){
mirror([0,1,0]){
camera_base();
mirror([0,1,0]){camera_holeswcone();}
//camera_base();
//}
}
}
}
mirror([0,1,0]){
camera_holeswcone();
}
}
}
}
mirror([0,1,0]){camera_mount_holes();}
}
}
module camera_base_bottom() {
difference() {
union(){
//central_post();
translate([0,0,-6]){
camera_base();
}
cover();
cylinder(r=20, h=32, $fn = 48);
}
bottom_lens();
}
}