summaryrefslogtreecommitdiff
path: root/lasttretrad.scad
blob: a5dec0fb681f19944b4fb237dad9229c19523dd0 (plain)
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
use <wheel.scad>;
use <suspension_fork.scad>;

// total outer dimension of the lasttretrad
ltr_length = 3000;
ltr_width  = 1000;
ltr_height = 160;

bed_height = 18;

// the universal standard board used during prototype construction
board_width=25;
board_height=120;

module frame() {
    bessel=sqrt(3/2) -1;
    
    // translate([-l/2, -w/2, 0])
    // cube([l, w, h]);
    translate([0, 0, -board_height - bed_height]) {
	// front/back boards
	for (pos = [-0.9, -0.4, 0, 0.4, 0.9])
	translate([pos * (ltr_length - board_width)/2 - board_width + board_width/2, -ltr_width/2, 0])
	cube([board_width, ltr_width, board_height]);

	// left/right boards
	
	//   Positioned at the bessel points (yields minimal mean bend
	//   assuming equal load on the cargo bed); see
	//   https://de.wikipedia.org/wiki/Bessel-Punkt
	for (pos = [-1,1])
	translate([-ltr_length/2, pos * (1 - 2*bessel) * (ltr_width - board_width)/2 - board_width/2, 0])
	cube([ltr_length, board_width, board_height]);
    }
}

// use a large plywood board
module cargo_bed() {
    translate([0, 0, -bed_height/2])
    cube([ltr_length, ltr_width, bed_height], center=true);
}


// specify (f)ront/(c)enter/(b)ack as -1/0/1 and (l)eft/(r)ight as -1/1
module wheel_position(fcb, lr) {
    translate([1250 * fcb,
	       (fcb == 0) ? (340 * lr) : (370 * lr),
	       0])
    children();
}

// specify (f)ront/(b)ack and (l)eft/(r)ight as -1/1
module steered_wheel(fb=-1, lr=-1, rot=0, suspension_depth=0) {
    rotate([ 0, 0, fb*rot]) {
        suspension_fork(suspension_depth);
        translate([45, 0, wheel_offset(suspension_depth)])
        rotate([90, 0, 0]) wheel();
    }
}

// specify (l)eft/(r)ight as -1/1
module powered_wheel(lr=-1, suspension_depth=0) {
    axis_distance = 500;
    board_length = axis_distance + board_height;
    default_suspension_depth = 0; // used to calculate anchor point
    axis_offset = board_height/2 + bed_height; // distance from upper axis to cargo floor

    rot =         asin((250 -         suspension_depth              ) / axis_distance);
    default_rot = asin((250 - default_suspension_depth - axis_offset) / axis_distance);

    translate([-axis_distance * cos(default_rot), 0, -axis_offset])
    rotate([0, rot, 0]) {
	translate([axis_distance, 0, 0])
	rotate([90])
	wheel();

	for (i = [-1,1])
	translate([0, i*40 - lr*5, 0])
	// board with rounded edges
	hull()
	for (i = [0, 1])
	translate([i * axis_distance, 0, 0])
	rotate([90, 0, 0])
	cylinder(r=board_height/2, h=board_width, center=true);
    }
}

module lasttretrad(rot=0, suspension_depth=0) {
    color("SaddleBrown") frame();
    color("Cornsilk") cargo_bed();
    
    for (lr = [-1,1])
    for (fb = [-1,1])
    wheel_position(fb, lr)
    steered_wheel(fb, lr, rot=rot, suspension_depth=suspension_depth);
    
    for (lr = [-1,1])
    wheel_position(0, lr)
    powered_wheel(lr, suspension_depth=suspension_depth);
}

lasttretrad(30, 50);
contact: Jan Huwald // Impressum