dac38b58 |
1 | // challenge-bot |
2 | // GNU AGPLv3 (or later at your option) |
3 | // project available at these locations: |
4 | // https://gitorious.org/ozzloy/challenge-bot |
5 | // https://github.com/waynegramlich/challenge-bot |
6 | |
3d01ee80 |
7 | /* |
8 | this holds an hc-sr04 sonar sensor to a 3/16 inch deck. |
9 | http://fritzing.org/projects/hc-sr04-project |
10 | it can hold the sonar sensor either facing down, or forwards. |
11 | when facing down, it can detect if it passes over the edge of a table. |
12 | when facing forwards, it can detect and follow something in front of it. |
13 | */ |
14 | |
978bd219 |
15 | $fn = 60; |
16 | |
180a0f6f |
17 | include <sonar-table-top-holder-dimensions.scad> |
4390b08c |
18 | use <oshw.scad> |
19 | oshw_dy = 120.366; |
20 | oshw_dx = 133.888; |
21 | |
180a0f6f |
22 | module sonar_holder_2d() { |
23 | difference() { |
24 | square([sonar_holder_length, sonar_holder_width]); } } |
74f8c088 |
25 | |
8b84f6f3 |
26 | module sonars(){ |
27 | translate([between_sonar_centers / 2, 0, 0]){ |
28 | cylinder(r = sonar_radius, h = sonar_height);} |
29 | // for the variance with which the physical sonar cylinders are placed |
30 | translate([between_sonar_centers / 2 - between_sonar_centers_variance, 0, 0]){ |
31 | cylinder(r = sonar_radius, h = sonar_height); |
32 | translate([0, -sonar_radius, 0]){ |
33 | cube([between_sonar_centers_variance, sonar_diameter, sonar_height]);}} |
34 | translate([-between_sonar_centers / 2, 0, 0]){ |
35 | cylinder(r = sonar_radius, h = sonar_height);}} |
74f8c088 |
36 | |
8b84f6f3 |
37 | module sonar_holder(){ |
34e9f480 |
38 | elbow_length = deck_depth - 0.5; |
7888bdfb |
39 | rounded_corner_radius = buffer; |
49bffb72 |
40 | difference(){ |
41 | cube([sonar_holder_length, sonar_holder_width, sonar_holder_depth]); |
42 | translate([sonar_holder_length / 2, sonar_holder_width / 2, -0.05]){ |
7888bdfb |
43 | sonars();} |
180a0f6f |
44 | translate([sonar_holder_length, |
45 | sonar_holder_width, |
7888bdfb |
46 | 0]){ |
180a0f6f |
47 | corner_rounder(rounded_corner_radius, |
48 | sonar_holder_depth, |
49 | "bottom-right");}} |
8b84f6f3 |
50 | translate([sonar_holder_length, 0, 0]){ |
34e9f480 |
51 | cube([elbow_length, deck_depth, sonar_holder_depth]); |
8b84f6f3 |
52 | translate([elbow_length, 0, 0]){ |
53 | linear_extrude(height = sonar_holder_depth){ |
34e9f480 |
54 | polygon([[ 0, 0], |
8b84f6f3 |
55 | [sonar_holder_depth, 0], |
56 | [sonar_holder_depth, sonar_holder_width / 2], |
34e9f480 |
57 | [ 0, |
58 | sonar_holder_width / 2 + sonar_holder_depth]]);} |
8b84f6f3 |
59 | translate([0, (sonar_holder_width + sonar_holder_depth) / 2, 0]){ |
60 | cube([sonar_holder_depth / 2, |
61 | (sonar_holder_width - sonar_holder_depth) / 2 + 0.8, |
62 | sonar_holder_depth]);} |
60061640 |
63 | translate([-1.7, sonar_holder_width + 0.8, 0]){ |
8b84f6f3 |
64 | linear_extrude(height = sonar_holder_depth){ |
34e9f480 |
65 | polygon([[ 0, 0], |
8b84f6f3 |
66 | [sonar_holder_depth / 2 + 1.7, 4], |
67 | [sonar_holder_depth / 2 + 1.7, 0]]);}}}}} |
49bffb72 |
68 | |
74f8c088 |
69 | module deck_holder(){ |
be16f419 |
70 | deck_holder_width = sonar_holder_width - deck_depth; |
4390b08c |
71 | deck_holder_height = sonar_holder_depth * 2 + deck_depth; |
bc750455 |
72 | linear_extrude(height = deck_holder_width){ |
73 | difference(){ |
4390b08c |
74 | square([deck_holder_length, deck_holder_height]); |
bc750455 |
75 | translate([sonar_holder_depth, sonar_holder_depth]){ |
76 | square(deck_depth);} |
4390b08c |
77 | translate([deck_holder_height, sonar_holder_depth]){ |
78 | square([deck_holder_length - (deck_holder_height), deck_depth]);}}} |
79 | translate([deck_holder_length - oshw_dy * 0.05, 0, deck_holder_width / 2]) |
80 | scale([0.1, 1, 0.1]) |
81 | rotate(v = [1, 0, 0], a = 90) |
82 | rotate(90) |
83 | linear_extrude(height = 0.5) |
84 | oshw(); |
85 | translate([deck_holder_length - oshw_dy * 0.05, |
86 | deck_holder_height + 0.5, |
87 | deck_holder_width / 2]) |
88 | rotate(v = [1, 0, 0], a = 90) |
89 | rotate(90) |
90 | scale([0.1, 0.1, 1]) |
91 | linear_extrude(height = 0.5) |
92 | oshw();} |
74f8c088 |
93 | |
180a0f6f |
94 | module corner_rounder_2d(radius, corner_name="top-left"){ |
95 | rotate_for_corner = (corner_name == "top-left") ? 0 : |
96 | ((corner_name == "top-right") ? -90 : |
97 | ((corner_name == "bottom-left") ? 90 : |
98 | ((corner_name == "bottom-right") ? 180 : |
99 | 1 / 0))); |
100 | rotate(rotate_for_corner){ |
7888bdfb |
101 | difference (){ |
180a0f6f |
102 | square(radius); |
103 | translate([radius, radius]){ |
104 | circle(radius);}}}} |
7888bdfb |
105 | |
180a0f6f |
106 | module corner_rounder(radius, height, corner_name="top-left"){ |
107 | linear_extrude(height = height){ |
108 | corner_rounder_2d(radius, corner_name);}} |
7888bdfb |
109 | |
180a0f6f |
110 | sonar_holder(); |