X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=3d-printables%2Fwheel.scad;h=a37008333ae1207805cfa88ead7d60b11277d41e;hb=refs%2Fheads%2Fdevelop%2Fj;hp=87ec2865c38c456da267159bce0b19b41291c92d;hpb=fa6c6440266670ea11fda3d8bb5a9d48553e00d2;p=challenge-bot diff --git a/3d-printables/wheel.scad b/3d-printables/wheel.scad index 87ec286..a370083 100644 --- a/3d-printables/wheel.scad +++ b/3d-printables/wheel.scad @@ -7,67 +7,120 @@ // use $fn = 20 while developing, 100 when about to print // 20 will make previews fast // 100 will make printing smooth -$fn = 20; +$fn = 100; -wheel_depth = 6; -wheel_radius = 68/2; +include +use -module encoder_shaft(){ - // measured with calipers, checked against the motor shaft - motor_shaft_big = 3.7; // radius, gets doubled in cylinder - motor_shaft_small = 4.8; // total length of box - motor_shaft_length = wheel_depth * 3 / 4; +module mounting_screw_flat() { + circle(0.9); } - intersection(){ - cylinder(h = motor_shaft_length, r = motor_shaft_big, center = true); - // x direction is multiplied by 2 because the radius of the cylinder - // goes in both directions. the extra .1 is for overlap - cube([motor_shaft_big * 2.1, motor_shaft_small, motor_shaft_length], - center = true);}} +module motor_shaft_flat(radius, flat_width) { + intersection() { + circle(radius); + square([flat_width, radius * 2], center = true); } } -module mounting_screw(){ - cylinder(h = wheel_depth * 1.1, r = 1, center = true);} +module motor_shaft(radius, + flat_width, + shaft_length) { + linear_extrude(height = shaft_length) { + motor_shaft_flat(radius, flat_width); } } -module wheel(){ - translate([0, 0, wheel_depth / 2]){ - difference(){ - cylinder(h = wheel_depth, r = wheel_radius, center = true); - translate([0, 0, wheel_depth / 4]){ - scale([1, 1, 1.1]){ - encoder_shaft();}} - mounting_screw(); - for(i = [1 : 5]){ - rotate(i * 360/5, [0, 0, 1]){ - translate([0, 0, -0.6 * wheel_depth]) - between_spokes();}} - translate([0, 0, wheel_depth / 4]){ - difference(){ - cylinder(h = wheel_depth / 1.2, - r = 0.85 * wheel_radius, - center = true); - cylinder(h = wheel_depth / 1.2, - r = 0.23 * wheel_radius, - center = true);}}}}} +module rim(radius, wall_width, wheel_width) { + linear_extrude(height = wheel_width) { + difference() { + circle(radius); + circle(radius - wall_width); } } } -module wheel_block(){ - cube([wheel_radius, wheel_radius, wheel_depth]);} +module motor_shaft_holder_flat(radius, flat_width, wall_width) { + difference() { + motor_shaft_flat(radius + wall_width, + flat_width + wall_width); + motor_shaft_flat(radius, flat_width); } } -module pie_slice(){ - intersection(){ - translate([0, 0, wheel_depth / 2]){ - cylinder(h = wheel_depth, - r = 0.85 * wheel_radius, - center = true);} - translate([0, wheel_radius * 0.3, 0]){ - rotate([0, 0, (360 / 5) / 2]){ - intersection(){ - wheel_block(); - rotate([0, 0, 90 - 360 / 5]) - wheel_block();}}}}} +module motor_shaft_holder(radius, flat_width, wall_width, height) { + linear_extrude(height = height) { + motor_shaft_holder_flat(radius, flat_width, wall_width); } } -module between_spokes(){ - minkowski(){ - pie_slice(); - cylinder(h = wheel_depth / 2, r = 1);}} +module tread(wheel_radius, tread_radius) { + rotate_extrude(convexity = 10) { + translate([wheel_radius, 0]) { + circle(tread_radius); } } } -wheel(); +module wheel_black(radius, + width, + shaft_radius, + shaft_flat_width, + wall_width, + tread_radius) { + color("black") { + difference() { + rim(radius, wall_width, width); + translate([0, 0, width / 2]) { + tread(radius, tread_radius); } } + linear_extrude(height = qr_height) { + difference() { + qr_black_flat(); + mounting_screw_flat(); } } + translate([0, 0, qr_height]) { + motor_shaft_holder(shaft_radius, + shaft_flat_width, + wall_width, + width - qr_height); } } } + +module wheel_white() { + color("white") { + linear_extrude(height = qr_height) { + difference() { + qr_white_flat(); + mounting_screw_flat(); } } } } + +module wheel(radius, + width, + shaft_radius, + shaft_flat_width, + wall_width, + tread_radius) { + wheel_black(radius, + width, + shaft_radius, + shaft_flat_width, + wall_width, + tread_radius); + wheel_white(); } + +module wheel_solid(radius, + width, + shaft_radius, + shaft_flat_width, + wall_width, + tread_radius) { + difference() { + rim(radius, wall_width * 2, width); + translate([0, 0, width / 2]) { + tread(radius, tread_radius); } } + linear_extrude(height = qr_height) { + difference() { + square(qr_size, center = true); + mounting_screw_flat(); } } + translate([0, 0, qr_height]) { + motor_shaft_holder(shaft_radius, + shaft_flat_width, + wall_width, + width - qr_height); } } + +/* +wheel(wheel_radius, + wheel_width, + motor_shaft_radius, + motor_shaft_flat_width, + wall_width, + tread_radius); +*/ + +wheel_solid(wheel_radius, + wheel_width, + motor_shaft_radius, + motor_shaft_flat_width, + wall_width, + tread_radius);