From c70c0f838b30665de3f02db28b161c602113b522 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 2 Dec 2026 19:01:38 +0100 Subject: [PATCH] docs/kitbash.md: Rams and linkages: parts and touch, the signed oracle, the record, R-3 readings on meshes, costs with their conditions Co-Authored-By: Claude Fable 5.2 --- surfaces/blender/docs/kitbash.md | 99 ++++++++++++++++++++++---------- 1 file changed, 70 insertions(+), 29 deletions(-) diff --git a/surfaces/blender/docs/kitbash.md b/surfaces/blender/docs/kitbash.md index e1ffa33..194d441 100644 --- a/surfaces/blender/docs/kitbash.md +++ b/surfaces/blender/docs/kitbash.md @@ -640,49 +640,90 @@ its member stands: the rocker bars at R's, the coupler at `c`'s, the ram at `a`' Rates are closed form: for a linkage dphi/dtheta = (axis x (c - O)) . k / ((axis x (p - R)) . k), k along the coupler, and dL/dtheta = (axis x (d - R)) . u x dphi/dtheta, u along the ram. -`fit` runs the gates over the range, in this order, and a failed gate is a `RamError` naming the kind, the gate -and the angle or pin, with the readings attached: +`fit` runs the gates over the range, in this order. A failed gate is a `RamError` naming the kind, the gate, the +angle and the pin, with the readings attached; a refusal of the record or of a call (an unknown kind, a range, a +grid over the limit, a version) names the pin or the field it refuses. - **assembly**: the rocker and coupler close the loop at every step, and on the way from rest when the range does - not hold 0; within 1e-9 of a dead centre is refused, since the branch would change there. -- **stroke**: barrel = L_min - over - back - e_b, and it holds the travel, the overtravel at both ends and the gland. + not hold 0; within 1e-9 of a dead centre is refused, since the branch would change there. Names `c`. +- **stroke**: the barrel holds the travel, the overtravel at both ends and the gland. Names the angle of the + shortest length and the eye's pin. - **toggle**, **arm**: dL/dtheta keeps one sign, and |dL/dtheta| (the effective arm: hinge torque per unit ram - force) stays at or above `min_arm`. + force) stays at or above `min_arm`. Name the eye's pin. - **load** (linkages): the coupler's pin load per unit ram force, |dL/dtheta| over the coupler's moment arm about - the hinge, stays at or under `max_load` (3). -- **clash**: clearance, when a distance oracle is given. + the hinge, stays at or under `max_load` (3). Names `c`. +- **clash**: clearance, when a distance oracle is given. Names the member, the part, and the member's nearer pin. + +The barrel is derived, never stored: `barrel_length` is the length at the shorter end of the range less the +overtravel, the base clevis and the eye, and `fit` reads it from its own two end samples. Transmission angles at `c` and `p` are reported and not gated. Over the R-3 knee's 125 degrees the best least transmission angle of 200,000 sampled four-bars was 21.9 degrees, under the 30 to 40 a textbook asks; a gate there would have refused every one of them. What a poor angle costs is pin load, and that is the gate. -Clearance takes `distance(body, points) -> distances`: `body` one of parent, child, rocker, coupler, `points` in -that body's rest frame. The barrel, the rod (per offset) and the link bars are sampled along their axes at most -`spacing` apart (default the barrel's radius) and carried into every body's rest frame at each angle but their -own; a sample is clear at radius + gap + spacing / 2 or more, which keeps the gap for the surface between samples. -Only the clevis ends are left out: `e_a` at the ram's base, 0.4 `e_b` at its eye, 1.5 `link_r` at a link's pins; -the pin a clevis turns on is not part of the body the oracle answers for. The oracle may cap what it returns at -`Ram.reach(spacing)`: on the R-3 meshes (3,564 triangles) a BVH nearest query capped there cost 0.55 us against -3.12 us uncapped. A four-bar at the default spacing asks 155 points an angle. +### Clearance: parts and what a member may touch + +The record names the mechanism's `parts`, each a piece of one body (part -> parent, child, rocker or coupler: the +body whose rest frame it turns with), and `touch`: for each member (`barrel`, `rod`, `rocker`, `coupler`, and a +bell crank's `rocker arm`), the parts it may touch. This is the allowed-collision matrix of motion planning +(MoveIt's ACM): a pair listed there is skipped whole and every other (member, part) pair is checked. A member may +touch what it is pinned to and what is stacked on its pins: the pin, its own eye and clevis, its own plates, the +plates beside it on that pin, the bracket or horn the pin stands in. Nothing is exempt by a name, by a length cut +from a member's end, or by the member's own body: the barrel runs from its back end, the rod to the eye, a bar +from pin to pin. Every body of the kind owns at least one part, or the gate refuses the record. + +What it gives up: a pair in `touch` is not checked anywhere, so a coupler let touch the horn that carries `c` may +also pass through that horn's far end unseen. Parts are the grain: cut a body into the piece that carries the pin +and the rest, and let only the first. + +The oracle is `distance(part, points) -> distances`, `points` in the rest frame of the part's body. Each member is +sampled along its axis at most `spacing` apart (default the barrel's radius) and carried into each body's rest +frame at each angle; a sample is clear at radius + gap + spacing / 2 or more, which keeps the gap for the surface +between samples. A distance is signed: negative inside a part, by any depth. The oracle may cap what it returns at +`Ram.reach(spacing)`, outside a part only; a point inside reads negative however deep it lies. An oracle that +cannot tell inside from outside raises instead of answering (a nearest-surface query alone reads 0.13 at the +centre of the R-3 thigh's core, and reads clear when capped); nan is refused. `Fit.pairs` holds the least margin +and its angle for every pair checked, `Fit.allowed` every pair skipped. `search` seats a mechanism from a grid (ram seats; for linkages rocker pivots, child pins, `p` on a polar grid -about R, and `d` about R for a bell crank), refuses a grid over `limit` candidates naming the count, runs every -gate but clearance on all of them, then clearance in order of least arm; a miss returns the tally by gate and the -nearest miss. `record` and `from_record` carry a fitted mechanism as JSON; `swept` gives the ram's swept surface in -any body's frame, for a recess. +about R, and `d` about R for a bell crank, the eye standing at `a`'s place along the axis), refuses a grid over +`limit` candidates naming the count, runs every gate but clearance on all of them, then clearance in order of +least arm; a miss returns the tally by gate and the nearest miss. Clearance takes `world(m) -> (parts, touch, +distance)`: a linkage's brackets and links are the candidate's own, so each candidate that reaches the gate is met +with the parts its own pins place. `swept` gives the ram's swept surface in any body's frame, for a recess. -Readings on the R-3 knee (bore 0.042, tests/test_ram.py; bodies as boxes and cylinders, links as twin plates -outside the shin's side armour): +### The record -| drive | range | reading | -| --- | --- | --- | -| direct, the joint library's seats | 0..-62 | fits | -| direct, 2,000 seat pairs behind the knee | 0..-125 | none fits | -| four-bar behind the knee | 0..-125 | passes every gate before clearance: rocker swing 70.5, L 0.722..1.168, arm 0.096..0.265, pin load 1.61, transmission 16.5; refused on clearance: at -125 the barrel is inside the shin, a body the ram is not pinned to | -| bell crank in front of the knee | 0..-125 | fits: rocker swing 105.7, L 0.659..1.038, arm 0.091..0.215, pin load 1.13, transmission 13.8; ram and links clear the thigh, the shin and each other's bodies on both sides, least 0.109 beyond radius and gap to the shin (the coupler at -125) | +`record` and `from_record` carry a mechanism as JSON: `schema` (`brokkr.ram`), `version` (1), `kind`, `hinge`, +`pins`, `offsets`, `ram`, `parts`, `touch`, and `compliance`. It holds what is authored; barrel, closed length and +link lengths are derived by the reader. `compliance` is reserved for a load-path ram's settle (stiffness, damping, +travel); version 1 writes it null and solves none. A record of another schema or version, with a key version 1 +does not know (at the top, in `ram` or in `hinge`), or with a compliance block is refused whole: a reader never +reads past what it cannot solve. -One candidate's gates before clearance cost 1.7 to 3.8 ms at 49 steps on Starfire (median 3.6 of five reps of 200 -under other load); `limit` (20,000) is about a minute of them. +### Readings on the R-3 knee + +Bore 0.042, range 0..-125. The kinematic rows are tests/test_ram.py's. The clearance rows are Blender 5.3 readings +on meshes built with the joint library the knee was drawn with (thigh with its front plate, shin with caps and +armour, the bracket that carries R, the horn that carries `c`, twin link plates stacked 5 mm apart at x 0.31..0.345 +and 0.35..0.385, pins through the knee's width, a clevis at each ram pin; 4,176 triangles, 12 parts), a signed BVH +oracle (winding number along a ray for the side, nearest face for the depth). + +| drive | reading | +| --- | --- | +| direct, the joint library's seats, 0..-62 | fits (analytic thigh and shin) | +| direct, 2,000 seat pairs behind the knee | none fits (analytic thigh and shin) | +| four-bar behind the knee | passes every gate before clearance: rocker swing 70.5, L 0.722..1.168, arm 0.096..0.265, pin load 1.61, transmission 16.5. Refused on the meshes: of 23 checked pairs two fail, the barrel and the rod against the shin's body (0.277 and 0.246 inside their clearance at -122.5, 251 steps), a body the ram is not pinned to | +| bell crank in front of the knee | fits on the meshes, the plates on either side: rocker swing 105.7, L 0.659..1.038, arm 0.091..0.215, pin load 1.13, transmission 13.8. 36 pairs checked, 24 let. Over 251 steps the least margin beyond radius, gap and half the spacing is 0.039 (the rod and the rocker's pivot pin at -125), then 0.042 (the coupler and the bracket at 0) and 0.058 (the rocker's arm and the coupler's plates at 0); at spacing 0.01, 0.061. With `touch` empty the same gate refuses 19 pairs, each a member against a pin it rides, its own plates or clevis, a plate stacked on its pin, or the bracket or horn that pin stands in | +| bell-crank search on the meshes | 13,824 candidates, each world built from the candidate's pins: 78 pass the gates before clearance, 21 of them are refused on their own parts, the 22nd fits (arm 0.090, swing 99.9, pin load 0.73) | + +Cost on Starfire, 300 repetitions paired and interleaved with the previous revision, other work holding the cores +at 100 percent: one candidate's gates before clearance at 49 steps took 0.98 ms median on the four-bar (5th to 95th +percentile 0.88 to 3.35) and 0.96 on the bell crank (0.88 to 2.03), the previous revision 1.03 and 1.00 beside +them. A search without a world ran 1.6 to 1.8 ms a candidate over 3,456, so `limit` (20,000) is 30 to 40 s. The +bell crank's clearance against analytic parts added 11 ms; on the meshes its 36 pairs asked 17,248 points and +took 0.12 s capped, in a Python loop of BVH queries; a candidate's world built in 0.045 s, and the 13,824-candidate +mesh search took 29 s (55 s in a busier minute). ## The actions