remove qr size and height override
[challenge-bot] / 3d-printables / wheel.scad
CommitLineData
bc02cd24 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
136c3fb0 7// use $fn = 20 while developing, 100 when about to print
8// 20 will make previews fast
9// 100 will make printing smooth
8464810c 10$fn = 100;
136c3fb0 11
8464810c 12use <qr.scad>
0d781ab9 13
8464810c 14qr_size = 54;
15qr_height = 2;
bc02cd24 16
8464810c 17wall_width = 3;
18
19wheel_width = 6;
20wheel_radius = sqrt(2 * pow(qr_size / 2, 2)) + wall_width / 2;
21
22motor_shaft_radius = 3.7;
23motor_shaft_flat_width = 4.8;
24
403f9f0c 25tread_radius = 2.5 / 2;
26
8464810c 27module mounting_screw_flat(){
28 square(2, center = true);}
29
30module motor_shaft_flat(radius, flat_width){
bc02cd24 31 intersection(){
8464810c 32 circle(radius);
33 square([flat_width, radius * 2], center = true);}}
bc02cd24 34
8464810c 35module motor_shaft(radius,
36 flat_width,
37 shaft_length){
38 linear_extrude(height = shaft_length){
39 motor_shaft_flat(radius, flat_width);}}
0d781ab9 40
8464810c 41module rim(radius, wall_width, wheel_width){
42 linear_extrude(height = wheel_width){
0d781ab9 43 difference(){
8464810c 44 circle(radius);
45 circle(radius - wall_width);}}}
46
47module motor_shaft_holder_flat(radius, flat_width, wall_width){
48 difference(){
49 motor_shaft_flat(radius + wall_width,
50 flat_width + wall_width);
51 motor_shaft_flat(radius, flat_width);}}
52
53module motor_shaft_holder(radius, flat_width, wall_width, height){
54 linear_extrude(height = height){
55 motor_shaft_holder_flat(radius, flat_width, wall_width);}}
56
403f9f0c 57module tread(wheel_radius, tread_radius){
58 rotate_extrude(convexity = 10){
59 translate([wheel_radius, 0]){
60 circle(tread_radius);}}}
61
62module wheel_black(radius,
63 width,
64 shaft_radius,
65 shaft_flat_width,
66 wall_width,
67 tread_radius){
8464810c 68 color("black"){
403f9f0c 69 difference(){
70 rim(radius, wall_width, width);
71 translate([0, 0, width / 2]){
72 tread(radius, tread_radius);}}
8464810c 73 linear_extrude(height = qr_height){
74 difference(){
75 qr_black_flat();
76 mounting_screw_flat();}}
77 translate([0, 0, qr_height]){
78 motor_shaft_holder(shaft_radius,
79 shaft_flat_width,
80 wall_width,
81 width - qr_height);}}}
82
83module wheel_white(){
84 color("white"){
85 linear_extrude(height = qr_height){
86 difference(){
87 qr_white_flat();
88 mounting_screw_flat();}}}}
89
403f9f0c 90module wheel(radius,
91 width,
92 shaft_radius,
93 shaft_flat_width,
94 wall_width,
95 tread_radius){
8464810c 96 wheel_black(radius,
97 width,
98 shaft_radius,
99 shaft_flat_width,
403f9f0c 100 wall_width,
101 tread_radius);
8464810c 102 wheel_white();}
103
defb83a5 104module wheel_solid(radius,
105 width,
106 shaft_radius,
107 shaft_flat_width,
108 wall_width,
109 tread_radius){
110 difference(){
111 rim(radius, wall_width, width);
112 translate([0, 0, width / 2]){
113 tread(radius, tread_radius);}}
defb83a5 114 linear_extrude(height = qr_height){
25c7a966 115 difference (){
116 square(qr_size, center = true);
117 square(1.5, center = true);}}
defb83a5 118 translate([0, 0, qr_height]){
119 motor_shaft_holder(shaft_radius,
120 shaft_flat_width,
121 wall_width,
122 width - qr_height);}}
123
124/*
8464810c 125wheel(wheel_radius,
126 wheel_width,
127 motor_shaft_radius,
128 motor_shaft_flat_width,
403f9f0c 129 wall_width,
130 tread_radius);
defb83a5 131*/
132
133wheel_solid(wheel_radius,
134 wheel_width,
135 motor_shaft_radius,
136 motor_shaft_flat_width,
137 wall_width,
138 tread_radius);