@rulecad/cad 0.7.42 → 0.7.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/EXAMPLES.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [The tutorial](TUTORIAL.md) ends with a wall hook checked against its screw. These examples carry on from there, one
4
4
  for each thing the [README](README.md) describes after that: parts, variants and releases, joints and poses, a model
5
- from elsewhere, an optimised part, a board, a mechanism printed flat, gears, a gearbox, a motor, and a robot joint. Each is a few files and the commands to run
5
+ from elsewhere, an optimised part, a board, a mechanism printed flat, gears, a gearbox, a motor, a robot joint, and a machine sized from its task. Each is a few files and the commands to run
6
6
  them. The tests write every file here and run every command, so what you read is what works.
7
7
 
8
8
  They start from a workspace `npm create rulecad my-designs` makes, as the tutorial does, and run in order: later
@@ -1241,3 +1241,4251 @@ motor all the way round and finds no teeth touching, and neither do the output r
1241
1241
  Ten times over is more margin than the job needs, but the gearbox is the size it is for what the motor could do to it, not
1242
1242
  the arm: stalled against a stop, the 7.44 N m at the output puts 33 MPa on the planets' top teeth (`strength`, the Lewis
1243
1243
  equation, for teeth 8 mm wide), against PLA's 39. Give that a home switch, or a smaller current.
1244
+
1245
+ ## 12. A machine from its task: a SCARA arm that draws
1246
+
1247
+ A two-link arm with a pen, standing on a bench, draws on an A5 sheet to 0.3 mm at 50 mm/s. That sentence is the
1248
+ design's first line and everything else follows from it: where the sheet goes, how long the links are, what turns them,
1249
+ and what the error budget has to say. This chapter is a whole machine, so it is long. It is the project in
1250
+ `examples/bench/projects/arm` written out in full: the tests write every file here and run every command.
1251
+
1252
+ The arm is a compound planetary at the shoulder (chapter 11's gearbox, on a 17HS4401) and the same gearbox at the
1253
+ elbow on a smaller motor. Its joints are vertical, so gravity never loads a motor. The base can bolt flat on a
1254
+ bench to draw, or upright on a stand later, on the same four holes.
1255
+
1256
+ ### The task, and where the sheet goes
1257
+
1258
+ A sheet can face the arm either way. Portrait, the far corners are 290 mm from the shoulder; landscape, 242 mm, for the
1259
+ same paper, because the arm's reach is a circle and a landscape sheet fits inside it better. Landscape it is: the 210 mm
1260
+ side across the arm's front, its near edge 70 mm from the shoulder (past the base, with room for the pen holder), its
1261
+ centre at (144, 0), and its plane at z = 0, the bench.
1262
+
1263
+ The tool's plane has to be the sheet's. The pen's tip rests 1 mm below the paper, because that is how the leaf spring
1264
+ presses it down, so the tool anchor for the task is a point on the holder level with the paper, not the pen's tip itself.
1265
+
1266
+ ### The link lengths, from reach
1267
+
1268
+ The far corner is at √(218² + 105²) = 242 mm, and the arm has to stay away from full stretch there. Near full stretch
1269
+ the arm can only go sideways, and moving outward needs the elbow to race: the `task.speed` check finds the slowest point
1270
+ on the sheet, and with 95% of full stretch at the far corner (the first idea, 150 and 110 mm) the slowest point was only
1271
+ 31 mm/s against 50. Giving it 88% of full stretch brings the slowest point up to 51 mm/s. So L1 + L2 = 242 / 0.88 = 275 mm.
1272
+
1273
+ The split between them is decided by the error, because an angle at the elbow swings only the forearm, and an angle at the
1274
+ shoulder swings the whole reach. For equal joint errors the pen moves (242 + L2) × angle at the far corner, so the forearm
1275
+ should be as short as the reach allows. The limit is the near edge: fully folded the arm reaches in to L1 − L2 from the
1276
+ shoulder, and the elbow's home switch stops it at 160° of fold. At 160° of fold,
1277
+ 160 mm and 115 mm reach in to 65 mm, inside the near edge at 70. Shorter forearms leave the near edge out of reach:
1278
+ 115 mm is the shortest that works. These are the `upper` and `fore` rules in the rule set below.
1279
+
1280
+ | Links (mm) | Far corner | Slowest speed (motor at 240 rpm) |
1281
+ |---|---|---|
1282
+ | 150 + 110 | 93% of full stretch | 31 mm/s |
1283
+ | 155 + 115 | 90% | 39 mm/s |
1284
+ | 160 + 115 | 88% | 41 mm/s (51 at 300 rpm) |
1285
+ | 170 + 120 | 83% | 38 mm/s (slower again: the shoulder's limit takes over) |
1286
+
1287
+ ### The elbow, from the numbers
1288
+
1289
+ Three ways to turn the elbow:
1290
+
1291
+ | | Elbow motor | Step at the pen | What it adds | |
1292
+ |---|---|---|---|---|
1293
+ | Direct | NEMA 17 on the joint, no gears | 0.225° × 115 mm = 0.45 mm at 1/8 step | 280 g | over the 0.3 mm budget from one term |
1294
+ | Belt to the base | Motor at the base, a belt up to a pulley | depends on the ratio: 3:1 at most from pulleys that fit | No belt in the catalogue yet; the elbow couples to the shoulder and the sag of the belt is an error of its own | later |
1295
+ | Geared | NEMA 14 through the 38:1 gearbox | 0.0059° × 115 mm = 0.012 mm at 1/8 step | 190 g; the gearbox's play and twist | the choice |
1296
+
1297
+ The geared elbow uses the shoulder's gearbox unchanged, so the sun, the planets and the output ring are the same prints
1298
+ and the same bench test measures both. NEMA 14 rather than a second 17 because the torque the elbow needs is tiny: 0.08 N m
1299
+ at the elbow (the pen's drag, the forearm's inertia, the bias) against 2.27 N m the small motor gives through 38:1,
1300
+ and it weighs 90 g less at the end of a 160 mm link. The fixed ring is printed into the upper arm itself: the elbow costs
1301
+ a sun, three planets, an output ring and three clips.
1302
+
1303
+ ### The bearing
1304
+
1305
+ The output ring turns inside fixed posts, so nothing printed can go through it. The bearing goes above the gearbox: a
1306
+ 6800 in a three-armed bridge, with the output's shaft up through it, and the arm on a hexagon at the shaft's top. The upper arm's
1307
+ screw clamps the inner race between the spindle's collar and the arm's collar, so the arm's weight and the tipping moment go
1308
+ through the balls and not through the gears. `joint.moment` reports it, and `fit.seat` checks the seat as drawn.
1309
+
1310
+ Two rubber bands bias the joints, one from the upper arm to a corner bolt of the base and one across the elbow, each
1311
+ pulling the same way across the whole of the sheet: the arm's backlash is always taken up the same way, which is why
1312
+ play can appear in the budget as a small figure at all. Without the bias, 0.15 mm of drawn backlash is about 0.3° at the
1313
+ output, which is 1.2 mm at the far corner. The rules give the figures with the bias as targets, marked `estimate`: bench
1314
+ tests 14, 15 and 17 in `examples/bench/projects/benchmarks/MEASURE.md` measure them, and `cad measured` writes them back
1315
+ and moves the budget.
1316
+
1317
+ The rules: the reach, the stack of parts from the bench up, and what the budget assumes.
1318
+
1319
+ ```json rules/arm.json
1320
+ {
1321
+ "_doc": "The drawing arm's own figures: its reach, its stack of parts, and what its error budget assumes until the bench measures it. Examples chapter 12 explains each.",
1322
+ "name": "arm",
1323
+ "rules": {
1324
+ "sheet_w": {"value": 210, "unit": "mm", "rule": "An A5 sheet's long side, across the arm's front", "kind": "spec", "source": "ISO 216", "checked": "2026-11-09"},
1325
+ "sheet_h": {"value": 148, "unit": "mm", "rule": "An A5 sheet's short side, away from the arm", "kind": "spec", "source": "ISO 216", "checked": "2026-11-09"},
1326
+ "near": {"value": 70, "unit": "mm", "rule": "From the shoulder's axis to the sheet's near edge: past the base and the pen holder's width", "kind": "default", "source": "EXAMPLES.md chapter 12", "checked": "2026-11-09"},
1327
+ "upper": {"value": 160, "unit": "mm", "rule": "Shoulder to elbow: with the forearm, the shortest pair that keeps the far corner at 88% of full stretch (the speed check's slowest point) and folds to the near edge", "kind": "default", "source": "EXAMPLES.md chapter 12", "checked": "2026-11-09"},
1328
+ "fore": {"value": 115, "unit": "mm", "rule": "Elbow to pen: as short as the reach allows, because the elbow's error swings through it", "kind": "default", "source": "EXAMPLES.md chapter 12", "checked": "2026-11-09"},
1329
+ "play_shoulder": {"value": 0.02, "unit": "°", "rule": "The shoulder's play at its output with the bias spring taking up the gear backlash", "kind": "estimate", "source": "A target, not a measurement: bench test 14 in projects/benchmarks/MEASURE.md settles it", "checked": "2026-11-09"},
1330
+ "play_elbow": {"value": 0.02, "unit": "°", "rule": "The elbow's play, the same gearbox and bias", "kind": "estimate", "source": "A target, not a measurement: bench test 14", "checked": "2026-11-09"},
1331
+ "twist_shoulder": {"value": 0.01, "unit": "°", "rule": "The shoulder's gear train twisting under the pen's drag and the bias", "kind": "estimate", "source": "A guess: bench test 15", "checked": "2026-11-09"},
1332
+ "twist_elbow": {"value": 0.01, "unit": "°", "rule": "The elbow's gear train twisting, the same", "kind": "estimate", "source": "A guess: bench test 15", "checked": "2026-11-09"},
1333
+ "deflection": {"value": 0.02, "unit": "mm", "rule": "The links bending sideways at the pen under its drag, from beam formulas", "kind": "estimate", "source": "0.3 N of drag on the forearm and holder as cantilevers: bench test 17 measures the whole budget at once", "checked": "2026-11-09"},
1334
+ "drag": {"value": 0.3, "unit": "N", "rule": "A pen's drag on paper, about, pulled sideways at the tip", "kind": "estimate", "source": "A hand guess from a pen on a spring scale: measure yours", "checked": "2026-11-09"},
1335
+ "shoulder_torque": {"value": 0.2, "unit": "N m", "rule": "What the shoulder must do at the task's speed and accel: the pen's drag at 240 mm, the arm's inertia and the bias", "kind": "estimate", "source": "Drag 0.07 N m + inertia about 0.03 N m + the rubber band's bias 0.1 N m", "checked": "2026-11-09"},
1336
+ "elbow_torque": {"value": 0.08, "unit": "N m", "rule": "What the elbow must do: the pen's drag at 110 mm, the forearm's inertia and the bias", "kind": "estimate", "source": "Drag 0.03 N m + inertia 0.01 N m + the rubber band's bias 0.04 N m", "checked": "2026-11-09"},
1337
+ "foot": {"value": 6, "unit": "mm", "rule": "The base plate's thickness", "kind": "default", "source": "Stiff enough for four M5 screws", "checked": "2026-11-09"},
1338
+ "room": {"value": 2, "unit": "mm", "rule": "Air between the shoulder motor's back and the base plate", "kind": "default", "source": "Design", "checked": "2026-11-09"},
1339
+ "motor17": {"value": 40, "unit": "mm", "rule": "The 17HS4401's body length", "kind": "community", "source": "nema17 variant 17HS4401 (https://market.samm.com/17hs4401-nema17-step-motor-en)", "checked": "2026-11-09"},
1340
+ "face": {"value": "foot + room + motor17", "unit": "mm", "rule": "The shoulder motor's mounting face above the bench: the base's height", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
1341
+ "plate": {"value": 5, "unit": "mm", "rule": "The shoulder housing's plate: enough for M3 screws into a NEMA 17 (1.5 × their size)", "kind": "default", "source": "Chapter 11's housing", "checked": "2026-11-09"},
1342
+ "gear": {"value": 8, "unit": "mm", "rule": "Each gear stage's face", "kind": "default", "source": "Chapter 11's gearbox", "checked": "2026-11-09"},
1343
+ "ring_gap": {"value": 0.4, "unit": "mm", "rule": "Between the fixed ring and the output ring", "kind": "default", "source": "Chapter 11's gearbox", "checked": "2026-11-09"},
1344
+ "flange": {"value": 5, "unit": "mm", "rule": "The output ring's flange: thick enough for four M3 screws to bite", "kind": "default", "source": "Design", "checked": "2026-11-09"},
1345
+ "output_top": {"value": "face + plate + gear + ring_gap + gear + flange", "unit": "mm", "rule": "Top of the shoulder's output flange above the bench", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
1346
+ "disc": {"value": 3, "unit": "mm", "rule": "The spindle's disc, on the flange", "kind": "default", "source": "Design", "checked": "2026-11-09"},
1347
+ "bridge_gap": {"value": 0.6, "unit": "mm", "rule": "Between the spindle's disc and the bridge above it", "kind": "default", "source": "Design", "checked": "2026-11-09"},
1348
+ "bridge": {"value": 7, "unit": "mm", "rule": "The bridge's thickness: the 5 mm bearing and a 2 mm ledge", "kind": "default", "source": "Design", "checked": "2026-11-09"},
1349
+ "bridge_low": {"value": "output_top + disc + bridge_gap", "unit": "mm", "rule": "The bridge's underside above the bench", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
1350
+ "arm_gap": {"value": 0.5, "unit": "mm", "rule": "Between the bridge's top and the upper arm's underside", "kind": "default", "source": "Design", "checked": "2026-11-09"},
1351
+ "arm": {"value": 12, "unit": "mm", "rule": "The upper arm's thickness, a plate over the elbow too: about 1.7 mm of sag under its load at 8 mm thick, 0.5 mm at 12", "kind": "default", "source": "The cantilever formula in EXAMPLES.md chapter 12", "checked": "2026-11-09"},
1352
+ "switch_pitch": {"value": 9.5, "unit": "mm", "rule": "Between the endstop's two screw holes", "kind": "estimate", "source": "endstop-10t85 in @rulecad/rules: the set has words among its figures, so an object can't read it through uses", "checked": "2026-11-09"},
1353
+ "bearing_bore": {"value": 10, "unit": "mm", "rule": "The 6800's bore", "kind": "spec", "source": "bearing-6800 in @rulecad/rules (NTN)", "checked": "2026-11-09"},
1354
+ "bearing_outer": {"value": 19, "unit": "mm", "rule": "The 6800's outside diameter", "kind": "spec", "source": "bearing-6800", "checked": "2026-11-09"},
1355
+ "bearing_width": {"value": 5, "unit": "mm", "rule": "The 6800's width", "kind": "spec", "source": "bearing-6800", "checked": "2026-11-09"},
1356
+ "boss": {"value": 11.5, "unit": "mm", "rule": "The forearm's boss, so the bar passes under the elbow's clips", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
1357
+ "elbow_flange": {"value": "bridge_low + bridge + arm_gap - gear - ring_gap - gear - flange", "unit": "mm", "rule": "The elbow output flange's underside, where the forearm bolts on: the upper arm's underside less the elbow's stack", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
1358
+ "fore_low": {"value": "elbow_flange - boss", "unit": "mm", "rule": "The forearm bar's underside above the bench", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
1359
+ "fore_mid": {"value": "fore_low + arm_mid", "unit": "mm", "rule": "The holder's bolts, level with the middle of the forearm", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
1360
+ "arm_mid": {"value": 4, "unit": "mm", "rule": "Half the forearm's 8 mm thickness", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
1361
+ "press": {"value": 1, "unit": "mm", "rule": "How far below the paper the pen tip sits at rest, so the leaf spring presses it down", "kind": "default", "source": "Sets the pen force through the guide's stiffness", "checked": "2026-11-09"}
1362
+ }
1363
+ }
1364
+ ```
1365
+
1366
+ ```json projects/arm/project.json
1367
+ {
1368
+ "name": "arm",
1369
+ "description": "A SCARA arm sized from its task: an A5 sheet, a pen, 0.3 mm at 50 mm/s. EXAMPLES chapter 12 explains it.",
1370
+ "material": "PLA",
1371
+ "objects": [
1372
+ "base",
1373
+ "housing",
1374
+ "sun",
1375
+ "planet",
1376
+ "speck",
1377
+ "output",
1378
+ "bridge",
1379
+ "spindle",
1380
+ "upper",
1381
+ "clip",
1382
+ "forearm",
1383
+ "holder"
1384
+ ]
1385
+ }
1386
+ ```
1387
+
1388
+ ### The base and the shoulder
1389
+
1390
+ A square plate that takes four M5 bolts, flat on the bench or upright on a stand. Three columns hold the shoulder housing,
1391
+ with the motor hanging between them, and a post carries the shoulder's home switch.
1392
+
1393
+ ```json projects/arm/objects/base.json
1394
+ {
1395
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
1396
+ "name": "base",
1397
+ "title": "Base: plate and motor stand",
1398
+ "version": "0.1.0",
1399
+ "uses": ["x1c", "arm", "m2", "m3", "m5"],
1400
+ "engine": "manifold",
1401
+ "orientation": "The plate on the bed, columns up",
1402
+ "description": "A square plate that bolts down through four corner holes, flat on the bench or upright on a stand, with three columns round the motor carrying the shoulder housing and a post for the home switch.",
1403
+ "anchors": {
1404
+ "top": {"at": [0, 0, "column_top"], "axis": [0, 0, 1]},
1405
+ "cable": {"at": ["0 - side / 2", 0, "foot"], "axis": [0, 0, 1]},
1406
+ "switch": {"at": ["(post_r + switch_pitch / 2) * cosd(post_a)", "(post_r + switch_pitch / 2) * sind(post_a)", "post_top + switch_half"], "axis": [0, 0, 1], "ref": ["0 - cosd(post_a)", "0 - sind(post_a)", 0]}
1407
+ },
1408
+ "variables": {
1409
+ "side": {"value": 96, "unit": "mm", "rule": "The plate's side: round the columns, with room for the bolts", "label": "Plate", "show": true},
1410
+ "foot": {"value": "arm.foot", "unit": "mm", "rule": "The plate's thickness"},
1411
+ "corner": {"value": 8, "unit": "mm", "rule": "The plate's corners, rounded"},
1412
+ "bolt": {"value": "m5.clearance", "unit": "mm", "rule": "Bolts through to the bench, or an upright stand"},
1413
+ "bolt_at": {"value": 38, "unit": "mm", "rule": "Half the bolts' square: the same pattern on a bench and on a stand"},
1414
+ "column_top": {"value": "arm.face", "unit": "mm", "rule": "Up to the shoulder motor's mounting face"},
1415
+ "column_r": {"value": 37, "unit": "mm", "rule": "Round the motor's corners"},
1416
+ "column": {"value": 10, "unit": "mm", "rule": "Solid, stiff enough for the arm's tipping load: section against 2 x the arm's weight in the chapter"},
1417
+ "pilot": {"value": 2.9, "unit": "mm", "rule": "An M3 screw self-tapped into the column's top", "kind": "community"},
1418
+ "pilot_depth": {"value": 16, "unit": "mm", "rule": "For an M3 × 20 through the housing's plate"},
1419
+ "post_r": {"value": 50, "unit": "mm", "rule": "The switch post, outside the housing's posts", "interface": true},
1420
+ "post_a": {"value": 235, "unit": "°", "rule": "Round from the front: where the upper arm's flag meets the switch's lever at the shoulder's home, -116°", "interface": true},
1421
+ "post_w": {"value": 14, "unit": "mm", "rule": "The post's width along the radius, for the switch's two screws"},
1422
+ "post_d": {"value": 12, "unit": "mm", "rule": "The post's depth, tangential"},
1423
+ "post_top": {"value": "arm.bridge_low + arm.bridge - 6", "unit": "mm", "rule": "The switch lies on the post, its lever under the arm's flag"},
1424
+ "switch_pilot": {"value": "m2.clearance - 0.6", "unit": "mm", "rule": "An M2 screw self-tapped into the post", "kind": "community"},
1425
+ "switch_pitch": {"value": "arm.switch_pitch", "unit": "mm", "rule": "The switch's screw spacing"},
1426
+ "switch_depth": {"value": 10, "unit": "mm", "rule": "Pilot depth for M2 × 8"},
1427
+ "segments": {"value": 64, "rule": "Round enough"},
1428
+ "rad": {"value": 0.017453293, "rule": "Radians in a degree"},
1429
+ "c1": {"value": 90, "unit": "°", "rule": "First column, between the motor's corners"},
1430
+ "c2": {"value": 210, "unit": "°", "rule": "Second column"},
1431
+ "c3": {"value": 330, "unit": "°", "rule": "Third column"},
1432
+ "switch_half": {"value": 3, "unit": "mm", "rule": "Half the switch's thickness: it lies on the post, its screws straight down"}
1433
+ }
1434
+ }
1435
+ ```
1436
+
1437
+ ```js projects/arm/objects/base.js
1438
+ // A plate with three columns and a post: first layer one square with four holes.
1439
+ import jscad from '@jscad/modeling'
1440
+ const { cylinder, cuboid, roundedRectangle } = jscad.primitives
1441
+ const { extrudeLinear } = jscad.extrusions
1442
+ const { translate, rotateZ } = jscad.transforms
1443
+
1444
+ export function main (v) {
1445
+ const plate = extrudeLinear({ height: v.foot }, roundedRectangle({ size: [v.side, v.side], roundRadius: v.corner, segments: v.segments }))
1446
+ const angles = [v.c1, v.c2, v.c3].map((a) => a * v.rad)
1447
+ const at = (r, a) => [r * Math.cos(a), r * Math.sin(a)]
1448
+ const columns = angles.map((a) => cylinder({ radius: v.column / 2, height: v.column_top, center: [...at(v.column_r, a), v.column_top / 2], segments: v.segments }))
1449
+ const pilots = angles.map((a) => cylinder({ radius: v.pilot / 2, height: v.pilot_depth, center: [...at(v.column_r, a), v.column_top - v.pilot_depth / 2], segments: v.segments }))
1450
+ const a = v.post_a * v.rad
1451
+ const post = translate([...at(v.post_r, a), 0], rotateZ(a, cuboid({ size: [v.post_w, v.post_d, v.post_top], center: [0, 0, v.post_top / 2] })))
1452
+ const pads = [-1, 1].map((s) => cylinder({ radius: v.switch_pilot / 2, height: v.switch_depth, center: [...at(v.post_r + s * v.switch_pitch / 2, a), v.post_top - v.switch_depth / 2], segments: v.segments }))
1453
+ const holes = [[1, 1], [-1, 1], [1, -1], [-1, -1]].map(([x, y]) => cylinder({ radius: v.bolt / 2, height: v.foot + 1, center: [x * v.bolt_at, y * v.bolt_at, v.foot / 2], segments: v.segments }))
1454
+ return v.ops.subtract(v.ops.union(plate, columns, post), pilots, pads, holes)
1455
+ }
1456
+ ```
1457
+
1458
+ The housing is chapter 11's with its posts longer, and with the bridge in place of the clips. Above each motor's boss is a
1459
+ 45° cone up through the plate: a pocket there would have to be bridged.
1460
+
1461
+ ```json projects/arm/objects/housing.json
1462
+ {
1463
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
1464
+ "name": "housing",
1465
+ "title": "Shoulder housing and fixed ring",
1466
+ "version": "0.1.0",
1467
+ "uses": ["x1c", "arm", "m3"],
1468
+ "engine": "manifold",
1469
+ "orientation": "The motor plate on the bed, the ring and posts up",
1470
+ "anchors": {
1471
+ "axis": {"at": [0, 0, "plate"], "axis": [0, 0, 1]},
1472
+ "motor": {"at": [0, 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]}
1473
+ },
1474
+ "variables": {
1475
+ "plate": {"value": "arm.plate", "unit": "mm", "rule": "The motor plate", "interface": true},
1476
+ "gear": {"value": "arm.gear", "unit": "mm", "rule": "The fixed ring's face: strong enough for the motor's whole torque"},
1477
+ "rim": {"value": 62, "unit": "mm", "rule": "Round the 54-tooth ring, three lines and more of wall"},
1478
+ "module": {"value": 1, "unit": "mm", "rule": "The gears'"},
1479
+ "teeth": {"value": 54, "rule": "The fixed ring"},
1480
+ "post_r": {"value": 37, "unit": "mm", "rule": "Three posts outside the output ring", "interface": true},
1481
+ "post": {"value": 7, "unit": "mm", "rule": "Each post's diameter"},
1482
+ "post_high": {"value": "arm.bridge_low - arm.face - plate", "unit": "mm", "rule": "From the plate to under the bridge", "interface": true},
1483
+ "pilot": {"value": 2.9, "unit": "mm", "rule": "An M3 screw self-tapped", "kind": "community"},
1484
+ "pilot_depth": {"value": 8, "unit": "mm", "rule": "For an M3 × 16 through the bridge"},
1485
+ "column_r": {"value": 37, "unit": "mm", "rule": "Over the base's columns"},
1486
+ "lobe": {"value": 12, "unit": "mm", "rule": "The plate reaches out over each column"},
1487
+ "screw": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance, down into the column"},
1488
+ "head": {"value": "m3.head + 2 * x1c.fit + x1c.hole_comp", "unit": "mm", "rule": "The screw head's counterbore"},
1489
+ "head_depth": {"value": "m3.head_height + x1c.layer", "unit": "mm", "rule": "A socket head's height, sunk"},
1490
+ "segments": {"value": 64, "rule": "Round enough"},
1491
+ "ring_segments": {"value": 96, "rule": "Smooth to the eye and to the gear"},
1492
+ "rad": {"value": 0.017453293, "rule": "Radians in a degree"},
1493
+ "p1": {"value": 30, "unit": "°", "rule": "First post"},
1494
+ "p2": {"value": 150, "unit": "°", "rule": "Second post"},
1495
+ "p3": {"value": 270, "unit": "°", "rule": "Third post"},
1496
+ "f1": {"value": 90, "unit": "°", "rule": "First foot, over a column"},
1497
+ "f2": {"value": 210, "unit": "°", "rule": "Second foot"},
1498
+ "f3": {"value": 330, "unit": "°", "rule": "Third foot"}
1499
+ }
1500
+ }
1501
+ ```
1502
+
1503
+ ```js projects/arm/objects/housing.js
1504
+ // The motor plate with the fixed ring and posts standing on it. The motor bolts underneath, its shaft up through the middle.
1505
+ import jscad from '@jscad/modeling'
1506
+ const { cylinder, cylinderElliptic } = jscad.primitives
1507
+ const { translate } = jscad.transforms
1508
+
1509
+ export function main (v) {
1510
+ const motor = v.motors.motorModel('17HS4401')
1511
+ const at = (r, a) => [r * Math.cos(a), r * Math.sin(a)]
1512
+ const posts = [v.p1, v.p2, v.p3].map((a) => a * v.rad), feet = [v.f1, v.f2, v.f3].map((a) => a * v.rad)
1513
+ const plate = cylinder({ radius: v.rim / 2, height: v.plate, center: [0, 0, v.plate / 2], segments: v.ring_segments })
1514
+ const ring = translate([0, 0, v.plate], v.gears.internal({ module: v.module, teeth: v.teeth, width: v.gear, rim: v.rim }))
1515
+ const lobes = [...posts, ...feet].map((a) => cylinder({ radius: v.lobe / 2, height: v.plate, center: [...at(v.post_r, a), v.plate / 2], segments: v.segments }))
1516
+ const joins = [...posts, ...feet].map((a) => jscad.transforms.rotateZ(a, jscad.primitives.cuboid({ size: [v.post_r - v.rim / 2 + 2, v.lobe, v.plate], center: [(v.post_r + v.rim / 2 - 2) / 2, 0, v.plate / 2] })))
1517
+ const uprights = posts.map((a) => cylinder({ radius: v.post / 2, height: v.post_high + v.plate, center: [...at(v.post_r, a), (v.post_high + v.plate) / 2], segments: v.segments }))
1518
+ const pilots = posts.map((a) => cylinder({ radius: v.pilot / 2, height: v.pilot_depth, center: [...at(v.post_r, a), v.plate + v.post_high - v.pilot_depth / 2], segments: v.segments }))
1519
+ const screws = feet.map((a) => cylinder({ radius: v.screw / 2, height: v.plate + 1, center: [...at(v.column_r, a), v.plate / 2], segments: v.segments }))
1520
+ const heads = feet.map((a) => cylinder({ radius: v.head / 2, height: v.head_depth, center: [...at(v.column_r, a), v.plate - v.head_depth / 2], segments: v.segments }))
1521
+ // the pocket for the motor's boss would be bridged across: a 45° cone from its roof up through the plate needs no bridge
1522
+ const hole = v.motors.mountModel(motor, { plate: v.plate, counterbore: true }), rise = v.plate - hole.pocketDepth
1523
+ const roof = cylinderElliptic({ height: rise + 1, startRadius: [hole.pocket / 2, hole.pocket / 2], endRadius: [hole.pocket / 2 - rise - 1, hole.pocket / 2 - rise - 1], center: [0, 0, hole.pocketDepth + (rise + 1) / 2], segments: v.segments })
1524
+ return v.ops.subtract(v.ops.union(plate, ring, lobes, joins, uprights), v.motors.mount(motor, { plate: v.plate, counterbore: true }, v.ops), pilots, screws, heads, roof)
1525
+ }
1526
+ ```
1527
+
1528
+ Sun, planet, the carrier that isn't printed and the output ring are chapter 11's, with the output's flange thicker so its
1529
+ holes can be self-tapped. The elbow's are the same prints.
1530
+
1531
+ ```json projects/arm/objects/sun.json
1532
+ {
1533
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
1534
+ "name": "sun",
1535
+ "title": "Sun gear on a motor's shaft",
1536
+ "version": "0.1.0",
1537
+ "uses": ["x1c"],
1538
+ "engine": "manifold",
1539
+ "orientation": "Gear down, the hub up",
1540
+ "anchors": {
1541
+ "axis": {"at": [0, 0, "0 - gap"], "axis": [0, 0, 1]}
1542
+ },
1543
+ "variables": {
1544
+ "gap": {"value": 0.3, "unit": "mm", "rule": "Clear of the motor plate"},
1545
+ "module": {"value": 1, "unit": "mm", "rule": "The gears'"},
1546
+ "teeth": {"value": 18, "rule": "As the planets' first step"},
1547
+ "width": {"value": 8, "unit": "mm", "rule": "The first stage"},
1548
+ "hub": {"value": 12, "unit": "mm", "rule": "A hub above the teeth, inside the planets' second step"},
1549
+ "tall": {"value": 16, "unit": "mm", "rule": "Up through both stages, so 12 mm of the shaft's flat is gripped"},
1550
+ "tip": {"value": 18.7, "unit": "mm", "rule": "Where the shaft's 24 mm tip is from the sun's underside, 5.3 mm above the mounting face (the elbow's plate is thicker: its sun sets this less)", "interface": true, "tweak": {"min": 10, "max": 24}},
1551
+ "segments": {"value": 64, "rule": "Round enough"}
1552
+ }
1553
+ }
1554
+ ```
1555
+
1556
+ ```js projects/arm/objects/sun.js
1557
+ // The sun with a hub above it, up through both stages, for grip on the shaft's flat.
1558
+ import jscad from '@jscad/modeling'
1559
+ const { cylinder } = jscad.primitives
1560
+
1561
+ export function main (v) {
1562
+ const motor = v.motors.motorModel('nema17')
1563
+ const gear = v.gears.spur({ module: v.module, teeth: v.teeth, width: v.width })
1564
+ const hub = cylinder({ radius: v.hub / 2, height: v.tall, center: [0, 0, v.tall / 2], segments: v.segments })
1565
+ return v.ops.subtract(v.ops.union(gear, hub), v.motors.bore(motor, { depth: v.tall, tip: v.tip }, v.ops))
1566
+ }
1567
+ ```
1568
+
1569
+ ```json projects/arm/objects/planet.json
1570
+ {
1571
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
1572
+ "name": "planet",
1573
+ "title": "Stepped planet",
1574
+ "version": "0.1.0",
1575
+ "uses": ["x1c"],
1576
+ "engine": "manifold",
1577
+ "orientation": "The wider step on the bed",
1578
+ "anchors": {
1579
+ "axis": {"at": [0, 0, "width * 2 + gap"], "axis": [0, 0, -1]}
1580
+ },
1581
+ "variables": {
1582
+ "gap": {"value": 0.3, "unit": "mm", "rule": "Clear of the motor plate"},
1583
+ "module": {"value": 1, "unit": "mm", "rule": "The gears'"},
1584
+ "low": {"value": 18, "rule": "On the sun and the held ring"},
1585
+ "high": {"value": 21, "rule": "On the output ring"},
1586
+ "width": {"value": 8, "unit": "mm", "rule": "Each stage"},
1587
+ "low_chamfer": {"value": 0.25, "unit": "mm", "rule": "The top step's tooth tips slanted in at their root, so they do not overhang the step below"}
1588
+ }
1589
+ }
1590
+ ```
1591
+
1592
+ ```js projects/arm/objects/planet.js
1593
+ // A planet in two steps, in one piece, printed with the wider step on the bed.
1594
+ import jscad from '@jscad/modeling'
1595
+ const { translate } = jscad.transforms
1596
+
1597
+ export function main (v) {
1598
+ const high = v.gears.spur({ module: v.module, teeth: v.high, width: v.width })
1599
+ const low = translate([0, 0, v.width], v.gears.spur({ module: v.module, teeth: v.low, width: v.width, chamfer: v.low_chamfer }))
1600
+ return v.ops.union(high, low)
1601
+ }
1602
+ ```
1603
+
1604
+ ```json projects/arm/objects/speck.json
1605
+ {
1606
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
1607
+ "name": "speck",
1608
+ "title": "Carrier (not printed)",
1609
+ "version": "0.1.0",
1610
+ "role": "reference",
1611
+ "anchors": {
1612
+ "axis": {"at": [0, 0, 0], "axis": [0, 0, 1]},
1613
+ "a": {"at": [18, 0, 0], "axis": [0, 0, 1]},
1614
+ "b": {"at": ["0 - 9", "18 * sind(120)", 0], "axis": [0, 0, 1]},
1615
+ "c": {"at": ["0 - 9", "0 - 18 * sind(120)", 0], "axis": [0, 0, 1]}
1616
+ },
1617
+ "variables": {
1618
+ "r": {"value": 0.2, "unit": "mm", "rule": "A speck, so the planets' joints have something to hang from"},
1619
+ "far": {"value": 110, "unit": "mm", "rule": "Out of the way, above the arm"}
1620
+ }
1621
+ }
1622
+ ```
1623
+
1624
+ ```js projects/arm/objects/speck.js
1625
+ // Nothing is printed here: the planets ride on the sun and the rings. A mark for the planets' joints to be on.
1626
+ import jscad from '@jscad/modeling'
1627
+ const { sphere } = jscad.primitives
1628
+
1629
+ export function main (v) { return sphere({ radius: v.r, center: [0, 0, v.far] }) }
1630
+ ```
1631
+
1632
+ ```json projects/arm/objects/output.json
1633
+ {
1634
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
1635
+ "name": "output",
1636
+ "title": "Output ring and flange",
1637
+ "version": "0.1.0",
1638
+ "uses": ["x1c", "arm", "m3"],
1639
+ "engine": "manifold",
1640
+ "orientation": "The flange on the bed, the teeth standing on it",
1641
+ "description": "Printed flange down and fitted upside down: the same part on the shoulder and the elbow.",
1642
+ "anchors": {
1643
+ "axis": {"at": [0, 0, "top + width"], "axis": [0, 0, -1]},
1644
+ "flange": {"at": [0, 0, 0], "axis": [0, 0, -1]}
1645
+ },
1646
+ "variables": {
1647
+ "top": {"value": "arm.flange", "unit": "mm", "rule": "The flange, printed on the bed", "interface": true},
1648
+ "width": {"value": "arm.gear", "unit": "mm", "rule": "The output ring's face"},
1649
+ "rim": {"value": 66, "unit": "mm", "rule": "Round the 57-tooth ring"},
1650
+ "module": {"value": 1, "unit": "mm", "rule": "The gears'"},
1651
+ "teeth": {"value": 57, "rule": "The output ring"},
1652
+ "pilot": {"value": 2.9, "unit": "mm", "rule": "An M3 screw self-tapped into the flange", "kind": "community"},
1653
+ "middle": {"value": 15, "unit": "mm", "rule": "A hole in the middle for the motor's shaft to come up in"},
1654
+ "bolt": {"value": 20, "unit": "mm", "rule": "Radius of the bolt circle", "interface": true},
1655
+ "segments": {"value": 24, "rule": "Small holes"},
1656
+ "ring_segments": {"value": 96, "rule": "Smooth to the eye and to the gear"},
1657
+ "quarter": {"value": 1.57079633, "rule": "The bolts, a quarter turn apart, in radians"},
1658
+ "bolts": {"value": 4, "rule": "Four"}
1659
+ }
1660
+ }
1661
+ ```
1662
+
1663
+ ```js projects/arm/objects/output.js
1664
+ // The output ring, drawn as it prints: its flange on the bed, the teeth standing on it; it goes on upside down.
1665
+ import jscad from '@jscad/modeling'
1666
+ const { cylinder } = jscad.primitives
1667
+ const { translate } = jscad.transforms
1668
+
1669
+ export function main (v) {
1670
+ const flange = cylinder({ radius: v.rim / 2, height: v.top, center: [0, 0, v.top / 2], segments: v.ring_segments })
1671
+ const ring = translate([0, 0, v.top], v.gears.internal({ module: v.module, teeth: v.teeth, width: v.width, rim: v.rim }))
1672
+ const holes = Array.from({ length: v.bolts }, (_, k) => cylinder({ radius: v.pilot / 2, height: v.top + 1, center: [v.bolt * Math.cos(k * v.quarter), v.bolt * Math.sin(k * v.quarter), v.top / 2], segments: v.segments }))
1673
+ const middle = cylinder({ radius: v.middle / 2, height: v.top + 1, center: [0, 0, v.top / 2], segments: v.ring_segments })
1674
+ return v.ops.subtract(v.ops.union(flange, ring), holes, middle)
1675
+ }
1676
+ ```
1677
+
1678
+ The spindle bolts onto the output's flange and carries the bearing's inner race on a shoulder. The bridge, on the housing's
1679
+ posts, holds the outer race in a seat drawn from the 6800's rule set and this printer's press fit.
1680
+
1681
+ ```json projects/arm/objects/bridge.json
1682
+ {
1683
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
1684
+ "name": "bridge",
1685
+ "title": "Bridge: the 6800's seat",
1686
+ "version": "0.1.0",
1687
+ "uses": ["x1c", "arm", "m3"],
1688
+ "engine": "manifold",
1689
+ "orientation": "Upside to the sky, as it goes on: the pocket opens upward and its ledge prints flat",
1690
+ "description": "Three arms across the housing's posts, holding the bearing that takes the output's tipping load.",
1691
+ "anchors": {
1692
+ "seat": {"at": [0, 0, "thick - width"], "axis": [0, 0, 1]},
1693
+ "under": {"at": [0, 0, 0], "axis": [0, 0, 1]}
1694
+ },
1695
+ "variables": {
1696
+ "thick": {"value": "arm.bridge", "unit": "mm", "rule": "The bearing's width and a ledge", "interface": true},
1697
+ "bore": {"value": "arm.bearing_bore", "unit": "mm", "rule": "The 6800's bore"},
1698
+ "outer": {"value": "arm.bearing_outer", "unit": "mm", "rule": "The 6800's outside"},
1699
+ "width": {"value": "arm.bearing_width", "unit": "mm", "rule": "The 6800's width"},
1700
+ "relief": {"value": "thick - width", "unit": "mm", "rule": "Through the ledge, so the seat prints without a bridge"},
1701
+ "hub": {"value": 34, "unit": "mm", "rule": "Round the pocket, three lines and more of wall"},
1702
+ "post_r": {"value": 37, "unit": "mm", "rule": "On the housing's posts"},
1703
+ "lobe": {"value": 12, "unit": "mm", "rule": "Each arm's width"},
1704
+ "p1": {"value": 30, "unit": "°", "rule": "First post"},
1705
+ "p2": {"value": 150, "unit": "°", "rule": "Second post"},
1706
+ "p3": {"value": 270, "unit": "°", "rule": "Third post"},
1707
+ "rad": {"value": 0.017453293, "rule": "Radians in a degree"},
1708
+ "screw": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
1709
+ "head": {"value": "m3.head + 2 * x1c.fit + x1c.hole_comp", "unit": "mm", "rule": "The screw head's counterbore"},
1710
+ "head_depth": {"value": "m3.head_height + x1c.layer", "unit": "mm", "rule": "A socket head's height, sunk, so the arm passes over"},
1711
+ "segments": {"value": 64, "rule": "Round enough"}
1712
+ }
1713
+ }
1714
+ ```
1715
+
1716
+ ```js projects/arm/objects/bridge.js
1717
+ // A three-armed plate over the gearbox, the bearing's seat in the middle.
1718
+ import jscad from '@jscad/modeling'
1719
+ const { cylinder, cuboid } = jscad.primitives
1720
+ const { rotateZ } = jscad.transforms
1721
+
1722
+ export function main (v) {
1723
+ const posts = [v.p1, v.p2, v.p3].map((a) => a * v.rad), at = (a) => [v.post_r * Math.cos(a), v.post_r * Math.sin(a)]
1724
+ const hub = cylinder({ radius: v.hub / 2, height: v.thick, center: [0, 0, v.thick / 2], segments: v.segments * 2 })
1725
+ const arms = posts.map((a) => rotateZ(a, cuboid({ size: [v.post_r, v.lobe, v.thick], center: [v.post_r / 2, 0, v.thick / 2] })))
1726
+ const lobes = posts.map((a) => cylinder({ radius: v.lobe / 2, height: v.thick, center: [...at(a), v.thick / 2], segments: v.segments }))
1727
+ const seat = v.shapes.bearingSeat({ bore: v.bore, outer_diameter: v.outer, width: v.width }, { fit: 'press', relief: v.relief, through: true, printer: v.x1c, at: [0, 0, v.thick], into: '-z', lead: 0 })
1728
+ const screws = posts.map((a) => cylinder({ radius: v.screw / 2, height: v.thick + 1, center: [...at(a), v.thick / 2], segments: v.segments }))
1729
+ const heads = posts.map((a) => cylinder({ radius: v.head / 2, height: v.head_depth + 1, center: [...at(a), v.thick - (v.head_depth - 1) / 2], segments: v.segments }))
1730
+ return v.ops.subtract(v.ops.union(hub, arms, lobes), seat, screws, heads)
1731
+ }
1732
+ ```
1733
+
1734
+ ```json projects/arm/objects/spindle.json
1735
+ {
1736
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
1737
+ "name": "spindle",
1738
+ "title": "Spindle: disc and shaft",
1739
+ "version": "0.1.0",
1740
+ "uses": ["x1c", "arm", "m3"],
1741
+ "engine": "manifold",
1742
+ "orientation": "The disc on the bed, the shaft up, as it goes on",
1743
+ "description": "The output's flange turns the spindle; the spindle's shaft runs in the 6800 and carries the upper arm on a hexagon at its top.",
1744
+ "anchors": {
1745
+ "down": {"at": [0, 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]},
1746
+ "seat": {"at": [0, 0, "collar_top + width"], "axis": [0, 0, 1], "ref": [1, 0, 0]}
1747
+ },
1748
+ "variables": {
1749
+ "disc": {"value": "arm.disc", "unit": "mm", "rule": "Thick enough for a countersunk M3"},
1750
+ "rim": {"value": 46, "unit": "mm", "rule": "Round the 40 mm bolt circle"},
1751
+ "bolt": {"value": 20, "unit": "mm", "rule": "On the output's bolt circle"},
1752
+ "hole": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
1753
+ "head": {"value": "m3.head", "unit": "mm", "rule": "A countersunk head, flush with the disc so the bridge passes over"},
1754
+ "shaft": {"value": "arm.bearing_bore - x1c.press", "unit": "mm", "rule": "A close slide into the bearing's bore, clamped end to end by the upper arm's screw"},
1755
+ "width": {"value": "arm.bearing_width", "unit": "mm", "rule": "The bearing"},
1756
+ "collar_top": {"value": "arm.bridge_low + arm.bridge - width - arm.output_top", "unit": "mm", "rule": "Where the inner race rests, above the disc's underside"},
1757
+ "shoulder": {"value": 13, "unit": "mm", "rule": "Stops the inner race; clears the outer race"},
1758
+ "hex": {"value": 8, "unit": "mm", "rule": "Hexagon across its flats: inside the bore, drives the upper arm"},
1759
+ "hex_long": {"value": 5, "unit": "mm", "rule": "Into the arm's socket"},
1760
+ "pilot": {"value": 2.9, "unit": "mm", "rule": "An M3 screw self-tapped", "kind": "community"},
1761
+ "pilot_depth": {"value": 12, "unit": "mm", "rule": "For the arm's M3"},
1762
+ "cos30": {"value": "cosd(30)", "rule": "A hexagon, across corners to across flats"},
1763
+ "bolts": {"value": 4, "rule": "On the bolt circle"},
1764
+ "quarter": {"value": 1.57079633, "rule": "A quarter turn in radians"},
1765
+ "segments": {"value": 64, "rule": "Round enough"},
1766
+ "hex_segments": {"value": 6, "rule": "A hexagon's sides"}
1767
+ }
1768
+ }
1769
+ ```
1770
+
1771
+ ```js projects/arm/objects/spindle.js
1772
+ // A disc on the output's flange and a shaft up through the bearing, a hexagon at its top for the arm.
1773
+ import jscad from '@jscad/modeling'
1774
+ const { cylinder } = jscad.primitives
1775
+
1776
+ export function main (v) {
1777
+ const plate = cylinder({ radius: v.rim / 2, height: v.disc, center: [0, 0, v.disc / 2], segments: v.segments * 2 })
1778
+ const top = v.collar_top + v.width
1779
+ const shaft = cylinder({ radius: v.shaft / 2, height: top - 1, center: [0, 0, (top + 1) / 2], segments: v.segments * 2 })
1780
+ const collar = v.shapes.shaftShoulder(v.shaft, { shoulder: v.shoulder, height: v.collar_top - v.disc, at: [0, 0, v.collar_top] })
1781
+ const hex = cylinder({ radius: v.hex / 2 / v.cos30, height: v.hex_long, center: [0, 0, top + v.hex_long / 2], segments: v.hex_segments })
1782
+ const screws = Array.from({ length: v.bolts }, (_, k) => {
1783
+ const c = [v.bolt * Math.cos(k * v.quarter), v.bolt * Math.sin(k * v.quarter), v.disc]
1784
+ return v.shapes.countersink({ hole: v.hole, head: v.head, length: v.disc + 1, at: c, into: '-z' })
1785
+ })
1786
+ const pilot = cylinder({ radius: v.pilot / 2, height: v.pilot_depth, center: [0, 0, top + v.hex_long - v.pilot_depth / 2], segments: v.segments })
1787
+ return v.ops.subtract(v.ops.union(plate, shaft, collar, hex), screws, pilot)
1788
+ }
1789
+ ```
1790
+
1791
+ ### The arm
1792
+
1793
+ The upper arm prints with its top face on the bed, and everything hanging below it rises off that face: the
1794
+ hexagon's socket, the elbow's fixed ring and posts. The elbow's motor bolts to the bed side.
1795
+
1796
+ ```json projects/arm/objects/upper.json
1797
+ {
1798
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
1799
+ "name": "upper",
1800
+ "title": "Upper arm",
1801
+ "version": "0.1.0",
1802
+ "uses": ["x1c", "arm", "m2", "m3"],
1803
+ "engine": "manifold",
1804
+ "orientation": "The arm's top face on the bed: the hub, the elbow's fixed ring and its posts all rise from the one flat face, and go on hanging down",
1805
+ "description": "From the shoulder's hexagon to the elbow's motor. Printed as one part with the elbow's fixed ring, so the elbow's gearbox costs a sun, three planets and an output ring.",
1806
+ "anchors": {
1807
+ "hub": {"at": [0, 0, "thick + collar"], "axis": [0, 0, -1], "ref": [1, 0, 0]},
1808
+ "elbow": {"at": ["long", 0, "thick"], "axis": [0, 0, 1], "ref": [1, 0, 0]},
1809
+ "output": {"at": ["long", 0, "thick + gear + arm_gap"], "axis": [0, 0, 1], "ref": [1, 0, 0]},
1810
+ "motor": {"at": ["long", 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]},
1811
+ "clip1": {"at": ["long + post_r * cosd(p1)", "post_r * sind(p1)", "clip_at"], "axis": [0, 0, 1], "ref": ["cosd(p1)", "sind(p1)", 0]},
1812
+ "clip2": {"at": ["long + post_r * cosd(p2)", "post_r * sind(p2)", "clip_at"], "axis": [0, 0, 1], "ref": ["cosd(p2)", "sind(p2)", 0]},
1813
+ "clip3": {"at": ["long + post_r * cosd(p3)", "post_r * sind(p3)", "clip_at"], "axis": [0, 0, 1], "ref": ["cosd(p3)", "sind(p3)", 0]},
1814
+ "switch": {"at": ["long + (switch_r - switch_pitch / 2) * cosd(switch_a)", "(switch_r - switch_pitch / 2) * sind(switch_a)", "thick + switch_high + switch_half"], "axis": [0, 0, 1], "ref": ["cosd(switch_a)", "sind(switch_a)", 0]},
1815
+ "flag": {"at": ["flag_r", 0, "thick + flag_h"], "axis": [0, 0, 1]},
1816
+ "cable": {"at": ["long / 2", 0, 0], "axis": [0, 0, 1]}
1817
+ },
1818
+ "variables": {
1819
+ "long": {"value": "arm.upper", "unit": "mm", "rule": "Shoulder to elbow", "label": "Upper arm", "show": true, "interface": true},
1820
+ "neck": {"value": 22, "unit": "mm", "rule": "The arm's width: its sag and sideways bending are in the chapter"},
1821
+ "hub": {"value": 36, "unit": "mm", "rule": "Round the hexagon socket"},
1822
+ "collar": {"value": "arm.arm_gap", "unit": "mm", "rule": "A collar on the arm's underside, on the bearing's inner race, so the outer race doesn't drag"},
1823
+ "collar_d": {"value": 13.5, "unit": "mm", "rule": "On the inner race, clear of the outer"},
1824
+ "hex": {"value": 8, "unit": "mm", "rule": "The spindle's hexagon"},
1825
+ "hex_depth": {"value": "thick + collar - floor", "unit": "mm", "rule": "The socket's depth"},
1826
+ "floor": {"value": 3, "unit": "mm", "rule": "What the screw pulls against: a socket's floor"},
1827
+ "hex_fit": {"value": "x1c.fit + x1c.hole_comp", "unit": "mm", "rule": "Across the socket's flats, over the spindle's, printed"},
1828
+ "screw": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
1829
+ "gear": {"value": "arm.gear", "unit": "mm", "rule": "The fixed ring's face"},
1830
+ "arm_gap": {"value": "arm.ring_gap", "unit": "mm", "rule": "Between the fixed ring and the output ring"},
1831
+ "rim": {"value": 62, "unit": "mm", "rule": "Round the 54-tooth ring"},
1832
+ "module": {"value": 1, "unit": "mm", "rule": "The gears'"},
1833
+ "teeth": {"value": 54, "rule": "The fixed ring"},
1834
+ "post_r": {"value": 37, "unit": "mm", "rule": "Three posts outside the output ring"},
1835
+ "post": {"value": 7, "unit": "mm", "rule": "Each post's diameter"},
1836
+ "lobe": {"value": 12, "unit": "mm", "rule": "The plate reaches out to each post"},
1837
+ "p1": {"value": 30, "unit": "°", "rule": "First post"},
1838
+ "p2": {"value": 150, "unit": "°", "rule": "Second post"},
1839
+ "p3": {"value": 270, "unit": "°", "rule": "Third post"},
1840
+ "rad": {"value": 0.017453293, "rule": "Radians in a degree"},
1841
+ "clip_at": {"value": "thick + gear + arm_gap + gear + arm.flange + clip_gap", "unit": "mm", "rule": "Each post's tip, where its clip goes on, just past the output's flange"},
1842
+ "clip_gap": {"value": 0.3, "unit": "mm", "rule": "The output turns under the clips with this to spare"},
1843
+ "pilot": {"value": 2.9, "unit": "mm", "rule": "An M3 screw self-tapped into a post", "kind": "community"},
1844
+ "pilot_depth": {"value": 8, "unit": "mm", "rule": "For an M3 × 10 through a clip"},
1845
+ "flag_r": {"value": 50, "unit": "mm", "rule": "The home flag, as far from the shoulder as its switch"},
1846
+ "flag_h": {"value": 5.5, "unit": "mm", "rule": "Down from the arm's underside far enough to reach the switch's lever"},
1847
+ "flag_wide": {"value": 14, "unit": "mm", "rule": "Along the radius"},
1848
+ "flag_thick": {"value": 4, "unit": "mm", "rule": "Tangential"},
1849
+ "switch_a": {"value": 183, "unit": "°", "rule": "Round from straight on: the forearm's flag meets the lever at 160° of fold"},
1850
+ "switch_r": {"value": 45.7, "unit": "mm", "rule": "The elbow switch, as far from the elbow as the forearm's flag: outside the posts' radius"},
1851
+ "switch_x": {"value": "long + switch_r * cosd(switch_a)", "unit": "mm", "rule": "Elbow switch post"},
1852
+ "switch_y": {"value": "switch_r * sind(switch_a)", "unit": "mm", "rule": "Elbow switch post"},
1853
+ "switch_high": {"value": 9.5, "unit": "mm", "rule": "A post so the switch hangs level with the forearm's flag"},
1854
+ "post_w": {"value": 14, "unit": "mm", "rule": "Elbow switch post, along the radius"},
1855
+ "post_d": {"value": 12, "unit": "mm", "rule": "Elbow switch post, tangential"},
1856
+ "switch_pitch": {"value": "arm.switch_pitch", "unit": "mm", "rule": "The switch's screw spacing"},
1857
+ "switch_pilot": {"value": "m2.clearance - 0.6", "unit": "mm", "rule": "An M2 self-tapped", "kind": "community"},
1858
+ "switch_depth": {"value": 9, "unit": "mm", "rule": "Pilot depth for M2 × 8"},
1859
+ "segments": {"value": 64, "rule": "Round enough"},
1860
+ "ring_segments": {"value": 96, "rule": "The rim's circle"},
1861
+ "hex_segments": {"value": 6, "rule": "A hexagon's sides"},
1862
+ "cos30": {"value": "cosd(30)", "rule": "A hexagon, across corners to across flats"},
1863
+ "thick": {"value": "arm.arm", "unit": "mm", "rule": "The arm's thickness, and the elbow motor's plate: 16 lines of 0.42 and 40 layers"},
1864
+ "bias_d": {"value": 4, "unit": "mm", "rule": "A hole for a rubber band, or a cable tie to hook one on"},
1865
+ "bias_1": {"value": 30, "unit": "mm", "rule": "The shoulder's band, from here to a corner bolt of the base"},
1866
+ "bias_2": {"value": 95, "unit": "mm", "rule": "The elbow's band, from here to the forearm"},
1867
+ "switch_half": {"value": 3, "unit": "mm", "rule": "Half the switch's thickness"}
1868
+ }
1869
+ }
1870
+ ```
1871
+
1872
+ ```js projects/arm/objects/upper.js
1873
+ // The upper arm, drawn as it prints: its top face on the bed, the elbow's ring standing on it, the hub's socket opening
1874
+ // upward. The elbow's NEMA 14 bolts on the bed side, its shaft up through the plate, as chapter 11's housing does.
1875
+ import jscad from '@jscad/modeling'
1876
+ const { cylinder, cylinderElliptic, cuboid, circle } = jscad.primitives
1877
+ const { translate, rotateZ } = jscad.transforms
1878
+ const { extrudeLinear } = jscad.extrusions
1879
+ const { hull } = jscad.hulls
1880
+
1881
+ export function main (v) {
1882
+ const motor = v.motors.motorModel('nema14')
1883
+ const at = (r, a) => [v.long + r * Math.cos(a), r * Math.sin(a)]
1884
+ const posts = [v.p1, v.p2, v.p3].map((a) => a * v.rad)
1885
+ const round = (r, c) => translate([c, 0], circle({ radius: r, segments: v.segments }))
1886
+ const neck = extrudeLinear({ height: v.thick }, hull(round(v.hub / 2, 0), round(v.neck / 2, v.long)))
1887
+ const hub = cylinder({ radius: v.hub / 2, height: v.thick, center: [0, 0, v.thick / 2], segments: v.ring_segments })
1888
+ const plate = cylinder({ radius: v.rim / 2, height: v.thick, center: [v.long, 0, v.thick / 2], segments: v.ring_segments })
1889
+ const ring = translate([v.long, 0, v.thick], v.gears.internal({ module: v.module, teeth: v.teeth, width: v.gear, rim: v.rim }))
1890
+ const lobes = posts.map((a) => cylinder({ radius: v.lobe / 2, height: v.thick, center: [...at(v.post_r, a), v.thick / 2], segments: v.segments }))
1891
+ const joins = posts.map((a) => translate([v.long, 0, 0], rotateZ(a, cuboid({ size: [v.post_r - v.rim / 2 + 2, v.lobe, v.thick], center: [(v.post_r + v.rim / 2 - 2) / 2, 0, v.thick / 2] }))))
1892
+ const uprights = posts.map((a) => cylinder({ radius: v.post / 2, height: v.clip_at, center: [...at(v.post_r, a), v.clip_at / 2], segments: v.segments }))
1893
+ const pilots = posts.map((a) => cylinder({ radius: v.pilot / 2, height: v.pilot_depth, center: [...at(v.post_r, a), v.clip_at - v.pilot_depth / 2], segments: v.segments }))
1894
+ const collar = cylinder({ radius: v.collar_d / 2, height: v.collar + 1, center: [0, 0, v.thick + (v.collar - 1) / 2], segments: v.segments })
1895
+ const socket = cylinder({ radius: (v.hex + v.hex_fit) / 2 / v.cos30, height: v.hex_depth + 1, center: [0, 0, v.floor + (v.hex_depth + 1) / 2], segments: v.hex_segments })
1896
+ const through = cylinder({ radius: v.screw / 2, height: v.floor + 1, center: [0, 0, (v.floor - 1) / 2], segments: v.segments })
1897
+ const flag = cuboid({ size: [v.flag_wide, v.flag_thick, v.flag_h], center: [v.flag_r, 0, v.thick + v.flag_h / 2] })
1898
+ const a = v.switch_a * v.rad
1899
+ const switchPost = translate([v.switch_x, v.switch_y, 0], rotateZ(a, cuboid({ size: [v.post_w, v.post_d, v.thick + v.switch_high], center: [0, 0, (v.thick + v.switch_high) / 2] })))
1900
+ const switchPilots = [-1, 1].map((s) => cylinder({ radius: v.switch_pilot / 2, height: v.switch_depth, center: [v.switch_x + s * v.switch_pitch / 2 * Math.cos(a), v.switch_y + s * v.switch_pitch / 2 * Math.sin(a), v.thick + v.switch_high - v.switch_depth / 2], segments: v.segments }))
1901
+ const bands = [v.bias_1, v.bias_2].map((x) => cylinder({ radius: v.bias_d / 2, height: v.thick + 1, center: [x, 0, v.thick / 2], segments: v.segments }))
1902
+ const hole = v.motors.mountModel(motor, { plate: v.thick, counterbore: true }), rise = v.thick - hole.pocketDepth
1903
+ const roof = translate([v.long, 0, 0], cylinderElliptic({ height: rise + 1, startRadius: [hole.pocket / 2, hole.pocket / 2], endRadius: [hole.pocket / 2 - rise - 1, hole.pocket / 2 - rise - 1], center: [0, 0, hole.pocketDepth + (rise + 1) / 2], segments: v.segments }))
1904
+ const mount = translate([v.long, 0, 0], v.motors.mount(motor, { plate: v.thick, counterbore: true }, v.ops))
1905
+ return v.ops.subtract(v.ops.union(neck, hub, plate, ring, lobes, joins, uprights, collar, flag, switchPost), socket, through, pilots, switchPilots, bands, mount, roof)
1906
+ }
1907
+ ```
1908
+
1909
+ ```json projects/arm/objects/clip.json
1910
+ {
1911
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
1912
+ "name": "clip",
1913
+ "title": "Retaining clip",
1914
+ "version": "0.1.0",
1915
+ "uses": ["x1c", "m3"],
1916
+ "orientation": "Flat on the bed",
1917
+ "description": "Holds the elbow's output ring from dropping off its posts.",
1918
+ "anchors": {
1919
+ "post": {"at": [0, 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]}
1920
+ },
1921
+ "variables": {
1922
+ "reach": {"value": 6, "unit": "mm", "rule": "In over the flange's edge, 4 mm"},
1923
+ "back": {"value": 4, "unit": "mm", "rule": "Round the post"},
1924
+ "wide": {"value": 8, "unit": "mm", "rule": "As wide as the post and a little"},
1925
+ "thick": {"value": 3, "unit": "mm", "rule": "Fifteen layers"},
1926
+ "hole": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
1927
+ "segments": {"value": 24, "rule": "Small round hole"}
1928
+ }
1929
+ }
1930
+ ```
1931
+
1932
+ ```js projects/arm/objects/clip.js
1933
+ // A flat tab screwed to a post, its nose over the flange.
1934
+ import jscad from '@jscad/modeling'
1935
+ const { cuboid, cylinder } = jscad.primitives
1936
+ const { subtract } = jscad.booleans
1937
+
1938
+ export function main (v) {
1939
+ const tab = cuboid({ size: [v.reach + v.back, v.wide, v.thick], center: [(v.back - v.reach) / 2, 0, v.thick / 2] })
1940
+ return subtract(tab, cylinder({ radius: v.hole / 2, height: v.thick + 1, center: [0, 0, v.thick / 2], segments: v.segments }))
1941
+ }
1942
+ ```
1943
+
1944
+ ```json projects/arm/objects/forearm.json
1945
+ {
1946
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
1947
+ "name": "forearm",
1948
+ "title": "Forearm",
1949
+ "version": "0.1.0",
1950
+ "uses": ["x1c", "arm", "m3"],
1951
+ "engine": "manifold",
1952
+ "orientation": "The bar flat on the bed, the boss and flag up",
1953
+ "anchors": {
1954
+ "hub": {"at": [0, 0, "boss"], "axis": [0, 0, -1], "ref": [1, 0, 0]},
1955
+ "holder": {"at": ["long", 0, "mid"], "axis": [0, 1, 0], "ref": [1, 0, 0]},
1956
+ "flag": {"at": ["flag_x", "flag_y", "bar + flag_h"], "axis": [0, 0, 1]},
1957
+ "cable": {"at": ["long / 2", 0, "bar"], "axis": [0, 0, 1]}
1958
+ },
1959
+ "variables": {
1960
+ "long": {"value": "arm.fore - pen_x", "unit": "mm", "rule": "To the holder's bolts: the 110 mm link less the holder's own reach", "label": "Forearm", "show": true, "interface": true},
1961
+ "pen_x": {"value": 54, "unit": "mm", "rule": "From the holder's bolts to the pen, its own reach"},
1962
+ "bar": {"value": 8, "unit": "mm", "rule": "Thickness, sized in the chapter"},
1963
+ "wide": {"value": 20, "unit": "mm", "rule": "Width by the boss"},
1964
+ "mid": {"value": "arm.arm_mid", "unit": "mm", "rule": "Half the thickness"},
1965
+ "boss": {"value": "arm.boss", "unit": "mm", "rule": "The bar passes under the elbow's clips, the boss above reaches the flange"},
1966
+ "boss_d": {"value": 46, "unit": "mm", "rule": "Round the 40 mm bolt circle"},
1967
+ "screw": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
1968
+ "head": {"value": "m3.head + 2 * x1c.fit + x1c.hole_comp", "unit": "mm", "rule": "The screw's head, counterbored in the bed side"},
1969
+ "head_depth": {"value": "m3.head_height + x1c.layer", "unit": "mm", "rule": "Sunk"},
1970
+ "bolt": {"value": 20, "unit": "mm", "rule": "The output's bolt circle, radius"},
1971
+ "bolts": {"value": 4, "rule": "On the bolt circle"},
1972
+ "quarter": {"value": 1.57079633, "rule": "A quarter turn in radians"},
1973
+ "block": {"value": 16, "unit": "mm", "rule": "The holder's thickness, between the cheeks"},
1974
+ "cheek": {"value": 6, "unit": "mm", "rule": "Each cheek's thickness"},
1975
+ "slot_fit": {"value": "x1c.fit + x1c.hole_comp", "unit": "mm", "rule": "Across the slot, over the holder"},
1976
+ "slot_from": {"value": 8, "unit": "mm", "rule": "The slot runs back this far before the holder's bolts"},
1977
+ "reach": {"value": 7, "unit": "mm", "rule": "Past the bolts, to the slot's end: stops before the servo's tab"},
1978
+ "pitch": {"value": 4, "unit": "mm", "rule": "Half the spacing between the holder's two bolts"},
1979
+ "flag_x": {"value": 44.75, "unit": "mm", "rule": "The home flag, along the arm"},
1980
+ "flag_y": {"value": 9.5, "unit": "mm", "rule": "On the cheek's far edge, past the elbow's posts: about 46 mm from the elbow"},
1981
+ "flag_h": {"value": 12, "unit": "mm", "rule": "Up to the elbow switch's lever"},
1982
+ "flag_wide": {"value": 5.5, "unit": "mm", "rule": "Along the arm"},
1983
+ "flag_thick": {"value": 4, "unit": "mm", "rule": "Sideways"},
1984
+ "segments": {"value": 64, "rule": "Round enough"},
1985
+ "bias_d": {"value": 4, "unit": "mm", "rule": "A hole for the elbow's rubber band"},
1986
+ "bias_at": {"value": 30, "unit": "mm", "rule": "Clear of the boss"}
1987
+ }
1988
+ }
1989
+ ```
1990
+
1991
+ ```js projects/arm/objects/forearm.js
1992
+ // A short bar from the elbow's output to a yoke round the pen holder's block.
1993
+ import jscad from '@jscad/modeling'
1994
+ const { cylinder, cuboid, circle, rectangle } = jscad.primitives
1995
+ const { translate } = jscad.transforms
1996
+ const { extrudeLinear } = jscad.extrusions
1997
+ const { hull } = jscad.hulls
1998
+
1999
+ export function main (v) {
2000
+ const endWide = v.block + v.cheek * 2, tip = v.long + v.reach
2001
+ const dot = (r, x) => translate([x, 0], circle({ radius: r, segments: v.segments }))
2002
+ const bar = extrudeLinear({ height: v.bar }, hull(dot(v.wide / 2, 0), rectangle({ size: [1, endWide], center: [tip - 1 / 2, 0] })))
2003
+ const boss = cylinder({ radius: v.boss_d / 2, height: v.boss, center: [0, 0, v.boss / 2], segments: v.segments * 2 })
2004
+ const slot = cuboid({ size: [tip + 1 - (v.long - v.slot_from), v.block + v.slot_fit, v.bar + 1], center: [(tip + 1 + v.long - v.slot_from) / 2, 0, v.bar / 2] })
2005
+ const holes = [-1, 1].map((s) => v.shapes.teardropHole({ d: v.screw, length: endWide + 1, at: [v.long + s * v.pitch, 0 - endWide / 2 - 1 / 2, v.mid], into: '+y', through: true }))
2006
+ const bolts = Array.from({ length: v.bolts }, (_, k) => cylinder({ radius: v.screw / 2, height: v.boss + 1, center: [v.bolt * Math.cos(k * v.quarter), v.bolt * Math.sin(k * v.quarter), v.boss / 2], segments: v.segments }))
2007
+ const heads = Array.from({ length: v.bolts }, (_, k) => cylinder({ radius: v.head / 2, height: v.head_depth + 1, center: [v.bolt * Math.cos(k * v.quarter), v.bolt * Math.sin(k * v.quarter), (v.head_depth - 1) / 2], segments: v.segments }))
2008
+ const flag = cuboid({ size: [v.flag_wide, v.flag_thick, v.flag_h], center: [v.flag_x, v.flag_y, v.bar + v.flag_h / 2] })
2009
+ const band = cylinder({ radius: v.bias_d / 2, height: v.bar + 1, center: [v.bias_at, 0, v.bar / 2], segments: v.segments })
2010
+ return v.ops.subtract(v.ops.union(bar, boss, flag), slot, holes, bolts, heads, band)
2011
+ }
2012
+ ```
2013
+
2014
+ ### The pen holder
2015
+
2016
+ A parallel guide of two tapered leaves, printed flat in PETG, is the pen's linear bearing and its spring at once: the
2017
+ leaves are its pressure. At rest the leaves are straight and the tip sits 1 mm below the paper, so the paper pushes the
2018
+ shuttle up 1 mm: 0.6 N on the pen. An SG90 on its stock horn lifts the shuttle by a lug, 5 mm at the most: 3 N, against
2019
+ the servo's 9.8 N at 18 mm of horn, 3 times over, and 0.80% strain in the leaves against the PETG's limit. (The figures
2020
+ come out of the build: the holder's `.js` computes them and refuses to build if the strain is too much.)
2021
+
2022
+ ```json projects/arm/objects/holder.json
2023
+ {
2024
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
2025
+ "name": "holder",
2026
+ "title": "Pen holder with lift",
2027
+ "version": "0.1.0",
2028
+ "uses": ["x1c", "arm", "petg", "m2", "m3"],
2029
+ "engine": "manifold",
2030
+ "material": "PETG",
2031
+ "orientation": "Flat on the bed: the drawing's x and y are the bed's, the pen's axis along y. The leaves bend within their layers. PETG: it creeps less than PLA held bent",
2032
+ "description": "A shuttle holding the pen on two tapered leaves: a parallel guide. Its spring is the pen's pressure; an SG90 on a stock horn lifts it. Drawn at rest, the leaves straight.",
2033
+ "anchors": {
2034
+ "mount": {"at": [0, 0, "half"], "axis": [0, 0, -1], "ref": [1, 0, 0]},
2035
+ "tool": {"at": ["pen_x", "paper", "half"], "axis": [0, 1, 0], "ref": [1, 0, 0]},
2036
+ "pen": {"at": ["pen_x", "paper - arm.press", "half"], "axis": [0, 1, 0], "ref": [1, 0, 0]},
2037
+ "servo": {"at": ["xh", "yh", "thick"], "axis": [0, 0, 1], "ref": [1, 0, 0]},
2038
+ "horn": {"at": ["xh", "yh", "thick + horn_at"], "axis": [0, 0, 1], "ref": [1, 0, 0]},
2039
+ "cable": {"at": ["xh", "yh", 0], "axis": [0, 0, 1]}
2040
+ },
2041
+ "variables": {
2042
+ "thick": {"value": 16, "unit": "mm", "rule": "The block's thickness, 80 layers, and the leaves' width", "interface": true},
2043
+ "half": {"value": "thick / 2", "unit": "mm", "rule": "Half of it"},
2044
+ "pen_x": {"value": 54, "unit": "mm", "rule": "From the bolts to the pen", "interface": true},
2045
+ "paper": {"value": "0 - arm.fore_mid", "unit": "mm", "rule": "The paper, in this frame: the bench is the sheet's plane, the bolts are level with the forearm's middle"},
2046
+ "pen_d": {"value": 10.4, "unit": "mm", "rule": "A 10 mm fineliner, 0.2 mm each side; set this to your pen"},
2047
+ "pen_wall": {"value": 7, "unit": "mm", "rule": "The shuttle reaches this far past the pen each way"},
2048
+ "leaf_t": {"value": "x1c.line * 2", "unit": "mm", "rule": "Two lines: stiff enough against pen drag, soft enough for the servo"},
2049
+ "leaf_l": {"value": 38, "unit": "mm", "rule": "Long enough to keep the strain small at full lift", "label": "Leaf", "show": true},
2050
+ "taper": {"value": 0.3, "rule": "Thickened toward both ends: the strain spread along the leaf"},
2051
+ "fillet": {"value": "x1c.line * 3", "unit": "mm", "rule": "A round where each leaf meets its block: no square corner to yield at"},
2052
+ "travel": {"value": 5, "unit": "mm", "rule": "1 mm below the paper at rest, to 4 mm above it lifted"},
2053
+ "gap": {"value": 20, "unit": "mm", "rule": "Between the leaves: resists the pen's drag twisting the shuttle"},
2054
+ "block_x": {"value": 8, "unit": "mm", "rule": "Half the bolt block's length along x"},
2055
+ "shuttle": {"value": 14, "unit": "mm", "rule": "Half the shuttle's height along y"},
2056
+ "bolt_y": {"value": 4, "unit": "mm", "rule": "Half the bolts' spacing along x"},
2057
+ "bolt": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance, through the block"},
2058
+ "clamp": {"value": "m3.clearance - 0.6", "unit": "mm", "rule": "The pen's clamp screw, self-tapped through the shuttle's wall", "kind": "community"},
2059
+ "lug_x0": {"value": 43, "unit": "mm", "rule": "The lug the horn lifts, its left edge"},
2060
+ "lug_x1": {"value": 47.5, "unit": "mm", "rule": "Its right edge, clear of the pen"},
2061
+ "lug_y": {"value": -22.2, "unit": "mm", "rule": "Its underside, a hair above the horn at rest"},
2062
+ "horn_at": {"value": 13.3, "unit": "mm", "rule": "Horn seat above the tabs: the case's top and boss"},
2063
+ "lug_top": {"value": "thick + horn_at + 2", "unit": "mm", "rule": "Up to the horn's top"},
2064
+ "lug_wide": {"value": 4, "unit": "mm", "rule": "The lug's depth along y where it stands up: strong enough for 3 N"},
2065
+ "xh": {"value": 30, "unit": "mm", "rule": "The servo's shaft, along x"},
2066
+ "yh": {"value": -25, "unit": "mm", "rule": "The servo's shaft, along y"},
2067
+ "frame_x": {"value": 41.4, "unit": "mm", "rule": "The servo frame's right edge"},
2068
+ "frame_top": {"value": -16, "unit": "mm", "rule": "The frame's top edge, clear of the lower leaf's travel"},
2069
+ "frame_low": {"value": -37, "unit": "mm", "rule": "The frame's bottom edge"},
2070
+ "segments": {"value": 32, "rule": "Round enough"}
2071
+ }
2072
+ }
2073
+ ```
2074
+
2075
+ ```js projects/arm/objects/holder.js
2076
+ // All in one flat print: a fixed frame with the servo, two tapered leaves, the shuttle with the pen's bore and a lug for the horn.
2077
+ import jscad from '@jscad/modeling'
2078
+ const { cuboid, cylinder } = jscad.primitives
2079
+ const { translate } = jscad.transforms
2080
+
2081
+ export function main (v) {
2082
+ const f = v.flexures, material = f.flexureMaterial({ modulus: v.petg.modulus, strength: v.petg.strength, name: 'PETG' })
2083
+ const leaf = { length: v.leaf_l, thickness: v.leaf_t, width: v.thick, gap: v.gap, taper: v.taper, fillet: v.fillet, shuttle: v.pen_x - v.block_x - v.leaf_l + v.pen_wall, base: v.block_x * 2 }
2084
+ const model = f.parallelGuideModel(leaf, { E: v.petg.modulus })
2085
+ for (const x of f.printable({ thickness: v.leaf_t, width: v.thick, travel: v.travel }, v.x1c, material, model)) if (x.level === 'fail') throw new Error(x.text)
2086
+ const guide = translate([v.block_x, 0, 0], f.parallelGuide(leaf))
2087
+ const block = cuboid({ size: [v.block_x * 2, v.shuttle * 2, v.thick], center: [0, 0, v.half] })
2088
+ const frameBody = cuboid({ size: [v.frame_x + v.block_x, v.frame_top - v.frame_low, v.thick], center: [(v.frame_x - v.block_x) / 2, (v.frame_top + v.frame_low) / 2, v.half] })
2089
+ const tail = cuboid({ size: [v.block_x * 2, v.frame_top - v.frame_low + v.shuttle * 2 - 1, v.thick], center: [0, (v.frame_top + v.frame_low + v.shuttle * 2) / 2 - 1 / 2 - 1, v.half] })
2090
+ const shuttleBlock = cuboid({ size: [v.pen_x + v.pen_wall - v.block_x - v.leaf_l, v.shuttle * 2, v.thick], center: [v.block_x + v.leaf_l + (v.pen_x + v.pen_wall - v.block_x - v.leaf_l) / 2, 0, v.half] })
2091
+ const tabBody = cuboid({ size: [v.lug_x1 - v.lug_x0, (0 - v.shuttle) - v.lug_y + 1, v.thick], center: [(v.lug_x0 + v.lug_x1) / 2, (v.lug_y + (0 - v.shuttle) + 1) / 2, v.half] })
2092
+ const lug = cuboid({ size: [v.lug_x1 - v.lug_x0, v.lug_wide, v.lug_top - v.thick + 1], center: [(v.lug_x0 + v.lug_x1) / 2, v.lug_y + v.lug_wide / 2, v.thick + (v.lug_top - v.thick - 1) / 2] })
2093
+ const bore = v.shapes.teardropHole({ d: v.pen_d, length: v.shuttle * 2 + 1, at: [v.pen_x, 0 - v.shuttle - 1 / 2, v.half], into: '+y', through: true })
2094
+ const clamp = cylinder({ radius: v.clamp / 2, height: v.thick, center: [v.pen_x, 0, v.thick - v.half / 2], segments: v.segments })
2095
+ const servo = translate([v.xh, v.yh, v.thick], v.motors.mount(v.motors.motorModel('sg90'), { plate: v.thick }, v.ops))
2096
+ const holes = [-1, 1].map((s) => cylinder({ radius: v.bolt / 2, height: v.thick + 1, center: [s * v.bolt_y, 0, v.half], segments: v.segments }))
2097
+ return v.ops.subtract(v.ops.union(guide, block, frameBody, tail, shuttleBlock, tabBody, lug), bore, clamp, servo, holes)
2098
+ }
2099
+ ```
2100
+
2101
+ Two more bought parts, drawn from a few measurements of the ones on the bench: the pen, and the horn.
2102
+
2103
+ ```json projects/arm/objects/pen.json
2104
+ {
2105
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
2106
+ "name": "pen",
2107
+ "title": "Pen (bought, a fineliner)",
2108
+ "version": "0.1.0",
2109
+ "role": "reference",
2110
+ "anchors": {
2111
+ "tip": {"at": [0, 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]}
2112
+ },
2113
+ "variables": {
2114
+ "d": {"value": 10, "unit": "mm", "rule": "A fineliner's body, about: measure yours and set the holder's bore"},
2115
+ "long": {"value": 140, "unit": "mm", "rule": "Its length"},
2116
+ "point": {"value": 15, "unit": "mm", "rule": "The tapered point"},
2117
+ "tip_d": {"value": 2, "unit": "mm", "rule": "At the tip"},
2118
+ "segments": {"value": 32, "rule": "Round enough"}
2119
+ }
2120
+ }
2121
+ ```
2122
+
2123
+ ```js projects/arm/objects/pen.js
2124
+ // A fineliner, drawn from a few measurements.
2125
+ import jscad from '@jscad/modeling'
2126
+ const { cylinder, cylinderElliptic } = jscad.primitives
2127
+
2128
+ export function main (v) {
2129
+ const body = cylinder({ radius: v.d / 2, height: v.long - v.point, center: [0, 0, v.point + (v.long - v.point) / 2], segments: v.segments })
2130
+ const cone = cylinderElliptic({ height: v.point, startRadius: [v.tip_d / 2, v.tip_d / 2], endRadius: [v.d / 2, v.d / 2], center: [0, 0, v.point / 2], segments: v.segments })
2131
+ return v.ops.union(body, cone)
2132
+ }
2133
+ ```
2134
+
2135
+ ```json projects/arm/objects/horn.json
2136
+ {
2137
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
2138
+ "name": "horn",
2139
+ "title": "Servo horn (bought, comes with the SG90)",
2140
+ "version": "0.1.0",
2141
+ "role": "reference",
2142
+ "anchors": {
2143
+ "axis": {"at": [0, 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]}
2144
+ },
2145
+ "variables": {
2146
+ "reach": {"value": 18, "unit": "mm", "rule": "Axis to the arm's tip, a single-arm horn as sold, about: measure yours", "kind": "estimate", "source": "Measured on one horn: SG90 horns vary"},
2147
+ "wide": {"value": 5, "unit": "mm", "rule": "The arm's width"},
2148
+ "thick": {"value": 2, "unit": "mm", "rule": "The arm's thickness"},
2149
+ "hub": {"value": 7, "unit": "mm", "rule": "Round the spline"},
2150
+ "segments": {"value": 24, "rule": "Round enough"}
2151
+ }
2152
+ }
2153
+ ```
2154
+
2155
+ ```js projects/arm/objects/horn.js
2156
+ // The arm a servo comes with, pointing along x at rest.
2157
+ import jscad from '@jscad/modeling'
2158
+ const { cuboid, cylinder } = jscad.primitives
2159
+
2160
+ export function main (v) {
2161
+ const arm = cuboid({ size: [v.reach, v.wide, v.thick], center: [v.reach / 2, 0, v.thick / 2] })
2162
+ const hub = cylinder({ radius: v.hub / 2, height: v.thick, center: [0, 0, v.thick / 2], segments: v.segments })
2163
+ return v.ops.union(arm, hub)
2164
+ }
2165
+ ```
2166
+
2167
+ ### The assembly
2168
+
2169
+ One assembly, every output. The `task` block says what it is for; the `planetary` blocks are chapter 11's; the
2170
+ drivers, the supply and the wires are `bought` items and `wires` entries; the joints carry their home switches
2171
+ and the error terms that read the rules.
2172
+
2173
+ ```json projects/arm/assemblies/arm.json
2174
+ {
2175
+ "$schema": "https://jonibach.github.io/rulecad/schemas/assembly.schema.json",
2176
+ "title": "SCARA arm that draws",
2177
+ "kind": "fit",
2178
+ "description": "A two-link arm on a bench, an A5 sheet in front of it. The task, the wires, the drivers and the supply are all here: one assembly, every output.",
2179
+ "uses": ["arm"],
2180
+ "items": [
2181
+ { "id": "base", "object": "base" },
2182
+ { "id": "m1", "motor": { "model": "17HS4401", "drives": "drive", "speed": 300, "duty": 0.3, "driver": "d1", "current": 0.5, "microsteps": 8 } },
2183
+ { "id": "housing", "object": "housing", "at": [0, 0, "arm.face"] },
2184
+ { "id": "sun", "object": "sun" },
2185
+ { "id": "carrier", "object": "speck" },
2186
+ { "id": "p1", "object": "planet" }, { "id": "p2", "object": "planet" }, { "id": "p3", "object": "planet" },
2187
+ { "id": "output", "object": "output" },
2188
+ { "id": "spindle", "object": "spindle" },
2189
+ { "id": "bridge", "object": "bridge", "at": [0, 0, "arm.bridge_low"] },
2190
+ { "id": "b1", "bought": "bearing-6800", "at": [0, 0, "arm.bridge_low + arm.bridge - arm.bearing_width"] },
2191
+ { "id": "upper", "object": "upper" },
2192
+ { "id": "m2", "motor": { "model": "nema14", "drives": "edrive", "speed": 300, "duty": 0.3, "driver": "d2", "current": 0.5, "microsteps": 8 } },
2193
+ { "id": "esun", "object": "sun", "set": { "tip": 11.7 } },
2194
+ { "id": "ecarrier", "object": "speck" }, { "id": "ering", "object": "speck" },
2195
+ { "id": "ep1", "object": "planet" }, { "id": "ep2", "object": "planet" }, { "id": "ep3", "object": "planet" },
2196
+ { "id": "eoutput", "object": "output" },
2197
+ { "id": "clip1", "object": "clip" }, { "id": "clip2", "object": "clip" }, { "id": "clip3", "object": "clip" },
2198
+ { "id": "forearm", "object": "forearm" },
2199
+ { "id": "holder", "object": "holder" },
2200
+ { "id": "servo", "motor": { "model": "sg90", "drives": "lift_servo", "duty": 0.05 } },
2201
+ { "id": "horn", "object": "horn" },
2202
+ { "id": "pen", "object": "pen" },
2203
+ { "id": "es1", "bought": "endstop-10t85" },
2204
+ { "id": "es2", "bought": "endstop-10t85" },
2205
+ { "id": "d1", "bought": "drv8825", "at": [-300, -30, 8] },
2206
+ { "id": "d2", "bought": "drv8825", "at": [-300, 0, 8] },
2207
+ { "id": "shield", "bought": "cnc-shield-v3", "at": [-300, 0, 0] },
2208
+ { "id": "psu", "bought": "supply-24v", "variant": "LRS-50-24", "at": [-330, 150, 0] }
2209
+ ],
2210
+ "joints": [
2211
+ { "id": "m1_on", "type": "fixed", "parent": "housing.motor", "child": "m1.face" },
2212
+ { "id": "drive", "type": "revolute", "parent": "housing.axis", "child": "sun.axis", "min": -4570, "max": 4588, "label": "Shoulder motor" },
2213
+ { "id": "turn", "type": "revolute", "parent": "housing.axis", "child": "carrier.axis", "min": -4570, "max": 4588 },
2214
+ { "id": "s1", "type": "revolute", "parent": "carrier.a", "child": "p1.axis", "min": -30000, "max": 30000 },
2215
+ { "id": "s2", "type": "revolute", "parent": "carrier.b", "child": "p2.axis", "min": -30000, "max": 30000 },
2216
+ { "id": "s3", "type": "revolute", "parent": "carrier.c", "child": "p3.axis", "min": -30000, "max": 30000 },
2217
+ { "id": "out", "type": "revolute", "parent": { "item": "housing", "at": [0, 0, "arm.plate + arm.gear + arm.ring_gap"], "axis": [0, 0, 1] }, "child": "output.axis", "min": -116, "max": 125, "label": "Shoulder", "support": { "bearings": ["b1"] },
2218
+ "errors": { "play": "arm.play_shoulder", "twist": "arm.twist_shoulder" }, "home": { "endstop": "es1.lever", "direction": -1 } },
2219
+ { "id": "spindle_on", "type": "fixed", "parent": "output.flange", "child": "spindle.down" },
2220
+ { "id": "upper_on", "type": "fixed", "parent": "spindle.seat", "child": "upper.hub" },
2221
+ { "id": "m2_on", "type": "fixed", "parent": "upper.motor", "child": "m2.face" },
2222
+ { "id": "edrive", "type": "revolute", "parent": "upper.elbow", "child": "esun.axis", "min": -5900, "max": 180, "label": "Elbow motor" },
2223
+ { "id": "ering_on", "type": "fixed", "parent": "upper.elbow", "child": "ering.axis" },
2224
+ { "id": "eturn", "type": "revolute", "parent": "upper.elbow", "child": "ecarrier.axis", "min": -5900, "max": 180 },
2225
+ { "id": "es1a", "type": "revolute", "parent": "ecarrier.a", "child": "ep1.axis", "min": -30000, "max": 30000 },
2226
+ { "id": "es2a", "type": "revolute", "parent": "ecarrier.b", "child": "ep2.axis", "min": -30000, "max": 30000 },
2227
+ { "id": "es3a", "type": "revolute", "parent": "ecarrier.c", "child": "ep3.axis", "min": -30000, "max": 30000 },
2228
+ { "id": "elbow", "type": "revolute", "parent": "upper.output", "child": "eoutput.axis", "min": 0, "max": 160, "label": "Elbow", "support": { "clips": ["clip1", "clip2", "clip3"], "pitch": 74 },
2229
+ "errors": { "play": "arm.play_elbow", "twist": "arm.twist_elbow" }, "home": { "endstop": "es2.lever", "direction": 1 } },
2230
+ { "id": "c1_on", "type": "fixed", "parent": "upper.clip1", "child": "clip1.post" },
2231
+ { "id": "c2_on", "type": "fixed", "parent": "upper.clip2", "child": "clip2.post" },
2232
+ { "id": "c3_on", "type": "fixed", "parent": "upper.clip3", "child": "clip3.post" },
2233
+ { "id": "forearm_on", "type": "fixed", "parent": "eoutput.flange", "child": "forearm.hub" },
2234
+ { "id": "holder_on", "type": "fixed", "parent": "forearm.holder", "child": "holder.mount" },
2235
+ { "id": "servo_on", "type": "fixed", "parent": "holder.servo", "child": "servo.face" },
2236
+ { "id": "lift_servo", "type": "revolute", "parent": "holder.horn", "child": "horn.axis", "min": 0, "max": 20, "label": "Pen lift" },
2237
+ { "id": "lift", "type": "prismatic", "parent": "holder.pen", "child": "pen.tip", "min": 0, "max": 5, "follow": "lift_servo", "ratio": 0.25 },
2238
+ { "id": "es1_on", "type": "fixed", "parent": "base.switch", "child": "es1.left" },
2239
+ { "id": "es2_on", "type": "fixed", "parent": "upper.switch", "child": "es2.left" }
2240
+ ],
2241
+ "planetary": [
2242
+ { "sun": "sun", "carrier": "carrier", "ring": "housing", "planets": ["p1", "p2", "p3"], "drive": "sun", "module": 1, "teeth": [18, 18, 54], "output": { "ring": "output", "planet": 21, "teeth": 57 } },
2243
+ { "sun": "esun", "carrier": "ecarrier", "ring": "ering", "planets": ["ep1", "ep2", "ep3"], "drive": "sun", "module": 1, "teeth": [18, 18, 54], "output": { "ring": "eoutput", "planet": 21, "teeth": 57 } }
2244
+ ],
2245
+ "fits": [
2246
+ { "a": "m1", "b": "housing", "fastens": true, "min": -0.1, "note": "The shoulder motor, on its four screws, its boss seated in the plate's pocket" },
2247
+ { "a": "m1", "b": "sun", "shaft": true, "note": "The shaft in the sun" },
2248
+ { "a": "m2", "b": "esun", "shaft": true, "note": "The elbow motor's shaft in its sun" },
2249
+ { "a": "m2", "b": "upper", "fastens": true, "min": -0.1, "note": "The elbow motor, on its four screws, its boss seated in the plate's pocket" },
2250
+ { "a": "housing", "b": "base", "fastens": true, "min": 0, "note": "The housing, on the base's three columns" },
2251
+ { "a": "bridge", "b": "housing", "fastens": true, "min": 0, "note": "The bridge, on the housing's posts" },
2252
+ { "a": "b1", "b": "bridge", "seat": "press", "note": "The 6800 in its seat" },
2253
+ { "a": "es1", "b": "base", "fastens": true, "min": -0.1, "note": "The home switch on its post, 0.1 mm of resting contact allowed" },
2254
+ { "a": "es2", "b": "upper", "fastens": true, "min": -0.1, "note": "The elbow's home switch on its post" },
2255
+ { "a": "es1", "b": "upper", "min": -30, "note": "The arm's flag on the home switch's lever at the end of the range" },
2256
+ { "a": "es2", "b": "forearm", "min": -30, "note": "The forearm's flag on the elbow switch's lever" },
2257
+ { "a": "horn", "b": "holder", "min": -30, "note": "The horn lifts the shuttle's lug: drawn at rest, the lug doesn't rise here" },
2258
+ { "a": "ecarrier", "b": "ering", "min": -1, "note": "Two specks: neither is printed" },
2259
+ { "a": "d1", "b": "shield", "fastens": true, "min": -20, "note": "Plugged in" },
2260
+ { "a": "d2", "b": "shield", "fastens": true, "min": -20, "note": "Plugged in" }
2261
+ ],
2262
+ "wires": [
2263
+ { "id": "shoulder", "from": "m1.connector", "to": "shield.X", "via": ["base.cable"], "gauge": "awg24", "colour": "black, red, green, blue", "connectors": ["JST-XH 4 pin", "screw terminal"], "note": "From the motor's own lead, down through the base" },
2264
+ { "id": "elbow", "from": "m2.connector", "to": "shield.Y", "via": ["upper.cable", "base.cable"], "gauge": "awg24", "colour": "black, red, green, blue", "connectors": ["JST-XH 4 pin", "screw terminal"] },
2265
+ { "id": "pen", "from": "servo.connector", "to": "shield.Z", "via": ["forearm.cable", "upper.cable", "base.cable"], "gauge": "awg26", "colour": "brown, red, orange", "conductors": 3, "current": 0.7, "connectors": ["Servo JR 3 pin", "D11, 5 V, GND"], "note": "D11 is the Z limit pin on a V3.00 shield: arm.ino uses it for the servo" },
2266
+ { "id": "home1", "from": "es1.left", "to": "shield.X", "via": ["base.cable"], "gauge": "awg26", "colour": "white, black", "conductors": 2, "connectors": ["Crimped spade", "X limit and GND"] },
2267
+ { "id": "home2", "from": "es2.left", "to": "shield.Y", "via": ["upper.cable", "base.cable"], "gauge": "awg26", "colour": "white, black", "conductors": 2, "connectors": ["Crimped spade", "Y limit and GND"] },
2268
+ { "id": "power", "from": "psu.terminals", "to": "shield.top", "gauge": "awg22", "colour": "red, black", "conductors": 2, "current": 2, "connectors": ["Ring terminal", "Screw terminal"], "note": "24 V into the shield's motor terminals" }
2269
+ ],
2270
+ "loads": [
2271
+ { "joint": "out", "torque": "arm.shoulder_torque", "note": "The pen's drag at its reach, the arm's inertia at 500 mm/s², the bias" },
2272
+ { "joint": "elbow", "torque": "arm.elbow_torque", "note": "The pen's drag, the forearm's inertia, the bias" }
2273
+ ],
2274
+ "task": { "tool": "holder.tool", "sheet": { "size": "a5", "landscape": true, "at": ["arm.near + arm.sheet_h / 2", 0, 0], "u": [0, 1, 0] }, "speed": 50, "accuracy": 0.3, "accel": 500, "elbow": "left", "deflection": "arm.deflection", "pen": { "up": 20, "down": 0 } },
2275
+ "poses": { "rest": { "drive": -1530, "edrive": -4586, "lift_servo": 0 } }
2276
+ }
2277
+ ```
2278
+
2279
+ Why each driver is set where it is: both motors run at 0.5 A a coil, under the 17HS4401's 1.5 A and the NEMA 14's
2280
+ 0.8 A, and the number comes from what they must do rather than what they can. The shoulder needs 0.011 N m at the motor's
2281
+ shaft for the task (0.2 N m through 38:1 at 47%) and has about 0.09 N m at 0.5 A, turning, eight times over. More current
2282
+ would only heat the motor and the PLA it is bolted to. It also sets the worst the arm can do to itself: stalled against
2283
+ something, 0.5 A puts about 2.4 N m on the shoulder's output, and that is 12 MPa of shear in the spindle's printed 10 mm
2284
+ shaft, against PLA's 22, about twice over (at the current the shoulder could take, the shaft would break first). A
2285
+ DRV8825 runs 0.5 A with no heat sink. Set each trimmer to what `cad check` says for these 0.1 Ω sense resistors (0.25 V):
2286
+ read the resistors on your own board first, because clones differ.
2287
+
2288
+ ```xml projects/arm/drawings/test.svg
2289
+ <svg xmlns="http://www.w3.org/2000/svg" width="210mm" height="148mm" viewBox="0 0 210 148"><rect id="square" x="55" y="24" width="100" height="100" fill="none"/><circle id="circle" cx="105" cy="74" r="35" fill="none"/></svg>
2290
+ ```
2291
+
2292
+ ```sh
2293
+ npx cad check arm/arm --json
2294
+ npx cad list arm/arm
2295
+ npx cad wires arm/arm
2296
+ npx cad machine arm/arm
2297
+ npx cad plot arm/arm projects/arm/drawings/test.svg
2298
+ npx cad plot arm/arm --calibrate
2299
+ npx cad preview arm/arm
2300
+ ```
2301
+
2302
+ The check runs with `--json` here because the arm's budget rests on estimates, and those are warnings the test would stop at: run
2303
+ it without `--json` and read them. What it says:
2304
+
2305
+ - `task.reach` passes: `holder.tool` reaches the whole sheet with the elbow to the left, 25 mm to spare at the worst point, the
2306
+ shoulder between -11° and 101° and the elbow between 58° and 157°.
2307
+ - `task.speed` passes, just: 51.3 mm/s at the slowest point, the middle of the near edge, against the 50 asked for. The
2308
+ motors are at 300 rpm, 8000 steps a second at 1/8 step, which is about what the Uno's firmware streams; any faster and
2309
+ the speed has to give, not the microsteps.
2310
+ - `task.accuracy` warns, as it should: 0.244 mm worst case, 0.11 root-sum-square, at the far corner, against 0.3, with the
2311
+ shoulder's play the biggest single term. Those figures are the bench's to replace, and the sentence says so: `Rests on estimates`.
2312
+ The worst case is 81% of the budget, under the 100% where the check would fail, over the 80% where it stops saying pass.
2313
+ Bench test 14 (play) and 17 (repeatability) decide whether this arm draws to 0.3 mm or to 0.5.
2314
+ - The rules that are guesses are named in one warning line, `uses estimates, not measurements`, and each settles with `cad measured arm/arm <name>=<value>`.
2315
+ - `joint.moment` puts 83 N equivalent on the 6800, against its 925 N static rating, eleven times over; `fit.seat` says the
2316
+ pocket is drawn 19.038 mm, a press fit, with a 1.11 mm lip on the outer race and clear of the inner.
2317
+ - `m1 into out` gives 25 times the 0.2 N m the task asks at the shoulder (that figure is at rated current: at the 0.5 A chosen, about 8 times),
2318
+ `m2 into elbow` 28 times. Both joints hold with the power off: 38:1 at 47% can't be driven backwards.
2319
+ - `motor.driver` gives 0.25 V on each trimmer for 0.5 A. `power.supply`: the machine draws under 1 A at 24 V, and an
2320
+ LRS-50-24 gives 2.2 A.
2321
+ - `cad list` is the shopping list: 440 g of printing in 20 parts, about 8 hours, and everything bought. `cad wires` is the
2322
+ wiring sheet: each wire's length through the arm's whole range, its gauge, its colours and its board pins.
2323
+ - `cad machine` writes `exports/arm/arm.machine.json`: steps per degree, 168.9 at 1/8 step through 38:1, the rates and the
2324
+ homing. `cad plot` plans the test drawing, a 100 mm square and a circle, in 15 s, and the preview in `.preview/arm/`
2325
+ animates it. `cad plot --calibrate` writes the calibration drawing the same way.
2326
+
2327
+ Home the arm with the elbow open: homing swings the shoulder to its stop with the elbow wherever it was, and with the
2328
+ elbow folded the holder comes round to the base's switch post. `npx cad check arm/arm --sweep` moves each joint alone across its range and finds nothing colliding (the switches' flags and the horn's lug
2329
+ touch where they are meant to, and say so in `fits`). It takes about a quarter of an hour, so run it yourself: the replay here leaves it out.
2330
+
2331
+ What the chapter leaves to the bench is written down in `examples/bench/projects/benchmarks/MEASURE.md`: the play, the
2332
+ twist and the repeatability; the pen's drag, and whether the rubber bands bias the arm enough to take up the gears' backlash.
2333
+ Print the shoulder's coupon before the whole arm, then measure, then `cad measured`, then read the budget again.
2334
+
2335
+ ## 13. The same arm, lifting: upright, a gripper, a Z axis
2336
+
2337
+ Chapter 12's arm has vertical joints: gravity never loads a motor, the pen hardly weighs anything, and its figures are about drawing straight. This chapter bolts the same parts to a wall so the joints' axes are level. Now the motors hold the arm up, a payload hangs off the end, and the numbers that matter are the shoulder's torque, the bearing's moment, the links' bend and what happens with the power off. Every part of chapter 12's arm stays: the base, the gearboxes, the upper arm, the forearm. What's new is a compliant gripper where the pen holder bolted, and then, on its own stand, a small Z axis that could bolt to the same place.
2338
+
2339
+ ### What changes from drawing to lifting
2340
+
2341
+ The base plate has four corner holes and bolts flat on a bench or against a wall on the same pattern. In `arm-upright` it is on a wall: the plate's face is vertical, the arm's joints have level axes, and the arm swings in a vertical plane. Nothing else about the base changes.
2342
+
2343
+ The task is a box of points in front of the arm, 80 mm deep and 120 mm tall, with a payload of 100 g at the tool. The arm is planar, so the box is one plane thick. The assembly writes it as a volume with the plane's depth given, `"y": [-56.6, -56.6]`: the tool's plane is 56.6 mm out from the wall, the height of the forearm's middle above the base plate in chapter 12's stack.
2344
+
2345
+ | | Drawing (chapter 12) | Lifting (this chapter) |
2346
+ |---|---|---|
2347
+ | Load on the shoulder | 0.2 N m of pen drag, inertia and bias, no gravity | 1.02 N m, the arm's own weight and 100 g, at the far end of the box |
2348
+ | Shoulder motor at 0.5 A | 8 times over | 1.7 times over: under the 2 times the check asks for |
2349
+ | Current | 0.5 A a coil | 0.8 A a coil for the shoulder, 2.65 times over; the elbow stays at 0.5 A |
2350
+ | What the links do | 0.3 N of drag sideways, about 0.02 mm | 5.7 N of weight in their plane: the tool drops 1.8 mm, the biggest term in the budget |
2351
+ | What the 6800 sees | The pen's drag | 0.134 N m of tipping and 5.7 N across it: 24 N equivalent, against 925 N |
2352
+ | The budget | 0.3 mm | 2.5 mm: a gripper, not a pen |
2353
+
2354
+ The shoulder has to hold the arm up, and the way to read that is the worst pose: the arm stretched forward with its elbow up, the tool at the box's far side, the masses all as far out as they get. `motor.torque` looks at each loaded joint with its motor run through its range, and at each pose of the assembly. The assembly is drawn in that far pose (named `reach`), so that sweep passes through it. The shoulder needs 1.016 N m and has 2.69 N m at 0.8 A through the 38:1 gearbox: 2.65 times over. The kit's other torque figure, `motor.accel`, is worked out across all the box's sampled points: at the worst of them there is still 0.104 N m left at the motor to accelerate with.
2355
+
2356
+ Why 0.8 A and not more. Chapter 12 set the current from what the arm has to do, and the same reasoning sets it here. It also sets what the arm can do to itself when it stalls: at 0.8 A the shoulder can give about 3.8 N m stalled, and that is 19 MPa of shear in the spindle's printed 10 mm shaft, against PLA's 22. A person running this arm at 0.8 A should print the spindle in PETG or put a steel shaft through it. That is the first thing that changes in the parts, and it's the sort of number a check can't fix for you.
2357
+
2358
+ The loads are written in the assembly as three masses at anchors, from the mass table that `joint.moment` prints:
2359
+
2360
+ - `lift.upper_mass` 0.376 kg at `upper.elbow`: the upper arm, the elbow's gears and motor, treated as all at the elbow, which overstates it a little: the shoulder's figure is on the safe side.
2361
+ - `lift.fore_mass` 0.07 kg at `forearm.cable`, about halfway along the forearm: the forearm and the elbow's output gear.
2362
+ - `lift.tool_mass` 0.148 kg at `gripper.tool`: the gripper, its servo and the 100 g payload.
2363
+
2364
+ ### Holding it with the power off
2365
+
2366
+ `motor.holds` passes the shoulder and the elbow with the power off, for the same reason as chapter 11: the 38:1 compound planetary is about 47% efficient forwards, and a train under 50% can't be turned backwards from the output (efficiency backwards is 2 minus one over the forward efficiency). That 47% is an estimate of a printed gearbox, though, and printed gears run in. What matters is how far the real figure can move before the arm falls, and the numbers say by a long way:
2367
+
2368
+ | Real efficiency | Backward efficiency | Back at the motor | Against the 0.025 N m detent |
2369
+ |---|---|---|---|
2370
+ | 47% (the estimate) | under 0 | 0, it can't turn backwards | holds |
2371
+ | 60% | 33% | 0.009 N m | holds, 2.8 times over |
2372
+ | 75% | 67% | 0.018 N m | holds, 1.4 times over |
2373
+ | 85% | 82% | 0.022 N m | just holds |
2374
+
2375
+ The back torque there is the shoulder's 1.016 N m worst load through 38:1, times the backward efficiency: the motor's own detent torque, 0.025 N m (the catalogue's figure, an `estimate`), carries it even if the gears run much freer than anything printed is likely to. The elbow, 0.233 N m through the same box against the NEMA 14's 0.008 N m detent, holds by the same arithmetic up to 85% too, with little in hand there.
2376
+
2377
+ Three things could hold the arm with the power off: the gears' friction, a counter-spring, or a brake. A counter-spring from `@rulecad/flexures` is the usual way to take gravity off a shoulder, and it earns its place when a joint is back-drivable; it would cost a leaf spring strong enough for a newton metre across 90° of swing, a large part, for a joint that already holds. A brake is a bought part and a coil to wire for a problem the gears already solve. So the chapter chooses friction, marks it `estimate`, and bench test 14 in `examples/bench/projects/benchmarks/MEASURE.md` (the gearbox's play, measured at both directions) is where a person learns whether the efficiency is what the figures assume.
2378
+
2379
+ ### The gripper
2380
+
2381
+ A compliant gripper holds what it's given by a servo's force and the friction at its jaws, with no hinge to wear or backlash to take up. The gripper replaces the pen holder in the forearm's yoke, on the same two M3 screws, printed flat in PETG with its 16 mm width (the yoke's slot) as the height of every wall.
2382
+
2383
+ It has a palm and two fingers. Each finger is a long leaf with rounded ends and a tapered middle, carrying a stiff back that ends in a jaw reaching inward; the leaf's root grows from an arm off the palm. The servo stands on the palm with its shaft pointing down into the print, and its double-arm horn turns *in the plane of the leaves*, halfway up their width. That detail is the point of the design: a horn on top of the print, pushing on lugs that stand up from the fingers, twists each finger about its long leaf with a couple the leaf can't resist. A leaf 1 mm thick and 16 wide has almost no torsional stiffness (0.2 N m of twist at 5 N and 40 mm would turn it most of a radian). With the horn at the leaves' mid-plane there's no twist to resist.
2384
+
2385
+ Each tip of the horn presses on a flat cut into the outer face of a finger, pushing it inward. Because the two arms of a double horn are diametrically opposed, one tip presses on the upper finger in front of the servo's axis and the other tip presses on the lower finger behind it. So the two fingers aren't mirror images: the upper leaf ends ahead of the axis and the lower leaf ends behind it, on different lengths along the palm. Both leaves are 50 mm long, and on the far side of their contact each finger is a rigid back carrying its jaw. A horn with its contact in the plane of the fingers, on its outer face, and no lugs or links: it's the simplest way found here to close two jaws with one rotating arm, and its cost is that the two fingers aren't equal.
2386
+
2387
+ `tool.grip` works out what the servo gives. The SG90 is taken as usable at 60% of its 0.1765 N m stall. Its horn's arm at full close is 18 mm long and pointing 47° from the axis along the arm, so its lever on the flat, the force's moment arm, is 18 cos 47° = 12.3 mm: the servo's 0.106 N m pushes each finger with 0.106 / (2 × 0.0123) = 4.3 N (`lift.grip_horn`, the smallest lever on the way shut). That push reaches the jaw by a lever. A leaf bends about a centre about a third of its length back from its tip, so a finger pivots there, roughly: on the lower finger, the worse of the two, the contact is 21 mm from that centre and the jaw 55 mm, so only 38% of the push reaches the jaw: 1.64 N (`lift.grip_lever`, an `estimate` from a beam argument until the grip is measured). The leaf itself takes 0.17 N to bend the 3 mm the horn pushes it, by `leafModel`, leaving 1.46 N at each jaw.
2388
+
2389
+ With μ = 0.4 (PETG on a clean plastic or wood part, an `estimate`) and two jaws, that holds 2 × 0.4 × 1.46 = 1.17 N. The object needs its weight and the arm's acceleration, `m (g + a)`. The closing check, at the arm's 300 mm/s² and a 50 g object, needs 0.51 N: held 2.3 times over, past the 2 asked for. At 100 g the same grip is 1.17 against 1.01 N: 1.2 times over, and `tool.grip` warns: the gripper is rated for 50 g at twice over, and carries 100 g only with a cleaner pad or a tighter hold. A soft pad on the jaws, roughly doubling the friction, is the cheap fix a person would try first. The leaf at full close is 3.3 MPa, 10% of PETG's 34 MPa strength, in `tool.strain`: comfortable, because a long leaf only bends a little.
2390
+
2391
+ Why 50 mm of leaf and not less: halving the leaf to 25 mm halves the travel it can give for the same strain, and the 1/L³ makes the spring eight times stiffer, so the servo's small grip would go almost all into bending the leaf. A longer leaf costs only print length.
2392
+
2393
+ The rules these figures come from:
2394
+
2395
+ ```json rules/lift.json
2396
+ {
2397
+ "_doc": "What the arm's lifting adds to the drawing arm's rules: the payload, the masses a motor has to raise, the gripper's numbers. Examples chapter 13 explains each.",
2398
+ "name": "lift",
2399
+ "rules": {
2400
+ "payload": {"value": 0.1, "unit": "kg", "rule": "The most the arm is rated to carry at the tool", "kind": "default", "source": "Design: the top of the range the arm is for, 50 to 100 g", "checked": "2026-11-09"},
2401
+ "upper_mass": {"value": 0.376, "unit": "kg", "rule": "The upper arm, the elbow's gears, the elbow's motor and the switch: as the shoulder sees them", "kind": "derived", "source": "joint.moment's carried mass in chapter 13, less what's beyond the elbow", "checked": "2026-11-09"},
2402
+ "fore_mass": {"value": 0.07, "unit": "kg", "rule": "The forearm and the elbow's output gear, about", "kind": "derived", "source": "joint.moment's carried mass in chapter 13", "checked": "2026-11-09"},
2403
+ "tool_mass": {"value": 0.148, "unit": "kg", "rule": "The gripper with its servo and horn, and the payload", "kind": "derived", "source": "joint.moment's carried mass in chapter 13", "checked": "2026-11-09"},
2404
+ "grip_horn": {"value": 12.3, "unit": "mm", "rule": "The horn's lever at full close, where it's smallest (18 mm reach × cos 47°): what the servo's torque turns into the push on each finger", "kind": "derived", "source": "gripper's reach and close_a", "checked": "2026-11-09"},
2405
+ "grip_lever": {"value": 0.38, "rule": "What of the push reaches the jaw, on the worse finger: from the leaf's bending centre, the contact is nearer than the jaw", "kind": "estimate", "source": "A beam argument in the chapter, an estimate until the grip is measured", "checked": "2026-11-09"},
2406
+ "grip_travel": {"value": 3, "unit": "mm", "rule": "How far the horn pushes each finger at the flat to close it fully", "kind": "derived", "source": "gripper's flat: tip travel between rest_a and close_a", "checked": "2026-11-09"},
2407
+ "leaf_l": {"value": 50, "unit": "mm", "rule": "The gripper's leaf length", "kind": "default", "source": "gripper's leaf_l", "checked": "2026-11-09"},
2408
+ "leaf_t": {"value": 1, "unit": "mm", "rule": "The gripper's leaf thickness", "kind": "default", "source": "gripper's leaf_t", "checked": "2026-11-09"},
2409
+ "leaf_w": {"value": 16, "unit": "mm", "rule": "The gripper's leaf width", "kind": "default", "source": "gripper's width", "checked": "2026-11-09"},
2410
+ "grip_payload": {"value": 0.05, "unit": "kg", "rule": "What the closing check holds, the object the gripper is rated for at 2×", "kind": "default", "source": "Issue: a 50 g object at 2× margin", "checked": "2026-11-09"},
2411
+ "z_lead": {"value": 8, "unit": "mm", "rule": "The T8 screw's lead: four starts, the screw at the screw's own rule", "kind": "community", "source": "t8-screw in @rulecad/rules", "checked": "2026-11-09"},
2412
+ "z_friction": {"value": 0.2, "rule": "Brass or POM on steel, about, dry", "kind": "estimate", "source": "A hand figure: bench it", "checked": "2026-11-09"},
2413
+ "z_mass": {"value": 0.25, "unit": "kg", "rule": "What the Z axis lifts: the gripper, the payload, the servo and the carriage, about", "kind": "derived", "source": "This chapter's masses", "checked": "2026-11-09"},
2414
+ "belt_k": {"value": 2817, "unit": "N/strain/mm", "rule": "A 6 mm GT2 belt's stiffness per unit strain per mm of width", "kind": "spec", "source": "gt2-belt-6 in @rulecad/rules", "checked": "2026-11-09"},
2415
+ "belt_load": {"value": 5, "unit": "N", "rule": "The belt's working pull: the load's weight and its acceleration at a few hundred mm/s²", "kind": "estimate", "source": "Worked in chapter 13", "checked": "2026-11-09"},
2416
+ "friction": {"value": 0.4, "rule": "PETG on a clean plastic or wood part, about", "kind": "estimate", "source": "A hand figure for a dry contact: a soft pad on the jaw would double it", "checked": "2026-11-09"}
2417
+ }
2418
+ }
2419
+ ```
2420
+
2421
+ The two objects, drawn at rest with the fingers straight. The gripper is one print, the fingers joined only through their leaves; the `part` variable lets the closing check below take it apart. The double horn is the one the SG90 comes with, drawn from a few measurements of the bag's contents:
2422
+
2423
+ ```js projects/arm/objects/gripper.js
2424
+ // A compliant gripper, printed flat in PETG: a palm with the servo on it, and two fingers, each a rigid jaw on one long
2425
+ // leaf with rounded ends. A double-arm horn in the leaves' own plane pushes each finger inward at its outer face.
2426
+ import jscad from '@jscad/modeling'
2427
+ const { cuboid, cylinder, polygon } = jscad.primitives
2428
+ const { translate } = jscad.transforms
2429
+ const { extrudeLinear } = jscad.extrusions
2430
+
2431
+ export function main (v) {
2432
+ const f = v.flexures, W = v.width, box = (x0, x1, y0, y1, z0 = 0, z1 = W) => cuboid({ size: [x1 - x0, y1 - y0, z1 - z0], center: [(x0 + x1) / 2, (y0 + y1) / 2, (z0 + z1) / 2] })
2433
+ const leaf = (end, y) => translate([end - v.leaf_l, y + v.leaf_t / 2, 0], f.leaf({ length: v.leaf_l, thickness: v.leaf_t, width: W, taper: v.taper, fillet: v.fillet, tip: true, into: v.into }))
2434
+ const wedge = (a0, a1, r, h, z0) => extrudeLinear({ height: h }, polygon({ points: [[0, 0], ...Array.from({ length: v.wedge_n + 1 }, (_, i) => { const a = (a0 + (a1 - a0) * i / v.wedge_n) * v.deg; return [r * Math.cos(a), r * Math.sin(a)] })] }))
2435
+ const wedgeAt = (a0, a1) => translate([v.xs, 0, v.cavity], wedge(a0, a1, v.reach + v.slack, W, 0))
2436
+ // Palm: the block in the forearm's yoke, the stem under the servo and the two arms the leaves grow from
2437
+ const block = box(-v.block_x, v.block_x, -v.block_y, v.block_y)
2438
+ const stem = v.ops.union(box(v.block_x - 1, v.xs - v.pocket_back, -v.stem_y0, v.stem_y0), box(v.xs - v.pocket_back - 2, v.stem_x1, -v.stem_y, v.stem_y))
2439
+ const armUp = box(v.up_root - v.root, v.up_root + v.into, v.arm_y, v.y_in + v.leaf_t), armLow = box(v.low_root - v.root, v.low_root + v.into, -(v.y_in + v.leaf_t), -v.arm_y)
2440
+ const pads = [box(v.xs + v.pocket_front + v.pad_gap, v.xs + v.pad_front + v.pad_x, -v.pad_y, v.pad_y, W - v.dip, v.face), box(v.xs - v.pad_back - v.pad_x, v.xs - v.pocket_back - v.pad_gap, -v.pad_y, v.pad_y, W - v.dip, v.face)]
2441
+ const pilots = [v.xs + v.pad_front, v.xs - v.pad_back].map((x) => cylinder({ radius: v.pilot / 2, height: v.pilot_d + 1, center: [x, 0, v.face - (v.pilot_d - 1) / 2], segments: v.segments }))
2442
+ const bolts = [-1, 1].map((s) => cylinder({ radius: v.bolt / 2, height: W + 1, center: [s * v.bolt_x, 0, W / 2], segments: v.segments }))
2443
+ // The servo's case and boss come down into the stem from above; the horn turns in two wedges cut from the stem's top
2444
+ const pocket = box(v.xs - v.pocket_back, v.xs + v.pocket_front, -v.pocket_y, v.pocket_y, v.case_z, W + 1)
2445
+ const boss = cylinder({ radius: v.boss / 2, height: v.case_z - v.horn_z + 1, center: [v.xs, 0, v.horn_z + (v.case_z - v.horn_z + 1) / 2], segments: v.segments })
2446
+ const hub = cylinder({ radius: v.hub / 2, height: W - v.cavity + 1, center: [v.xs, 0, v.cavity + (W - v.cavity + 1) / 2], segments: v.segments })
2447
+ const cutPalm = [wedgeAt(v.close_a - v.spare, v.rest_a + v.spare), wedgeAt(v.half_turn + v.close_a - v.spare, v.half_turn + v.rest_a + v.spare), hub, boss, pocket]
2448
+ const palm = v.ops.subtract(v.ops.union(block, stem, armUp, armLow, pads), ...cutPalm, bolts, pilots)
2449
+ // A finger: leaf, then a stiff back with a flat where the horn presses, then the jaw reaching in
2450
+ const finger = (s, end, flatX0, flatX1) => {
2451
+ const y0 = s > 0 ? v.y_in : -v.y_out, y1 = s > 0 ? v.y_out : -v.y_in
2452
+ const back = box(end - v.overlap, v.jaw_x1, y0, y1)
2453
+ const flat = s > 0 ? box(flatX0, flatX1, v.y_flat, v.y_out + 1, -1, W + 1) : box(flatX0, flatX1, -v.y_out - 1, -v.y_flat, -1, W + 1)
2454
+ const jaw = s > 0 ? box(v.jaw_x0, v.jaw_x1, v.pad_y, v.y_out) : box(v.jaw_x0, v.jaw_x1, -v.y_out, -v.pad_y)
2455
+ return v.ops.subtract(v.ops.union(leaf(end, s > 0 ? v.y_in : -v.y_in - v.leaf_t), back, jaw), flat)
2456
+ }
2457
+ const up = finger(1, v.up_end, v.xs + v.flat_a, v.xs + v.flat_b), low = finger(-1, v.low_end, v.xs - v.flat_b, v.xs - v.flat_a)
2458
+ const parts = [palm, up, low]
2459
+ return v.part ? parts[v.part - 1] : v.ops.union(...parts)
2460
+ }
2461
+ ```
2462
+
2463
+ ```json projects/arm/objects/gripper.json
2464
+ {
2465
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
2466
+ "name": "gripper",
2467
+ "title": "Gripper: palm and two fingers on leaves",
2468
+ "version": "0.1.0",
2469
+ "uses": [
2470
+ "x1c",
2471
+ "m2",
2472
+ "m3"
2473
+ ],
2474
+ "engine": "manifold",
2475
+ "material": "PETG",
2476
+ "orientation": "Flat on the bed, the leaves printed upright in their layers: every wall of the leaves is a whole layer stack, no overhang, the same outline the whole way up",
2477
+ "description": "Bolts into the forearm's yoke where the pen holder bolts. Two fingers on long leaves, closed by a double-arm horn turning in the leaves' own plane: no lift, no twist. Drawn at rest, open, the leaves straight.",
2478
+ "anchors": {
2479
+ "mount": {
2480
+ "at": [
2481
+ 0,
2482
+ 0,
2483
+ "half"
2484
+ ],
2485
+ "axis": [
2486
+ 0,
2487
+ 0,
2488
+ -1
2489
+ ],
2490
+ "ref": [
2491
+ 1,
2492
+ 0,
2493
+ 0
2494
+ ]
2495
+ },
2496
+ "tool": {
2497
+ "at": [
2498
+ "jaw_at",
2499
+ 0,
2500
+ "half"
2501
+ ],
2502
+ "axis": [
2503
+ 1,
2504
+ 0,
2505
+ 0
2506
+ ],
2507
+ "ref": [
2508
+ 0,
2509
+ 1,
2510
+ 0
2511
+ ]
2512
+ },
2513
+ "servo": {
2514
+ "at": [
2515
+ "xs",
2516
+ 0,
2517
+ "face"
2518
+ ],
2519
+ "axis": [
2520
+ 0,
2521
+ 0,
2522
+ -1
2523
+ ],
2524
+ "ref": [
2525
+ 1,
2526
+ 0,
2527
+ 0
2528
+ ]
2529
+ },
2530
+ "horn": {
2531
+ "at": [
2532
+ "xs",
2533
+ 0,
2534
+ "horn_z"
2535
+ ],
2536
+ "axis": [
2537
+ 0,
2538
+ 0,
2539
+ -1
2540
+ ],
2541
+ "ref": [
2542
+ "cosd(rest_a)",
2543
+ "sind(rest_a)",
2544
+ 0
2545
+ ]
2546
+ },
2547
+ "cable": {
2548
+ "at": [
2549
+ "xs",
2550
+ 0,
2551
+ 0
2552
+ ],
2553
+ "axis": [
2554
+ 0,
2555
+ 0,
2556
+ 1
2557
+ ]
2558
+ },
2559
+ "upper": {
2560
+ "at": [
2561
+ "jaw_x0",
2562
+ "pad_y",
2563
+ "half"
2564
+ ],
2565
+ "axis": [
2566
+ 0,
2567
+ -1,
2568
+ 0
2569
+ ],
2570
+ "ref": [
2571
+ 1,
2572
+ 0,
2573
+ 0
2574
+ ]
2575
+ },
2576
+ "lower": {
2577
+ "at": [
2578
+ "jaw_x0",
2579
+ "0 - pad_y",
2580
+ "half"
2581
+ ],
2582
+ "axis": [
2583
+ 0,
2584
+ 1,
2585
+ 0
2586
+ ],
2587
+ "ref": [
2588
+ 1,
2589
+ 0,
2590
+ 0
2591
+ ]
2592
+ }
2593
+ },
2594
+ "variables": {
2595
+ "part": {
2596
+ "value": 0,
2597
+ "rule": "0 the whole print, 1 the palm, 2 the upper finger, 3 the lower: the closing check moves the fingers apart from the palm",
2598
+ "tweak": {
2599
+ "min": 0,
2600
+ "max": 3
2601
+ }
2602
+ },
2603
+ "width": {
2604
+ "value": 16,
2605
+ "unit": "mm",
2606
+ "rule": "The print's thickness, and the width of the leaves: the yoke's slot and stiff against the payload's weight across the leaves",
2607
+ "interface": true
2608
+ },
2609
+ "half": {
2610
+ "value": "width / 2",
2611
+ "unit": "mm",
2612
+ "rule": "Half of it, where the horn turns and the load sits"
2613
+ },
2614
+ "block_x": {
2615
+ "value": 8,
2616
+ "unit": "mm",
2617
+ "rule": "Half the block in the yoke, along the arm"
2618
+ },
2619
+ "block_y": {
2620
+ "value": 9,
2621
+ "unit": "mm",
2622
+ "rule": "Half the block across it"
2623
+ },
2624
+ "bolt_x": {
2625
+ "value": 4,
2626
+ "unit": "mm",
2627
+ "rule": "Half the yoke's two M3 screws' spacing, as the pen holder's"
2628
+ },
2629
+ "bolt": {
2630
+ "value": "m3.clearance + x1c.hole_comp",
2631
+ "unit": "mm",
2632
+ "rule": "M3 clearance through the block"
2633
+ },
2634
+ "xs": {
2635
+ "value": 62,
2636
+ "unit": "mm",
2637
+ "rule": "From the bolts to the servo's shaft: the leaves' length and the servo's body set it"
2638
+ },
2639
+ "leaf_l": {
2640
+ "value": 50,
2641
+ "unit": "mm",
2642
+ "rule": "A leaf's length: long, so the servo spends little of its torque bending it and the strain stays small",
2643
+ "label": "Leaf",
2644
+ "show": true
2645
+ },
2646
+ "leaf_t": {
2647
+ "value": 1,
2648
+ "unit": "mm",
2649
+ "rule": "A leaf's thickness: two and a bit lines"
2650
+ },
2651
+ "taper": {
2652
+ "value": 0.25,
2653
+ "rule": "Thicker toward both ends, the strain spread along it"
2654
+ },
2655
+ "fillet": {
2656
+ "value": 1.5,
2657
+ "unit": "mm",
2658
+ "rule": "A round where each leaf meets a block: no square corner to yield at"
2659
+ },
2660
+ "into": {
2661
+ "value": 1.5,
2662
+ "unit": "mm",
2663
+ "rule": "How far a leaf runs into the block at each end"
2664
+ },
2665
+ "y_in": {
2666
+ "value": 14,
2667
+ "unit": "mm",
2668
+ "rule": "A finger's inner face at rest: the stem's side, its full travel and a gap"
2669
+ },
2670
+ "y_out": {
2671
+ "value": 18.5,
2672
+ "unit": "mm",
2673
+ "rule": "A finger's outer edge"
2674
+ },
2675
+ "y_flat": {
2676
+ "value": 16,
2677
+ "unit": "mm",
2678
+ "rule": "The flat the horn presses, the finger cut back to here so the tip reaches it from the outside"
2679
+ },
2680
+ "up_end": {
2681
+ "value": "xs + 6.5",
2682
+ "unit": "mm",
2683
+ "rule": "The upper leaf ends just before the horn's contact"
2684
+ },
2685
+ "low_end": {
2686
+ "value": "xs - 15.5",
2687
+ "unit": "mm",
2688
+ "rule": "The lower leaf ends just before its contact: the two arms of a horn press on opposite sides of its axis"
2689
+ },
2690
+ "up_root": {
2691
+ "value": "up_end - leaf_l",
2692
+ "unit": "mm",
2693
+ "rule": "Where the upper leaf grows from"
2694
+ },
2695
+ "low_root": {
2696
+ "value": "low_end - leaf_l",
2697
+ "unit": "mm",
2698
+ "rule": "Where the lower leaf grows from"
2699
+ },
2700
+ "arm_y": {
2701
+ "value": 5,
2702
+ "unit": "mm",
2703
+ "rule": "Where the root arms join the palm, off the middle: clear of the forearm's bar, which runs on behind the yoke"
2704
+ },
2705
+ "root": {
2706
+ "value": 6,
2707
+ "unit": "mm",
2708
+ "rule": "The root arms' depth along the arm"
2709
+ },
2710
+ "overlap": {
2711
+ "value": 1.5,
2712
+ "unit": "mm",
2713
+ "rule": "A leaf's tip into the finger's back"
2714
+ },
2715
+ "flat_a": {
2716
+ "value": 7,
2717
+ "unit": "mm",
2718
+ "rule": "The flat, starting out from the axis along the arm: where the tip touches at rest"
2719
+ },
2720
+ "flat_b": {
2721
+ "value": 15.5,
2722
+ "unit": "mm",
2723
+ "rule": "The flat's far end: where the tip gets to at full close, with a little over"
2724
+ },
2725
+ "jaw_x0": {
2726
+ "value": 78,
2727
+ "unit": "mm",
2728
+ "rule": "The jaws begin, past the end of the stem and the servo's front"
2729
+ },
2730
+ "jaw_x1": {
2731
+ "value": 92,
2732
+ "unit": "mm",
2733
+ "rule": "The jaws end"
2734
+ },
2735
+ "pad_y": {
2736
+ "value": 4,
2737
+ "unit": "mm",
2738
+ "rule": "Half a post across"
2739
+ },
2740
+ "jaw_at": {
2741
+ "value": 85,
2742
+ "unit": "mm",
2743
+ "rule": "Halfway along the jaws: the payload's point and the tool's anchor"
2744
+ },
2745
+ "stem_x1": {
2746
+ "value": 75,
2747
+ "unit": "mm",
2748
+ "rule": "The stem ends past the servo's front screw"
2749
+ },
2750
+ "stem_y": {
2751
+ "value": 8.4,
2752
+ "unit": "mm",
2753
+ "rule": "Half the stem round the servo's body: 6.1 and a 2 mm wall"
2754
+ },
2755
+ "stem_y0": {
2756
+ "value": 5.5,
2757
+ "unit": "mm",
2758
+ "rule": "Half the stem behind the servo"
2759
+ },
2760
+ "face": {
2761
+ "value": "horn_top + 13.3",
2762
+ "unit": "mm",
2763
+ "rule": "The servo's mounting tabs: its case and boss reach down 13.3 mm to the horn"
2764
+ },
2765
+ "horn_z": {
2766
+ "value": "half",
2767
+ "unit": "mm",
2768
+ "rule": "The horn's plane: the middle of the leaves' width, so a push on the finger doesn't twist it",
2769
+ "interface": true
2770
+ },
2771
+ "horn_t": {
2772
+ "value": 2,
2773
+ "unit": "mm",
2774
+ "rule": "The horn's thickness"
2775
+ },
2776
+ "horn_top": {
2777
+ "value": "horn_z + horn_t / 2",
2778
+ "unit": "mm",
2779
+ "rule": "The side of the horn toward the servo"
2780
+ },
2781
+ "case_z": {
2782
+ "value": "face - 10",
2783
+ "unit": "mm",
2784
+ "rule": "Where the servo's case ends, coming down"
2785
+ },
2786
+ "pocket_back": {
2787
+ "value": 17.3,
2788
+ "unit": "mm",
2789
+ "rule": "The case's pocket, behind the shaft"
2790
+ },
2791
+ "pocket_front": {
2792
+ "value": 6.6,
2793
+ "unit": "mm",
2794
+ "rule": "The case's pocket, ahead of the shaft"
2795
+ },
2796
+ "pocket_y": {
2797
+ "value": 6.3,
2798
+ "unit": "mm",
2799
+ "rule": "Half the case's pocket across"
2800
+ },
2801
+ "boss": {
2802
+ "value": 12.4,
2803
+ "unit": "mm",
2804
+ "rule": "Round the servo's boss, through the stem"
2805
+ },
2806
+ "hub": {
2807
+ "value": 13,
2808
+ "unit": "mm",
2809
+ "rule": "Round the horn's hub"
2810
+ },
2811
+ "cavity": {
2812
+ "value": 6.5,
2813
+ "unit": "mm",
2814
+ "rule": "The floor under the horn: what's left of the stem where the horn sweeps"
2815
+ },
2816
+ "pad_front": {
2817
+ "value": 8.4,
2818
+ "unit": "mm",
2819
+ "rule": "The servo's front screw, from the shaft"
2820
+ },
2821
+ "pad_back": {
2822
+ "value": 19.1,
2823
+ "unit": "mm",
2824
+ "rule": "The servo's rear screw, from the shaft"
2825
+ },
2826
+ "pad_x": {
2827
+ "value": 4,
2828
+ "unit": "mm",
2829
+ "rule": "A post under each of the servo's tabs, how far past its screw, along the arm"
2830
+ },
2831
+ "pad_gap": {
2832
+ "value": 0.2,
2833
+ "unit": "mm",
2834
+ "rule": "Air between a post and the case's pocket"
2835
+ },
2836
+ "dip": {
2837
+ "value": 1,
2838
+ "unit": "mm",
2839
+ "rule": "How far the posts run down into the stem"
2840
+ },
2841
+ "pilot": {
2842
+ "value": "m2.clearance - 0.6",
2843
+ "unit": "mm",
2844
+ "rule": "An M2 screw self-tapped into a post",
2845
+ "kind": "community"
2846
+ },
2847
+ "pilot_d": {
2848
+ "value": 8,
2849
+ "unit": "mm",
2850
+ "rule": "A pilot hole's depth"
2851
+ },
2852
+ "reach": {
2853
+ "value": 18,
2854
+ "unit": "mm",
2855
+ "rule": "The horn's arm, from the axis to its tip, as drawn by the kit's reference horn"
2856
+ },
2857
+ "slack": {
2858
+ "value": 2,
2859
+ "unit": "mm",
2860
+ "rule": "The wedge's reach past the horn's tip"
2861
+ },
2862
+ "spare": {
2863
+ "value": 20,
2864
+ "unit": "\u00b0",
2865
+ "rule": "The wedge's angular spare each side"
2866
+ },
2867
+ "rest_a": {
2868
+ "value": 64,
2869
+ "unit": "\u00b0",
2870
+ "rule": "The horn's arm direction at rest: the tip just touching the finger's flat"
2871
+ },
2872
+ "close_a": {
2873
+ "value": 47,
2874
+ "unit": "\u00b0",
2875
+ "rule": "The horn's arm direction at full close: 3 mm of push at the flat"
2876
+ },
2877
+ "wedge_n": {
2878
+ "value": 8,
2879
+ "rule": "Steps round a wedge's arc"
2880
+ },
2881
+ "half_turn": {
2882
+ "value": 180,
2883
+ "unit": "\u00b0",
2884
+ "rule": "Half a turn"
2885
+ },
2886
+ "deg": {
2887
+ "value": 0.017453293,
2888
+ "rule": "Radians in a degree"
2889
+ },
2890
+ "segments": {
2891
+ "value": 48,
2892
+ "rule": "Round enough"
2893
+ }
2894
+ }
2895
+ }
2896
+ ```
2897
+
2898
+ ```js projects/arm/objects/ghorn.js
2899
+ // A double-arm servo horn as sold: a hub and two arms across it, a rounded tip on each.
2900
+ import jscad from '@jscad/modeling'
2901
+ const { cuboid, cylinder } = jscad.primitives
2902
+
2903
+ export function main (v) {
2904
+ const arm = cuboid({ size: [v.reach * 2, v.wide, v.thick], center: [0, 0, 0] })
2905
+ const tips = [-1, 1].map((s) => cylinder({ radius: v.wide / 2, height: v.thick, center: [s * v.reach, 0, 0], segments: v.segments }))
2906
+ const hub = cylinder({ radius: v.hub / 2, height: v.thick, center: [0, 0, 0], segments: v.segments })
2907
+ return v.ops.union(arm, ...tips, hub)
2908
+ }
2909
+ ```
2910
+
2911
+ ```json projects/arm/objects/ghorn.json
2912
+ {
2913
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
2914
+ "name": "ghorn",
2915
+ "title": "Double-arm servo horn (bought, comes with the SG90)",
2916
+ "version": "0.1.0",
2917
+ "role": "reference",
2918
+ "anchors": {
2919
+ "axis": {"at": [0, 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]}
2920
+ },
2921
+ "variables": {
2922
+ "reach": {"value": 18, "unit": "mm", "rule": "Axis to the tip's centre, about, on the long double horn in the bag", "kind": "estimate", "source": "A guess from the usual SG90 horn set: measure yours"},
2923
+ "wide": {"value": 4.5, "unit": "mm", "rule": "The arm's width, and the tip's round"},
2924
+ "thick": {"value": 2, "unit": "mm", "rule": "The arm's thickness, centred on the horn's plane"},
2925
+ "hub": {"value": 7, "unit": "mm", "rule": "Round the spline"},
2926
+ "segments": {"value": 24, "rule": "Round enough"}
2927
+ }
2928
+ }
2929
+ ```
2930
+
2931
+ The project lists the new objects:
2932
+
2933
+ ```json projects/arm/project.json
2934
+ {
2935
+ "name": "arm",
2936
+ "description": "A SCARA arm sized from its task: an A5 sheet, a pen, 0.3 mm at 50 mm/s. EXAMPLES chapter 12 explains it.",
2937
+ "material": "PLA",
2938
+ "objects": [
2939
+ "base",
2940
+ "housing",
2941
+ "sun",
2942
+ "planet",
2943
+ "speck",
2944
+ "output",
2945
+ "bridge",
2946
+ "spindle",
2947
+ "upper",
2948
+ "clip",
2949
+ "forearm",
2950
+ "holder",
2951
+ "gripper",
2952
+ "ghorn",
2953
+ "zframe",
2954
+ "zcar"
2955
+ ]
2956
+ }
2957
+ ```
2958
+
2959
+ ### The upright assembly
2960
+
2961
+ `arm-upright` is `arm` from chapter 12 with five differences: the base, the housing, the bridge and its bearing are rotated 90° about the x axis and the rest follows through the joints (their positions become `[0, "0 - arm.face", 0]` and so on: a rotation of x, y, z to x, -z, y); the pen holder is replaced by the gripper on the forearm's same anchor; the task is a box of points with `payload` and `grip`; `gravity` is set to `[0, 0, -1]` as the check needs the word down; and the elbow folds only to 140°, not 160°, for the reason under the commands below. Its one pose, `reach`, is the far corner of the box: the assembly is drawn there because the shoulder's load is worst there, and "drawn" is what `motor.torque` sweeps its motor from. The fingers are straight in it, as every flexure here is.
2962
+
2963
+ ```json projects/arm/assemblies/arm-upright.json
2964
+ {
2965
+ "$schema": "https://jonibach.github.io/rulecad/schemas/assembly.schema.json",
2966
+ "title": "The arm upright: it lifts",
2967
+ "kind": "fit",
2968
+ "description": "The drawing arm's parts on the same base, its plate bolted to a wall so the joints' axes are level and gravity loads the motors. The tool is a compliant gripper, the task a box of points in front of the arm.",
2969
+ "gravity": [0, 0, -1],
2970
+ "uses": ["arm", "lift"],
2971
+ "items": [
2972
+ { "id": "base", "object": "base", "rotate": [90, 0, 0] },
2973
+ { "id": "m1", "motor": { "model": "17HS4401", "drives": "drive", "speed": 300, "duty": 0.3, "driver": "d1", "current": 0.8, "microsteps": 8 } },
2974
+ { "id": "housing", "object": "housing", "at": [0, "0 - arm.face", 0], "rotate": [90, 0, 0] },
2975
+ { "id": "sun", "object": "sun" },
2976
+ { "id": "carrier", "object": "speck" },
2977
+ { "id": "p1", "object": "planet" }, { "id": "p2", "object": "planet" }, { "id": "p3", "object": "planet" },
2978
+ { "id": "output", "object": "output" },
2979
+ { "id": "spindle", "object": "spindle" },
2980
+ { "id": "bridge", "object": "bridge", "at": [0, "0 - arm.bridge_low", 0], "rotate": [90, 0, 0] },
2981
+ { "id": "b1", "bought": "bearing-6800", "at": [0, "0 - (arm.bridge_low + arm.bridge - arm.bearing_width)", 0], "rotate": [90, 0, 0] },
2982
+ { "id": "upper", "object": "upper" },
2983
+ { "id": "m2", "motor": { "model": "nema14", "drives": "edrive", "speed": 300, "duty": 0.3, "driver": "d2", "current": 0.5, "microsteps": 8 } },
2984
+ { "id": "esun", "object": "sun", "set": { "tip": 11.7 } },
2985
+ { "id": "ecarrier", "object": "speck" }, { "id": "ering", "object": "speck" },
2986
+ { "id": "ep1", "object": "planet" }, { "id": "ep2", "object": "planet" }, { "id": "ep3", "object": "planet" },
2987
+ { "id": "eoutput", "object": "output" },
2988
+ { "id": "clip1", "object": "clip" }, { "id": "clip2", "object": "clip" }, { "id": "clip3", "object": "clip" },
2989
+ { "id": "forearm", "object": "forearm" },
2990
+ { "id": "gripper", "object": "gripper" },
2991
+ { "id": "gservo", "motor": { "model": "sg90", "drives": "squeeze", "duty": 0.05 } },
2992
+ { "id": "ghorn", "object": "ghorn" },
2993
+ { "id": "es1", "bought": "endstop-10t85" },
2994
+ { "id": "es2", "bought": "endstop-10t85" },
2995
+ { "id": "d1", "bought": "drv8825", "at": [-300, -30, 8] },
2996
+ { "id": "d2", "bought": "drv8825", "at": [-300, 0, 8] },
2997
+ { "id": "shield", "bought": "cnc-shield-v3", "at": [-300, 0, 0] },
2998
+ { "id": "psu", "bought": "supply-24v", "variant": "LRS-50-24", "at": [-330, 150, 0] }
2999
+ ],
3000
+ "joints": [
3001
+ { "id": "m1_on", "type": "fixed", "parent": "housing.motor", "child": "m1.face" },
3002
+ { "id": "drive", "type": "revolute", "parent": "housing.axis", "child": "sun.axis", "min": -4570, "max": 4588, "label": "Shoulder motor" },
3003
+ { "id": "turn", "type": "revolute", "parent": "housing.axis", "child": "carrier.axis", "min": -4570, "max": 4588 },
3004
+ { "id": "s1", "type": "revolute", "parent": "carrier.a", "child": "p1.axis", "min": -30000, "max": 30000 },
3005
+ { "id": "s2", "type": "revolute", "parent": "carrier.b", "child": "p2.axis", "min": -30000, "max": 30000 },
3006
+ { "id": "s3", "type": "revolute", "parent": "carrier.c", "child": "p3.axis", "min": -30000, "max": 30000 },
3007
+ { "id": "out", "type": "revolute", "parent": { "item": "housing", "at": [0, 0, "arm.plate + arm.gear + arm.ring_gap"], "axis": [0, 0, 1] }, "child": "output.axis", "min": -116, "max": 125, "label": "Shoulder", "support": { "bearings": ["b1"] },
3008
+ "errors": { "play": "arm.play_shoulder", "twist": "arm.twist_shoulder" }, "home": { "endstop": "es1.lever", "direction": -1 } },
3009
+ { "id": "spindle_on", "type": "fixed", "parent": "output.flange", "child": "spindle.down" },
3010
+ { "id": "upper_on", "type": "fixed", "parent": "spindle.seat", "child": "upper.hub" },
3011
+ { "id": "m2_on", "type": "fixed", "parent": "upper.motor", "child": "m2.face" },
3012
+ { "id": "edrive", "type": "revolute", "parent": "upper.elbow", "child": "esun.axis", "min": -5320, "max": 180, "label": "Elbow motor" },
3013
+ { "id": "ering_on", "type": "fixed", "parent": "upper.elbow", "child": "ering.axis" },
3014
+ { "id": "eturn", "type": "revolute", "parent": "upper.elbow", "child": "ecarrier.axis", "min": -5320, "max": 180 },
3015
+ { "id": "es1a", "type": "revolute", "parent": "ecarrier.a", "child": "ep1.axis", "min": -30000, "max": 30000 },
3016
+ { "id": "es2a", "type": "revolute", "parent": "ecarrier.b", "child": "ep2.axis", "min": -30000, "max": 30000 },
3017
+ { "id": "es3a", "type": "revolute", "parent": "ecarrier.c", "child": "ep3.axis", "min": -30000, "max": 30000 },
3018
+ { "id": "elbow", "type": "revolute", "parent": "upper.output", "child": "eoutput.axis", "min": 0, "max": 140, "label": "Elbow", "support": { "clips": ["clip1", "clip2", "clip3"], "pitch": 74 },
3019
+ "errors": { "play": "arm.play_elbow", "twist": "arm.twist_elbow" }, "home": { "endstop": "es2.lever", "direction": 1 } },
3020
+ { "id": "c1_on", "type": "fixed", "parent": "upper.clip1", "child": "clip1.post" },
3021
+ { "id": "c2_on", "type": "fixed", "parent": "upper.clip2", "child": "clip2.post" },
3022
+ { "id": "c3_on", "type": "fixed", "parent": "upper.clip3", "child": "clip3.post" },
3023
+ { "id": "forearm_on", "type": "fixed", "parent": "eoutput.flange", "child": "forearm.hub" },
3024
+ { "id": "gripper_on", "type": "fixed", "parent": "forearm.holder", "child": "gripper.mount" },
3025
+ { "id": "servo_on", "type": "fixed", "parent": "gripper.servo", "child": "gservo.face" },
3026
+ { "id": "squeeze", "type": "revolute", "parent": "gripper.horn", "child": "ghorn.axis", "min": 0, "max": 17, "label": "Grip" },
3027
+ { "id": "es1_on", "type": "fixed", "parent": "base.switch", "child": "es1.left" },
3028
+ { "id": "es2_on", "type": "fixed", "parent": "upper.switch", "child": "es2.left" }
3029
+ ],
3030
+ "planetary": [
3031
+ { "sun": "sun", "carrier": "carrier", "ring": "housing", "planets": ["p1", "p2", "p3"], "drive": "sun", "module": 1, "teeth": [18, 18, 54], "output": { "ring": "output", "planet": 21, "teeth": 57 } },
3032
+ { "sun": "esun", "carrier": "ecarrier", "ring": "ering", "planets": ["ep1", "ep2", "ep3"], "drive": "sun", "module": 1, "teeth": [18, 18, 54], "output": { "ring": "eoutput", "planet": 21, "teeth": 57 } }
3033
+ ],
3034
+ "fits": [
3035
+ { "a": "m1", "b": "housing", "fastens": true, "min": -0.1, "note": "The shoulder motor, on its four screws, its boss seated in the plate's pocket" },
3036
+ { "a": "m1", "b": "sun", "shaft": true, "note": "The shaft in the sun" },
3037
+ { "a": "m2", "b": "esun", "shaft": true, "note": "The elbow motor's shaft in its sun" },
3038
+ { "a": "m2", "b": "upper", "fastens": true, "min": -0.1, "note": "The elbow motor, on its four screws, its boss seated in the plate's pocket" },
3039
+ { "a": "housing", "b": "base", "fastens": true, "min": 0, "note": "The housing, on the base's three columns" },
3040
+ { "a": "bridge", "b": "housing", "fastens": true, "min": 0, "note": "The bridge, on the housing's posts" },
3041
+ { "a": "b1", "b": "bridge", "seat": "press", "note": "The 6800 in its seat" },
3042
+ { "a": "es1", "b": "base", "fastens": true, "min": -0.1, "note": "The home switch on its post, 0.1 mm of resting contact allowed" },
3043
+ { "a": "es2", "b": "upper", "fastens": true, "min": -0.1, "note": "The elbow's home switch on its post" },
3044
+ { "a": "es1", "b": "upper", "min": -30, "note": "The arm's flag on the home switch's lever at the end of the range" },
3045
+ { "a": "es2", "b": "forearm", "min": -30, "note": "The forearm's flag on the elbow switch's lever" },
3046
+ { "a": "ghorn", "b": "gripper", "min": -30, "note": "The horn presses the fingers' flats: drawn at rest, the fingers don't move here" },
3047
+ { "a": "gservo", "b": "gripper", "fastens": true, "min": -0.2, "note": "The servo on its two posts" },
3048
+ { "a": "ecarrier", "b": "ering", "min": -1, "note": "Two specks: neither is printed" },
3049
+ { "a": "d1", "b": "shield", "fastens": true, "min": -20, "note": "Plugged in" },
3050
+ { "a": "d2", "b": "shield", "fastens": true, "min": -20, "note": "Plugged in" }
3051
+ ],
3052
+ "wires": [
3053
+ { "id": "shoulder", "from": "m1.connector", "to": "shield.X", "via": ["base.cable"], "gauge": "awg24", "colour": "black, red, green, blue", "connectors": ["JST-XH 4 pin", "screw terminal"], "note": "From the motor's own lead, down through the base" },
3054
+ { "id": "elbow", "from": "m2.connector", "to": "shield.Y", "via": ["upper.cable", "base.cable"], "gauge": "awg24", "colour": "black, red, green, blue", "connectors": ["JST-XH 4 pin", "screw terminal"] },
3055
+ { "id": "grip", "from": "gservo.connector", "to": "shield.Z", "via": ["gripper.cable", "forearm.cable", "upper.cable", "base.cable"], "gauge": "awg26", "colour": "brown, red, orange", "conductors": 3, "current": 0.7, "connectors": ["Servo JR 3 pin", "D11, 5 V, GND"] },
3056
+ { "id": "home1", "from": "es1.left", "to": "shield.X", "via": ["base.cable"], "gauge": "awg26", "colour": "white, black", "conductors": 2, "connectors": ["Crimped spade", "X limit and GND"] },
3057
+ { "id": "home2", "from": "es2.left", "to": "shield.Y", "via": ["upper.cable", "base.cable"], "gauge": "awg26", "colour": "white, black", "conductors": 2, "connectors": ["Crimped spade", "Y limit and GND"] },
3058
+ { "id": "power", "from": "psu.terminals", "to": "shield.top", "gauge": "awg22", "colour": "red, black", "conductors": 2, "current": 2, "connectors": ["Ring terminal", "Screw terminal"], "note": "24 V into the shield's motor terminals" }
3059
+ ],
3060
+ "loads": [
3061
+ { "mass": "lift.upper_mass", "at": "upper.elbow", "note": "The upper arm, the elbow's gears and its motor, worst placed at the elbow" },
3062
+ { "mass": "lift.fore_mass", "at": "forearm.cable", "note": "The forearm and the elbow's output gear, about half along" },
3063
+ { "mass": "lift.tool_mass", "at": "gripper.tool", "note": "The gripper, its servo and the payload" }
3064
+ ],
3065
+ "task": { "tool": "gripper.tool", "volume": { "x": [170, 250], "y": [-56.6, -56.6], "z": [-60, 60] }, "accuracy": 2.5, "accel": 300, "elbow": "left", "payload": "lift.payload", "grip": { "material": "petg", "servo": "gservo", "horn": "lift.grip_horn", "leaf": { "length": "lift.leaf_l", "thickness": "lift.leaf_t", "width": "lift.leaf_w" }, "travel": "lift.grip_travel", "friction": "lift.friction", "lever": "lift.grip_lever" } },
3066
+ "poses": { "reach": { "drive": -1269.4, "edrive": -2679.6, "squeeze": 0 } }
3067
+ }
3068
+ ```
3069
+
3070
+ The shoulder's bearing is the same `support` with the 6800 named; the elbow's three printed clips are named too, as they are in chapter 12. `joint.moment` puts 0.134 N m of tipping and 5.72 N across the shoulder bearing (24 N equivalent, against its 925 N static rating), and 0.038 N m through the elbow's clips, which FE reads at 1.1 MPa. Neither is close. The moment is small because the tool is held out in the plane the arm turns in: gravity does its work as torque on the motors, not as tipping on the bearing. A person who put an object out in front of the plate instead (the wrist 100 mm further from the wall) would see this moment grow, and the 6800 and the clips are what would need looking at again.
3071
+
3072
+ `link.deflection` reads the links as drawn, by finite elements: the upper arm with everything bolted to it, as one piece from its joint's axis out, held at the joint and loaded at its far end with the weight it carries, then the forearm the same way. This is a coarse model: 4 mm cubes through a 12 mm arm, and printed parts bolted together treated as one solid. It says the tool drops 1.8 mm at full stretch, nearly all of it from the upper arm bending in its plane with its own motor at its end. It's an `estimate`, and a generous one: a hand formula on the bare 22 × 12 mm upper arm gives about 0.6 mm at the tool; finer cells (`"cell": 2.5` on the joint's `support`) and a real measurement are both worth doing before believing either. Bench test 17 measures the tool's actual position. It is the largest term in the budget (the arm's own sag under its own weight and motor): the budget here, 2.5 mm, is a gripper's, and a gripper tolerates being a millimetre low. To draw upright, the arm would need its elbow motor off the far end of the upper arm, or a thicker link: that's the second thing a person would change.
3073
+
3074
+ `assembly.frequency` puts the lowest mode at about 12 Hz at full stretch, from the same FE stiffness and the mass it carries: slow enough to see, and worth moving gently at the start and end of a motion. The FE's coarseness is why this is said to one significant figure.
3075
+
3076
+ The joints in chapter 12's gearboxes (the motor's sun, the carriers and the planets) also now show `joint.moment` warnings that nothing named takes their tipping: they carry grams, on shafts and printed pins inside the gear train, and the check doesn't know them from a real joint. They stay as warnings; the check runs with `--json` for that reason, and because the rules are estimates.
3077
+
3078
+ ### Closing the gripper, shown at rest
3079
+
3080
+ The gripper is one flexing print, and an assembly can't show a leaf bending. `gripper-check` is the check of the closing. It takes the gripper apart into its palm and two fingers, through the `part` variable, and puts each finger on a slide that follows the servo's turn by what the horn pushes it: 3 mm at the flat over 17° of turn. Only the horn's tips, the fingers and the palm can touch; the leaves pass through their roots freely, because really the leaf bends rather than slides. The check's poses are `open` and `closed`, the finger shown at rest in `open`, and the closing is swept by the assembly's `poses`:
3081
+
3082
+ ```json projects/arm/assemblies/gripper-check.json
3083
+ {
3084
+ "$schema": "https://jonibach.github.io/rulecad/schemas/assembly.schema.json",
3085
+ "title": "Gripper: closing check",
3086
+ "kind": "fit",
3087
+ "description": "The gripper's three pieces moved apart so the fingers' closing can be swept: the palm, and each finger on a slide that follows the servo by how far the horn pushes it. The real part is one print, at rest; this is the check, not the build.",
3088
+ "gravity": [
3089
+ 0,
3090
+ 0,
3091
+ -1
3092
+ ],
3093
+ "uses": [
3094
+ "lift"
3095
+ ],
3096
+ "items": [
3097
+ {
3098
+ "id": "palm",
3099
+ "object": "gripper",
3100
+ "set": {
3101
+ "part": 1
3102
+ }
3103
+ },
3104
+ {
3105
+ "id": "upper",
3106
+ "object": "gripper",
3107
+ "set": {
3108
+ "part": 2
3109
+ }
3110
+ },
3111
+ {
3112
+ "id": "lower",
3113
+ "object": "gripper",
3114
+ "set": {
3115
+ "part": 3
3116
+ }
3117
+ },
3118
+ {
3119
+ "id": "gservo",
3120
+ "motor": {
3121
+ "model": "sg90",
3122
+ "drives": "squeeze",
3123
+ "duty": 0.05
3124
+ }
3125
+ },
3126
+ {
3127
+ "id": "ghorn",
3128
+ "object": "ghorn"
3129
+ }
3130
+ ],
3131
+ "joints": [
3132
+ {
3133
+ "id": "servo_on",
3134
+ "type": "fixed",
3135
+ "parent": "palm.servo",
3136
+ "child": "gservo.face"
3137
+ },
3138
+ {
3139
+ "id": "squeeze",
3140
+ "type": "revolute",
3141
+ "parent": "palm.horn",
3142
+ "child": "ghorn.axis",
3143
+ "min": 0,
3144
+ "max": 17,
3145
+ "label": "Grip"
3146
+ },
3147
+ {
3148
+ "id": "close_up",
3149
+ "type": "prismatic",
3150
+ "parent": "palm.upper",
3151
+ "child": "upper.upper",
3152
+ "min": 0,
3153
+ "max": 4,
3154
+ "follow": "squeeze",
3155
+ "ratio": 0.176
3156
+ },
3157
+ {
3158
+ "id": "close_low",
3159
+ "type": "prismatic",
3160
+ "parent": "palm.lower",
3161
+ "child": "lower.lower",
3162
+ "min": 0,
3163
+ "max": 4,
3164
+ "follow": "squeeze",
3165
+ "ratio": 0.176
3166
+ }
3167
+ ],
3168
+ "fits": [
3169
+ {
3170
+ "a": "gservo",
3171
+ "b": "palm",
3172
+ "fastens": true,
3173
+ "min": -0.3,
3174
+ "note": "The servo on its two posts, its case and boss down in the pocket"
3175
+ },
3176
+ {
3177
+ "a": "gservo",
3178
+ "b": "upper",
3179
+ "min": -0.05,
3180
+ "note": "The servo clears the finger"
3181
+ },
3182
+ {
3183
+ "a": "ghorn",
3184
+ "b": "upper",
3185
+ "min": -0.25,
3186
+ "note": "The horn's tip on the finger's flat"
3187
+ },
3188
+ {
3189
+ "a": "ghorn",
3190
+ "b": "lower",
3191
+ "min": -0.25,
3192
+ "note": "The horn's tip on the finger's flat"
3193
+ },
3194
+ {
3195
+ "a": "upper",
3196
+ "b": "palm",
3197
+ "min": -2,
3198
+ "note": "The leaf's root runs into its arm: the fingers slide here as a check, the leaf really bends"
3199
+ },
3200
+ {
3201
+ "a": "lower",
3202
+ "b": "palm",
3203
+ "min": -2,
3204
+ "note": "The leaf's root runs into its arm"
3205
+ }
3206
+ ],
3207
+ "task": {
3208
+ "tool": "upper.tool",
3209
+ "volume": {
3210
+ "x": [
3211
+ 85,
3212
+ 85
3213
+ ],
3214
+ "y": [
3215
+ 0,
3216
+ 0
3217
+ ],
3218
+ "z": [
3219
+ 8,
3220
+ 8
3221
+ ]
3222
+ },
3223
+ "payload": "lift.grip_payload",
3224
+ "grip": {
3225
+ "material": "petg",
3226
+ "servo": "gservo",
3227
+ "horn": "lift.grip_horn",
3228
+ "leaf": {
3229
+ "length": "lift.leaf_l",
3230
+ "thickness": "lift.leaf_t",
3231
+ "width": "lift.leaf_w"
3232
+ },
3233
+ "travel": "lift.grip_travel",
3234
+ "friction": "lift.friction",
3235
+ "lever": "lift.grip_lever"
3236
+ },
3237
+ "accel": 300
3238
+ },
3239
+ "poses": {
3240
+ "open": {
3241
+ "squeeze": 0
3242
+ },
3243
+ "closed": {
3244
+ "squeeze": 17
3245
+ }
3246
+ }
3247
+ }
3248
+ ```
3249
+
3250
+ The check sees the horn's tips touch the fingers' flats at both poses, and nothing else collide: the horn's swing clears the palm's wedges and its hub's hole, the servo's case sits in its pocket, and the fingers clear the stem. Everything else the assembly says about the arm's own joints doesn't apply here, and the check runs with `--json`. `tool.grip` in this assembly is the 50 g case, passing at 2.3 times over.
3251
+
3252
+ The closing check moves the fingers as stiff pieces on slides because the kit moves stiff pieces on joints. The real finger's leaf bends and tilts the jaw a little: 1 or 2 degrees of tilt over the 3 mm, which the object's own compliance takes up. Bench test: print it, load it with a 50 g weight on a thread, and watch the jaws.
3253
+
3254
+ ### A Z axis, and where it goes
3255
+
3256
+ Lifting wants a Z, the tool up and down, and on a flat arm a Z is the only way to pick something up: the arm of chapter 12 can only reach sideways. There are two places to put it, and the numbers choose between them. Say the tool end weighs 250 g and the arm all told 1.3 kg:
3257
+
3258
+ | | Z at the wrist | Z at the base |
3259
+ |---|---|---|
3260
+ | What the screw lifts | The gripper, the payload and the carriage: about 250 g, 2.5 N | The whole arm: motors, gears, links and tool, 1.3 kg, 13 N |
3261
+ | What it adds at the tool | About 300 g on the end of a 275 mm arm (steel rods and screw, frame, motor) | Nothing at the tool; the arm is unchanged |
3262
+ | What it costs | 0.9 N m more on the shoulder of an upright arm, and sag at the wrist | A column as tall as the travel, with the arm's whole tipping moment carried on two LM8UUs: the 1.3 kg at 150 mm is 2 N m, four times what the wrist's screw ever sees, and 8 mm rods flex under it |
3263
+ | What it leaves unchanged | The arm's links and joints, calibrated as they are | Nothing |
3264
+ | The choice | Wrist: it lifts a fifth of the mass and needs no new structure | |
3265
+
3266
+ So the Z goes at the wrist, bolted into the forearm's yoke where the gripper goes, and on the drawing arm only: on the upright arm a wrist Z runs level, in and out from the wall, and adds to the shoulder's load instead of lifting anything. The motor is the small geared stepper, the 28BYJ-48: 30 g rather than the 190 g NEMA 14, because a 250 g load on an 8 mm lead needs only 2.45 N. Everything turns on the lead's torque, `F = T × 2π × η / lead`: with an 8 mm lead the 28BYJ-48's 0.034 N m gives 15.5 N at about 58% (μ 0.2 on the nut, an `estimate` in the rule set), 6 times over.
3267
+
3268
+ The frame bolts into the yoke, two bars hold two 8 mm rods with teardrop holes, and the screw hangs from a coupler at the top with its far end loose in the bottom bar, steadied only by the nut: this is small enough that the rods keep it straight. The carriage rides the rods on two LM8UUs and carries a flanged T8 nut. Printed standing, its pockets and trap open from the top.
3269
+
3270
+ ```js projects/arm/objects/zframe.js
3271
+ // A Z axis for the wrist, printed flat: a frame bolted into the forearm's yoke, two bars with the rods' holes, and the
3272
+ // small stepper on the top bar, its shaft down through the bar to a lead screw.
3273
+ import jscad from '@jscad/modeling'
3274
+ const { cuboid, cylinder } = jscad.primitives
3275
+
3276
+ export function main (v) {
3277
+ const W = v.width, box = (x0, x1, y0, y1, z0 = 0, z1 = W) => cuboid({ size: [x1 - x0, y1 - y0, z1 - z0], center: [(x0 + x1) / 2, (y0 + y1) / 2, (z0 + z1) / 2] })
3278
+ const block = box(-v.block_x, v.block_x, -v.block_y, v.block_y, 0, v.block_w)
3279
+ const spine = box(v.block_x - 1, v.spine_x, -v.y_out, v.y_out)
3280
+ const top = box(v.block_x - 1, v.bar_x, v.y_in, v.y_out), bottom = box(v.block_x - 1, v.bar_x, -v.y_out, -v.y_in)
3281
+ const rods = [v.sx - v.rod_gap, v.sx + v.rod_gap].map((x) => v.shapes.teardropHole({ d: v.rod, length: 2 * v.y_out + 2, at: [x, -v.y_out - 1, v.half], into: '+y', through: true }))
3282
+ const screwFree = v.shapes.teardropHole({ d: v.screw, length: v.y_out - v.y_in + 2, at: [v.sx, -v.y_out - 1, v.half], into: '+y', through: true })
3283
+ const bolts = [-1, 1].map((s) => cylinder({ radius: v.bolt / 2, height: W + 1, center: [s * v.bolt_x, 0, v.half], segments: v.segments }))
3284
+ const motorHoles = [-1, 1].map((s) => v.shapes.teardropHole({ d: v.motor_hole, length: v.y_out - v.y_in + 2, at: [v.sx + s * v.tab, v.y_in - 1, v.half - v.offset], into: '+y', through: true }))
3285
+ const boss = v.shapes.teardropHole({ d: v.boss, length: v.y_out - v.y_in + 2, at: [v.sx, v.y_in - 1, v.half], into: '+y', through: true })
3286
+ return v.ops.subtract(v.ops.union(block, spine, top, bottom), rods, screwFree, bolts, motorHoles, boss)
3287
+ }
3288
+ ```
3289
+
3290
+ ```json projects/arm/objects/zframe.json
3291
+ {
3292
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
3293
+ "name": "zframe",
3294
+ "title": "Z axis frame",
3295
+ "version": "0.1.0",
3296
+ "uses": ["x1c", "m3"],
3297
+ "engine": "manifold",
3298
+ "orientation": "Flat on the bed: the rods' holes run along the bed and have teardrop roofs, the motor's mount cut through the top bar",
3299
+ "description": "Bolts into the forearm's yoke where the pen holder or gripper bolts. Two bars hold two 8 mm rods; a 28BYJ-48 on the top bar turns a T8 screw between them.",
3300
+ "anchors": {
3301
+ "mount": {"at": [0, 0, "block_w / 2"], "axis": [0, 0, -1], "ref": [1, 0, 0]},
3302
+ "motor": {"at": ["sx", "y_out", "half"], "axis": [0, -1, 0], "ref": [1, 0, 0]},
3303
+ "slide": {"at": ["sx", "0 - y_in", "half"], "axis": [0, 1, 0], "ref": [1, 0, 0]},
3304
+ "rod1": {"at": ["sx - rod_gap", "0 - y_out", "half"], "axis": [0, 1, 0], "ref": [1, 0, 0]},
3305
+ "rod2": {"at": ["sx + rod_gap", "0 - y_out", "half"], "axis": [0, 1, 0], "ref": [1, 0, 0]},
3306
+ "screw": {"at": ["sx", "0 - y_in", "half"], "axis": [0, 1, 0], "ref": [1, 0, 0]},
3307
+ "cable": {"at": ["sx", "y_out", 0], "axis": [0, 0, 1]}
3308
+ },
3309
+ "variables": {
3310
+ "width": {"value": 24, "unit": "mm", "rule": "The bars' thickness: the motor's screws sit 8 mm off the shaft, so the plate has to reach past them", "interface": true},
3311
+ "block_w": {"value": 16, "unit": "mm", "rule": "The block's thickness, the yoke's slot"},
3312
+ "half": {"value": "width / 2", "unit": "mm", "rule": "Half of it: the rods and the screw lie here"},
3313
+ "block_x": {"value": 8, "unit": "mm", "rule": "Half the block in the yoke"},
3314
+ "block_y": {"value": 9, "unit": "mm", "rule": "Half the block across it"},
3315
+ "bolt_x": {"value": 4, "unit": "mm", "rule": "Half the yoke's screws' spacing"},
3316
+ "bolt": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
3317
+ "spine_x": {"value": 12, "unit": "mm", "rule": "The spine's far edge"},
3318
+ "bar_x": {"value": 75, "unit": "mm", "rule": "The bars' far edge: past the second rod's hole"},
3319
+ "y_in": {"value": 41, "unit": "mm", "rule": "Half the window between the bars: the carriage and its 50 mm of travel", "interface": true},
3320
+ "y_out": {"value": 51, "unit": "mm", "rule": "Outside the bars: 10 mm of bar, enough for the motor's screws"},
3321
+ "sx": {"value": 43, "unit": "mm", "rule": "From the bolts to the screw", "interface": true},
3322
+ "rod_gap": {"value": 20, "unit": "mm", "rule": "Each rod from the screw: wide enough to clear the nut's flange and take the load's tipping"},
3323
+ "rod": {"value": 8, "unit": "mm", "rule": "The 8 mm rod's hole: a light press, printed", "label": "Rod", "show": true},
3324
+ "screw": {"value": 9, "unit": "mm", "rule": "The lead screw through the bottom bar, loose: its end only steadied"},
3325
+ "tab": {"value": 17.5, "unit": "mm", "rule": "Half the 28BYJ-48's tab screws' spacing", "kind": "community", "source": "28byj48 in @rulecad/rules"},
3326
+ "offset": {"value": 8, "unit": "mm", "rule": "The 28BYJ-48's screws sit this far from its shaft", "kind": "community", "source": "28byj48 in @rulecad/rules"},
3327
+ "motor_hole": {"value": 4.2, "unit": "mm", "rule": "The motor's tab screws, an M3 or a 4 mm"},
3328
+ "boss": {"value": 12, "unit": "mm", "rule": "Round the motor's boss, through the top bar"},
3329
+ "segments": {"value": 48, "rule": "Round enough"}
3330
+ }
3331
+ }
3332
+ ```
3333
+
3334
+ ```js projects/arm/objects/zcar.js
3335
+ // The Z axis's carriage, printed standing: two LM8UU pockets and a nut trap, all going down from the top.
3336
+ import jscad from '@jscad/modeling'
3337
+ const { cuboid } = jscad.primitives
3338
+
3339
+ export function main (v) {
3340
+ const body = cuboid({ size: [v.long * 2, v.deep * 2, v.high], center: [0, 0, v.high / 2] })
3341
+ const bearing = { bore: v.rod_d, outer_diameter: v.lm_d, length: v.lm_l }
3342
+ const pockets = [-1, 1].map((s) => v.shapes.lm8uuPocket(bearing, { fit: 'press', printer: v.x1c, at: [s * v.rod_gap, 0, v.high], into: '-z', through: true }))
3343
+ const nut = { flange_diameter: v.flange, flange_thickness: v.flange_t, body_diameter: v.nut_d, length: v.nut_l, hole_circle: v.hole_c, hole_count: v.holes, hole_diameter: v.hole_d }
3344
+ const trap = v.shapes.nutTrap(nut, { printer: v.x1c, at: [0, 0, v.high], depth: v.high + 1 })
3345
+ return v.ops.subtract(body, pockets, trap)
3346
+ }
3347
+ ```
3348
+
3349
+ ```json projects/arm/objects/zcar.json
3350
+ {
3351
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
3352
+ "name": "zcar",
3353
+ "title": "Z axis carriage",
3354
+ "version": "0.1.0",
3355
+ "uses": ["x1c"],
3356
+ "engine": "manifold",
3357
+ "orientation": "Standing, the rods' direction vertical: both LM8UU pockets and the nut trap open from the top, nothing to bridge",
3358
+ "description": "Rides the frame's two rods on LM8UU bearings; a flanged T8 nut in the middle takes the screw's push. The tool anchor is on its front face.",
3359
+ "anchors": {
3360
+ "slide": {"at": [0, 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]},
3361
+ "tool": {"at": ["long", 0, "high / 2"], "axis": [1, 0, 0], "ref": [0, 1, 0]},
3362
+ "lm1": {"at": ["0 - rod_gap", 0, "high - lm_l"], "axis": [0, 0, 1], "ref": [1, 0, 0]},
3363
+ "lm2": {"at": ["rod_gap", 0, "high - lm_l"], "axis": [0, 0, 1], "ref": [1, 0, 0]}
3364
+ },
3365
+ "variables": {
3366
+ "high": {"value": 30, "unit": "mm", "rule": "Along the rods: the two bearings' length and a floor", "label": "Carriage", "show": true, "interface": true},
3367
+ "long": {"value": 30, "unit": "mm", "rule": "Half the carriage's width along the arm: the rods' spacing and a wall", "interface": true},
3368
+ "deep": {"value": 13.5, "unit": "mm", "rule": "Half across: the nut's flange and a wall"},
3369
+ "rod_gap": {"value": 20, "unit": "mm", "rule": "Each rod from the screw, as the frame"},
3370
+ "rod_d": {"value": 8, "unit": "mm", "rule": "The rod, the LM8UU's bore"},
3371
+ "lm_d": {"value": 15, "unit": "mm", "rule": "The LM8UU's outside diameter"},
3372
+ "lm_l": {"value": 24, "unit": "mm", "rule": "The LM8UU's length"},
3373
+ "flange": {"value": 22, "unit": "mm", "rule": "The T8 nut's flange"},
3374
+ "flange_t": {"value": 3.5, "unit": "mm", "rule": "The flange's thickness"},
3375
+ "nut_d": {"value": 10.2, "unit": "mm", "rule": "The nut's body"},
3376
+ "nut_l": {"value": 15, "unit": "mm", "rule": "The nut's length"},
3377
+ "hole_c": {"value": 16, "unit": "mm", "rule": "The flange's bolt circle"},
3378
+ "holes": {"value": 4, "rule": "Bolts in the flange"},
3379
+ "hole_d": {"value": 3.5, "unit": "mm", "rule": "A flange bolt's hole"},
3380
+ "segments": {"value": 48, "rule": "Round enough"}
3381
+ }
3382
+ }
3383
+ ```
3384
+
3385
+ The Z axis is checked by itself, on a fixed frame, because an upright or a drawing arm around it changes nothing about its own figures. Its rods stand along y, and down is -y:
3386
+
3387
+ ```json projects/arm/assemblies/arm-z.json
3388
+ {
3389
+ "$schema": "https://jonibach.github.io/rulecad/schemas/assembly.schema.json",
3390
+ "title": "A Z axis on a T8 lead screw",
3391
+ "kind": "fit",
3392
+ "description": "The wrist's Z axis on its own, bolted down by the block that goes in the forearm's yoke. Fifty millimetres of travel on two 8 mm rods and LM8UU bearings, a 28BYJ-48 turning a T8 screw of 8 mm lead. The rods stand along y, so down is -y.",
3393
+ "gravity": [
3394
+ 0,
3395
+ -1,
3396
+ 0
3397
+ ],
3398
+ "uses": [
3399
+ "lift"
3400
+ ],
3401
+ "items": [
3402
+ {
3403
+ "id": "frame",
3404
+ "object": "zframe"
3405
+ },
3406
+ {
3407
+ "id": "car",
3408
+ "object": "zcar"
3409
+ },
3410
+ {
3411
+ "id": "zm",
3412
+ "motor": {
3413
+ "model": "28byj48",
3414
+ "drives": "z",
3415
+ "leadscrew": {
3416
+ "lead": "lift.z_lead",
3417
+ "diameter": 8,
3418
+ "friction": "lift.z_friction"
3419
+ },
3420
+ "microsteps": 1,
3421
+ "duty": 0.3
3422
+ }
3423
+ },
3424
+ {
3425
+ "id": "rod1",
3426
+ "bought": "rod-8",
3427
+ "set": {
3428
+ "length": 102
3429
+ }
3430
+ },
3431
+ {
3432
+ "id": "rod2",
3433
+ "bought": "rod-8",
3434
+ "set": {
3435
+ "length": 102
3436
+ }
3437
+ },
3438
+ {
3439
+ "id": "screw",
3440
+ "bought": "rod-8",
3441
+ "set": {
3442
+ "length": 92
3443
+ }
3444
+ },
3445
+ {
3446
+ "id": "lm1",
3447
+ "bought": "lm8uu"
3448
+ },
3449
+ {
3450
+ "id": "lm2",
3451
+ "bought": "lm8uu"
3452
+ }
3453
+ ],
3454
+ "joints": [
3455
+ {
3456
+ "id": "zm_on",
3457
+ "type": "fixed",
3458
+ "parent": "frame.motor",
3459
+ "child": "zm.face"
3460
+ },
3461
+ {
3462
+ "id": "z",
3463
+ "type": "prismatic",
3464
+ "parent": "frame.slide",
3465
+ "child": "car.slide",
3466
+ "min": 0,
3467
+ "max": 50,
3468
+ "label": "Z"
3469
+ },
3470
+ {
3471
+ "id": "rod1_on",
3472
+ "type": "fixed",
3473
+ "parent": "frame.rod1",
3474
+ "child": "rod1.bottom"
3475
+ },
3476
+ {
3477
+ "id": "rod2_on",
3478
+ "type": "fixed",
3479
+ "parent": "frame.rod2",
3480
+ "child": "rod2.bottom"
3481
+ },
3482
+ {
3483
+ "id": "screw_on",
3484
+ "type": "fixed",
3485
+ "parent": "frame.screw",
3486
+ "child": "screw.bottom"
3487
+ },
3488
+ {
3489
+ "id": "lm1_on",
3490
+ "type": "fixed",
3491
+ "parent": "car.lm1",
3492
+ "child": "lm1.face"
3493
+ },
3494
+ {
3495
+ "id": "lm2_on",
3496
+ "type": "fixed",
3497
+ "parent": "car.lm2",
3498
+ "child": "lm2.face"
3499
+ }
3500
+ ],
3501
+ "fits": [
3502
+ {
3503
+ "a": "zm",
3504
+ "b": "frame",
3505
+ "fastens": true,
3506
+ "min": -0.1,
3507
+ "note": "The stepper's face on the top bar"
3508
+ },
3509
+ {
3510
+ "a": "zm",
3511
+ "b": "screw",
3512
+ "min": -100,
3513
+ "note": "Coupled, drawn as one line"
3514
+ },
3515
+ {
3516
+ "a": "rod1",
3517
+ "b": "frame",
3518
+ "fastens": true,
3519
+ "min": -100,
3520
+ "note": "The rod pressed in its holes"
3521
+ },
3522
+ {
3523
+ "a": "rod2",
3524
+ "b": "frame",
3525
+ "fastens": true,
3526
+ "min": -100,
3527
+ "note": "The rod pressed in its holes"
3528
+ },
3529
+ {
3530
+ "a": "lm1",
3531
+ "b": "car",
3532
+ "fastens": true,
3533
+ "min": -100,
3534
+ "note": "The bearing in its pocket"
3535
+ },
3536
+ {
3537
+ "a": "lm2",
3538
+ "b": "car",
3539
+ "fastens": true,
3540
+ "min": -100,
3541
+ "note": "The bearing in its pocket"
3542
+ },
3543
+ {
3544
+ "a": "rod1",
3545
+ "b": "car",
3546
+ "min": -100,
3547
+ "note": "The rod runs through the carriage's bearing"
3548
+ },
3549
+ {
3550
+ "a": "rod2",
3551
+ "b": "car",
3552
+ "min": -100,
3553
+ "note": "The rod runs through the carriage's bearing"
3554
+ },
3555
+ {
3556
+ "a": "rod1",
3557
+ "b": "lm1",
3558
+ "min": -100,
3559
+ "note": "Rod in bearing"
3560
+ },
3561
+ {
3562
+ "a": "rod2",
3563
+ "b": "lm2",
3564
+ "min": -100,
3565
+ "note": "Rod in bearing"
3566
+ },
3567
+ {
3568
+ "a": "screw",
3569
+ "b": "car",
3570
+ "min": -100,
3571
+ "note": "The screw through the nut"
3572
+ },
3573
+ {
3574
+ "a": "screw",
3575
+ "b": "frame",
3576
+ "min": -100,
3577
+ "note": "The screw's end, loose in the bottom bar"
3578
+ }
3579
+ ],
3580
+ "loads": [
3581
+ {
3582
+ "mass": "lift.z_mass",
3583
+ "at": "car.tool",
3584
+ "note": "The gripper, servo, payload and carriage, as the screw sees them"
3585
+ }
3586
+ ],
3587
+ "task": {
3588
+ "tool": "car.tool",
3589
+ "volume": {
3590
+ "x": [
3591
+ 73,
3592
+ 73
3593
+ ],
3594
+ "y": [
3595
+ -26,
3596
+ 24
3597
+ ],
3598
+ "z": [
3599
+ 12,
3600
+ 12
3601
+ ]
3602
+ },
3603
+ "accuracy": 0.5,
3604
+ "accel": 100,
3605
+ "payload": "lift.z_mass"
3606
+ }
3607
+ }
3608
+ ```
3609
+
3610
+ The kit's `leadscrew` on the motor item turns the motor's torque into the screw's force, and into mm per turn for the steps: 4096 steps a revolution of the 28BYJ-48's shaft (64:1 geared, in the catalogue), and 8 mm a revolution is 512 steps a millimetre, the figure `cad machine` writes (`stepsPerUnit`). The joint's support is unnamed because the kit doesn't count linear bearings as a `support` (a printed clip or a bought ball bearing): `joint.moment` warns it can't check them. By hand: 326 g, the carriage and everything on it, is 0.074 N m of tipping at the tool, which over the rods' 40 mm spacing is 1.85 N each, against an LM8UU's 400 N static rating (a community figure): not the limit.
3611
+
3612
+ With an 8 mm lead the screw itself back-drives (`Tr8x8` has a 20° lead angle): the screw doesn't hold the load. The motor's own 64:1 gearbox does, 0.0588 N m of friction against 0.001 N m of back torque: the Z holds unpowered, and `motor.holds` says why. Choosing a 2 mm lead instead would make the screw lock on its own (a 5° lead angle) and lift four times slower still (0.29 mm/s against this one's 1.17 mm/s). The kit gives 1.17 mm/s at the 28BYJ-48's working speed: 43 s across the 50 mm travel. It's a slow axis and honest about it: the gripper's job is to pick something up, not to move quickly while doing it.
3613
+
3614
+ ### A belt instead of a screw
3615
+
3616
+ The same frame and carriage can run on a GT2 belt: a 20-tooth pulley on the motor's shaft, 40 mm of travel a turn, and the belt's stretch in the budget. The kit's `belt` on a motor item reads the belt's stiffness and its length and the load on it, and adds a `belt stretch` line to the error budget. On a 240 mm run with the 6 mm belt at 2817 N per unit strain per mm width (from `gt2-belt-6`), a 5 N load stretches it 5 × 240 / (2817 × 6) = 0.07 mm: the budget's biggest term, and small. The torque drops to 2.09 times over, because 40 mm a turn is five times the screw's 8 mm lead: the belt moves faster and pushes less. In the check a motor sits on its joint's axis because that's what the kit's check of the shaft expects; a real belt's pulley axis crosses the travel, and the assembly's description says so.
3617
+
3618
+ ```json projects/arm/assemblies/arm-z-belt.json
3619
+ {
3620
+ "$schema": "https://jonibach.github.io/rulecad/schemas/assembly.schema.json",
3621
+ "title": "A Z axis on a GT2 belt",
3622
+ "kind": "fit",
3623
+ "description": "The same frame and carriage driven by a 20-tooth pulley on a 6 mm GT2 belt, shown with the motor on the axis of the slide (the kit wants that for its checks): really the pulley's axis crosses it. The screw is gone; the belt stretches under load and the stretch goes in the budget.",
3624
+ "gravity": [
3625
+ 0,
3626
+ -1,
3627
+ 0
3628
+ ],
3629
+ "uses": [
3630
+ "lift"
3631
+ ],
3632
+ "items": [
3633
+ {
3634
+ "id": "frame",
3635
+ "object": "zframe"
3636
+ },
3637
+ {
3638
+ "id": "car",
3639
+ "object": "zcar"
3640
+ },
3641
+ {
3642
+ "id": "zm",
3643
+ "motor": {
3644
+ "model": "28byj48",
3645
+ "drives": "z",
3646
+ "belt": {
3647
+ "teeth": 20,
3648
+ "pitch": 2,
3649
+ "stiffness": "lift.belt_k",
3650
+ "width": 6,
3651
+ "length": 240,
3652
+ "load": "lift.belt_load"
3653
+ },
3654
+ "microsteps": 1,
3655
+ "duty": 0.3
3656
+ }
3657
+ },
3658
+ {
3659
+ "id": "rod1",
3660
+ "bought": "rod-8",
3661
+ "set": {
3662
+ "length": 102
3663
+ }
3664
+ },
3665
+ {
3666
+ "id": "rod2",
3667
+ "bought": "rod-8",
3668
+ "set": {
3669
+ "length": 102
3670
+ }
3671
+ },
3672
+ {
3673
+ "id": "lm1",
3674
+ "bought": "lm8uu"
3675
+ },
3676
+ {
3677
+ "id": "lm2",
3678
+ "bought": "lm8uu"
3679
+ }
3680
+ ],
3681
+ "joints": [
3682
+ {
3683
+ "id": "zm_on",
3684
+ "type": "fixed",
3685
+ "parent": "frame.motor",
3686
+ "child": "zm.face"
3687
+ },
3688
+ {
3689
+ "id": "z",
3690
+ "type": "prismatic",
3691
+ "parent": "frame.slide",
3692
+ "child": "car.slide",
3693
+ "min": 0,
3694
+ "max": 50,
3695
+ "label": "Z"
3696
+ },
3697
+ {
3698
+ "id": "rod1_on",
3699
+ "type": "fixed",
3700
+ "parent": "frame.rod1",
3701
+ "child": "rod1.bottom"
3702
+ },
3703
+ {
3704
+ "id": "rod2_on",
3705
+ "type": "fixed",
3706
+ "parent": "frame.rod2",
3707
+ "child": "rod2.bottom"
3708
+ },
3709
+ {
3710
+ "id": "lm1_on",
3711
+ "type": "fixed",
3712
+ "parent": "car.lm1",
3713
+ "child": "lm1.face"
3714
+ },
3715
+ {
3716
+ "id": "lm2_on",
3717
+ "type": "fixed",
3718
+ "parent": "car.lm2",
3719
+ "child": "lm2.face"
3720
+ }
3721
+ ],
3722
+ "fits": [
3723
+ {
3724
+ "a": "zm",
3725
+ "b": "frame",
3726
+ "fastens": true,
3727
+ "min": -0.1,
3728
+ "note": "The stepper's face on the top bar"
3729
+ },
3730
+ {
3731
+ "a": "rod1",
3732
+ "b": "frame",
3733
+ "fastens": true,
3734
+ "min": -100,
3735
+ "note": "The rod pressed in its holes"
3736
+ },
3737
+ {
3738
+ "a": "rod2",
3739
+ "b": "frame",
3740
+ "fastens": true,
3741
+ "min": -100,
3742
+ "note": "The rod pressed in its holes"
3743
+ },
3744
+ {
3745
+ "a": "lm1",
3746
+ "b": "car",
3747
+ "fastens": true,
3748
+ "min": -100,
3749
+ "note": "The bearing in its pocket"
3750
+ },
3751
+ {
3752
+ "a": "lm2",
3753
+ "b": "car",
3754
+ "fastens": true,
3755
+ "min": -100,
3756
+ "note": "The bearing in its pocket"
3757
+ },
3758
+ {
3759
+ "a": "rod1",
3760
+ "b": "car",
3761
+ "min": -100,
3762
+ "note": "The rod runs through the carriage's bearing"
3763
+ },
3764
+ {
3765
+ "a": "rod2",
3766
+ "b": "car",
3767
+ "min": -100,
3768
+ "note": "The rod runs through the carriage's bearing"
3769
+ },
3770
+ {
3771
+ "a": "rod1",
3772
+ "b": "lm1",
3773
+ "min": -100,
3774
+ "note": "Rod in bearing"
3775
+ },
3776
+ {
3777
+ "a": "rod2",
3778
+ "b": "lm2",
3779
+ "min": -100,
3780
+ "note": "Rod in bearing"
3781
+ }
3782
+ ],
3783
+ "loads": [
3784
+ {
3785
+ "mass": "lift.z_mass",
3786
+ "at": "car.tool",
3787
+ "note": "The gripper, servo, payload and carriage, as the screw sees them"
3788
+ }
3789
+ ],
3790
+ "task": {
3791
+ "tool": "car.tool",
3792
+ "volume": {
3793
+ "x": [
3794
+ 73,
3795
+ 73
3796
+ ],
3797
+ "y": [
3798
+ -26,
3799
+ 24
3800
+ ],
3801
+ "z": [
3802
+ 12,
3803
+ 12
3804
+ ]
3805
+ },
3806
+ "accuracy": 0.5,
3807
+ "accel": 100,
3808
+ "payload": "lift.z_mass"
3809
+ }
3810
+ }
3811
+ ```
3812
+
3813
+ A bare stepper on a belt would drop the load: a belt doesn't self-lock and there's no screw in the way. This motor's 64:1 gearbox holds it (`motor.holds` passes through gearbox friction), and that is why this small stepper is the one on the axis; a NEMA 17 belt axis would need a brake, a spring or its driver left on. `cad machine arm/arm-z-belt` writes `stepsPerUnit` at 102.4: 4096 steps a turn across 40 mm.
3814
+
3815
+ The commands. The checks that print what they find are written with `--json` where the findings include warnings on purpose (the estimates, the gearbox joints with no support, the linear bearings), so the replay here stops only if the assembly fails. Run them without `--json` and read them.
3816
+
3817
+ ```sh
3818
+ npx cad check arm/gripper
3819
+ npx cad check arm/ghorn
3820
+ npx cad check arm/zframe
3821
+ npx cad check arm/zcar
3822
+ npx cad check arm/arm-upright --json
3823
+ npx cad check arm/gripper-check --json
3824
+ npx cad check arm/arm-z --json
3825
+ npx cad check arm/arm-z-belt --json
3826
+ npx cad machine arm/arm-z
3827
+ npx cad list arm/arm-upright
3828
+ ```
3829
+
3830
+ What it says:
3831
+
3832
+ - `motor.torque` passes at 2.65 and 6.1 times over at the far pose; the shoulder needs 0.8 A here, not chapter 12's 0.5, and both figures rest on the catalogue's community motor figures, an estimate until measured.
3833
+ - `motor.holds` passes both joints with the power off, on the gears' 47% (an estimate): the table above says how much that figure can rise before it stops being true, and the detent torque carries it by a wide margin.
3834
+ - `joint.moment` gives the shoulder's 6800 38 times over, the elbow's clips 35. They aren't the limits; the arm's sag is.
3835
+ - `link.deflection` gives 1.8 mm at full stretch from coarse FE on the whole link, an `estimate` (see above): it's the largest error in the stack, and `task.accuracy` warns at 2.08 mm worst case against the 2.5 mm budget.
3836
+ - `task.reach` passes with 48.9 mm in hand.
3837
+ - `tool.grip` warns at 100 g (1.2 times over) on `arm-upright` and passes on `gripper-check` at 50 g (2.3 times over). `tool.strain` passes at 10% of PETG's strength at full close, in the leaf the check reads as a plain cantilever (`leafModel`).
3838
+ - The Z axis gives 512 steps a mm, 15.5 N of force at 6 times over its 2.45 N load, and holds with the power off because of the motor's gearbox. The belt gives 102.4 steps a mm and 5.1 N, 2 times over, with 0.07 mm of stretch in the budget.
3839
+ - `cad list` prints the same 443.5 g printed as `check`'s mass table, with the gripper's 37 g in it; the whole machine weighs about 1.27 kg before the wires and the wall.
3840
+
3841
+ `npx cad check arm/arm-upright --sweep` swings each joint of the arm through its range and finds nothing colliding, with the finger-flat contact allowed by its `fits` entry. It earned its keep: with chapter 12's limit of 160° of fold, the sweep found the gripper's servo hitting the shoulder housing and the output ring, because the gripper is 32 mm longer than the pen holder and its servo stands up from the print. The elbow is limited to 140° here, which clears with room to spare and costs nothing, since the box needs at most about 113°. Like chapter 12's sweep it is slow, half an hour on a busy laptop, so the replay leaves it out.
3842
+
3843
+ ### What a person would change
3844
+
3845
+ Read the check's output and the table at the top together, and three things stand out: the current (0.8 A against the shaft, and PETG or steel in the spindle if the arm will ever stall); the upper arm's in-plane stiffness (the 1.8 mm figure, which a person would refine by measuring, and fix by moving the elbow motor back along the arm or thickening the link across its 22 mm); the gripper's friction and grip, which rate the arm for 50 g reliably and 100 g with a pad on the jaws; and the elbow's home switch, which sits at 160° of fold, past the new 140° limit. As drawn, this arm can't home its elbow on that switch with the gripper on: a person would move the switch post and the forearm's flag to about 130°, or home the elbow against the opposite end of its travel. It's left unchanged here so that the arm's parts stay chapter 12's, and it's the one thing that stops this arm being built as it stands.
3846
+
3847
+ ### What waits on the bench
3848
+
3849
+ The figures that are `estimate` above wait on the bench: the gearbox's real efficiency for holding, the link's sag against FE, the leaf's force against `leafModel`, the friction of a jaw on what it holds and the jaw lever `lift.grip_lever`, the belt's working load, and the motor's torque figures as the catalogue gives them. Bench tests 14, 15 and 17 in `examples/bench/projects/benchmarks/MEASURE.md` measure the gearbox and the tool; for the gripper, the test is a 50 g weight on a thread held and shaken, then a 100 g one with a pad; for the Z axis, how far the carriage moves when a load is added, and whether the motor's gearbox slips. As in chapter 12, `cad measured` writes each result back where its estimate was, and the budget moves.
3850
+
3851
+ ## 14. A leg from the arm's parts: a stand, then a quadruped on paper
3852
+
3853
+ The shoulder gearbox that holds a drawing arm still also holds a leg up. This chapter takes the arm's hip and elbow, turns them on
3854
+ their side, and asks them to stand on a kitchen scale: one leg on a stand first, then four of them on a body as a design exercise.
3855
+ It is the project in `examples/bench/projects/leg` written out in full, and the tests write every file here and run every command.
3856
+
3857
+ Everything in this chapter is quasi-static: the feet move slowly enough that the body's own acceleration does not count, and no
3858
+ gait here has been built or measured. The gearbox's efficiency and the printed parts' strength are estimates, marked as such, until
3859
+ a bench says otherwise.
3860
+
3861
+ ### From arm to leg, in the numbers
3862
+
3863
+ | | The arm (chapter 12) | The leg |
3864
+ |---|---|---|
3865
+ | Joint axis | Vertical: gravity never loads a motor | Horizontal: gravity is the load |
3866
+ | Task | A pen's drag on paper, 0.3 N | A robot's weight on the foot, 7.4 N |
3867
+ | Worst torque | 0.2 N m at the shoulder | 0.451 N m at the knee, 0.147 N m at the hip |
3868
+ | Margin at the motor | 8 times (shoulder, at 0.5 A) | 3.1 times at the knee, 11.4 times at the hip, at the same 0.5 A |
3869
+ | What decides the link length | Reach across a sheet, and how far the elbow's error swings | The lever on the foot: the shorter, the less torque |
3870
+
3871
+ The same gearbox on a NEMA 17 at the hip and a NEMA 14 at the knee. A 1.5 kg robot trotting puts its weight on two feet at a time, so
3872
+ each leg carries up to 0.75 kg: that is the stand's load, and it is what this leg weighs by itself, near enough: 765 g of motors, gears and
3873
+ prints. So the carriage's own weight stands in for the robot's body, with nothing added.
3874
+
3875
+ The thigh is 100 mm, the shortest that keeps the knee's 43 mm gearbox radius clear of the hip's (43 + 43 and a little to swing past), and
3876
+ the shin 100 mm to match. At 170 mm of standing height the foot is under the hip with the knee bent 32° each way, and the
3877
+ torque on the knee is the shin's weight share across its lever: about 53 mm at the middle of the stride, up to about 73 mm at its ends.
3878
+
3879
+ ### The leg's rules
3880
+
3881
+ The stack of the same gearbox with the motor's face as zero, what the leg stands on, and the stand. Nothing is copied by hand from the arm: where a figure is the arm's, its rule says so.
3882
+
3883
+ ```json rules/leg.json
3884
+ {
3885
+ "_doc": "A leg made from the drawing arm's parts: the stack of the same gearbox, with the arm's motor face as this leg's zero, what the leg is asked to stand up, and the stand it does that on. Examples chapter 14 explains each.",
3886
+ "name": "leg",
3887
+ "rules": {
3888
+ "plate": {"value": 5, "unit": "mm", "rule": "The hip housing's plate: enough for M3 screws into a NEMA 17 (1.5 × their size)", "kind": "default", "source": "EXAMPLES chapter 11's housing", "checked": "2026-11-09"},
3889
+ "gear": {"value": 8, "unit": "mm", "rule": "Each gear stage's face", "kind": "default", "source": "EXAMPLES chapter 11's gearbox", "checked": "2026-11-09"},
3890
+ "ring_gap": {"value": 0.4, "unit": "mm", "rule": "Between the fixed ring and the output ring", "kind": "default", "source": "EXAMPLES chapter 11's gearbox", "checked": "2026-11-09"},
3891
+ "flange": {"value": 5, "unit": "mm", "rule": "The output ring's flange: thick enough for four M3 screws to bite", "kind": "default", "source": "EXAMPLES chapter 12", "checked": "2026-11-09"},
3892
+ "output_top": {"value": "plate + gear + ring_gap + gear + flange", "unit": "mm", "rule": "The top of the hip's output flange, from the motor's face", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
3893
+ "disc": {"value": 3, "unit": "mm", "rule": "The spindle's disc, on the flange", "kind": "default", "source": "EXAMPLES chapter 12", "checked": "2026-11-09"},
3894
+ "bridge_gap": {"value": 0.6, "unit": "mm", "rule": "Between the spindle's disc and the bridge above it", "kind": "default", "source": "EXAMPLES chapter 12", "checked": "2026-11-09"},
3895
+ "bridge": {"value": 7, "unit": "mm", "rule": "The bridge's thickness: the 5 mm bearing and a 2 mm ledge", "kind": "default", "source": "EXAMPLES chapter 12", "checked": "2026-11-09"},
3896
+ "bridge_low": {"value": "output_top + disc + bridge_gap", "unit": "mm", "rule": "The bridge's underside, from the motor's face", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
3897
+ "arm_gap": {"value": 0.5, "unit": "mm", "rule": "Between the bridge's top and the thigh", "kind": "default", "source": "EXAMPLES chapter 12", "checked": "2026-11-09"},
3898
+ "arm": {"value": 12, "unit": "mm", "rule": "The thigh's thickness, a plate over the knee too", "kind": "default", "source": "EXAMPLES chapter 12's upper arm", "checked": "2026-11-09"},
3899
+ "bearing_bore": {"value": 10, "unit": "mm", "rule": "The 6800's bore", "kind": "spec", "source": "bearing-6800 in @rulecad/rules (NTN)", "checked": "2026-11-09"},
3900
+ "bearing_outer": {"value": 19, "unit": "mm", "rule": "The 6800's outside diameter", "kind": "spec", "source": "bearing-6800", "checked": "2026-11-09"},
3901
+ "bearing_width": {"value": 5, "unit": "mm", "rule": "The 6800's width", "kind": "spec", "source": "bearing-6800", "checked": "2026-11-09"},
3902
+ "knee_flange": {"value": "bridge_low + bridge + arm_gap - gear - ring_gap - gear - flange", "unit": "mm", "rule": "The knee output flange's underside, where the shin bolts on: the thigh's underside less the knee's stack", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
3903
+ "boss": {"value": 11.5, "unit": "mm", "rule": "The shin's boss, so its bar passes under the knee's clips", "kind": "default", "source": "EXAMPLES chapter 12's forearm", "checked": "2026-11-09"},
3904
+ "thigh": {"value": 100, "unit": "mm", "rule": "Hip to knee: past the 43 mm radius of each gearbox's posts, plus room to swing past one another", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
3905
+ "shin": {"value": 100, "unit": "mm", "rule": "Knee to the middle of the foot: as long as the thigh, the longest stride for the height", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
3906
+ "foot_r": {"value": 15, "unit": "mm", "rule": "The foot's round end, with its pad: rolls on the ground as the shin leans, so the gait's point stays over the contact", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
3907
+ "stance": {"value": 170, "unit": "mm", "rule": "Hip to the foot's centre, standing: the knee bent about 32° each way, its lever on the foot small", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
3908
+ "stride": {"value": 40, "unit": "mm", "rule": "The foot's travel in stance", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
3909
+ "lift": {"value": 15, "unit": "mm", "rule": "The foot's lift in swing", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
3910
+ "robot": {"value": 1.5, "unit": "kg", "rule": "The small robot the leg is sized for first; the quadruped built from these parts weighs more, and the chapter says how much", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
3911
+ "share": {"value": "robot / 2", "unit": "kg", "rule": "Each leg's share in a trot, the most: two feet down at once", "kind": "default", "source": "Statics: the weight split over the two feet in stance", "checked": "2026-11-09"},
3912
+ "scale_h": {"value": 25, "unit": "mm", "rule": "A kitchen scale's height: the foot's ground is its top. Yours differs", "kind": "estimate", "source": "A guess at a common 5 kg scale: measure yours", "checked": "2026-11-09"},
3913
+ "stop_drop": {"value": 3, "unit": "mm", "rule": "How far the carriage drops onto its stops when the foot lifts: the foot pushes it up this much standing, so the scale carries the leg", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
3914
+ "rod_x": {"value": 90, "unit": "mm", "rule": "Each rod's distance from the middle: a 130 mm scale fits between the feet", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
3915
+ "rod_y": {"value": 17, "unit": "mm", "rule": "The rods behind the carriage's face", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
3916
+ "rod_d": {"value": 8, "unit": "mm", "rule": "The rods' diameter", "kind": "community", "source": "rod-8 in @rulecad/rules", "checked": "2026-11-09"},
3917
+ "rod_long": {"value": 300, "unit": "mm", "rule": "The rods, cut to this: bench to above the carriage's travel", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
3918
+ "foot_block": {"value": 16, "unit": "mm", "rule": "The foot blocks' thickness: 12 mm of socket and a floor", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
3919
+ "body_half": {"value": 75, "unit": "mm", "rule": "Hip to hip along the body, halved: the side plate, 242 mm long, fits on a 256 mm bed, and the knees point outward so they stay apart", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
3920
+ "body_w": {"value": 50, "unit": "mm", "rule": "The body's half-width, to the hips' plates: two hip motors back to back fit inside", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
3921
+ "side_t": {"value": 6, "unit": "mm", "rule": "The side plate's thickness", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
3922
+ "robot_mass": {"value": 3.8, "unit": "kg", "rule": "The quadruped as drawn: 3.37 kg of prints, motors and bearings from cad list, and about 0.4 kg for its drivers, an Uno and shield, a battery and the wires, an estimate until built", "kind": "estimate", "source": "cad list leg/quadruped and a guess at the electronics", "checked": "2026-11-09"},
3923
+ "foot_socket": {"value": 12, "unit": "mm", "rule": "How far each rod goes into a foot block", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"}
3924
+ }
3925
+ }
3926
+ ```
3927
+
3928
+ ```json projects/leg/project.json
3929
+ {
3930
+ "name": "leg",
3931
+ "description": "A leg from the arm's parts: hip and knee from the same compound planetary, on a stand that reads its stance on a scale, and four of them as a quadruped. EXAMPLES chapter 14 explains it.",
3932
+ "material": "PLA",
3933
+ "objects": [
3934
+ "carriage",
3935
+ "foot",
3936
+ "tie",
3937
+ "collar",
3938
+ "housing",
3939
+ "sun",
3940
+ "planet",
3941
+ "output",
3942
+ "bridge",
3943
+ "spindle",
3944
+ "thigh",
3945
+ "clip",
3946
+ "shin",
3947
+ "pad",
3948
+ "side",
3949
+ "beam"
3950
+ ]
3951
+ }
3952
+ ```
3953
+
3954
+ ### The gearbox, as the arm's
3955
+
3956
+ The housing, the sun, the planets, the carrier that isn't printed, the output ring with its flange, the spindle with its shaft through a 6800, the bridge, and the clips are chapter 12's prints, read through this leg's rule set. The hip is the arm's shoulder and the knee the elbow, each turned on its side.
3957
+
3958
+ ```json projects/leg/objects/housing.json
3959
+ {
3960
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
3961
+ "name": "housing",
3962
+ "title": "Shoulder housing and fixed ring",
3963
+ "version": "0.1.0",
3964
+ "uses": ["x1c", "leg", "m3"],
3965
+ "engine": "manifold",
3966
+ "orientation": "The motor plate on the bed, the ring and posts up",
3967
+ "anchors": {
3968
+ "axis": {"at": [0, 0, "plate"], "axis": [0, 0, 1]},
3969
+ "motor": {"at": [0, 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]}
3970
+ },
3971
+ "variables": {
3972
+ "plate": {"value": "leg.plate", "unit": "mm", "rule": "The motor plate", "interface": true},
3973
+ "gear": {"value": "leg.gear", "unit": "mm", "rule": "The fixed ring's face: strong enough for the motor's whole torque"},
3974
+ "rim": {"value": 62, "unit": "mm", "rule": "Round the 54-tooth ring, three lines and more of wall"},
3975
+ "module": {"value": 1, "unit": "mm", "rule": "The gears'"},
3976
+ "teeth": {"value": 54, "rule": "The fixed ring"},
3977
+ "post_r": {"value": 37, "unit": "mm", "rule": "Three posts outside the output ring", "interface": true},
3978
+ "post": {"value": 7, "unit": "mm", "rule": "Each post's diameter"},
3979
+ "post_high": {"value": "leg.bridge_low - 0 - plate", "unit": "mm", "rule": "From the plate to under the bridge", "interface": true},
3980
+ "pilot": {"value": 2.9, "unit": "mm", "rule": "An M3 screw self-tapped", "kind": "community"},
3981
+ "pilot_depth": {"value": 8, "unit": "mm", "rule": "For an M3 × 16 through the bridge"},
3982
+ "column_r": {"value": 37, "unit": "mm", "rule": "Over the base's columns"},
3983
+ "lobe": {"value": 12, "unit": "mm", "rule": "The plate reaches out over each column"},
3984
+ "screw": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance, down into the column"},
3985
+ "head": {"value": "m3.head + 2 * x1c.fit + x1c.hole_comp", "unit": "mm", "rule": "The screw head's counterbore"},
3986
+ "head_depth": {"value": "m3.head_height + x1c.layer", "unit": "mm", "rule": "A socket head's height, sunk"},
3987
+ "segments": {"value": 64, "rule": "Round enough"},
3988
+ "ring_segments": {"value": 96, "rule": "Smooth to the eye and to the gear"},
3989
+ "rad": {"value": 0.017453293, "rule": "Radians in a degree"},
3990
+ "p1": {"value": 30, "unit": "°", "rule": "First post"},
3991
+ "p2": {"value": 150, "unit": "°", "rule": "Second post"},
3992
+ "p3": {"value": 270, "unit": "°", "rule": "Third post"},
3993
+ "f1": {"value": 90, "unit": "°", "rule": "First foot, over a column"},
3994
+ "f2": {"value": 210, "unit": "°", "rule": "Second foot"},
3995
+ "f3": {"value": 330, "unit": "°", "rule": "Third foot"}
3996
+ }
3997
+ }
3998
+ ```
3999
+
4000
+ ```js projects/leg/objects/housing.js
4001
+ // The motor plate with the fixed ring and posts standing on it. The motor bolts underneath, its shaft up through the middle.
4002
+ import jscad from '@jscad/modeling'
4003
+ const { cylinder, cylinderElliptic } = jscad.primitives
4004
+ const { translate } = jscad.transforms
4005
+
4006
+ export function main (v) {
4007
+ const motor = v.motors.motorModel('17HS4401')
4008
+ const at = (r, a) => [r * Math.cos(a), r * Math.sin(a)]
4009
+ const posts = [v.p1, v.p2, v.p3].map((a) => a * v.rad), feet = [v.f1, v.f2, v.f3].map((a) => a * v.rad)
4010
+ const plate = cylinder({ radius: v.rim / 2, height: v.plate, center: [0, 0, v.plate / 2], segments: v.ring_segments })
4011
+ const ring = translate([0, 0, v.plate], v.gears.internal({ module: v.module, teeth: v.teeth, width: v.gear, rim: v.rim }))
4012
+ const lobes = [...posts, ...feet].map((a) => cylinder({ radius: v.lobe / 2, height: v.plate, center: [...at(v.post_r, a), v.plate / 2], segments: v.segments }))
4013
+ const joins = [...posts, ...feet].map((a) => jscad.transforms.rotateZ(a, jscad.primitives.cuboid({ size: [v.post_r - v.rim / 2 + 2, v.lobe, v.plate], center: [(v.post_r + v.rim / 2 - 2) / 2, 0, v.plate / 2] })))
4014
+ const uprights = posts.map((a) => cylinder({ radius: v.post / 2, height: v.post_high + v.plate, center: [...at(v.post_r, a), (v.post_high + v.plate) / 2], segments: v.segments }))
4015
+ const pilots = posts.map((a) => cylinder({ radius: v.pilot / 2, height: v.pilot_depth, center: [...at(v.post_r, a), v.plate + v.post_high - v.pilot_depth / 2], segments: v.segments }))
4016
+ const screws = feet.map((a) => cylinder({ radius: v.screw / 2, height: v.plate + 1, center: [...at(v.column_r, a), v.plate / 2], segments: v.segments }))
4017
+ const heads = feet.map((a) => cylinder({ radius: v.head / 2, height: v.head_depth, center: [...at(v.column_r, a), v.plate - v.head_depth / 2], segments: v.segments }))
4018
+ // the pocket for the motor's boss would be bridged across: a 45° cone from its roof up through the plate needs no bridge
4019
+ const hole = v.motors.mountModel(motor, { plate: v.plate, counterbore: true }), rise = v.plate - hole.pocketDepth
4020
+ const roof = cylinderElliptic({ height: rise + 1, startRadius: [hole.pocket / 2, hole.pocket / 2], endRadius: [hole.pocket / 2 - rise - 1, hole.pocket / 2 - rise - 1], center: [0, 0, hole.pocketDepth + (rise + 1) / 2], segments: v.segments })
4021
+ return v.ops.subtract(v.ops.union(plate, ring, lobes, joins, uprights), v.motors.mount(motor, { plate: v.plate, counterbore: true }, v.ops), pilots, screws, heads, roof)
4022
+ }
4023
+ ```
4024
+
4025
+ ```json projects/leg/objects/sun.json
4026
+ {
4027
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4028
+ "name": "sun",
4029
+ "title": "Sun gear on a motor's shaft",
4030
+ "version": "0.1.0",
4031
+ "uses": ["x1c"],
4032
+ "engine": "manifold",
4033
+ "orientation": "Gear down, the hub up",
4034
+ "anchors": {
4035
+ "axis": {"at": [0, 0, "0 - gap"], "axis": [0, 0, 1]}
4036
+ },
4037
+ "variables": {
4038
+ "gap": {"value": 0.3, "unit": "mm", "rule": "Clear of the motor plate"},
4039
+ "module": {"value": 1, "unit": "mm", "rule": "The gears'"},
4040
+ "teeth": {"value": 18, "rule": "As the planets' first step"},
4041
+ "width": {"value": 8, "unit": "mm", "rule": "The first stage"},
4042
+ "hub": {"value": 12, "unit": "mm", "rule": "A hub above the teeth, inside the planets' second step"},
4043
+ "tall": {"value": 16, "unit": "mm", "rule": "Up through both stages, so 12 mm of the shaft's flat is gripped"},
4044
+ "tip": {"value": 18.7, "unit": "mm", "rule": "Where the shaft's 24 mm tip is from the sun's underside, 5.3 mm above the mounting face (the elbow's plate is thicker: its sun sets this less)", "interface": true, "tweak": {"min": 10, "max": 24}},
4045
+ "segments": {"value": 64, "rule": "Round enough"}
4046
+ }
4047
+ }
4048
+ ```
4049
+
4050
+ ```js projects/leg/objects/sun.js
4051
+ // The sun with a hub above it, up through both stages, for grip on the shaft's flat.
4052
+ import jscad from '@jscad/modeling'
4053
+ const { cylinder } = jscad.primitives
4054
+
4055
+ export function main (v) {
4056
+ const motor = v.motors.motorModel('nema17')
4057
+ const gear = v.gears.spur({ module: v.module, teeth: v.teeth, width: v.width })
4058
+ const hub = cylinder({ radius: v.hub / 2, height: v.tall, center: [0, 0, v.tall / 2], segments: v.segments })
4059
+ return v.ops.subtract(v.ops.union(gear, hub), v.motors.bore(motor, { depth: v.tall, tip: v.tip }, v.ops))
4060
+ }
4061
+ ```
4062
+
4063
+ ```json projects/leg/objects/planet.json
4064
+ {
4065
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4066
+ "name": "planet",
4067
+ "title": "Stepped planet",
4068
+ "version": "0.1.0",
4069
+ "uses": ["x1c"],
4070
+ "engine": "manifold",
4071
+ "orientation": "The wider step on the bed",
4072
+ "anchors": {
4073
+ "axis": {"at": [0, 0, "width * 2 + gap"], "axis": [0, 0, -1]}
4074
+ },
4075
+ "variables": {
4076
+ "gap": {"value": 0.3, "unit": "mm", "rule": "Clear of the motor plate"},
4077
+ "module": {"value": 1, "unit": "mm", "rule": "The gears'"},
4078
+ "low": {"value": 18, "rule": "On the sun and the held ring"},
4079
+ "high": {"value": 21, "rule": "On the output ring"},
4080
+ "width": {"value": 8, "unit": "mm", "rule": "Each stage"},
4081
+ "low_chamfer": {"value": 0.25, "unit": "mm", "rule": "The top step's tooth tips slanted in at their root, so they do not overhang the step below"}
4082
+ }
4083
+ }
4084
+ ```
4085
+
4086
+ ```js projects/leg/objects/planet.js
4087
+ // A planet in two steps, in one piece, printed with the wider step on the bed.
4088
+ import jscad from '@jscad/modeling'
4089
+ const { translate } = jscad.transforms
4090
+
4091
+ export function main (v) {
4092
+ const high = v.gears.spur({ module: v.module, teeth: v.high, width: v.width })
4093
+ const low = translate([0, 0, v.width], v.gears.spur({ module: v.module, teeth: v.low, width: v.width, chamfer: v.low_chamfer }))
4094
+ return v.ops.union(high, low)
4095
+ }
4096
+ ```
4097
+
4098
+ ```json projects/leg/objects/speck.json
4099
+ {
4100
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4101
+ "name": "speck",
4102
+ "title": "Carrier (not printed)",
4103
+ "version": "0.1.0",
4104
+ "role": "reference",
4105
+ "anchors": {
4106
+ "axis": {"at": [0, 0, 0], "axis": [0, 0, 1]},
4107
+ "a": {"at": [18, 0, 0], "axis": [0, 0, 1]},
4108
+ "b": {"at": ["0 - 9", "18 * sind(120)", 0], "axis": [0, 0, 1]},
4109
+ "c": {"at": ["0 - 9", "0 - 18 * sind(120)", 0], "axis": [0, 0, 1]}
4110
+ },
4111
+ "variables": {
4112
+ "r": {"value": 0.2, "unit": "mm", "rule": "A speck, so the planets' joints have something to hang from"},
4113
+ "far": {"value": 110, "unit": "mm", "rule": "Out of the way, past the leg"}
4114
+ }
4115
+ }
4116
+ ```
4117
+
4118
+ ```js projects/leg/objects/speck.js
4119
+ // Nothing is printed here: the planets ride on the sun and the rings. A mark for the planets' joints to be on.
4120
+ import jscad from '@jscad/modeling'
4121
+ const { sphere } = jscad.primitives
4122
+
4123
+ export function main (v) { return sphere({ radius: v.r, center: [0, 0, v.far] }) }
4124
+ ```
4125
+
4126
+ ```json projects/leg/objects/output.json
4127
+ {
4128
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4129
+ "name": "output",
4130
+ "title": "Output ring and flange",
4131
+ "version": "0.1.0",
4132
+ "uses": ["x1c", "leg", "m3"],
4133
+ "engine": "manifold",
4134
+ "orientation": "The flange on the bed, the teeth standing on it",
4135
+ "description": "Printed flange down and fitted upside down: the same part on the shoulder and the elbow.",
4136
+ "anchors": {
4137
+ "axis": {"at": [0, 0, "top + width"], "axis": [0, 0, -1]},
4138
+ "flange": {"at": [0, 0, 0], "axis": [0, 0, -1]}
4139
+ },
4140
+ "variables": {
4141
+ "top": {"value": "leg.flange", "unit": "mm", "rule": "The flange, printed on the bed", "interface": true},
4142
+ "width": {"value": "leg.gear", "unit": "mm", "rule": "The output ring's face"},
4143
+ "rim": {"value": 66, "unit": "mm", "rule": "Round the 57-tooth ring"},
4144
+ "module": {"value": 1, "unit": "mm", "rule": "The gears'"},
4145
+ "teeth": {"value": 57, "rule": "The output ring"},
4146
+ "pilot": {"value": 2.9, "unit": "mm", "rule": "An M3 screw self-tapped into the flange", "kind": "community"},
4147
+ "middle": {"value": 15, "unit": "mm", "rule": "A hole in the middle for the motor's shaft to come up in"},
4148
+ "bolt": {"value": 20, "unit": "mm", "rule": "Radius of the bolt circle", "interface": true},
4149
+ "segments": {"value": 24, "rule": "Small holes"},
4150
+ "ring_segments": {"value": 96, "rule": "Smooth to the eye and to the gear"},
4151
+ "quarter": {"value": 1.57079633, "rule": "The bolts, a quarter turn apart, in radians"},
4152
+ "bolts": {"value": 4, "rule": "Four"}
4153
+ }
4154
+ }
4155
+ ```
4156
+
4157
+ ```js projects/leg/objects/output.js
4158
+ // The output ring, drawn as it prints: its flange on the bed, the teeth standing on it; it goes on upside down.
4159
+ import jscad from '@jscad/modeling'
4160
+ const { cylinder } = jscad.primitives
4161
+ const { translate } = jscad.transforms
4162
+
4163
+ export function main (v) {
4164
+ const flange = cylinder({ radius: v.rim / 2, height: v.top, center: [0, 0, v.top / 2], segments: v.ring_segments })
4165
+ const ring = translate([0, 0, v.top], v.gears.internal({ module: v.module, teeth: v.teeth, width: v.width, rim: v.rim }))
4166
+ const holes = Array.from({ length: v.bolts }, (_, k) => cylinder({ radius: v.pilot / 2, height: v.top + 1, center: [v.bolt * Math.cos(k * v.quarter), v.bolt * Math.sin(k * v.quarter), v.top / 2], segments: v.segments }))
4167
+ const middle = cylinder({ radius: v.middle / 2, height: v.top + 1, center: [0, 0, v.top / 2], segments: v.ring_segments })
4168
+ return v.ops.subtract(v.ops.union(flange, ring), holes, middle)
4169
+ }
4170
+ ```
4171
+
4172
+ ```json projects/leg/objects/bridge.json
4173
+ {
4174
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4175
+ "name": "bridge",
4176
+ "title": "Bridge: the 6800's seat",
4177
+ "version": "0.1.0",
4178
+ "uses": ["x1c", "leg", "m3"],
4179
+ "engine": "manifold",
4180
+ "orientation": "Upside to the sky, as it goes on: the pocket opens upward and its ledge prints flat",
4181
+ "description": "Three arms across the housing's posts, holding the bearing that takes the output's tipping load.",
4182
+ "anchors": {
4183
+ "seat": {"at": [0, 0, "thick - width"], "axis": [0, 0, 1]},
4184
+ "under": {"at": [0, 0, 0], "axis": [0, 0, 1]}
4185
+ },
4186
+ "variables": {
4187
+ "thick": {"value": "leg.bridge", "unit": "mm", "rule": "The bearing's width and a ledge", "interface": true},
4188
+ "bore": {"value": "leg.bearing_bore", "unit": "mm", "rule": "The 6800's bore"},
4189
+ "outer": {"value": "leg.bearing_outer", "unit": "mm", "rule": "The 6800's outside"},
4190
+ "width": {"value": "leg.bearing_width", "unit": "mm", "rule": "The 6800's width"},
4191
+ "relief": {"value": "thick - width", "unit": "mm", "rule": "Through the ledge, so the seat prints without a bridge"},
4192
+ "hub": {"value": 34, "unit": "mm", "rule": "Round the pocket, three lines and more of wall"},
4193
+ "post_r": {"value": 37, "unit": "mm", "rule": "On the housing's posts"},
4194
+ "lobe": {"value": 12, "unit": "mm", "rule": "Each arm's width"},
4195
+ "p1": {"value": 30, "unit": "°", "rule": "First post"},
4196
+ "p2": {"value": 150, "unit": "°", "rule": "Second post"},
4197
+ "p3": {"value": 270, "unit": "°", "rule": "Third post"},
4198
+ "rad": {"value": 0.017453293, "rule": "Radians in a degree"},
4199
+ "screw": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
4200
+ "head": {"value": "m3.head + 2 * x1c.fit + x1c.hole_comp", "unit": "mm", "rule": "The screw head's counterbore"},
4201
+ "head_depth": {"value": "m3.head_height + x1c.layer", "unit": "mm", "rule": "A socket head's height, sunk, so the thigh passes over"},
4202
+ "segments": {"value": 64, "rule": "Round enough"}
4203
+ }
4204
+ }
4205
+ ```
4206
+
4207
+ ```js projects/leg/objects/bridge.js
4208
+ // A three-armed plate over the gearbox, the bearing's seat in the middle.
4209
+ import jscad from '@jscad/modeling'
4210
+ const { cylinder, cuboid } = jscad.primitives
4211
+ const { rotateZ } = jscad.transforms
4212
+
4213
+ export function main (v) {
4214
+ const posts = [v.p1, v.p2, v.p3].map((a) => a * v.rad), at = (a) => [v.post_r * Math.cos(a), v.post_r * Math.sin(a)]
4215
+ const hub = cylinder({ radius: v.hub / 2, height: v.thick, center: [0, 0, v.thick / 2], segments: v.segments * 2 })
4216
+ const arms = posts.map((a) => rotateZ(a, cuboid({ size: [v.post_r, v.lobe, v.thick], center: [v.post_r / 2, 0, v.thick / 2] })))
4217
+ const lobes = posts.map((a) => cylinder({ radius: v.lobe / 2, height: v.thick, center: [...at(a), v.thick / 2], segments: v.segments }))
4218
+ const seat = v.shapes.bearingSeat({ bore: v.bore, outer_diameter: v.outer, width: v.width }, { fit: 'press', relief: v.relief, through: true, printer: v.x1c, at: [0, 0, v.thick], into: '-z', lead: 0 })
4219
+ const screws = posts.map((a) => cylinder({ radius: v.screw / 2, height: v.thick + 1, center: [...at(a), v.thick / 2], segments: v.segments }))
4220
+ const heads = posts.map((a) => cylinder({ radius: v.head / 2, height: v.head_depth + 1, center: [...at(a), v.thick - (v.head_depth - 1) / 2], segments: v.segments }))
4221
+ return v.ops.subtract(v.ops.union(hub, arms, lobes), seat, screws, heads)
4222
+ }
4223
+ ```
4224
+
4225
+ ```json projects/leg/objects/spindle.json
4226
+ {
4227
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4228
+ "name": "spindle",
4229
+ "title": "Spindle: disc and shaft",
4230
+ "version": "0.1.0",
4231
+ "uses": ["x1c", "leg", "m3"],
4232
+ "engine": "manifold",
4233
+ "orientation": "The disc on the bed, the shaft up, as it goes on",
4234
+ "description": "The output's flange turns the spindle; the spindle's shaft runs in the 6800 and carries the thigh on a hexagon at its top.",
4235
+ "anchors": {
4236
+ "down": {"at": [0, 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]},
4237
+ "seat": {"at": [0, 0, "collar_top + width"], "axis": [0, 0, 1], "ref": [1, 0, 0]}
4238
+ },
4239
+ "variables": {
4240
+ "disc": {"value": "leg.disc", "unit": "mm", "rule": "Thick enough for a countersunk M3"},
4241
+ "rim": {"value": 46, "unit": "mm", "rule": "Round the 40 mm bolt circle"},
4242
+ "bolt": {"value": 20, "unit": "mm", "rule": "On the output's bolt circle"},
4243
+ "hole": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
4244
+ "head": {"value": "m3.head", "unit": "mm", "rule": "A countersunk head, flush with the disc so the bridge passes over"},
4245
+ "shaft": {"value": "leg.bearing_bore - x1c.press", "unit": "mm", "rule": "A close slide into the bearing's bore, clamped end to end by the thigh's screw"},
4246
+ "width": {"value": "leg.bearing_width", "unit": "mm", "rule": "The bearing"},
4247
+ "collar_top": {"value": "leg.bridge_low + leg.bridge - width - leg.output_top", "unit": "mm", "rule": "Where the inner race rests, above the disc's underside"},
4248
+ "shoulder": {"value": 13, "unit": "mm", "rule": "Stops the inner race; clears the outer race"},
4249
+ "hex": {"value": 8, "unit": "mm", "rule": "Hexagon across its flats: inside the bore, drives the thigh"},
4250
+ "hex_long": {"value": 5, "unit": "mm", "rule": "Into the thigh's socket"},
4251
+ "pilot": {"value": 2.9, "unit": "mm", "rule": "An M3 screw self-tapped", "kind": "community"},
4252
+ "pilot_depth": {"value": 12, "unit": "mm", "rule": "For the thigh's M3"},
4253
+ "cos30": {"value": "cosd(30)", "rule": "A hexagon, across corners to across flats"},
4254
+ "bolts": {"value": 4, "rule": "On the bolt circle"},
4255
+ "quarter": {"value": 1.57079633, "rule": "A quarter turn in radians"},
4256
+ "segments": {"value": 64, "rule": "Round enough"},
4257
+ "hex_segments": {"value": 6, "rule": "A hexagon's sides"}
4258
+ }
4259
+ }
4260
+ ```
4261
+
4262
+ ```js projects/leg/objects/spindle.js
4263
+ // A disc on the output's flange and a shaft up through the bearing, a hexagon at its top for the arm.
4264
+ import jscad from '@jscad/modeling'
4265
+ const { cylinder } = jscad.primitives
4266
+
4267
+ export function main (v) {
4268
+ const plate = cylinder({ radius: v.rim / 2, height: v.disc, center: [0, 0, v.disc / 2], segments: v.segments * 2 })
4269
+ const top = v.collar_top + v.width
4270
+ const shaft = cylinder({ radius: v.shaft / 2, height: top - 1, center: [0, 0, (top + 1) / 2], segments: v.segments * 2 })
4271
+ const collar = v.shapes.shaftShoulder(v.shaft, { shoulder: v.shoulder, height: v.collar_top - v.disc, at: [0, 0, v.collar_top] })
4272
+ const hex = cylinder({ radius: v.hex / 2 / v.cos30, height: v.hex_long, center: [0, 0, top + v.hex_long / 2], segments: v.hex_segments })
4273
+ const screws = Array.from({ length: v.bolts }, (_, k) => {
4274
+ const c = [v.bolt * Math.cos(k * v.quarter), v.bolt * Math.sin(k * v.quarter), v.disc]
4275
+ return v.shapes.countersink({ hole: v.hole, head: v.head, length: v.disc + 1, at: c, into: '-z' })
4276
+ })
4277
+ const pilot = cylinder({ radius: v.pilot / 2, height: v.pilot_depth, center: [0, 0, top + v.hex_long - v.pilot_depth / 2], segments: v.segments })
4278
+ return v.ops.subtract(v.ops.union(plate, shaft, collar, hex), screws, pilot)
4279
+ }
4280
+ ```
4281
+
4282
+ ```json projects/leg/objects/clip.json
4283
+ {
4284
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4285
+ "name": "clip",
4286
+ "title": "Retaining clip",
4287
+ "version": "0.1.0",
4288
+ "uses": ["x1c", "m3"],
4289
+ "orientation": "Flat on the bed",
4290
+ "description": "Holds the knee's output ring from dropping off its posts.",
4291
+ "anchors": {
4292
+ "post": {"at": [0, 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]}
4293
+ },
4294
+ "variables": {
4295
+ "reach": {"value": 6, "unit": "mm", "rule": "In over the flange's edge, 4 mm"},
4296
+ "back": {"value": 4, "unit": "mm", "rule": "Round the post"},
4297
+ "wide": {"value": 8, "unit": "mm", "rule": "As wide as the post and a little"},
4298
+ "thick": {"value": 3, "unit": "mm", "rule": "Fifteen layers"},
4299
+ "hole": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
4300
+ "segments": {"value": 24, "rule": "Small round hole"}
4301
+ }
4302
+ }
4303
+ ```
4304
+
4305
+ ```js projects/leg/objects/clip.js
4306
+ // A flat tab screwed to a post, its nose over the flange.
4307
+ import jscad from '@jscad/modeling'
4308
+ const { cuboid, cylinder } = jscad.primitives
4309
+ const { subtract } = jscad.booleans
4310
+
4311
+ export function main (v) {
4312
+ const tab = cuboid({ size: [v.reach + v.back, v.wide, v.thick], center: [(v.back - v.reach) / 2, 0, v.thick / 2] })
4313
+ return subtract(tab, cylinder({ radius: v.hole / 2, height: v.thick + 1, center: [0, 0, v.thick / 2], segments: v.segments }))
4314
+ }
4315
+ ```
4316
+
4317
+ ### The thigh, the shin and the foot
4318
+
4319
+ The thigh is the arm's upper arm, 100 mm long, without its home switch or bands. The shin is new: a tapered bar from the knee's flange to a disc, printed flat, so the bending under a foot's load runs along the layers. A disc for a foot means the contact rolls as the shin leans, so a point at the disc's centre stays over the ground: that centre is the `tip` the gait moves, and `height` is the hip to that centre. The pad is TPU, printed lying down, its ridge snapping into a groove round the disc so a wet floor can't pull it off and PLA doesn't skate on a scale's top.
4320
+
4321
+ ```json projects/leg/objects/thigh.json
4322
+ {
4323
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4324
+ "name": "thigh",
4325
+ "title": "Thigh",
4326
+ "version": "0.1.0",
4327
+ "uses": ["x1c", "leg", "m3"],
4328
+ "engine": "manifold",
4329
+ "orientation": "The thigh's outer face on the bed: the hub, the knee's fixed ring and its posts all rise from the one flat face",
4330
+ "description": "From the hip's hexagon to the knee's motor. The drawing arm's upper arm, shorter and without its home switch or bands: printed as one part with the knee's fixed ring, so the knee's gearbox costs a sun, three planets and an output ring.",
4331
+ "anchors": {
4332
+ "hub": {"at": [0, 0, "thick + collar"], "axis": [0, 0, -1], "ref": [1, 0, 0]},
4333
+ "knee": {"at": ["long", 0, "thick"], "axis": [0, 0, 1], "ref": [1, 0, 0]},
4334
+ "output": {"at": ["long", 0, "thick + gear + arm_gap"], "axis": [0, 0, 1], "ref": [1, 0, 0]},
4335
+ "motor": {"at": ["long", 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]},
4336
+ "clip1": {"at": ["long + post_r * cosd(p1)", "post_r * sind(p1)", "clip_at"], "axis": [0, 0, 1], "ref": ["cosd(p1)", "sind(p1)", 0]},
4337
+ "clip2": {"at": ["long + post_r * cosd(p2)", "post_r * sind(p2)", "clip_at"], "axis": [0, 0, 1], "ref": ["cosd(p2)", "sind(p2)", 0]},
4338
+ "clip3": {"at": ["long + post_r * cosd(p3)", "post_r * sind(p3)", "clip_at"], "axis": [0, 0, 1], "ref": ["cosd(p3)", "sind(p3)", 0]},
4339
+ "cable": {"at": ["long / 2", 0, 0], "axis": [0, 0, 1]}
4340
+ },
4341
+ "variables": {
4342
+ "long": {"value": "leg.thigh", "unit": "mm", "rule": "Hip to knee", "label": "Thigh", "show": true, "interface": true},
4343
+ "neck": {"value": 22, "unit": "mm", "rule": "The thigh's width at the knee: its bending under the stance load is in the chapter"},
4344
+ "hub": {"value": 36, "unit": "mm", "rule": "Round the hexagon socket"},
4345
+ "collar": {"value": "leg.arm_gap", "unit": "mm", "rule": "A collar on the thigh's underside, on the bearing's inner race, so the outer race doesn't drag"},
4346
+ "collar_d": {"value": 13.5, "unit": "mm", "rule": "On the inner race, clear of the outer"},
4347
+ "hex": {"value": 8, "unit": "mm", "rule": "The spindle's hexagon"},
4348
+ "hex_depth": {"value": "thick + collar - floor", "unit": "mm", "rule": "The socket's depth"},
4349
+ "floor": {"value": 3, "unit": "mm", "rule": "What the screw pulls against: a socket's floor"},
4350
+ "hex_fit": {"value": "x1c.fit + x1c.hole_comp", "unit": "mm", "rule": "Across the socket's flats, over the spindle's, printed"},
4351
+ "screw": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
4352
+ "gear": {"value": "leg.gear", "unit": "mm", "rule": "The fixed ring's face"},
4353
+ "arm_gap": {"value": "leg.ring_gap", "unit": "mm", "rule": "Between the fixed ring and the output ring"},
4354
+ "rim": {"value": 62, "unit": "mm", "rule": "Round the 54-tooth ring"},
4355
+ "module": {"value": 1, "unit": "mm", "rule": "The gears'"},
4356
+ "teeth": {"value": 54, "rule": "The fixed ring"},
4357
+ "post_r": {"value": 37, "unit": "mm", "rule": "Three posts outside the output ring"},
4358
+ "post": {"value": 7, "unit": "mm", "rule": "Each post's diameter"},
4359
+ "lobe": {"value": 12, "unit": "mm", "rule": "The plate reaches out to each post"},
4360
+ "p1": {"value": 30, "unit": "°", "rule": "First post"},
4361
+ "p2": {"value": 150, "unit": "°", "rule": "Second post"},
4362
+ "p3": {"value": 270, "unit": "°", "rule": "Third post"},
4363
+ "rad": {"value": 0.017453293, "rule": "Radians in a degree"},
4364
+ "clip_at": {"value": "thick + gear + arm_gap + gear + leg.flange + clip_gap", "unit": "mm", "rule": "Each post's tip, where its clip goes on, just past the output's flange"},
4365
+ "clip_gap": {"value": 0.3, "unit": "mm", "rule": "The output turns under the clips with this to spare"},
4366
+ "pilot": {"value": 2.9, "unit": "mm", "rule": "An M3 screw self-tapped into a post", "kind": "community"},
4367
+ "pilot_depth": {"value": 8, "unit": "mm", "rule": "For an M3 × 10 through a clip"},
4368
+ "segments": {"value": 64, "rule": "Round enough"},
4369
+ "ring_segments": {"value": 96, "rule": "The rim's circle"},
4370
+ "hex_segments": {"value": 6, "rule": "A hexagon's sides"},
4371
+ "cos30": {"value": "cosd(30)", "rule": "A hexagon, across corners to across flats"},
4372
+ "thick": {"value": "leg.arm", "unit": "mm", "rule": "The thigh's thickness, and the knee motor's plate: 16 lines of 0.42 and 40 layers"}
4373
+ }
4374
+ }
4375
+ ```
4376
+
4377
+ ```js projects/leg/objects/thigh.js
4378
+ // The thigh, drawn as it prints: its outer face on the bed, the knee's ring standing on it, the hub's socket opening
4379
+ // upward. The knee's NEMA 14 bolts on the bed side, its shaft up through the plate, as the arm's elbow does.
4380
+ import jscad from '@jscad/modeling'
4381
+ const { cylinder, cylinderElliptic, cuboid, circle } = jscad.primitives
4382
+ const { translate, rotateZ } = jscad.transforms
4383
+ const { extrudeLinear } = jscad.extrusions
4384
+ const { hull } = jscad.hulls
4385
+
4386
+ export function main (v) {
4387
+ const motor = v.motors.motorModel('nema14')
4388
+ const at = (r, a) => [v.long + r * Math.cos(a), r * Math.sin(a)]
4389
+ const posts = [v.p1, v.p2, v.p3].map((a) => a * v.rad)
4390
+ const round = (r, c) => translate([c, 0], circle({ radius: r, segments: v.segments }))
4391
+ const neck = extrudeLinear({ height: v.thick }, hull(round(v.hub / 2, 0), round(v.neck / 2, v.long)))
4392
+ const hub = cylinder({ radius: v.hub / 2, height: v.thick, center: [0, 0, v.thick / 2], segments: v.ring_segments })
4393
+ const plate = cylinder({ radius: v.rim / 2, height: v.thick, center: [v.long, 0, v.thick / 2], segments: v.ring_segments })
4394
+ const ring = translate([v.long, 0, v.thick], v.gears.internal({ module: v.module, teeth: v.teeth, width: v.gear, rim: v.rim }))
4395
+ const lobes = posts.map((a) => cylinder({ radius: v.lobe / 2, height: v.thick, center: [...at(v.post_r, a), v.thick / 2], segments: v.segments }))
4396
+ const joins = posts.map((a) => translate([v.long, 0, 0], rotateZ(a, cuboid({ size: [v.post_r - v.rim / 2 + 2, v.lobe, v.thick], center: [(v.post_r + v.rim / 2 - 2) / 2, 0, v.thick / 2] }))))
4397
+ const uprights = posts.map((a) => cylinder({ radius: v.post / 2, height: v.clip_at, center: [...at(v.post_r, a), v.clip_at / 2], segments: v.segments }))
4398
+ const pilots = posts.map((a) => cylinder({ radius: v.pilot / 2, height: v.pilot_depth, center: [...at(v.post_r, a), v.clip_at - v.pilot_depth / 2], segments: v.segments }))
4399
+ const collar = cylinder({ radius: v.collar_d / 2, height: v.collar + 1, center: [0, 0, v.thick + (v.collar - 1) / 2], segments: v.segments })
4400
+ const socket = cylinder({ radius: (v.hex + v.hex_fit) / 2 / v.cos30, height: v.hex_depth + 1, center: [0, 0, v.floor + (v.hex_depth + 1) / 2], segments: v.hex_segments })
4401
+ const through = cylinder({ radius: v.screw / 2, height: v.floor + 1, center: [0, 0, (v.floor - 1) / 2], segments: v.segments })
4402
+ const hole = v.motors.mountModel(motor, { plate: v.thick, counterbore: true }), rise = v.thick - hole.pocketDepth
4403
+ const roof = translate([v.long, 0, 0], cylinderElliptic({ height: rise + 1, startRadius: [hole.pocket / 2, hole.pocket / 2], endRadius: [hole.pocket / 2 - rise - 1, hole.pocket / 2 - rise - 1], center: [0, 0, hole.pocketDepth + (rise + 1) / 2], segments: v.segments }))
4404
+ const mount = translate([v.long, 0, 0], v.motors.mount(motor, { plate: v.thick, counterbore: true }, v.ops))
4405
+ return v.ops.subtract(v.ops.union(neck, hub, plate, ring, lobes, joins, uprights, collar), socket, through, pilots, mount, roof)
4406
+ }
4407
+ ```
4408
+
4409
+ ```json projects/leg/objects/shin.json
4410
+ {
4411
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4412
+ "name": "shin",
4413
+ "title": "Shin and foot",
4414
+ "version": "0.1.0",
4415
+ "uses": ["x1c", "leg", "m3"],
4416
+ "engine": "manifold",
4417
+ "orientation": "The bar and the foot flat on the bed, the boss up. The foot's V groove at 45° needs no support",
4418
+ "description": "From the knee's output flange to a round foot: a bar in one piece with the disc the grip pad snaps round.",
4419
+ "anchors": {
4420
+ "hub": {"at": [0, 0, "boss"], "axis": [0, 0, -1], "ref": [1, 0, 0]},
4421
+ "tip": {"at": ["long", 0, "foot_w / 2"], "axis": [0, 0, 1], "ref": [1, 0, 0]},
4422
+ "pad": {"at": ["long", 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]},
4423
+ "cable": {"at": ["long / 2", 0, "bar"], "axis": [0, 0, 1]}
4424
+ },
4425
+ "variables": {
4426
+ "long": {"value": "leg.shin", "unit": "mm", "rule": "Knee to the foot's centre", "label": "Shin", "show": true, "interface": true},
4427
+ "bar": {"value": 8, "unit": "mm", "rule": "The bar's thickness, sized in the chapter: 2 MPa under the worst stance load"},
4428
+ "wide": {"value": 20, "unit": "mm", "rule": "The bar's width at the knee"},
4429
+ "toe": {"value": 16, "unit": "mm", "rule": "Its width at the foot: tapered, as the bending falls to nothing at the foot"},
4430
+ "boss": {"value": "leg.boss", "unit": "mm", "rule": "The bar passes under the knee's clips, the boss above reaches the flange"},
4431
+ "boss_d": {"value": 46, "unit": "mm", "rule": "Round the 40 mm bolt circle"},
4432
+ "screw": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
4433
+ "head": {"value": "m3.head + 2 * x1c.fit + x1c.hole_comp", "unit": "mm", "rule": "The screw's head, counterbored in the bed side"},
4434
+ "head_depth": {"value": "m3.head_height + x1c.layer", "unit": "mm", "rule": "Sunk"},
4435
+ "bolt": {"value": 20, "unit": "mm", "rule": "The output's bolt circle, radius"},
4436
+ "bolts": {"value": 4, "rule": "On the bolt circle"},
4437
+ "quarter": {"value": 1.57079633, "rule": "A quarter turn in radians"},
4438
+ "foot_w": {"value": 14, "unit": "mm", "rule": "The foot's width across the leg: wide enough to stand on the pad's tread", "interface": true},
4439
+ "foot_r": {"value": "leg.foot_r - pad_t", "unit": "mm", "rule": "The disc's radius, under the pad"},
4440
+ "pad_t": {"value": 3, "unit": "mm", "rule": "The pad's thickness, its tread included", "interface": true},
4441
+ "groove": {"value": 1, "unit": "mm", "rule": "The V groove the pad's ridge locks into, 1 mm deep: at 45° it prints without support", "interface": true},
4442
+ "segments": {"value": 64, "rule": "Round enough"}
4443
+ }
4444
+ }
4445
+ ```
4446
+
4447
+ ```js projects/leg/objects/shin.js
4448
+ // A tapered bar from the knee's boss to a round foot, flat on the bed. The foot's rim has a V groove for the pad's ridge.
4449
+ import jscad from '@jscad/modeling'
4450
+ const { cylinder, circle, polygon } = jscad.primitives
4451
+ const { translate } = jscad.transforms
4452
+ const { extrudeLinear, extrudeRotate } = jscad.extrusions
4453
+ const { hull } = jscad.hulls
4454
+
4455
+ export function main (v) {
4456
+ const dot = (r, x) => translate([x, 0], circle({ radius: r, segments: v.segments }))
4457
+ const bar = extrudeLinear({ height: v.bar }, hull(dot(v.wide / 2, 0), dot(v.toe / 2, v.long)))
4458
+ const boss = cylinder({ radius: v.boss_d / 2, height: v.boss, center: [0, 0, v.boss / 2], segments: v.segments * 2 })
4459
+ const r = v.foot_r, mid = v.foot_w / 2, g = v.groove
4460
+ const foot = translate([v.long, 0, 0], extrudeRotate({ segments: v.segments }, polygon({ points: [[0, 0], [r, 0], [r, mid - g], [r - g, mid], [r, mid + g], [r, v.foot_w], [0, v.foot_w]] })))
4461
+ const bolts = Array.from({ length: v.bolts }, (_, k) => cylinder({ radius: v.screw / 2, height: v.boss + 1, center: [v.bolt * Math.cos(k * v.quarter), v.bolt * Math.sin(k * v.quarter), v.boss / 2], segments: v.segments }))
4462
+ const heads = Array.from({ length: v.bolts }, (_, k) => cylinder({ radius: v.head / 2, height: v.head_depth + 1, center: [v.bolt * Math.cos(k * v.quarter), v.bolt * Math.sin(k * v.quarter), (v.head_depth - 1) / 2], segments: v.segments }))
4463
+ return v.ops.subtract(v.ops.union(bar, boss, foot), bolts, heads)
4464
+ }
4465
+ ```
4466
+
4467
+ ```json projects/leg/objects/pad.json
4468
+ {
4469
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4470
+ "name": "pad",
4471
+ "title": "Grip pad",
4472
+ "version": "0.1.0",
4473
+ "uses": ["x1c", "leg"],
4474
+ "engine": "manifold",
4475
+ "material": "TPU",
4476
+ "orientation": "On one flat side: a C with its tread across the layers. TPU, 95A: PLA on a kitchen scale would slip",
4477
+ "description": "A printed tread that snaps round the foot's disc, its inner ridge in the disc's groove. It takes the ground's push and bends a little under it.",
4478
+ "anchors": {
4479
+ "axis": {"at": [0, 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]}
4480
+ },
4481
+ "variables": {
4482
+ "width": {"value": 14, "unit": "mm", "rule": "The foot's width, the disc's", "interface": true},
4483
+ "inner": {"value": "leg.foot_r - 3", "unit": "mm", "rule": "The disc's radius"},
4484
+ "outer": {"value": "leg.foot_r", "unit": "mm", "rule": "Out to the tread"},
4485
+ "grip": {"value": 0.05, "unit": "mm", "rule": "How much the pad's bore is under the disc: TPU stretches, and it stays on"},
4486
+ "ridge": {"value": 1, "unit": "mm", "rule": "The ridge in the groove, 45°"},
4487
+ "sweep": {"value": 200, "unit": "°", "rule": "Round the disc: past half way, so it snaps on and stays"},
4488
+ "rad": {"value": 0.017453293, "rule": "Radians in a degree"},
4489
+ "ribs": {"value": 11, "rule": "Cuts across the tread, each a little more edge on the ground"},
4490
+ "rib_w": {"value": 1.2, "unit": "mm", "rule": "Each cut's width: three lines of 0.4"},
4491
+ "rib_d": {"value": 1, "unit": "mm", "rule": "Each cut's depth, a third of the pad's thickness"},
4492
+ "segments": {"value": 64, "rule": "Round enough"}
4493
+ }
4494
+ }
4495
+ ```
4496
+
4497
+ ```js projects/leg/objects/pad.js
4498
+ // A C of TPU, printed lying down: its bore has a 45° ridge that snaps into the foot's groove, and ribs across its tread.
4499
+ import jscad from '@jscad/modeling'
4500
+ const { polygon, cuboid } = jscad.primitives
4501
+ const { translate, rotateZ } = jscad.transforms
4502
+ const { extrudeRotate } = jscad.extrusions
4503
+
4504
+ export function main (v) {
4505
+ const mid = v.width / 2, r = v.inner - v.grip, g = v.ridge
4506
+ const arc = v.sweep * v.rad
4507
+ const ring = extrudeRotate({ segments: v.segments, startAngle: -arc / 2 - Math.PI / 2, angle: arc }, polygon({ points: [[r, 0], [v.outer, 0], [v.outer, v.width], [r, v.width], [r, mid + g], [r - g, mid], [r, mid - g]] }))
4508
+ const n = v.ribs
4509
+ const cuts = Array.from({ length: n }, (_, k) => rotateZ(-arc / 2 - Math.PI / 2 + (arc * (k + 1)) / (n + 1), cuboid({ size: [v.rib_d * 2, v.rib_w, v.width + 1], center: [v.outer, 0, mid] })))
4510
+ return v.ops.subtract(ring, cuts)
4511
+ }
4512
+ ```
4513
+
4514
+ ### The stand
4515
+
4516
+ A carriage rides up two 8 mm rods on two LM8UU bushings; the hip's housing screws to its face and the hip motor goes through a window in the middle. A foot block holds each rod to the bench and a tie across their tops stops them leaning. The scale sits on the bench under the foot, between the two feet; a collar on each rod is the stop the carriage rests on when the foot lifts.
4517
+
4518
+ In this design the body's frame is the world: the hip is at the origin, so the gait's targets are in the body's frame as they should be, and the stand hangs off it rather than the other way round. That is why nothing joins the carriage to the rods: the slide is real on the bench, but the check treats the frame as still and the leg as stepping from it.
4519
+
4520
+ ```json projects/leg/objects/carriage.json
4521
+ {
4522
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4523
+ "name": "carriage",
4524
+ "title": "Stand carriage: the leg's mount on two rods",
4525
+ "version": "0.1.0",
4526
+ "uses": ["x1c", "leg", "m3", "lm8uu"],
4527
+ "engine": "manifold",
4528
+ "orientation": "The hip's face on the bed, the bosses up; each bearing pocket is a teardrop across the layers",
4529
+ "description": "A plate on two LM8UU bushings. The hip housing screws to its face and the hip's motor goes through its middle. It rides up the rods as the foot pushes, so the scale reads the leg.",
4530
+ "anchors": {
4531
+ "hip": {"at": [0, 0, 0], "axis": [0, 0, -1], "ref": [1, 0, 0]},
4532
+ "cable": {"at": ["half_w", 0, 0], "axis": [0, 0, -1]}
4533
+ },
4534
+ "variables": {
4535
+ "plate": {"value": 8, "unit": "mm", "rule": "The plate's thickness: three M3 screws bite here and carry the leg into the bushings"},
4536
+ "feet_r": {"value": 37, "unit": "mm", "rule": "The housing's three feet", "interface": true},
4537
+ "hub": {"value": 46, "unit": "mm", "rule": "The plate's round middle: past the feet, for the screws"},
4538
+ "arm_w": {"value": 24, "unit": "mm", "rule": "The arms' width, out to the bosses"},
4539
+ "half_w": {"value": "leg.rod_x + boss_x", "unit": "mm", "rule": "To the far side of a boss"},
4540
+ "boss_x": {"value": 11, "unit": "mm", "rule": "Half a boss's width"},
4541
+ "boss_long": {"value": 26, "unit": "mm", "rule": "A boss along the rod: 24 mm of bushing and a 2 mm wall with the rod's hole at the far end"},
4542
+ "boss_h": {"value": "leg.rod_y + boss_x", "unit": "mm", "rule": "Up from the face, past the bushing"},
4543
+ "rod_x": {"value": "leg.rod_x", "unit": "mm", "rule": "Each rod"},
4544
+ "rod_y": {"value": "leg.rod_y", "unit": "mm", "rule": "The rods' distance behind the face"},
4545
+ "cut": {"value": 44.5, "unit": "mm", "rule": "The motor's way through: a NEMA 17 and 1.1 mm each side"},
4546
+ "corner": {"value": 3, "unit": "mm", "rule": "Round the corners of the motor's window"},
4547
+ "pilot": {"value": 2.9, "unit": "mm", "rule": "M3 self-tapped into the plate, from the housing", "kind": "community"},
4548
+ "a1": {"value": 90, "unit": "°", "rule": "The housing's first foot"},
4549
+ "a2": {"value": 210, "unit": "°", "rule": "Second"},
4550
+ "a3": {"value": 330, "unit": "°", "rule": "Third"},
4551
+ "rad": {"value": 0.017453293, "rule": "Radians in a degree"},
4552
+ "segments": {"value": 48, "rule": "Round enough"}
4553
+ }
4554
+ }
4555
+ ```
4556
+
4557
+ ```js projects/leg/objects/carriage.js
4558
+ // A round hub for the hip, arms out to two bushing bosses, the hip's face down on the bed.
4559
+ import jscad from '@jscad/modeling'
4560
+ const { cylinder, cuboid, roundedRectangle } = jscad.primitives
4561
+ const { extrudeLinear } = jscad.extrusions
4562
+
4563
+ export function main (v) {
4564
+ const arms = cuboid({ size: [v.half_w * 2, v.arm_w, v.plate], center: [0, 0, v.plate / 2] })
4565
+ const hub = cylinder({ radius: v.hub, height: v.plate, center: [0, 0, v.plate / 2], segments: v.segments * 2 })
4566
+ const bosses = [-1, 1].map((s) => cuboid({ size: [v.boss_x * 2, v.boss_long, v.boss_h], center: [s * v.rod_x, 0, v.boss_h / 2] }))
4567
+ const window = extrudeLinear({ height: v.plate + 1 }, roundedRectangle({ size: [v.cut, v.cut], roundRadius: v.corner, segments: v.segments }))
4568
+ const feet = [v.a1, v.a2, v.a3].map((a) => a * v.rad).map((a) => cylinder({ radius: v.pilot / 2, height: v.plate + 1, center: [v.feet_r * Math.cos(a), 0 - v.feet_r * Math.sin(a), v.plate / 2], segments: v.segments }))
4569
+ const pockets = [-1, 1].map((s) => v.shapes.lm8uuPocket(v.lm8uu, { printer: v.x1c, at: [s * v.rod_x, 0 - v.boss_long / 2, v.rod_y], into: '+y', through: true }))
4570
+ return v.ops.subtract(v.ops.union(arms, hub, bosses), window, feet, pockets)
4571
+ }
4572
+ ```
4573
+
4574
+ ```json projects/leg/objects/foot.json
4575
+ {
4576
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4577
+ "name": "foot",
4578
+ "title": "Stand foot block",
4579
+ "version": "0.1.0",
4580
+ "uses": ["x1c", "leg", "m5"],
4581
+ "engine": "manifold",
4582
+ "orientation": "Flat on the bed, the rod's socket opening up",
4583
+ "description": "Holds a rod upright, and bolts to the bench through two holes.",
4584
+ "variables": {
4585
+ "long": {"value": 36, "unit": "mm", "rule": "Along the bench: the rod and a bolt each side"},
4586
+ "wide": {"value": 26, "unit": "mm", "rule": "Across: the socket and the bolts"},
4587
+ "thick": {"value": "leg.foot_block", "unit": "mm", "rule": "The socket's depth and a floor"},
4588
+ "socket": {"value": "leg.rod_d + x1c.hole_comp", "unit": "mm", "rule": "The rod, a press into the printed bore"},
4589
+ "depth": {"value": "leg.foot_socket", "unit": "mm", "rule": "How far the rod goes in"},
4590
+ "bolt": {"value": "m5.clearance", "unit": "mm", "rule": "To the bench"},
4591
+ "bolt_x": {"value": 12, "unit": "mm", "rule": "The bolts, either side of the rod"},
4592
+ "corner": {"value": 4, "unit": "mm", "rule": "The block's corners, rounded"},
4593
+ "segments": {"value": 48, "rule": "Round enough"}
4594
+ }
4595
+ }
4596
+ ```
4597
+
4598
+ ```js projects/leg/objects/foot.js
4599
+ // A block with a rod's socket in the top and a bolt through each end.
4600
+ import jscad from '@jscad/modeling'
4601
+ const { cylinder, roundedRectangle } = jscad.primitives
4602
+ const { extrudeLinear } = jscad.extrusions
4603
+
4604
+ export function main (v) {
4605
+ const block = extrudeLinear({ height: v.thick }, roundedRectangle({ size: [v.long, v.wide], roundRadius: v.corner, segments: v.segments }))
4606
+ const socket = cylinder({ radius: v.socket / 2, height: v.depth + 1, center: [0, 0, v.thick - v.depth + (v.depth + 1) / 2], segments: v.segments })
4607
+ const bolts = [-1, 1].map((s) => cylinder({ radius: v.bolt / 2, height: v.thick + 1, center: [s * v.bolt_x, 0, v.thick / 2], segments: v.segments }))
4608
+ return v.ops.subtract(block, socket, bolts)
4609
+ }
4610
+ ```
4611
+
4612
+ ```json projects/leg/objects/tie.json
4613
+ {
4614
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4615
+ "name": "tie",
4616
+ "title": "Stand top tie",
4617
+ "version": "0.1.0",
4618
+ "uses": ["x1c", "leg"],
4619
+ "engine": "manifold",
4620
+ "orientation": "Flat on the bed, the rods up through it",
4621
+ "description": "A bar across the tops of the two rods, so they cannot lean apart.",
4622
+ "variables": {
4623
+ "long": {"value": "leg.rod_x * 2 + width * 2", "unit": "mm", "rule": "From rod to rod, and a width past each"},
4624
+ "width": {"value": 20, "unit": "mm", "rule": "Across the bar"},
4625
+ "thick": {"value": 8, "unit": "mm", "rule": "Thick enough not to flex"},
4626
+ "socket": {"value": "leg.rod_d + x1c.hole_comp", "unit": "mm", "rule": "The rod, pressed through"},
4627
+ "rod_x": {"value": "leg.rod_x", "unit": "mm", "rule": "Each rod"},
4628
+ "corner": {"value": 5, "unit": "mm", "rule": "The bar's corners"},
4629
+ "segments": {"value": 48, "rule": "Round enough"}
4630
+ }
4631
+ }
4632
+ ```
4633
+
4634
+ ```js projects/leg/objects/tie.js
4635
+ // A flat bar with a hole at each end, pressed down over the tops of the rods.
4636
+ import jscad from '@jscad/modeling'
4637
+ const { cylinder, roundedRectangle } = jscad.primitives
4638
+ const { extrudeLinear } = jscad.extrusions
4639
+
4640
+ export function main (v) {
4641
+ const bar = extrudeLinear({ height: v.thick }, roundedRectangle({ size: [v.long, v.width], roundRadius: v.corner, segments: v.segments }))
4642
+ const holes = [-1, 1].map((s) => cylinder({ radius: v.socket / 2, height: v.thick + 1, center: [s * v.rod_x, 0, v.thick / 2], segments: v.segments }))
4643
+ return v.ops.subtract(bar, holes)
4644
+ }
4645
+ ```
4646
+
4647
+ ```json projects/leg/objects/collar.json
4648
+ {
4649
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4650
+ "name": "collar",
4651
+ "title": "Rod collar: the carriage's stop",
4652
+ "version": "0.1.0",
4653
+ "uses": ["x1c", "leg", "m3"],
4654
+ "engine": "manifold",
4655
+ "orientation": "Flat on the bed, the rod's hole upright, the clamp's slot through one side",
4656
+ "description": "Set on a rod under the carriage: the carriage drops onto it when the foot lifts, so the foot really leaves the scale.",
4657
+ "variables": {
4658
+ "bore": {"value": "leg.rod_d + x1c.hole_comp", "unit": "mm", "rule": "The rod"},
4659
+ "outer": {"value": 22, "unit": "mm", "rule": "Round the rod, wall enough to take the screw"},
4660
+ "high": {"value": 10, "unit": "mm", "rule": "Along the rod"},
4661
+ "slot": {"value": 1.5, "unit": "mm", "rule": "The slot the clamp screw closes"},
4662
+ "screw": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "The clamp's M3, across the slot: its hole a teardrop"},
4663
+ "screw_out": {"value": 8, "unit": "mm", "rule": "The screw, clear of the rod"},
4664
+ "segments": {"value": 48, "rule": "Round enough"}
4665
+ }
4666
+ }
4667
+ ```
4668
+
4669
+ ```js projects/leg/objects/collar.js
4670
+ // A ring with a slot and a screw across it, closing round the rod. The screw's hole is a teardrop across the layers.
4671
+ import jscad from '@jscad/modeling'
4672
+ const { cylinder, cuboid } = jscad.primitives
4673
+
4674
+ export function main (v) {
4675
+ const ring = cylinder({ radius: v.outer / 2, height: v.high, center: [0, 0, v.high / 2], segments: v.segments * 2 })
4676
+ const hole = cylinder({ radius: v.bore / 2, height: v.high + 1, center: [0, 0, v.high / 2], segments: v.segments })
4677
+ const slot = cuboid({ size: [v.outer / 2 + 1, v.slot, v.high + 1], center: [(v.outer / 2 + 1) / 2, 0, v.high / 2] })
4678
+ const screw = v.shapes.teardropHole({ d: v.screw, length: v.outer, at: [v.screw_out, 0 - v.outer / 2, v.high / 2], into: '+y', through: true })
4679
+ return v.ops.subtract(ring, hole, slot, screw)
4680
+ }
4681
+ ```
4682
+
4683
+ ```json projects/leg/objects/scale.json
4684
+ {
4685
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4686
+ "name": "scale",
4687
+ "title": "Kitchen scale (not printed)",
4688
+ "version": "0.1.0",
4689
+ "role": "reference",
4690
+ "uses": ["leg"],
4691
+ "anchors": {
4692
+ "top": {"at": [0, 0, "high"], "axis": [0, 0, 1]}
4693
+ },
4694
+ "variables": {
4695
+ "side": {"value": 120, "unit": "mm", "rule": "The platform: a common 5 kg kitchen scale. Measure yours", "kind": "estimate"},
4696
+ "high": {"value": "leg.scale_h", "unit": "mm", "rule": "Its height"}
4697
+ }
4698
+ }
4699
+ ```
4700
+
4701
+ ```js projects/leg/objects/scale.js
4702
+ // A block where the scale goes: the foot stands on its top.
4703
+ import jscad from '@jscad/modeling'
4704
+ const { cuboid } = jscad.primitives
4705
+
4706
+ export function main (v) { return cuboid({ size: [v.side, v.side, v.high], center: [0, 0, v.high / 2] }) }
4707
+ ```
4708
+
4709
+ ### The stand assembly
4710
+
4711
+ Standing, the foot is under the hip with the knee behind it. The gait is a single leg's: `"pattern": { "duty": 0.6, "phase": [0] }` says stance for 60% of the cycle, swing for the rest. The mass is the robot's share, 0.75 kg.
4712
+
4713
+ ```json projects/leg/assemblies/stand.json
4714
+ {
4715
+ "$schema": "https://jonibach.github.io/rulecad/schemas/assembly.schema.json",
4716
+ "title": "A leg on a test stand",
4717
+ "kind": "fit",
4718
+ "description": "One leg on a carriage that rides up two rods: it stands and steps against a kitchen scale. The body's frame is the world: the hip at the origin, the ground at the scale's top.",
4719
+ "uses": ["leg"],
4720
+ "items": [
4721
+ { "id": "foot1", "object": "foot", "at": ["0 - leg.rod_x", "0 - leg.rod_y", "0 - leg.stance - leg.foot_r - leg.scale_h"] },
4722
+ { "id": "carriage", "object": "carriage", "rotate": [90, 0, 0] },
4723
+ { "id": "lm1", "bought": "lm8uu", "at": ["0 - leg.rod_x", "0 - leg.rod_y", "0 - carriage.boss_long / 2"] },
4724
+ { "id": "lm2", "bought": "lm8uu", "at": ["leg.rod_x", "0 - leg.rod_y", "0 - carriage.boss_long / 2"] },
4725
+ { "id": "m1", "motor": { "model": "17HS4401", "drives": "hd", "speed": 200, "duty": 0.3, "driver": "d1", "current": 0.5, "microsteps": 8 } },
4726
+ { "id": "housing", "object": "housing", "rotate": [-90, 0, 0] },
4727
+ { "id": "sun", "object": "sun" },
4728
+ { "id": "carrier", "object": "speck" },
4729
+ { "id": "p1", "object": "planet" }, { "id": "p2", "object": "planet" }, { "id": "p3", "object": "planet" },
4730
+ { "id": "output", "object": "output" },
4731
+ { "id": "spindle", "object": "spindle" },
4732
+ { "id": "bridge", "object": "bridge", "at": [0, "leg.bridge_low", 0], "rotate": [-90, 0, 0] },
4733
+ { "id": "b1", "bought": "bearing-6800", "at": [0, "leg.bridge_low + leg.bridge - leg.bearing_width", 0], "rotate": [-90, 0, 0] },
4734
+ { "id": "thigh", "object": "thigh" },
4735
+ { "id": "m2", "motor": { "model": "nema14", "drives": "kd", "speed": 200, "duty": 0.3, "driver": "d2", "current": 0.5, "microsteps": 8 } },
4736
+ { "id": "esun", "object": "sun", "set": { "tip": 11.7 } },
4737
+ { "id": "ecarrier", "object": "speck" }, { "id": "ering", "object": "speck" },
4738
+ { "id": "ep1", "object": "planet" }, { "id": "ep2", "object": "planet" }, { "id": "ep3", "object": "planet" },
4739
+ { "id": "eoutput", "object": "output" },
4740
+ { "id": "clip1", "object": "clip" }, { "id": "clip2", "object": "clip" }, { "id": "clip3", "object": "clip" },
4741
+ { "id": "shin", "object": "shin" },
4742
+ { "id": "pad", "object": "pad" },
4743
+ { "id": "rod1", "bought": "rod-8", "set": { "length": "leg.rod_long" }, "at": ["0 - leg.rod_x", "0 - leg.rod_y", "0 - leg.stance - leg.foot_r - leg.scale_h + leg.foot_block - leg.foot_socket"] },
4744
+ { "id": "rod2", "bought": "rod-8", "set": { "length": "leg.rod_long" }, "at": ["leg.rod_x", "0 - leg.rod_y", "0 - leg.stance - leg.foot_r - leg.scale_h + leg.foot_block - leg.foot_socket"] },
4745
+ { "id": "foot2", "object": "foot", "at": ["leg.rod_x", "0 - leg.rod_y", "0 - leg.stance - leg.foot_r - leg.scale_h"] },
4746
+ { "id": "tie", "object": "tie", "at": [0, "0 - leg.rod_y", 76] },
4747
+ { "id": "collar1", "object": "collar", "rotate": [0, 0, 180], "at": ["0 - leg.rod_x", "0 - leg.rod_y", "0 - carriage.boss_long / 2 - leg.stop_drop - collar1.high"] },
4748
+ { "id": "collar2", "object": "collar", "at": ["leg.rod_x", "0 - leg.rod_y", "0 - carriage.boss_long / 2 - leg.stop_drop - collar2.high"] },
4749
+ { "id": "scale", "object": "scale", "at": [0, 5, "0 - leg.stance - leg.foot_r - leg.scale_h"] },
4750
+ { "id": "d1", "bought": "drv8825", "at": [240, -30, -180] },
4751
+ { "id": "d2", "bought": "drv8825", "at": [240, 0, -180] },
4752
+ { "id": "shield", "bought": "cnc-shield-v3", "at": [240, 0, -190] },
4753
+ { "id": "psu", "bought": "supply-24v", "variant": "LRS-50-24", "at": [300, 150, -190] }
4754
+ ],
4755
+ "joints": [
4756
+ { "id": "m1_on", "type": "fixed", "parent": "housing.motor", "child": "m1.face" },
4757
+ { "id": "hd", "type": "revolute", "parent": "housing.axis", "child": "sun.axis", "min": -6200, "max": 200, "label": "Hip motor" },
4758
+ { "id": "turn", "type": "revolute", "parent": "housing.axis", "child": "carrier.axis", "min": -6200, "max": 200 },
4759
+ { "id": "s1", "type": "revolute", "parent": "carrier.a", "child": "p1.axis", "min": -30000, "max": 30000 },
4760
+ { "id": "s2", "type": "revolute", "parent": "carrier.b", "child": "p2.axis", "min": -30000, "max": 30000 },
4761
+ { "id": "s3", "type": "revolute", "parent": "carrier.c", "child": "p3.axis", "min": -30000, "max": 30000 },
4762
+ { "id": "hip", "type": "revolute", "parent": { "item": "housing", "at": [0, 0, "leg.plate + leg.gear + leg.ring_gap"], "axis": [0, 0, 1] }, "child": "output.axis", "min": 30, "max": 150, "label": "Hip", "support": { "bearings": ["b1"] } },
4763
+ { "id": "spindle_on", "type": "fixed", "parent": "output.flange", "child": "spindle.down" },
4764
+ { "id": "thigh_on", "type": "fixed", "parent": "spindle.seat", "child": "thigh.hub" },
4765
+ { "id": "m2_on", "type": "fixed", "parent": "thigh.motor", "child": "m2.face" },
4766
+ { "id": "kd", "type": "revolute", "parent": "thigh.knee", "child": "esun.axis", "min": -5900, "max": 180, "label": "Knee motor" },
4767
+ { "id": "ering_on", "type": "fixed", "parent": "thigh.knee", "child": "ering.axis" },
4768
+ { "id": "eturn", "type": "revolute", "parent": "thigh.knee", "child": "ecarrier.axis", "min": -5900, "max": 180 },
4769
+ { "id": "es1a", "type": "revolute", "parent": "ecarrier.a", "child": "ep1.axis", "min": -30000, "max": 30000 },
4770
+ { "id": "es2a", "type": "revolute", "parent": "ecarrier.b", "child": "ep2.axis", "min": -30000, "max": 30000 },
4771
+ { "id": "es3a", "type": "revolute", "parent": "ecarrier.c", "child": "ep3.axis", "min": -30000, "max": 30000 },
4772
+ { "id": "knee", "type": "revolute", "parent": "thigh.output", "child": "eoutput.axis", "min": 0, "max": 150, "label": "Knee", "support": { "clips": ["clip1", "clip2", "clip3"], "pitch": 74 } },
4773
+ { "id": "c1_on", "type": "fixed", "parent": "thigh.clip1", "child": "clip1.post" },
4774
+ { "id": "c2_on", "type": "fixed", "parent": "thigh.clip2", "child": "clip2.post" },
4775
+ { "id": "c3_on", "type": "fixed", "parent": "thigh.clip3", "child": "clip3.post" },
4776
+ { "id": "shin_on", "type": "fixed", "parent": "eoutput.flange", "child": "shin.hub" },
4777
+ { "id": "pad_on", "type": "fixed", "parent": "shin.pad", "child": "pad.axis" }
4778
+ ],
4779
+ "planetary": [
4780
+ { "sun": "sun", "carrier": "carrier", "ring": "housing", "planets": ["p1", "p2", "p3"], "drive": "sun", "module": 1, "teeth": [18, 18, 54], "output": { "ring": "output", "planet": 21, "teeth": 57 } },
4781
+ { "sun": "esun", "carrier": "ecarrier", "ring": "ering", "planets": ["ep1", "ep2", "ep3"], "drive": "sun", "module": 1, "teeth": [18, 18, 54], "output": { "ring": "eoutput", "planet": 21, "teeth": 57 } }
4782
+ ],
4783
+ "fits": [
4784
+ { "a": "m1", "b": "housing", "fastens": true, "min": -0.1, "note": "The hip motor, on its four screws, its boss seated in the plate's pocket" },
4785
+ { "a": "m1", "b": "sun", "shaft": true, "note": "The shaft in the sun" },
4786
+ { "a": "m2", "b": "esun", "shaft": true, "note": "The knee motor's shaft in its sun" },
4787
+ { "a": "m2", "b": "thigh", "fastens": true, "min": -0.1, "note": "The knee motor, on its four screws" },
4788
+ { "a": "housing", "b": "carriage", "fastens": true, "min": 0, "note": "The housing, screwed to the carriage's face" },
4789
+ { "a": "bridge", "b": "housing", "fastens": true, "min": 0, "note": "The bridge, on the housing's posts" },
4790
+ { "a": "b1", "b": "bridge", "seat": "press", "note": "The 6800 in its seat" },
4791
+ { "a": "ecarrier", "b": "ering", "min": -1, "note": "Two specks: neither is printed" },
4792
+ { "a": "lm1", "b": "carriage", "fastens": true, "min": -0.5, "note": "The bushing, pressed in its pocket" },
4793
+ { "a": "lm2", "b": "carriage", "fastens": true, "min": -0.5, "note": "The bushing, pressed in its pocket" },
4794
+ { "a": "rod1", "b": "lm1", "fastens": true, "min": -1000, "note": "The bushing rides the rod: the carriage is free to rise and is held on the rods" },
4795
+ { "a": "rod2", "b": "lm2", "fastens": true, "min": -1000, "note": "The bushing rides the rod" },
4796
+ { "a": "rod1", "b": "foot1", "fastens": true, "min": -1000, "note": "The rod in its socket" },
4797
+ { "a": "rod2", "b": "foot2", "fastens": true, "min": -1000, "note": "The rod in its socket" },
4798
+ { "a": "rod1", "b": "tie", "fastens": true, "min": -1000, "note": "The rod through the tie" },
4799
+ { "a": "rod2", "b": "tie", "fastens": true, "min": -1000, "note": "The rod through the tie" },
4800
+ { "a": "rod1", "b": "collar1", "fastens": true, "min": -1000, "note": "The stop clamped on the rod" },
4801
+ { "a": "rod2", "b": "collar2", "fastens": true, "min": -1000, "note": "The stop clamped on the rod" },
4802
+ { "a": "pad", "b": "shin", "min": -2, "note": "The pad on the foot's disc" },
4803
+ { "a": "pad", "b": "scale", "min": -0.5, "note": "The foot stands on the scale" },
4804
+ { "a": "d1", "b": "shield", "fastens": true, "min": -20, "note": "Plugged in" },
4805
+ { "a": "d2", "b": "shield", "fastens": true, "min": -20, "note": "Plugged in" }
4806
+ ],
4807
+ "wires": [
4808
+ { "id": "hip_wire", "from": "m1.connector", "to": "shield.X", "via": ["carriage.cable"], "gauge": "awg24", "colour": "black, red, green, blue", "connectors": ["JST-XH 4 pin", "screw terminal"] },
4809
+ { "id": "knee_wire", "from": "m2.connector", "to": "shield.Y", "via": ["thigh.cable", "carriage.cable"], "gauge": "awg24", "colour": "black, red, green, blue", "connectors": ["JST-XH 4 pin", "screw terminal"] },
4810
+ { "id": "power", "from": "psu.terminals", "to": "shield.top", "gauge": "awg22", "colour": "red, black", "conductors": 2, "current": 2, "connectors": ["Ring terminal", "Screw terminal"], "note": "24 V into the shield's motor terminals" }
4811
+ ],
4812
+ "gait": { "legs": ["shin.tip"], "pattern": { "duty": 0.6, "phase": [0] }, "stride": "leg.stride", "lift": "leg.lift", "period": 2, "height": "leg.stance", "mass": "leg.share", "clearance": 12 },
4813
+ "poses": { "standing": { "hd": -5587.7, "kd": -2236 } }
4814
+ }
4815
+ ```
4816
+
4817
+ ```sh
4818
+ npx cad check leg/stand --json
4819
+ npx cad list leg/stand
4820
+ npx cad animate leg/stand
4821
+ ```
4822
+
4823
+ The check runs with `--json` here because the stand's own warning, that its figures rest on estimates, would otherwise stop the test: run it plain to read it. What it says:
4824
+
4825
+ - `gait.clearance` passes: the swing foot lifts 15 mm clear of the scale (asked 12).
4826
+ - `motor.torque` through the gait: the hip needs 0.147 N m at the worst of the cycle against 1.682 N m the 17HS4401 gives at 0.5 A through 38:1 at 47%, 11.4 times; the knee 0.451 N m against 1.419 N m, 3.1 times. Those figures are the foot's load only, not the leg's own weight in the swing, and the gearbox efficiency is an estimate.
4827
+ - `gait.sweep` passes: the leg, moved through the cycle pose by pose, hits nothing, with every planet and the sun turning as they should (the gait moves the motor's shaft that leads each output, and the rest follows).
4828
+ - The gears' overlap is zero: the second ring is put in phase at the joint's own zero, wherever its range starts. (A range that left out zero once put the ring 30° out, and every planet into its teeth.)
4829
+ - `cad list` gives 471 g of printing and about 8.6 hours. Per part, printed and bought, the leg (without the stand) is the sum above; the heaviest prints are the thigh (98 g), the carriage (92 g), the tie (43 g) and the shin (43 g).
4830
+ - Margin per part, by hand (`estimate`, PLA at 39 MPa, bending at the worst stance load): the thigh 80 times, the shin 45 times, the carriage's arms 130 times. The motors' margins above are the small ones.
4831
+ - `cad animate leg/stand` writes `.preview/leg/stand-gait.svg`: the leg's sticks in side view, the foot's stance in blue and swing in orange. The model page plays the same cycle in the Motion panel of a link: `cad link leg/stand` carries it.
4832
+
4833
+ To run the leg on the bench: tare the scale with the carriage resting on its stops and the foot just off it, command the stance, and read the scale, which reads the foot's push. A known mass hung on the carriage is the test of whether the leg holds and what the torque margin really is.
4834
+
4835
+ ### The quadruped
4836
+
4837
+ Four legs, on a body two plates wide: a design exercise. The two side plates are the same 242 mm print, turned end for end, held apart by two beams and each with two hips. Each hip motor goes through its plate, inward, so a body 100 mm wide takes two motors back to back. The knees point outward, front and back, so a front knee never reaches a back hip.
4838
+
4839
+ ```json projects/leg/objects/side.json
4840
+ {
4841
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4842
+ "name": "side",
4843
+ "title": "Body side plate",
4844
+ "version": "0.1.0",
4845
+ "uses": ["x1c", "leg", "m3"],
4846
+ "engine": "manifold",
4847
+ "orientation": "Flat on the bed: the hips' faces down",
4848
+ "description": "Two hip hubs joined by a spar, with the windows the hip motors go through and four pilot holes for the cross beams. The two sides are the same print, turned end for end.",
4849
+ "anchors": {
4850
+ "hip1": {"at": ["half", 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]},
4851
+ "hip2": {"at": ["0 - half", 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]}
4852
+ },
4853
+ "variables": {
4854
+ "half": {"value": "leg.body_half", "unit": "mm", "rule": "Hip to the middle: the body's half-length", "interface": true},
4855
+ "thick": {"value": 6, "unit": "mm", "rule": "The plate: enough for the housing's three M3 screws to bite"},
4856
+ "hub": {"value": 46, "unit": "mm", "rule": "A hub's radius: past the housing's feet"},
4857
+ "spar": {"value": 30, "unit": "mm", "rule": "The spar's depth between the hubs"},
4858
+ "feet_r": {"value": 37, "unit": "mm", "rule": "The housing's three feet", "interface": true},
4859
+ "a1": {"value": 90, "unit": "°", "rule": "The housing's first foot"},
4860
+ "a2": {"value": 210, "unit": "°", "rule": "Second"},
4861
+ "a3": {"value": 330, "unit": "°", "rule": "Third"},
4862
+ "pilot": {"value": 2.9, "unit": "mm", "rule": "M3, self-tapped", "kind": "community"},
4863
+ "window": {"value": 44.5, "unit": "mm", "rule": "The motor's way through the plate: a NEMA 17 and 1.1 mm each side"},
4864
+ "corner": {"value": 3, "unit": "mm", "rule": "Round the corners of the window"},
4865
+ "beam_at": {"value": 27, "unit": "mm", "rule": "The two cross beams, between the hip motors: the motors take the space from 54 mm to the plate's end"},
4866
+ "beam_y": {"value": 16, "unit": "mm", "rule": "Each beam's two screws, this far either side of its middle"},
4867
+ "rad": {"value": 0.017453293, "rule": "Radians in a degree"},
4868
+ "segments": {"value": 64, "rule": "Round enough"}
4869
+ }
4870
+ }
4871
+ ```
4872
+
4873
+ ```js projects/leg/objects/side.js
4874
+ // Two hubs and a spar, flat on the bed. Each hub is a window for a hip motor with the housing's three pilot holes round it.
4875
+ import jscad from '@jscad/modeling'
4876
+ const { cylinder, cuboid, roundedRectangle } = jscad.primitives
4877
+ const { extrudeLinear } = jscad.extrusions
4878
+ const { translate } = jscad.transforms
4879
+
4880
+ export function main (v) {
4881
+ const hubs = [-1, 1].map((s) => cylinder({ radius: v.hub, height: v.thick, center: [s * v.half, 0, v.thick / 2], segments: v.segments * 2 }))
4882
+ const spar = cuboid({ size: [v.half * 2, v.spar, v.thick], center: [0, 0, v.thick / 2] })
4883
+ const windows = [-1, 1].map((s) => translate([s * v.half, 0, 0], extrudeLinear({ height: v.thick + 1 }, roundedRectangle({ size: [v.window, v.window], roundRadius: v.corner, segments: v.segments }))))
4884
+ const feet = [-1, 1].flatMap((s) => [v.a1, v.a2, v.a3].map((a) => a * v.rad).map((a) => cylinder({ radius: v.pilot / 2, height: v.thick + 1, center: [s * v.half + v.feet_r * Math.cos(a), 0 - v.feet_r * Math.sin(a), v.thick / 2], segments: v.segments })))
4885
+ const beams = [-1, 1].flatMap((x) => [-1, 1].map((s) => cylinder({ radius: v.pilot / 2, height: v.thick + 1, center: [x * v.beam_at + s * v.beam_y, 0, v.thick / 2], segments: v.segments })))
4886
+ return v.ops.subtract(v.ops.union(hubs, spar), windows, feet, beams)
4887
+ }
4888
+ ```
4889
+
4890
+ ```json projects/leg/objects/beam.json
4891
+ {
4892
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4893
+ "name": "beam",
4894
+ "title": "Body cross beam",
4895
+ "version": "0.1.0",
4896
+ "uses": ["x1c", "leg", "m3"],
4897
+ "engine": "manifold",
4898
+ "orientation": "Flat on one side, its screw holes along the bed: each hole a teardrop",
4899
+ "description": "A beam across the body between the side plates: it holds them square against the legs' push. Three of them, screwed in through the plates.",
4900
+ "anchors": {
4901
+ "end": {"at": ["0 - long / 2", 0, "wide / 2"], "axis": [-1, 0, 0], "ref": [0, 1, 0]},
4902
+ "other": {"at": ["long / 2", 0, "wide / 2"], "axis": [1, 0, 0], "ref": [0, 1, 0]}
4903
+ },
4904
+ "variables": {
4905
+ "long": {"value": "leg.body_w * 2 - leg.side_t * 2", "unit": "mm", "rule": "Between the two side plates' inner faces"},
4906
+ "deep": {"value": 46, "unit": "mm", "rule": "Across the body's length: its two screws at each end, plus room, and clear of the hip motors"},
4907
+ "wide": {"value": 12, "unit": "mm", "rule": "Thick: 25 layers of stiffness for the side plates to pull on"},
4908
+ "pilot": {"value": 2.9, "unit": "mm", "rule": "An M3 self-tapped into each end", "kind": "community"},
4909
+ "pilot_len": {"value": 12, "unit": "mm", "rule": "For an M3 × 16 through a side plate"},
4910
+ "screw_y": {"value": 16, "unit": "mm", "rule": "The two screws at each end"},
4911
+ "segments": {"value": 32, "rule": "Round enough"}
4912
+ }
4913
+ }
4914
+ ```
4915
+
4916
+ ```js projects/leg/objects/beam.js
4917
+ // A flat bar with two teardrop pilot holes in each end.
4918
+ import jscad from '@jscad/modeling'
4919
+ const { cuboid } = jscad.primitives
4920
+
4921
+ export function main (v) {
4922
+ const bar = cuboid({ size: [v.long, v.deep, v.wide], center: [0, 0, v.wide / 2] })
4923
+ const holes = [1, -1].flatMap((end) => [-1, 1].map((s) => v.shapes.teardropHole({ d: v.pilot, length: v.pilot_len + 1, at: [end * (v.long / 2 + 1), s * v.screw_y, v.wide / 2], into: end > 0 ? '-x' : '+x' })))
4924
+ return v.ops.subtract(bar, holes)
4925
+ }
4926
+ ```
4927
+
4928
+ The quadruped carries the leg's parts, every one, as items of a single assembly. That costs length, because each leg's gearbox is written out; it is what lets the gait below move every joint, with every planet turning, and lets the sweep look for leg against leg. Two gaits, one file each: a trot and a crawl, the same machine. The hip motors live between the two plates, with the beams between them.
4929
+
4930
+ ```json projects/leg/assemblies/quadruped.json
4931
+ {
4932
+ "$schema": "https://jonibach.github.io/rulecad/schemas/assembly.schema.json",
4933
+ "title": "A quadruped, trotting: a design from the leg's parts",
4934
+ "kind": "fit",
4935
+ "description": "Four legs on a body: the leg's parts, all of them, as items of one assembly so the gait moves every joint. Trotting: the feet in diagonal pairs, statically balanced on two feet only in passing, and quasi-static only. A design, not yet a build.",
4936
+ "uses": ["leg"],
4937
+ "items": [
4938
+ {"id": "left", "object": "side", "at": [0, "leg.body_w",0], "rotate": [90,0,0]},
4939
+ {"id": "right", "object": "side", "at": [0, "0 - leg.body_w",0], "rotate": [90,0,180]},
4940
+ {"id": "beam1", "object": "beam", "at": ["left.beam_at",0,-6], "rotate": [0,0,90]},
4941
+ {"id": "beam2", "object": "beam", "at": ["0 - left.beam_at",0,-6], "rotate": [0,0,90]},
4942
+ {"id": "fl_m1", "motor": {"model": "17HS4401", "drives": "fl_hd", "speed": 200, "duty": 0.3, "current": 1, "microsteps": 8}},
4943
+ {"id": "fl_housing", "object": "housing", "at": ["leg.body_half", "leg.body_w",0], "rotate": [-90,0,0]},
4944
+ {"id": "fl_sun", "object": "sun"},
4945
+ {"id": "fl_carrier", "object": "speck"},
4946
+ {"id": "fl_p1", "object": "planet"},
4947
+ {"id": "fl_p2", "object": "planet"},
4948
+ {"id": "fl_p3", "object": "planet"},
4949
+ {"id": "fl_output", "object": "output"},
4950
+ {"id": "fl_spindle", "object": "spindle"},
4951
+ {"id": "fl_bridge", "object": "bridge"},
4952
+ {"id": "fl_b1", "bought": "bearing-6800"},
4953
+ {"id": "fl_thigh", "object": "thigh"},
4954
+ {"id": "fl_m2", "motor": {"model": "nema14", "drives": "fl_kd", "speed": 200, "duty": 0.3, "current": 0.8, "microsteps": 8}},
4955
+ {"id": "fl_esun", "object": "sun", "set": {"tip": 11.7}},
4956
+ {"id": "fl_ecarrier", "object": "speck"},
4957
+ {"id": "fl_ering", "object": "speck"},
4958
+ {"id": "fl_ep1", "object": "planet"},
4959
+ {"id": "fl_ep2", "object": "planet"},
4960
+ {"id": "fl_ep3", "object": "planet"},
4961
+ {"id": "fl_eoutput", "object": "output"},
4962
+ {"id": "fl_clip1", "object": "clip"},
4963
+ {"id": "fl_clip2", "object": "clip"},
4964
+ {"id": "fl_clip3", "object": "clip"},
4965
+ {"id": "fl_shin", "object": "shin"},
4966
+ {"id": "fl_pad", "object": "pad"},
4967
+ {"id": "fr_m1", "motor": {"model": "17HS4401", "drives": "fr_hd", "speed": 200, "duty": 0.3, "current": 1, "microsteps": 8}},
4968
+ {"id": "fr_housing", "object": "housing", "at": ["leg.body_half", "0 - leg.body_w",0], "rotate": [-90,0,180]},
4969
+ {"id": "fr_sun", "object": "sun"},
4970
+ {"id": "fr_carrier", "object": "speck"},
4971
+ {"id": "fr_p1", "object": "planet"},
4972
+ {"id": "fr_p2", "object": "planet"},
4973
+ {"id": "fr_p3", "object": "planet"},
4974
+ {"id": "fr_output", "object": "output"},
4975
+ {"id": "fr_spindle", "object": "spindle"},
4976
+ {"id": "fr_bridge", "object": "bridge"},
4977
+ {"id": "fr_b1", "bought": "bearing-6800"},
4978
+ {"id": "fr_thigh", "object": "thigh"},
4979
+ {"id": "fr_m2", "motor": {"model": "nema14", "drives": "fr_kd", "speed": 200, "duty": 0.3, "current": 0.8, "microsteps": 8}},
4980
+ {"id": "fr_esun", "object": "sun", "set": {"tip": 11.7}},
4981
+ {"id": "fr_ecarrier", "object": "speck"},
4982
+ {"id": "fr_ering", "object": "speck"},
4983
+ {"id": "fr_ep1", "object": "planet"},
4984
+ {"id": "fr_ep2", "object": "planet"},
4985
+ {"id": "fr_ep3", "object": "planet"},
4986
+ {"id": "fr_eoutput", "object": "output"},
4987
+ {"id": "fr_clip1", "object": "clip"},
4988
+ {"id": "fr_clip2", "object": "clip"},
4989
+ {"id": "fr_clip3", "object": "clip"},
4990
+ {"id": "fr_shin", "object": "shin"},
4991
+ {"id": "fr_pad", "object": "pad"},
4992
+ {"id": "bl_m1", "motor": {"model": "17HS4401", "drives": "bl_hd", "speed": 200, "duty": 0.3, "current": 1, "microsteps": 8}},
4993
+ {"id": "bl_housing", "object": "housing", "at": ["0 - leg.body_half", "leg.body_w",0], "rotate": [-90,0,0]},
4994
+ {"id": "bl_sun", "object": "sun"},
4995
+ {"id": "bl_carrier", "object": "speck"},
4996
+ {"id": "bl_p1", "object": "planet"},
4997
+ {"id": "bl_p2", "object": "planet"},
4998
+ {"id": "bl_p3", "object": "planet"},
4999
+ {"id": "bl_output", "object": "output"},
5000
+ {"id": "bl_spindle", "object": "spindle"},
5001
+ {"id": "bl_bridge", "object": "bridge"},
5002
+ {"id": "bl_b1", "bought": "bearing-6800"},
5003
+ {"id": "bl_thigh", "object": "thigh"},
5004
+ {"id": "bl_m2", "motor": {"model": "nema14", "drives": "bl_kd", "speed": 200, "duty": 0.3, "current": 0.8, "microsteps": 8}},
5005
+ {"id": "bl_esun", "object": "sun", "set": {"tip": 11.7}},
5006
+ {"id": "bl_ecarrier", "object": "speck"},
5007
+ {"id": "bl_ering", "object": "speck"},
5008
+ {"id": "bl_ep1", "object": "planet"},
5009
+ {"id": "bl_ep2", "object": "planet"},
5010
+ {"id": "bl_ep3", "object": "planet"},
5011
+ {"id": "bl_eoutput", "object": "output"},
5012
+ {"id": "bl_clip1", "object": "clip"},
5013
+ {"id": "bl_clip2", "object": "clip"},
5014
+ {"id": "bl_clip3", "object": "clip"},
5015
+ {"id": "bl_shin", "object": "shin"},
5016
+ {"id": "bl_pad", "object": "pad"},
5017
+ {"id": "br_m1", "motor": {"model": "17HS4401", "drives": "br_hd", "speed": 200, "duty": 0.3, "current": 1, "microsteps": 8}},
5018
+ {"id": "br_housing", "object": "housing", "at": ["0 - leg.body_half", "0 - leg.body_w",0], "rotate": [-90,0,180]},
5019
+ {"id": "br_sun", "object": "sun"},
5020
+ {"id": "br_carrier", "object": "speck"},
5021
+ {"id": "br_p1", "object": "planet"},
5022
+ {"id": "br_p2", "object": "planet"},
5023
+ {"id": "br_p3", "object": "planet"},
5024
+ {"id": "br_output", "object": "output"},
5025
+ {"id": "br_spindle", "object": "spindle"},
5026
+ {"id": "br_bridge", "object": "bridge"},
5027
+ {"id": "br_b1", "bought": "bearing-6800"},
5028
+ {"id": "br_thigh", "object": "thigh"},
5029
+ {"id": "br_m2", "motor": {"model": "nema14", "drives": "br_kd", "speed": 200, "duty": 0.3, "current": 0.8, "microsteps": 8}},
5030
+ {"id": "br_esun", "object": "sun", "set": {"tip": 11.7}},
5031
+ {"id": "br_ecarrier", "object": "speck"},
5032
+ {"id": "br_ering", "object": "speck"},
5033
+ {"id": "br_ep1", "object": "planet"},
5034
+ {"id": "br_ep2", "object": "planet"},
5035
+ {"id": "br_ep3", "object": "planet"},
5036
+ {"id": "br_eoutput", "object": "output"},
5037
+ {"id": "br_clip1", "object": "clip"},
5038
+ {"id": "br_clip2", "object": "clip"},
5039
+ {"id": "br_clip3", "object": "clip"},
5040
+ {"id": "br_shin", "object": "shin"},
5041
+ {"id": "br_pad", "object": "pad"}
5042
+ ],
5043
+ "joints": [
5044
+ {"id": "fl_m1_on", "type": "fixed", "parent": "fl_housing.motor", "child": "fl_m1.face"},
5045
+ {"id": "fl_hd", "type": "revolute", "parent": "fl_housing.axis", "child": "fl_sun.axis", "min": -6200, "max": 6200},
5046
+ {"id": "fl_turn", "type": "revolute", "parent": "fl_housing.axis", "child": "fl_carrier.axis", "min": -6200, "max": 6200},
5047
+ {"id": "fl_s1", "type": "revolute", "parent": "fl_carrier.a", "child": "fl_p1.axis", "min": -30000, "max": 30000},
5048
+ {"id": "fl_s2", "type": "revolute", "parent": "fl_carrier.b", "child": "fl_p2.axis", "min": -30000, "max": 30000},
5049
+ {"id": "fl_s3", "type": "revolute", "parent": "fl_carrier.c", "child": "fl_p3.axis", "min": -30000, "max": 30000},
5050
+ {"id": "fl_hip", "type": "revolute", "parent": {"item": "fl_housing", "at": [0,0, "leg.plate + leg.gear + leg.ring_gap"], "axis": [0,0,1]}, "child": "fl_output.axis", "min": 30, "max": 150, "label": "fl hip"},
5051
+ {"id": "fl_spindle_on", "type": "fixed", "parent": "fl_output.flange", "child": "fl_spindle.down"},
5052
+ {"id": "fl_thigh_on", "type": "fixed", "parent": "fl_spindle.seat", "child": "fl_thigh.hub"},
5053
+ {"id": "fl_bridge_on", "type": "fixed", "parent": {"item": "fl_housing", "at": [0,0, "leg.bridge_low"], "axis": [0,0,1]}, "child": "fl_bridge.under"},
5054
+ {"id": "fl_b1_on", "type": "fixed", "parent": {"item": "fl_housing", "at": [0,0, "leg.bridge_low + leg.bridge - leg.bearing_width"], "axis": [0,0,1]}, "child": "fl_b1.face"},
5055
+ {"id": "fl_m2_on", "type": "fixed", "parent": "fl_thigh.motor", "child": "fl_m2.face"},
5056
+ {"id": "fl_kd", "type": "revolute", "parent": "fl_thigh.knee", "child": "fl_esun.axis", "min": -6200, "max": 6200},
5057
+ {"id": "fl_ering_on", "type": "fixed", "parent": "fl_thigh.knee", "child": "fl_ering.axis"},
5058
+ {"id": "fl_eturn", "type": "revolute", "parent": "fl_thigh.knee", "child": "fl_ecarrier.axis", "min": -6200, "max": 6200},
5059
+ {"id": "fl_es1", "type": "revolute", "parent": "fl_ecarrier.a", "child": "fl_ep1.axis", "min": -30000, "max": 30000},
5060
+ {"id": "fl_es2", "type": "revolute", "parent": "fl_ecarrier.b", "child": "fl_ep2.axis", "min": -30000, "max": 30000},
5061
+ {"id": "fl_es3", "type": "revolute", "parent": "fl_ecarrier.c", "child": "fl_ep3.axis", "min": -30000, "max": 30000},
5062
+ {"id": "fl_knee", "type": "revolute", "parent": "fl_thigh.output", "child": "fl_eoutput.axis", "min": -150, "max": 0, "label": "fl knee"},
5063
+ {"id": "fl_c1_on", "type": "fixed", "parent": "fl_thigh.clip1", "child": "fl_clip1.post"},
5064
+ {"id": "fl_c2_on", "type": "fixed", "parent": "fl_thigh.clip2", "child": "fl_clip2.post"},
5065
+ {"id": "fl_c3_on", "type": "fixed", "parent": "fl_thigh.clip3", "child": "fl_clip3.post"},
5066
+ {"id": "fl_shin_on", "type": "fixed", "parent": "fl_eoutput.flange", "child": "fl_shin.hub"},
5067
+ {"id": "fl_pad_on", "type": "fixed", "parent": "fl_shin.pad", "child": "fl_pad.axis"},
5068
+ {"id": "fr_m1_on", "type": "fixed", "parent": "fr_housing.motor", "child": "fr_m1.face"},
5069
+ {"id": "fr_hd", "type": "revolute", "parent": "fr_housing.axis", "child": "fr_sun.axis", "min": -6200, "max": 6200},
5070
+ {"id": "fr_turn", "type": "revolute", "parent": "fr_housing.axis", "child": "fr_carrier.axis", "min": -6200, "max": 6200},
5071
+ {"id": "fr_s1", "type": "revolute", "parent": "fr_carrier.a", "child": "fr_p1.axis", "min": -30000, "max": 30000},
5072
+ {"id": "fr_s2", "type": "revolute", "parent": "fr_carrier.b", "child": "fr_p2.axis", "min": -30000, "max": 30000},
5073
+ {"id": "fr_s3", "type": "revolute", "parent": "fr_carrier.c", "child": "fr_p3.axis", "min": -30000, "max": 30000},
5074
+ {"id": "fr_hip", "type": "revolute", "parent": {"item": "fr_housing", "at": [0,0, "leg.plate + leg.gear + leg.ring_gap"], "axis": [0,0,1]}, "child": "fr_output.axis", "min": 30, "max": 150, "label": "fr hip"},
5075
+ {"id": "fr_spindle_on", "type": "fixed", "parent": "fr_output.flange", "child": "fr_spindle.down"},
5076
+ {"id": "fr_thigh_on", "type": "fixed", "parent": "fr_spindle.seat", "child": "fr_thigh.hub"},
5077
+ {"id": "fr_bridge_on", "type": "fixed", "parent": {"item": "fr_housing", "at": [0,0, "leg.bridge_low"], "axis": [0,0,1]}, "child": "fr_bridge.under"},
5078
+ {"id": "fr_b1_on", "type": "fixed", "parent": {"item": "fr_housing", "at": [0,0, "leg.bridge_low + leg.bridge - leg.bearing_width"], "axis": [0,0,1]}, "child": "fr_b1.face"},
5079
+ {"id": "fr_m2_on", "type": "fixed", "parent": "fr_thigh.motor", "child": "fr_m2.face"},
5080
+ {"id": "fr_kd", "type": "revolute", "parent": "fr_thigh.knee", "child": "fr_esun.axis", "min": -6200, "max": 6200},
5081
+ {"id": "fr_ering_on", "type": "fixed", "parent": "fr_thigh.knee", "child": "fr_ering.axis"},
5082
+ {"id": "fr_eturn", "type": "revolute", "parent": "fr_thigh.knee", "child": "fr_ecarrier.axis", "min": -6200, "max": 6200},
5083
+ {"id": "fr_es1", "type": "revolute", "parent": "fr_ecarrier.a", "child": "fr_ep1.axis", "min": -30000, "max": 30000},
5084
+ {"id": "fr_es2", "type": "revolute", "parent": "fr_ecarrier.b", "child": "fr_ep2.axis", "min": -30000, "max": 30000},
5085
+ {"id": "fr_es3", "type": "revolute", "parent": "fr_ecarrier.c", "child": "fr_ep3.axis", "min": -30000, "max": 30000},
5086
+ {"id": "fr_knee", "type": "revolute", "parent": "fr_thigh.output", "child": "fr_eoutput.axis", "min": 0, "max": 150, "label": "fr knee"},
5087
+ {"id": "fr_c1_on", "type": "fixed", "parent": "fr_thigh.clip1", "child": "fr_clip1.post"},
5088
+ {"id": "fr_c2_on", "type": "fixed", "parent": "fr_thigh.clip2", "child": "fr_clip2.post"},
5089
+ {"id": "fr_c3_on", "type": "fixed", "parent": "fr_thigh.clip3", "child": "fr_clip3.post"},
5090
+ {"id": "fr_shin_on", "type": "fixed", "parent": "fr_eoutput.flange", "child": "fr_shin.hub"},
5091
+ {"id": "fr_pad_on", "type": "fixed", "parent": "fr_shin.pad", "child": "fr_pad.axis"},
5092
+ {"id": "bl_m1_on", "type": "fixed", "parent": "bl_housing.motor", "child": "bl_m1.face"},
5093
+ {"id": "bl_hd", "type": "revolute", "parent": "bl_housing.axis", "child": "bl_sun.axis", "min": -6200, "max": 6200},
5094
+ {"id": "bl_turn", "type": "revolute", "parent": "bl_housing.axis", "child": "bl_carrier.axis", "min": -6200, "max": 6200},
5095
+ {"id": "bl_s1", "type": "revolute", "parent": "bl_carrier.a", "child": "bl_p1.axis", "min": -30000, "max": 30000},
5096
+ {"id": "bl_s2", "type": "revolute", "parent": "bl_carrier.b", "child": "bl_p2.axis", "min": -30000, "max": 30000},
5097
+ {"id": "bl_s3", "type": "revolute", "parent": "bl_carrier.c", "child": "bl_p3.axis", "min": -30000, "max": 30000},
5098
+ {"id": "bl_hip", "type": "revolute", "parent": {"item": "bl_housing", "at": [0,0, "leg.plate + leg.gear + leg.ring_gap"], "axis": [0,0,1]}, "child": "bl_output.axis", "min": 30, "max": 150, "label": "bl hip"},
5099
+ {"id": "bl_spindle_on", "type": "fixed", "parent": "bl_output.flange", "child": "bl_spindle.down"},
5100
+ {"id": "bl_thigh_on", "type": "fixed", "parent": "bl_spindle.seat", "child": "bl_thigh.hub"},
5101
+ {"id": "bl_bridge_on", "type": "fixed", "parent": {"item": "bl_housing", "at": [0,0, "leg.bridge_low"], "axis": [0,0,1]}, "child": "bl_bridge.under"},
5102
+ {"id": "bl_b1_on", "type": "fixed", "parent": {"item": "bl_housing", "at": [0,0, "leg.bridge_low + leg.bridge - leg.bearing_width"], "axis": [0,0,1]}, "child": "bl_b1.face"},
5103
+ {"id": "bl_m2_on", "type": "fixed", "parent": "bl_thigh.motor", "child": "bl_m2.face"},
5104
+ {"id": "bl_kd", "type": "revolute", "parent": "bl_thigh.knee", "child": "bl_esun.axis", "min": -6200, "max": 6200},
5105
+ {"id": "bl_ering_on", "type": "fixed", "parent": "bl_thigh.knee", "child": "bl_ering.axis"},
5106
+ {"id": "bl_eturn", "type": "revolute", "parent": "bl_thigh.knee", "child": "bl_ecarrier.axis", "min": -6200, "max": 6200},
5107
+ {"id": "bl_es1", "type": "revolute", "parent": "bl_ecarrier.a", "child": "bl_ep1.axis", "min": -30000, "max": 30000},
5108
+ {"id": "bl_es2", "type": "revolute", "parent": "bl_ecarrier.b", "child": "bl_ep2.axis", "min": -30000, "max": 30000},
5109
+ {"id": "bl_es3", "type": "revolute", "parent": "bl_ecarrier.c", "child": "bl_ep3.axis", "min": -30000, "max": 30000},
5110
+ {"id": "bl_knee", "type": "revolute", "parent": "bl_thigh.output", "child": "bl_eoutput.axis", "min": 0, "max": 150, "label": "bl knee"},
5111
+ {"id": "bl_c1_on", "type": "fixed", "parent": "bl_thigh.clip1", "child": "bl_clip1.post"},
5112
+ {"id": "bl_c2_on", "type": "fixed", "parent": "bl_thigh.clip2", "child": "bl_clip2.post"},
5113
+ {"id": "bl_c3_on", "type": "fixed", "parent": "bl_thigh.clip3", "child": "bl_clip3.post"},
5114
+ {"id": "bl_shin_on", "type": "fixed", "parent": "bl_eoutput.flange", "child": "bl_shin.hub"},
5115
+ {"id": "bl_pad_on", "type": "fixed", "parent": "bl_shin.pad", "child": "bl_pad.axis"},
5116
+ {"id": "br_m1_on", "type": "fixed", "parent": "br_housing.motor", "child": "br_m1.face"},
5117
+ {"id": "br_hd", "type": "revolute", "parent": "br_housing.axis", "child": "br_sun.axis", "min": -6200, "max": 6200},
5118
+ {"id": "br_turn", "type": "revolute", "parent": "br_housing.axis", "child": "br_carrier.axis", "min": -6200, "max": 6200},
5119
+ {"id": "br_s1", "type": "revolute", "parent": "br_carrier.a", "child": "br_p1.axis", "min": -30000, "max": 30000},
5120
+ {"id": "br_s2", "type": "revolute", "parent": "br_carrier.b", "child": "br_p2.axis", "min": -30000, "max": 30000},
5121
+ {"id": "br_s3", "type": "revolute", "parent": "br_carrier.c", "child": "br_p3.axis", "min": -30000, "max": 30000},
5122
+ {"id": "br_hip", "type": "revolute", "parent": {"item": "br_housing", "at": [0,0, "leg.plate + leg.gear + leg.ring_gap"], "axis": [0,0,1]}, "child": "br_output.axis", "min": 30, "max": 150, "label": "br hip"},
5123
+ {"id": "br_spindle_on", "type": "fixed", "parent": "br_output.flange", "child": "br_spindle.down"},
5124
+ {"id": "br_thigh_on", "type": "fixed", "parent": "br_spindle.seat", "child": "br_thigh.hub"},
5125
+ {"id": "br_bridge_on", "type": "fixed", "parent": {"item": "br_housing", "at": [0,0, "leg.bridge_low"], "axis": [0,0,1]}, "child": "br_bridge.under"},
5126
+ {"id": "br_b1_on", "type": "fixed", "parent": {"item": "br_housing", "at": [0,0, "leg.bridge_low + leg.bridge - leg.bearing_width"], "axis": [0,0,1]}, "child": "br_b1.face"},
5127
+ {"id": "br_m2_on", "type": "fixed", "parent": "br_thigh.motor", "child": "br_m2.face"},
5128
+ {"id": "br_kd", "type": "revolute", "parent": "br_thigh.knee", "child": "br_esun.axis", "min": -6200, "max": 6200},
5129
+ {"id": "br_ering_on", "type": "fixed", "parent": "br_thigh.knee", "child": "br_ering.axis"},
5130
+ {"id": "br_eturn", "type": "revolute", "parent": "br_thigh.knee", "child": "br_ecarrier.axis", "min": -6200, "max": 6200},
5131
+ {"id": "br_es1", "type": "revolute", "parent": "br_ecarrier.a", "child": "br_ep1.axis", "min": -30000, "max": 30000},
5132
+ {"id": "br_es2", "type": "revolute", "parent": "br_ecarrier.b", "child": "br_ep2.axis", "min": -30000, "max": 30000},
5133
+ {"id": "br_es3", "type": "revolute", "parent": "br_ecarrier.c", "child": "br_ep3.axis", "min": -30000, "max": 30000},
5134
+ {"id": "br_knee", "type": "revolute", "parent": "br_thigh.output", "child": "br_eoutput.axis", "min": -150, "max": 0, "label": "br knee"},
5135
+ {"id": "br_c1_on", "type": "fixed", "parent": "br_thigh.clip1", "child": "br_clip1.post"},
5136
+ {"id": "br_c2_on", "type": "fixed", "parent": "br_thigh.clip2", "child": "br_clip2.post"},
5137
+ {"id": "br_c3_on", "type": "fixed", "parent": "br_thigh.clip3", "child": "br_clip3.post"},
5138
+ {"id": "br_shin_on", "type": "fixed", "parent": "br_eoutput.flange", "child": "br_shin.hub"},
5139
+ {"id": "br_pad_on", "type": "fixed", "parent": "br_shin.pad", "child": "br_pad.axis"}
5140
+ ],
5141
+ "planetary": [
5142
+ {"sun": "fl_sun", "carrier": "fl_carrier", "ring": "fl_housing", "planets": ["fl_p1", "fl_p2", "fl_p3"], "drive": "sun", "module": 1, "teeth": [18,18,54], "output": {"ring": "fl_output", "planet": 21, "teeth": 57}},
5143
+ {"sun": "fl_esun", "carrier": "fl_ecarrier", "ring": "fl_ering", "planets": ["fl_ep1", "fl_ep2", "fl_ep3"], "drive": "sun", "module": 1, "teeth": [18,18,54], "output": {"ring": "fl_eoutput", "planet": 21, "teeth": 57}},
5144
+ {"sun": "fr_sun", "carrier": "fr_carrier", "ring": "fr_housing", "planets": ["fr_p1", "fr_p2", "fr_p3"], "drive": "sun", "module": 1, "teeth": [18,18,54], "output": {"ring": "fr_output", "planet": 21, "teeth": 57}},
5145
+ {"sun": "fr_esun", "carrier": "fr_ecarrier", "ring": "fr_ering", "planets": ["fr_ep1", "fr_ep2", "fr_ep3"], "drive": "sun", "module": 1, "teeth": [18,18,54], "output": {"ring": "fr_eoutput", "planet": 21, "teeth": 57}},
5146
+ {"sun": "bl_sun", "carrier": "bl_carrier", "ring": "bl_housing", "planets": ["bl_p1", "bl_p2", "bl_p3"], "drive": "sun", "module": 1, "teeth": [18,18,54], "output": {"ring": "bl_output", "planet": 21, "teeth": 57}},
5147
+ {"sun": "bl_esun", "carrier": "bl_ecarrier", "ring": "bl_ering", "planets": ["bl_ep1", "bl_ep2", "bl_ep3"], "drive": "sun", "module": 1, "teeth": [18,18,54], "output": {"ring": "bl_eoutput", "planet": 21, "teeth": 57}},
5148
+ {"sun": "br_sun", "carrier": "br_carrier", "ring": "br_housing", "planets": ["br_p1", "br_p2", "br_p3"], "drive": "sun", "module": 1, "teeth": [18,18,54], "output": {"ring": "br_output", "planet": 21, "teeth": 57}},
5149
+ {"sun": "br_esun", "carrier": "br_ecarrier", "ring": "br_ering", "planets": ["br_ep1", "br_ep2", "br_ep3"], "drive": "sun", "module": 1, "teeth": [18,18,54], "output": {"ring": "br_eoutput", "planet": 21, "teeth": 57}}
5150
+ ],
5151
+ "fits": [
5152
+ {"a": "beam1", "b": "left", "fastens": true, "min": 0, "note": "A beam, on two screws through each side plate"},
5153
+ {"a": "beam1", "b": "right", "fastens": true, "min": 0},
5154
+ {"a": "beam2", "b": "left", "fastens": true, "min": 0},
5155
+ {"a": "beam2", "b": "right", "fastens": true, "min": 0},
5156
+ {"a": "fl_m1", "b": "fl_housing", "fastens": true, "min": -0.1},
5157
+ {"a": "fl_m1", "b": "fl_sun", "shaft": true},
5158
+ {"a": "fl_m2", "b": "fl_esun", "shaft": true},
5159
+ {"a": "fl_m2", "b": "fl_thigh", "fastens": true, "min": -0.1},
5160
+ {"a": "fl_housing", "b": "left", "fastens": true, "min": 0},
5161
+ {"a": "fl_bridge", "b": "fl_housing", "fastens": true, "min": 0},
5162
+ {"a": "fl_b1", "b": "fl_bridge", "seat": "press"},
5163
+ {"a": "fl_ecarrier", "b": "fl_ering", "min": -1},
5164
+ {"a": "fl_pad", "b": "fl_shin", "min": -2},
5165
+ {"a": "fr_m1", "b": "fr_housing", "fastens": true, "min": -0.1},
5166
+ {"a": "fr_m1", "b": "fr_sun", "shaft": true},
5167
+ {"a": "fr_m2", "b": "fr_esun", "shaft": true},
5168
+ {"a": "fr_m2", "b": "fr_thigh", "fastens": true, "min": -0.1},
5169
+ {"a": "fr_housing", "b": "right", "fastens": true, "min": 0},
5170
+ {"a": "fr_bridge", "b": "fr_housing", "fastens": true, "min": 0},
5171
+ {"a": "fr_b1", "b": "fr_bridge", "seat": "press"},
5172
+ {"a": "fr_ecarrier", "b": "fr_ering", "min": -1},
5173
+ {"a": "fr_pad", "b": "fr_shin", "min": -2},
5174
+ {"a": "bl_m1", "b": "bl_housing", "fastens": true, "min": -0.1},
5175
+ {"a": "bl_m1", "b": "bl_sun", "shaft": true},
5176
+ {"a": "bl_m2", "b": "bl_esun", "shaft": true},
5177
+ {"a": "bl_m2", "b": "bl_thigh", "fastens": true, "min": -0.1},
5178
+ {"a": "bl_housing", "b": "left", "fastens": true, "min": 0},
5179
+ {"a": "bl_bridge", "b": "bl_housing", "fastens": true, "min": 0},
5180
+ {"a": "bl_b1", "b": "bl_bridge", "seat": "press"},
5181
+ {"a": "bl_ecarrier", "b": "bl_ering", "min": -1},
5182
+ {"a": "bl_pad", "b": "bl_shin", "min": -2},
5183
+ {"a": "br_m1", "b": "br_housing", "fastens": true, "min": -0.1},
5184
+ {"a": "br_m1", "b": "br_sun", "shaft": true},
5185
+ {"a": "br_m2", "b": "br_esun", "shaft": true},
5186
+ {"a": "br_m2", "b": "br_thigh", "fastens": true, "min": -0.1},
5187
+ {"a": "br_housing", "b": "right", "fastens": true, "min": 0},
5188
+ {"a": "br_bridge", "b": "br_housing", "fastens": true, "min": 0},
5189
+ {"a": "br_b1", "b": "br_bridge", "seat": "press"},
5190
+ {"a": "br_ecarrier", "b": "br_ering", "min": -1},
5191
+ {"a": "br_pad", "b": "br_shin", "min": -2}
5192
+ ],
5193
+ "gait": {"legs": ["fl_shin.tip", "fr_shin.tip", "bl_shin.tip", "br_shin.tip"], "pattern": "trot", "stride": "leg.stride", "lift": "leg.lift", "period": 2, "height": "leg.stance", "mass": "leg.robot_mass", "clearance": 11},
5194
+ "poses": { "standing": {"fl_hd": -3171.4, "fl_kd": 2597, "fr_hd": -5587.7, "fr_kd": -2236, "bl_hd": -5587.7, "bl_kd": -2236, "br_hd": -3171.4, "br_kd": 2597} }
5195
+ }
5196
+ ```
5197
+
5198
+ ```json projects/leg/assemblies/crawl.json
5199
+ {
5200
+ "$schema": "https://jonibach.github.io/rulecad/schemas/assembly.schema.json",
5201
+ "title": "A quadruped, crawling: a statically stable walk",
5202
+ "kind": "fit",
5203
+ "description": "The same machine as quadruped.json, walking one foot at a time, so its centre of mass is inside its feet in every pose. A design, not yet a build.",
5204
+ "uses": ["leg"],
5205
+ "items": [
5206
+ {"id": "left", "object": "side", "at": [0, "leg.body_w",0], "rotate": [90,0,0]},
5207
+ {"id": "right", "object": "side", "at": [0, "0 - leg.body_w",0], "rotate": [90,0,180]},
5208
+ {"id": "beam1", "object": "beam", "at": ["left.beam_at",0,-6], "rotate": [0,0,90]},
5209
+ {"id": "beam2", "object": "beam", "at": ["0 - left.beam_at",0,-6], "rotate": [0,0,90]},
5210
+ {"id": "fl_m1", "motor": {"model": "17HS4401", "drives": "fl_hd", "speed": 200, "duty": 0.3, "current": 1, "microsteps": 8}},
5211
+ {"id": "fl_housing", "object": "housing", "at": ["leg.body_half", "leg.body_w",0], "rotate": [-90,0,0]},
5212
+ {"id": "fl_sun", "object": "sun"},
5213
+ {"id": "fl_carrier", "object": "speck"},
5214
+ {"id": "fl_p1", "object": "planet"},
5215
+ {"id": "fl_p2", "object": "planet"},
5216
+ {"id": "fl_p3", "object": "planet"},
5217
+ {"id": "fl_output", "object": "output"},
5218
+ {"id": "fl_spindle", "object": "spindle"},
5219
+ {"id": "fl_bridge", "object": "bridge"},
5220
+ {"id": "fl_b1", "bought": "bearing-6800"},
5221
+ {"id": "fl_thigh", "object": "thigh"},
5222
+ {"id": "fl_m2", "motor": {"model": "nema14", "drives": "fl_kd", "speed": 200, "duty": 0.3, "current": 0.8, "microsteps": 8}},
5223
+ {"id": "fl_esun", "object": "sun", "set": {"tip": 11.7}},
5224
+ {"id": "fl_ecarrier", "object": "speck"},
5225
+ {"id": "fl_ering", "object": "speck"},
5226
+ {"id": "fl_ep1", "object": "planet"},
5227
+ {"id": "fl_ep2", "object": "planet"},
5228
+ {"id": "fl_ep3", "object": "planet"},
5229
+ {"id": "fl_eoutput", "object": "output"},
5230
+ {"id": "fl_clip1", "object": "clip"},
5231
+ {"id": "fl_clip2", "object": "clip"},
5232
+ {"id": "fl_clip3", "object": "clip"},
5233
+ {"id": "fl_shin", "object": "shin"},
5234
+ {"id": "fl_pad", "object": "pad"},
5235
+ {"id": "fr_m1", "motor": {"model": "17HS4401", "drives": "fr_hd", "speed": 200, "duty": 0.3, "current": 1, "microsteps": 8}},
5236
+ {"id": "fr_housing", "object": "housing", "at": ["leg.body_half", "0 - leg.body_w",0], "rotate": [-90,0,180]},
5237
+ {"id": "fr_sun", "object": "sun"},
5238
+ {"id": "fr_carrier", "object": "speck"},
5239
+ {"id": "fr_p1", "object": "planet"},
5240
+ {"id": "fr_p2", "object": "planet"},
5241
+ {"id": "fr_p3", "object": "planet"},
5242
+ {"id": "fr_output", "object": "output"},
5243
+ {"id": "fr_spindle", "object": "spindle"},
5244
+ {"id": "fr_bridge", "object": "bridge"},
5245
+ {"id": "fr_b1", "bought": "bearing-6800"},
5246
+ {"id": "fr_thigh", "object": "thigh"},
5247
+ {"id": "fr_m2", "motor": {"model": "nema14", "drives": "fr_kd", "speed": 200, "duty": 0.3, "current": 0.8, "microsteps": 8}},
5248
+ {"id": "fr_esun", "object": "sun", "set": {"tip": 11.7}},
5249
+ {"id": "fr_ecarrier", "object": "speck"},
5250
+ {"id": "fr_ering", "object": "speck"},
5251
+ {"id": "fr_ep1", "object": "planet"},
5252
+ {"id": "fr_ep2", "object": "planet"},
5253
+ {"id": "fr_ep3", "object": "planet"},
5254
+ {"id": "fr_eoutput", "object": "output"},
5255
+ {"id": "fr_clip1", "object": "clip"},
5256
+ {"id": "fr_clip2", "object": "clip"},
5257
+ {"id": "fr_clip3", "object": "clip"},
5258
+ {"id": "fr_shin", "object": "shin"},
5259
+ {"id": "fr_pad", "object": "pad"},
5260
+ {"id": "bl_m1", "motor": {"model": "17HS4401", "drives": "bl_hd", "speed": 200, "duty": 0.3, "current": 1, "microsteps": 8}},
5261
+ {"id": "bl_housing", "object": "housing", "at": ["0 - leg.body_half", "leg.body_w",0], "rotate": [-90,0,0]},
5262
+ {"id": "bl_sun", "object": "sun"},
5263
+ {"id": "bl_carrier", "object": "speck"},
5264
+ {"id": "bl_p1", "object": "planet"},
5265
+ {"id": "bl_p2", "object": "planet"},
5266
+ {"id": "bl_p3", "object": "planet"},
5267
+ {"id": "bl_output", "object": "output"},
5268
+ {"id": "bl_spindle", "object": "spindle"},
5269
+ {"id": "bl_bridge", "object": "bridge"},
5270
+ {"id": "bl_b1", "bought": "bearing-6800"},
5271
+ {"id": "bl_thigh", "object": "thigh"},
5272
+ {"id": "bl_m2", "motor": {"model": "nema14", "drives": "bl_kd", "speed": 200, "duty": 0.3, "current": 0.8, "microsteps": 8}},
5273
+ {"id": "bl_esun", "object": "sun", "set": {"tip": 11.7}},
5274
+ {"id": "bl_ecarrier", "object": "speck"},
5275
+ {"id": "bl_ering", "object": "speck"},
5276
+ {"id": "bl_ep1", "object": "planet"},
5277
+ {"id": "bl_ep2", "object": "planet"},
5278
+ {"id": "bl_ep3", "object": "planet"},
5279
+ {"id": "bl_eoutput", "object": "output"},
5280
+ {"id": "bl_clip1", "object": "clip"},
5281
+ {"id": "bl_clip2", "object": "clip"},
5282
+ {"id": "bl_clip3", "object": "clip"},
5283
+ {"id": "bl_shin", "object": "shin"},
5284
+ {"id": "bl_pad", "object": "pad"},
5285
+ {"id": "br_m1", "motor": {"model": "17HS4401", "drives": "br_hd", "speed": 200, "duty": 0.3, "current": 1, "microsteps": 8}},
5286
+ {"id": "br_housing", "object": "housing", "at": ["0 - leg.body_half", "0 - leg.body_w",0], "rotate": [-90,0,180]},
5287
+ {"id": "br_sun", "object": "sun"},
5288
+ {"id": "br_carrier", "object": "speck"},
5289
+ {"id": "br_p1", "object": "planet"},
5290
+ {"id": "br_p2", "object": "planet"},
5291
+ {"id": "br_p3", "object": "planet"},
5292
+ {"id": "br_output", "object": "output"},
5293
+ {"id": "br_spindle", "object": "spindle"},
5294
+ {"id": "br_bridge", "object": "bridge"},
5295
+ {"id": "br_b1", "bought": "bearing-6800"},
5296
+ {"id": "br_thigh", "object": "thigh"},
5297
+ {"id": "br_m2", "motor": {"model": "nema14", "drives": "br_kd", "speed": 200, "duty": 0.3, "current": 0.8, "microsteps": 8}},
5298
+ {"id": "br_esun", "object": "sun", "set": {"tip": 11.7}},
5299
+ {"id": "br_ecarrier", "object": "speck"},
5300
+ {"id": "br_ering", "object": "speck"},
5301
+ {"id": "br_ep1", "object": "planet"},
5302
+ {"id": "br_ep2", "object": "planet"},
5303
+ {"id": "br_ep3", "object": "planet"},
5304
+ {"id": "br_eoutput", "object": "output"},
5305
+ {"id": "br_clip1", "object": "clip"},
5306
+ {"id": "br_clip2", "object": "clip"},
5307
+ {"id": "br_clip3", "object": "clip"},
5308
+ {"id": "br_shin", "object": "shin"},
5309
+ {"id": "br_pad", "object": "pad"}
5310
+ ],
5311
+ "joints": [
5312
+ {"id": "fl_m1_on", "type": "fixed", "parent": "fl_housing.motor", "child": "fl_m1.face"},
5313
+ {"id": "fl_hd", "type": "revolute", "parent": "fl_housing.axis", "child": "fl_sun.axis", "min": -6200, "max": 6200},
5314
+ {"id": "fl_turn", "type": "revolute", "parent": "fl_housing.axis", "child": "fl_carrier.axis", "min": -6200, "max": 6200},
5315
+ {"id": "fl_s1", "type": "revolute", "parent": "fl_carrier.a", "child": "fl_p1.axis", "min": -30000, "max": 30000},
5316
+ {"id": "fl_s2", "type": "revolute", "parent": "fl_carrier.b", "child": "fl_p2.axis", "min": -30000, "max": 30000},
5317
+ {"id": "fl_s3", "type": "revolute", "parent": "fl_carrier.c", "child": "fl_p3.axis", "min": -30000, "max": 30000},
5318
+ {"id": "fl_hip", "type": "revolute", "parent": {"item": "fl_housing", "at": [0,0, "leg.plate + leg.gear + leg.ring_gap"], "axis": [0,0,1]}, "child": "fl_output.axis", "min": 30, "max": 150, "label": "fl hip"},
5319
+ {"id": "fl_spindle_on", "type": "fixed", "parent": "fl_output.flange", "child": "fl_spindle.down"},
5320
+ {"id": "fl_thigh_on", "type": "fixed", "parent": "fl_spindle.seat", "child": "fl_thigh.hub"},
5321
+ {"id": "fl_bridge_on", "type": "fixed", "parent": {"item": "fl_housing", "at": [0,0, "leg.bridge_low"], "axis": [0,0,1]}, "child": "fl_bridge.under"},
5322
+ {"id": "fl_b1_on", "type": "fixed", "parent": {"item": "fl_housing", "at": [0,0, "leg.bridge_low + leg.bridge - leg.bearing_width"], "axis": [0,0,1]}, "child": "fl_b1.face"},
5323
+ {"id": "fl_m2_on", "type": "fixed", "parent": "fl_thigh.motor", "child": "fl_m2.face"},
5324
+ {"id": "fl_kd", "type": "revolute", "parent": "fl_thigh.knee", "child": "fl_esun.axis", "min": -6200, "max": 6200},
5325
+ {"id": "fl_ering_on", "type": "fixed", "parent": "fl_thigh.knee", "child": "fl_ering.axis"},
5326
+ {"id": "fl_eturn", "type": "revolute", "parent": "fl_thigh.knee", "child": "fl_ecarrier.axis", "min": -6200, "max": 6200},
5327
+ {"id": "fl_es1", "type": "revolute", "parent": "fl_ecarrier.a", "child": "fl_ep1.axis", "min": -30000, "max": 30000},
5328
+ {"id": "fl_es2", "type": "revolute", "parent": "fl_ecarrier.b", "child": "fl_ep2.axis", "min": -30000, "max": 30000},
5329
+ {"id": "fl_es3", "type": "revolute", "parent": "fl_ecarrier.c", "child": "fl_ep3.axis", "min": -30000, "max": 30000},
5330
+ {"id": "fl_knee", "type": "revolute", "parent": "fl_thigh.output", "child": "fl_eoutput.axis", "min": -150, "max": 0, "label": "fl knee"},
5331
+ {"id": "fl_c1_on", "type": "fixed", "parent": "fl_thigh.clip1", "child": "fl_clip1.post"},
5332
+ {"id": "fl_c2_on", "type": "fixed", "parent": "fl_thigh.clip2", "child": "fl_clip2.post"},
5333
+ {"id": "fl_c3_on", "type": "fixed", "parent": "fl_thigh.clip3", "child": "fl_clip3.post"},
5334
+ {"id": "fl_shin_on", "type": "fixed", "parent": "fl_eoutput.flange", "child": "fl_shin.hub"},
5335
+ {"id": "fl_pad_on", "type": "fixed", "parent": "fl_shin.pad", "child": "fl_pad.axis"},
5336
+ {"id": "fr_m1_on", "type": "fixed", "parent": "fr_housing.motor", "child": "fr_m1.face"},
5337
+ {"id": "fr_hd", "type": "revolute", "parent": "fr_housing.axis", "child": "fr_sun.axis", "min": -6200, "max": 6200},
5338
+ {"id": "fr_turn", "type": "revolute", "parent": "fr_housing.axis", "child": "fr_carrier.axis", "min": -6200, "max": 6200},
5339
+ {"id": "fr_s1", "type": "revolute", "parent": "fr_carrier.a", "child": "fr_p1.axis", "min": -30000, "max": 30000},
5340
+ {"id": "fr_s2", "type": "revolute", "parent": "fr_carrier.b", "child": "fr_p2.axis", "min": -30000, "max": 30000},
5341
+ {"id": "fr_s3", "type": "revolute", "parent": "fr_carrier.c", "child": "fr_p3.axis", "min": -30000, "max": 30000},
5342
+ {"id": "fr_hip", "type": "revolute", "parent": {"item": "fr_housing", "at": [0,0, "leg.plate + leg.gear + leg.ring_gap"], "axis": [0,0,1]}, "child": "fr_output.axis", "min": 30, "max": 150, "label": "fr hip"},
5343
+ {"id": "fr_spindle_on", "type": "fixed", "parent": "fr_output.flange", "child": "fr_spindle.down"},
5344
+ {"id": "fr_thigh_on", "type": "fixed", "parent": "fr_spindle.seat", "child": "fr_thigh.hub"},
5345
+ {"id": "fr_bridge_on", "type": "fixed", "parent": {"item": "fr_housing", "at": [0,0, "leg.bridge_low"], "axis": [0,0,1]}, "child": "fr_bridge.under"},
5346
+ {"id": "fr_b1_on", "type": "fixed", "parent": {"item": "fr_housing", "at": [0,0, "leg.bridge_low + leg.bridge - leg.bearing_width"], "axis": [0,0,1]}, "child": "fr_b1.face"},
5347
+ {"id": "fr_m2_on", "type": "fixed", "parent": "fr_thigh.motor", "child": "fr_m2.face"},
5348
+ {"id": "fr_kd", "type": "revolute", "parent": "fr_thigh.knee", "child": "fr_esun.axis", "min": -6200, "max": 6200},
5349
+ {"id": "fr_ering_on", "type": "fixed", "parent": "fr_thigh.knee", "child": "fr_ering.axis"},
5350
+ {"id": "fr_eturn", "type": "revolute", "parent": "fr_thigh.knee", "child": "fr_ecarrier.axis", "min": -6200, "max": 6200},
5351
+ {"id": "fr_es1", "type": "revolute", "parent": "fr_ecarrier.a", "child": "fr_ep1.axis", "min": -30000, "max": 30000},
5352
+ {"id": "fr_es2", "type": "revolute", "parent": "fr_ecarrier.b", "child": "fr_ep2.axis", "min": -30000, "max": 30000},
5353
+ {"id": "fr_es3", "type": "revolute", "parent": "fr_ecarrier.c", "child": "fr_ep3.axis", "min": -30000, "max": 30000},
5354
+ {"id": "fr_knee", "type": "revolute", "parent": "fr_thigh.output", "child": "fr_eoutput.axis", "min": 0, "max": 150, "label": "fr knee"},
5355
+ {"id": "fr_c1_on", "type": "fixed", "parent": "fr_thigh.clip1", "child": "fr_clip1.post"},
5356
+ {"id": "fr_c2_on", "type": "fixed", "parent": "fr_thigh.clip2", "child": "fr_clip2.post"},
5357
+ {"id": "fr_c3_on", "type": "fixed", "parent": "fr_thigh.clip3", "child": "fr_clip3.post"},
5358
+ {"id": "fr_shin_on", "type": "fixed", "parent": "fr_eoutput.flange", "child": "fr_shin.hub"},
5359
+ {"id": "fr_pad_on", "type": "fixed", "parent": "fr_shin.pad", "child": "fr_pad.axis"},
5360
+ {"id": "bl_m1_on", "type": "fixed", "parent": "bl_housing.motor", "child": "bl_m1.face"},
5361
+ {"id": "bl_hd", "type": "revolute", "parent": "bl_housing.axis", "child": "bl_sun.axis", "min": -6200, "max": 6200},
5362
+ {"id": "bl_turn", "type": "revolute", "parent": "bl_housing.axis", "child": "bl_carrier.axis", "min": -6200, "max": 6200},
5363
+ {"id": "bl_s1", "type": "revolute", "parent": "bl_carrier.a", "child": "bl_p1.axis", "min": -30000, "max": 30000},
5364
+ {"id": "bl_s2", "type": "revolute", "parent": "bl_carrier.b", "child": "bl_p2.axis", "min": -30000, "max": 30000},
5365
+ {"id": "bl_s3", "type": "revolute", "parent": "bl_carrier.c", "child": "bl_p3.axis", "min": -30000, "max": 30000},
5366
+ {"id": "bl_hip", "type": "revolute", "parent": {"item": "bl_housing", "at": [0,0, "leg.plate + leg.gear + leg.ring_gap"], "axis": [0,0,1]}, "child": "bl_output.axis", "min": 30, "max": 150, "label": "bl hip"},
5367
+ {"id": "bl_spindle_on", "type": "fixed", "parent": "bl_output.flange", "child": "bl_spindle.down"},
5368
+ {"id": "bl_thigh_on", "type": "fixed", "parent": "bl_spindle.seat", "child": "bl_thigh.hub"},
5369
+ {"id": "bl_bridge_on", "type": "fixed", "parent": {"item": "bl_housing", "at": [0,0, "leg.bridge_low"], "axis": [0,0,1]}, "child": "bl_bridge.under"},
5370
+ {"id": "bl_b1_on", "type": "fixed", "parent": {"item": "bl_housing", "at": [0,0, "leg.bridge_low + leg.bridge - leg.bearing_width"], "axis": [0,0,1]}, "child": "bl_b1.face"},
5371
+ {"id": "bl_m2_on", "type": "fixed", "parent": "bl_thigh.motor", "child": "bl_m2.face"},
5372
+ {"id": "bl_kd", "type": "revolute", "parent": "bl_thigh.knee", "child": "bl_esun.axis", "min": -6200, "max": 6200},
5373
+ {"id": "bl_ering_on", "type": "fixed", "parent": "bl_thigh.knee", "child": "bl_ering.axis"},
5374
+ {"id": "bl_eturn", "type": "revolute", "parent": "bl_thigh.knee", "child": "bl_ecarrier.axis", "min": -6200, "max": 6200},
5375
+ {"id": "bl_es1", "type": "revolute", "parent": "bl_ecarrier.a", "child": "bl_ep1.axis", "min": -30000, "max": 30000},
5376
+ {"id": "bl_es2", "type": "revolute", "parent": "bl_ecarrier.b", "child": "bl_ep2.axis", "min": -30000, "max": 30000},
5377
+ {"id": "bl_es3", "type": "revolute", "parent": "bl_ecarrier.c", "child": "bl_ep3.axis", "min": -30000, "max": 30000},
5378
+ {"id": "bl_knee", "type": "revolute", "parent": "bl_thigh.output", "child": "bl_eoutput.axis", "min": 0, "max": 150, "label": "bl knee"},
5379
+ {"id": "bl_c1_on", "type": "fixed", "parent": "bl_thigh.clip1", "child": "bl_clip1.post"},
5380
+ {"id": "bl_c2_on", "type": "fixed", "parent": "bl_thigh.clip2", "child": "bl_clip2.post"},
5381
+ {"id": "bl_c3_on", "type": "fixed", "parent": "bl_thigh.clip3", "child": "bl_clip3.post"},
5382
+ {"id": "bl_shin_on", "type": "fixed", "parent": "bl_eoutput.flange", "child": "bl_shin.hub"},
5383
+ {"id": "bl_pad_on", "type": "fixed", "parent": "bl_shin.pad", "child": "bl_pad.axis"},
5384
+ {"id": "br_m1_on", "type": "fixed", "parent": "br_housing.motor", "child": "br_m1.face"},
5385
+ {"id": "br_hd", "type": "revolute", "parent": "br_housing.axis", "child": "br_sun.axis", "min": -6200, "max": 6200},
5386
+ {"id": "br_turn", "type": "revolute", "parent": "br_housing.axis", "child": "br_carrier.axis", "min": -6200, "max": 6200},
5387
+ {"id": "br_s1", "type": "revolute", "parent": "br_carrier.a", "child": "br_p1.axis", "min": -30000, "max": 30000},
5388
+ {"id": "br_s2", "type": "revolute", "parent": "br_carrier.b", "child": "br_p2.axis", "min": -30000, "max": 30000},
5389
+ {"id": "br_s3", "type": "revolute", "parent": "br_carrier.c", "child": "br_p3.axis", "min": -30000, "max": 30000},
5390
+ {"id": "br_hip", "type": "revolute", "parent": {"item": "br_housing", "at": [0,0, "leg.plate + leg.gear + leg.ring_gap"], "axis": [0,0,1]}, "child": "br_output.axis", "min": 30, "max": 150, "label": "br hip"},
5391
+ {"id": "br_spindle_on", "type": "fixed", "parent": "br_output.flange", "child": "br_spindle.down"},
5392
+ {"id": "br_thigh_on", "type": "fixed", "parent": "br_spindle.seat", "child": "br_thigh.hub"},
5393
+ {"id": "br_bridge_on", "type": "fixed", "parent": {"item": "br_housing", "at": [0,0, "leg.bridge_low"], "axis": [0,0,1]}, "child": "br_bridge.under"},
5394
+ {"id": "br_b1_on", "type": "fixed", "parent": {"item": "br_housing", "at": [0,0, "leg.bridge_low + leg.bridge - leg.bearing_width"], "axis": [0,0,1]}, "child": "br_b1.face"},
5395
+ {"id": "br_m2_on", "type": "fixed", "parent": "br_thigh.motor", "child": "br_m2.face"},
5396
+ {"id": "br_kd", "type": "revolute", "parent": "br_thigh.knee", "child": "br_esun.axis", "min": -6200, "max": 6200},
5397
+ {"id": "br_ering_on", "type": "fixed", "parent": "br_thigh.knee", "child": "br_ering.axis"},
5398
+ {"id": "br_eturn", "type": "revolute", "parent": "br_thigh.knee", "child": "br_ecarrier.axis", "min": -6200, "max": 6200},
5399
+ {"id": "br_es1", "type": "revolute", "parent": "br_ecarrier.a", "child": "br_ep1.axis", "min": -30000, "max": 30000},
5400
+ {"id": "br_es2", "type": "revolute", "parent": "br_ecarrier.b", "child": "br_ep2.axis", "min": -30000, "max": 30000},
5401
+ {"id": "br_es3", "type": "revolute", "parent": "br_ecarrier.c", "child": "br_ep3.axis", "min": -30000, "max": 30000},
5402
+ {"id": "br_knee", "type": "revolute", "parent": "br_thigh.output", "child": "br_eoutput.axis", "min": -150, "max": 0, "label": "br knee"},
5403
+ {"id": "br_c1_on", "type": "fixed", "parent": "br_thigh.clip1", "child": "br_clip1.post"},
5404
+ {"id": "br_c2_on", "type": "fixed", "parent": "br_thigh.clip2", "child": "br_clip2.post"},
5405
+ {"id": "br_c3_on", "type": "fixed", "parent": "br_thigh.clip3", "child": "br_clip3.post"},
5406
+ {"id": "br_shin_on", "type": "fixed", "parent": "br_eoutput.flange", "child": "br_shin.hub"},
5407
+ {"id": "br_pad_on", "type": "fixed", "parent": "br_shin.pad", "child": "br_pad.axis"}
5408
+ ],
5409
+ "planetary": [
5410
+ {"sun": "fl_sun", "carrier": "fl_carrier", "ring": "fl_housing", "planets": ["fl_p1", "fl_p2", "fl_p3"], "drive": "sun", "module": 1, "teeth": [18,18,54], "output": {"ring": "fl_output", "planet": 21, "teeth": 57}},
5411
+ {"sun": "fl_esun", "carrier": "fl_ecarrier", "ring": "fl_ering", "planets": ["fl_ep1", "fl_ep2", "fl_ep3"], "drive": "sun", "module": 1, "teeth": [18,18,54], "output": {"ring": "fl_eoutput", "planet": 21, "teeth": 57}},
5412
+ {"sun": "fr_sun", "carrier": "fr_carrier", "ring": "fr_housing", "planets": ["fr_p1", "fr_p2", "fr_p3"], "drive": "sun", "module": 1, "teeth": [18,18,54], "output": {"ring": "fr_output", "planet": 21, "teeth": 57}},
5413
+ {"sun": "fr_esun", "carrier": "fr_ecarrier", "ring": "fr_ering", "planets": ["fr_ep1", "fr_ep2", "fr_ep3"], "drive": "sun", "module": 1, "teeth": [18,18,54], "output": {"ring": "fr_eoutput", "planet": 21, "teeth": 57}},
5414
+ {"sun": "bl_sun", "carrier": "bl_carrier", "ring": "bl_housing", "planets": ["bl_p1", "bl_p2", "bl_p3"], "drive": "sun", "module": 1, "teeth": [18,18,54], "output": {"ring": "bl_output", "planet": 21, "teeth": 57}},
5415
+ {"sun": "bl_esun", "carrier": "bl_ecarrier", "ring": "bl_ering", "planets": ["bl_ep1", "bl_ep2", "bl_ep3"], "drive": "sun", "module": 1, "teeth": [18,18,54], "output": {"ring": "bl_eoutput", "planet": 21, "teeth": 57}},
5416
+ {"sun": "br_sun", "carrier": "br_carrier", "ring": "br_housing", "planets": ["br_p1", "br_p2", "br_p3"], "drive": "sun", "module": 1, "teeth": [18,18,54], "output": {"ring": "br_output", "planet": 21, "teeth": 57}},
5417
+ {"sun": "br_esun", "carrier": "br_ecarrier", "ring": "br_ering", "planets": ["br_ep1", "br_ep2", "br_ep3"], "drive": "sun", "module": 1, "teeth": [18,18,54], "output": {"ring": "br_eoutput", "planet": 21, "teeth": 57}}
5418
+ ],
5419
+ "fits": [
5420
+ {"a": "beam1", "b": "left", "fastens": true, "min": 0, "note": "A beam, on two screws through each side plate"},
5421
+ {"a": "beam1", "b": "right", "fastens": true, "min": 0},
5422
+ {"a": "beam2", "b": "left", "fastens": true, "min": 0},
5423
+ {"a": "beam2", "b": "right", "fastens": true, "min": 0},
5424
+ {"a": "fl_m1", "b": "fl_housing", "fastens": true, "min": -0.1},
5425
+ {"a": "fl_m1", "b": "fl_sun", "shaft": true},
5426
+ {"a": "fl_m2", "b": "fl_esun", "shaft": true},
5427
+ {"a": "fl_m2", "b": "fl_thigh", "fastens": true, "min": -0.1},
5428
+ {"a": "fl_housing", "b": "left", "fastens": true, "min": 0},
5429
+ {"a": "fl_bridge", "b": "fl_housing", "fastens": true, "min": 0},
5430
+ {"a": "fl_b1", "b": "fl_bridge", "seat": "press"},
5431
+ {"a": "fl_ecarrier", "b": "fl_ering", "min": -1},
5432
+ {"a": "fl_pad", "b": "fl_shin", "min": -2},
5433
+ {"a": "fr_m1", "b": "fr_housing", "fastens": true, "min": -0.1},
5434
+ {"a": "fr_m1", "b": "fr_sun", "shaft": true},
5435
+ {"a": "fr_m2", "b": "fr_esun", "shaft": true},
5436
+ {"a": "fr_m2", "b": "fr_thigh", "fastens": true, "min": -0.1},
5437
+ {"a": "fr_housing", "b": "right", "fastens": true, "min": 0},
5438
+ {"a": "fr_bridge", "b": "fr_housing", "fastens": true, "min": 0},
5439
+ {"a": "fr_b1", "b": "fr_bridge", "seat": "press"},
5440
+ {"a": "fr_ecarrier", "b": "fr_ering", "min": -1},
5441
+ {"a": "fr_pad", "b": "fr_shin", "min": -2},
5442
+ {"a": "bl_m1", "b": "bl_housing", "fastens": true, "min": -0.1},
5443
+ {"a": "bl_m1", "b": "bl_sun", "shaft": true},
5444
+ {"a": "bl_m2", "b": "bl_esun", "shaft": true},
5445
+ {"a": "bl_m2", "b": "bl_thigh", "fastens": true, "min": -0.1},
5446
+ {"a": "bl_housing", "b": "left", "fastens": true, "min": 0},
5447
+ {"a": "bl_bridge", "b": "bl_housing", "fastens": true, "min": 0},
5448
+ {"a": "bl_b1", "b": "bl_bridge", "seat": "press"},
5449
+ {"a": "bl_ecarrier", "b": "bl_ering", "min": -1},
5450
+ {"a": "bl_pad", "b": "bl_shin", "min": -2},
5451
+ {"a": "br_m1", "b": "br_housing", "fastens": true, "min": -0.1},
5452
+ {"a": "br_m1", "b": "br_sun", "shaft": true},
5453
+ {"a": "br_m2", "b": "br_esun", "shaft": true},
5454
+ {"a": "br_m2", "b": "br_thigh", "fastens": true, "min": -0.1},
5455
+ {"a": "br_housing", "b": "right", "fastens": true, "min": 0},
5456
+ {"a": "br_bridge", "b": "br_housing", "fastens": true, "min": 0},
5457
+ {"a": "br_b1", "b": "br_bridge", "seat": "press"},
5458
+ {"a": "br_ecarrier", "b": "br_ering", "min": -1},
5459
+ {"a": "br_pad", "b": "br_shin", "min": -2}
5460
+ ],
5461
+ "gait": {"legs": ["fl_shin.tip", "fr_shin.tip", "bl_shin.tip", "br_shin.tip"], "pattern": "crawl", "stride": "leg.stride", "lift": "leg.lift", "period": 4, "height": "leg.stance", "mass": "leg.robot_mass", "clearance": 11},
5462
+ "poses": { "standing": {"fl_hd": -3171.4, "fl_kd": 2597, "fr_hd": -5587.7, "fr_kd": -2236, "bl_hd": -5587.7, "bl_kd": -2236, "br_hd": -3171.4, "br_kd": 2597} }
5463
+ }
5464
+ ```
5465
+
5466
+ ```sh
5467
+ npx cad list leg/quadruped
5468
+ npx cad plates leg/quadruped
5469
+ ```
5470
+
5471
+ The weight first, plainly: the shopping list says 1469 g of printing and 1900 g of bought parts, 3369 g as a machine, before electronics. The 1.5 kg robot the leg was sized for does not exist: eight motors weigh 1880 g alone. So the robot is 3.8 kg (`leg.robot_mass`, with its electronics an `estimate`), and every number below is at that mass.
5472
+
5473
+ Trot and crawl are run through their checks by `cad check leg/quadruped --json` and `cad check leg/crawl --json`: they take several minutes each, so the replay here leaves them out; run them yourself. What they said when this chapter was written (quasi-static, a design, nothing built):
5474
+
5475
+ - **Trot.** Two feet down at a time: `gait.stable` reports it is quasi-static, resting on two feet, so its balance depends on moving: this is a slow walk, not a run. The worst joint is 1.33 N m at the knee, 1.7 times over at the 0.8 A set on the knee's NEMA 14. `gait.sweep` found nothing colliding through the cycle.
5476
+ - **Crawl.** One foot up at a time: statically stable, the least margin 4.3 mm of balance to spare, with the worst joint 1.17 N m. Slower, and safer: a crawl is what a quadruped with no balance control can do.
5477
+ - `cad plates` lays the quadruped's prints on beds, and `cad list` lists it all, ready to buy. That part of the design was done from the assembly, unchanged.
5478
+
5479
+ The honest reading: at 3.8 kg the knees have 1.7 times the torque a trot asks of them, and the check warns, because anything under two is thin on a printed gearbox whose efficiency is a guess. That is the number to fix before printing this as a robot: a lighter body, a shorter leg, or a NEMA 17 at the knee and a recount.
5480
+
5481
+ ### What a walking robot needs that this does not do
5482
+
5483
+ Said plainly, because a gait that passes these checks is not a robot that walks:
5484
+
5485
+ - **Dynamics.** Only statics are here: the torque is the weight on the foot through the leg's angles, no acceleration of the body or the leg's own swing. A real step's jolt is not in these numbers.
5486
+ - **Balance.** A crawl keeps its centre of mass inside its feet. A trot does not; it depends on moving, and on a controller nobody has written. There is no estimator of where the body is, no reaction to being pushed.
5487
+ - **Feedback.** The motors are open-loop steppers: a stall or a slip goes unnoticed. A real leg needs at least encoders at the joints and a way to feel the ground, and code that uses them.
5488
+ - **Measuring.** Nothing here has been printed. The stand exists to change that: run its leg, write what the scale reads into the ledger with `cad measured`, and start again from what it says.
5489
+
5490
+ `npm create rulecad --machine leg` starts a project from the leg and its stand. The step file for a gait, for a streamer grown to more axes, is not done yet, and neither is a measured leg.
5491
+