# iCub Digital Self-Assembling Factory

[`index.html`](index.html) serves the restored 39-link iCub factory with two
resin printers, shared post-processing, SO-101 de-plating and two-arm xArm
assembly. Its runtime is `src/main.js`, its styles are `src/style.css`, and
its contracts are `cell-manifest.v1` and `trajectory.v1`. The old
`legacy.html` route redirects to this homepage, preserving review parameters.
See [Current two-arm factory](#current-two-arm-factory) and
[Run locally](#run-locally) for the active experience.

## Retained D1 revision — source only

The following D1 description documents retained source and records, not the
published homepage. `src/project.js`, `src/d1-scene.js`, their styles and
`program/d1/` remain available for reference without an active HTML entry point.

The retained revision opened on the interactive D1 factory, using the dark
industrial palette of the earlier exhibit. Manufacturing planning comes next,
followed by the D1 robot, BOM, roadmap, and evidence, all connected through
versioned records in [`program/d1/`](program/d1/). Three.js loads the opening
factory automatically without starting playback. Data-saving connections keep
an explicit load button; the manufacturing diagram and project information
remain available on small screens and without WebGL.

The guided presentation starts inside the factory and returns to the complete
cell for commissioning. Ordinary wheel scrolling moves through the page;
Ctrl/⌘ plus the wheel zooms the scene. Touch supports vertical page scrolling,
horizontal orbit gestures, and two-finger model control. Camera presets and
keyboard controls provide alternatives. Rendering pauses when the factory is
offscreen or the page is hidden, and the tour starts only on user input.

The original project's 39 iCub body meshes form this revision's visual model,
including the original head, hands and feet. The restored inspection pose uses
lowered shoulders and preserves the original posterior chest trim and Voronoi
surface treatment. The 43-axis D1 control architecture and approximately
one-meter height target remain an adaptation target, with mechanical mapping
and manufacturing design still open. Its first milestone is commissioning on
a support fixture; walking remains a later gate.

Source STL dimensions convert once from millimeters to meters. The restored
pose measures 1,076.4 mm high; its meshes retain their native dimensions in the
body, exploded, SLA, assembly and packing views. Source-file hashes, transforms
and envelopes are recorded in `program/d1/body-source.json`. Linked manufacturing
records use these source envelopes. Planned internal components remain
schematic, and the full source body is not a released D1 manufacturing design.

Two SLA-family resin printers use provisional 300 x 300 x 330 mm build volumes.
The authored MSLA layout has a bottom exposure window, resin vat, vertical
carriage and suspended build plate. Selected body meshes rise from the resin
without being resized. The process record requires washing, drying and support
removal, UV cure and inspection before assembly. Equipment and resin selection,
wall design, supports and process recipes remain unqualified. Jobs use permitted
orientation, support/brim envelopes, edge clearance, height and a four-part
planning cap. Oversized parts remain unresolved. Metalwork and purchased parts
have separate routes.

Two native-scale SO-101 CAD rigs place small parts in sequence at a common
fixture. Two native-scale xArm 6 CAD rigs handle large modules around the
horizontal supported body. The illustrative sequence transfers the original
left arm and hand as one rigid payload attached to the xArm's source gripper
frame. The other xArm demonstrates support access. Manual fastening, electrical
connections and inspection remain explicit. The renderer solves bounded source
joints, reports positional residuals and constrains the xArm tool orientation;
sampled convergence is not collision, payload or hardware qualification.

The 60-second tour covers the factory, body modules, resin printing, minor and
large assembly, supported commissioning, and modular packing. It is illustrative
playback with unknown manufacturing durations. The packing view keeps source
module dimensions; the case and protective packaging require physical design.

The BOM separates robot components, cell equipment, per-build costs,
engineering/qualification, and delivery/service. Missing prices remain unknown
alongside known subtotals. The historical $13,655 D1 prototype-parts allowance
is not a complete program cost. The separate CH//16 BOM is historical context.

The retained browser contracts are
[`cell-manifest.v2`](public/data/cell-manifest.v2.json) and
[`trajectory.v2`](public/data/trajectory.v2.json), generated from the canonical
records. Python manifest readers explicitly dispatch v1 and v2; the v1
cinematic contract remains unchanged. The retained project runtime is
`src/project.js` and its optional scene is `src/d1-scene.js`.

## Current two-arm factory

The original experience is restored at [`index.html`](index.html), using
`src/main.js`, `src/style.css`, and the original v1 manifests. The following
sections document the active factory concept.

An interactive Three.js future-cell visualization of the customized, official
39-visual iCub v2.7 assembly. Every source visual is one persistent actor with
the lifecycle `PRINTING -> DRAINING -> WASHING -> DEPLATING -> CURING ->
STAGED -> HELD -> MATED`: the geometry exposed at the printer is the same
geometry carried in a rigid tray, grasped by an arm, and locked into the final
chassis. Source URDF dimensions are retained at 1 scene unit per metre for all
39 actors and the two assembly xArms. Parts never change size between process
stages. The assembly table is fitted to the complete source-mesh envelope with
100 mm edge clearance and at least 25 mm beneath the lowest mesh. The custom
process equipment uses one explicit conversion from legacy exhibit coordinates
to metres. Its build plate is 762 by 690 mm, the printer footprint is 1095 mm
square, and printer stands have a 750 mm working surface. All four batches are
packed using actual full-size part bounds. Native-size SO-101 handlers use
positioning slides to reach the compact receiving rack. The iCub source body
is approximately 1076 mm tall; it is not an adult-height D1 body.

The public experience deliberately identifies itself as a **future-cell concept
simulation**. It does not present cinematic telemetry as measured hardware data.
The process card and optional Technical Review drawer report only deterministic
runtime state, payload ownership, source status, and the physical-validation
boundary recorded by the manifests.

Two SLA cells use animated full-layer pixel fields to represent a 16K LCD
exposure. A shared clipping plane reveals the exact meshes layer by layer. The
39 actors are split into four non-overlapping, datum-centered print batches:
`A1` and `B1` are exposed together in the first printer cycle, then the same
two persistent plates return for `A2` and `B2` in the second cycle. Within each
batch, the actors are centered in mirrored left/right picking lanes assigned to
the two de-plating arms. Each plate is reused
exactly twice; a replacement carrier is never created between cycles.
Each open-frame printer stands on a procedurally authored Thorlabs ScienceDesk
SDA90120-inspired active-isolation workstation with a perforated breadboard,
four isolator supports, lower shelf, and casters. The visual is scaled to the
concept cell and is not vendor CAD or a purchasing specification.
The exposed vats and Z-carriage couplings incorporate OS1 CERN-OHL-S-2.0 STEP
geometry. The optical stack is ordered UV engine, LCD build window, opaque
mask/support plate, resin volume; the former orange hoods are absent. The two
persistent carriers are also the printers' sole build plates, and the
Z-carriages contain no second decorative plate. Per-part support clusters stay
within each plate footprint. The carriers drain and enter one shared line: a
single large keyed IPA immersion tank, a positively located full-plate raft
separator, and an open-front full-rack UV bay. All three machines stand on
independently isolated legged support tables whose tops share the assembly-bed
height. After the printer's drain lift, each carrier keeps the same `Y=5.41`
machine datum through wash and de-plating.

One collision-checked process shuttle owns every build plate or cassette-rack
payload during transfer. Its keyed gripper acquires the persistent plate,
follows the clear front service aisle, loads the wash fixture, hands the plate
to the de-plater nest, and returns the empty plate to its original printer. The
shuttle moves only one rigid payload at a time. Two official SO-101 CAD arms are
mounted inside DE-PLATE 01 and perform support-raft removal followed by five
synchronized pick-and-place slots. Each arm remains in its own side-safe lane,
lifts each persistent actor with its real end effector, and places it into a
keyed, numbered preassembly nest; the SO-101s are not transport arms. Parts are
distributed across eight rigid trays. Two trays lock into each of four
arm-assigned cassettes, so every xArm receives a dedicated two-tray payload
without combining loose parts.

After all four plate passes finish, the shuttle loads the complete four-cassette
rack into UV CURE 01. The laboratory is treated as a controlled dark room, so
the cure station has no amber window, door, or door animation. The rack clamps,
cures, cools, and unloads as one rigid payload before the four cassettes move to
their assembly nests. Plate passes are strictly sequential, keeping the one
wash bath, de-plater, and shuttle exclusive. This is a time-compressed
conceptual workflow, not a process recipe or control specification. Add
`?speed=engineering` to play at quarter speed for trajectory inspection.

## Sixty-second sequence

| Time (s) | Operation |
| --- | --- |
| `0.00-0.25` | Ingest |
| `0.25-0.50` | Fixture registration |
| `0.50-6.50` | Concurrent print cycle `A1/B1` |
| `6.50-13.50` | Plate pass `A1` |
| `13.50-20.50` | Plate pass `B1` |
| `20.50-26.50` | Concurrent print cycle `A2/B2` on the same plates |
| `26.50-33.50` | Plate pass `A2` |
| `33.50-40.50` | Plate pass `B2` |
| `40.50-46.50` | Four-cassette UV cure and rigid delivery |
| `46.50-57.50` | Two-arm assembly |
| `57.50-60.00` | Commissioning |

Every seven-second plate pass uses the same deterministic relative schedule:
`0.0-0.6` drain, `0.6-1.0` shuttle acquire, `1.0-1.8` transfer to wash,
`1.8-3.4` wash, `3.4-4.2` transfer to de-plating, `4.2-6.3` de-plating, and
`6.3-7.0` empty-plate return. The final rack transfers from `40.50-41.00`,
clamps from `41.00-41.30`, cures from `41.30-45.30`, cools and unloads from
`45.30-46.00`, and delivers the rigid cassettes from `46.00-46.50`.

Two assembly-only UFACTORY xArm 6 CAD rigs execute deterministic vertical
pre-grasp, lift, side-lane traverse, pre-insert, insertion, release, and
retreat segments. A bounded damped least-squares solver drives
the six published arm joints toward each task-space target without resetting an
active solution between frames, and the published
xArm Gripper G1 linkage closes around the active actor. The held actor follows
the actual end-effector frame. This is a clearance-authored cinematic trajectory,
not a physically commissioned robot program.
Two source-size xArms operate on independently supported longitudinal slides
at x = +/-0.69 m, flange height 1.08 m and z travel +/-1.3 m. Their floor-supported
rails sit outside the enlarged deck at x = +/-0.9 m, with short cantilever mounts.
Each serves two
storage cassettes, preserving all eight drawers and 39 actors. The slides allow
the two arms to cover the full body and outboard drawers without enlarging arm
links. Routes use vertical pick and insert segments and elevated transfer.

The assembly surface is 0.9 m high and at least 1.5 by 2.0 m. It expands further
if the loaded source geometry needs more clearance. Staging tables sit at
x = +/-1.14 m and z = +/-0.65 m. The compact process row and printer row use the
same metre-based scene as the assembly cell. De-plating retention is perimeter-only: interior bars that
crossed the printed parts have been removed. Drawers and their supports are
sized for constant-size parts, without a growth animation.

The final body retains the complete official iCub head, torso, articulated hands,
ankles, foot shells, and soles. The lower-quality Ada/LeRobot cinematic
substitutions were removed so the extremities retain their authored proportions
and transform hierarchy. The chest's
deep posterior cover remains culled as in the existing source customization;
fixture registration uses the lowest point across all retained parts.

## Run locally

```powershell
npm install
npm run dev
```

Open `/` under the URL printed by Vite. Use the timeline to scrub, drag to orbit, scroll
to zoom, and open Technical Review for trace, exhibit-component, and provenance
views. Playback waits at an explicit start screen until the manifests and all
required CAD hydrate, preventing the timeline from outrunning late assets. A
missing process or assembly-arm visual enters a labeled degraded mode; a missing
manifest or 39-link chassis blocks readiness instead of silently substituting a
claim.

Keyboard controls are Space for play/pause, Left/Right to scrub one second
(Shift for five), Home/End for the timeline bounds, `R` to replay, `T` for
Technical Review, and Escape to close it. The sequence ends on a review card
instead of looping.

On compact screens, the canvas fits between the safe-area header and playback
dock. Swipe the stage buttons sideways to navigate, and use **Details** for
trace, components, and sources. Welcome, completion, and technical-review panels
scroll on short screens. The renderer and camera resize to the canvas when
the device rotates; the scene geometry and process timing stay the same.

Query parameters remain available for review and capture:

- `/?t=48&paused=1` opens a deterministic paused frame.
- `/?speed=engineering` plays at quarter speed.
- `/?view=technical` opens the trace drawer.
- `/?quality=auto|full|lite` overrides adaptive rendering quality.

`lite` retains identical geometry, actor identities, and timing while disabling
expensive post-processing and reducing pixel ratio. Reduced-motion preferences
also suppress cinematic camera movement.

Runtime OS1, SO-101, xArm, and iCub STL geometry is deterministically converted
to standalone Draco meshes by `npm run assets:prepare`. The web set is 7.32 MB,
down from 35.27 MB of source STL, without decimation. Original CAD remains the
authoritative licensed source; [`web-assets.v1.json`](public/data/web-assets.v1.json)
records every derived mapping, size, and source hash.

## Production build

```powershell
npm run build
npm run preview
```

Validate unit and browser behavior with:

```powershell
npm test
npm run test:ui
```

The default browser suite runs `simulation-ui.spec.js`, `deplate-review.spec.js`
and `visual-review.spec.js` against the restored root page. The retained D1
`project-ui.spec.js` remains outside this active suite because its HTML entry
point is no longer published.

The active machine-readable simulation configuration files are
[`public/data/cell-manifest.v1.json`](public/data/cell-manifest.v1.json) and
[`public/data/trajectory.v1.json`](public/data/trajectory.v1.json). They label
the exhibit as a future-cell simulation and record actor lifecycle and cinematic
timing; they are not manufacturing specifications or commissioned robot programs.

The displayed exhibit component ledger is a communication aid, not a validated
engineering specification or production BOM. The separate machine-readable
[`CH//16 planning BOM`](product/bom/ch16-v1.json) and
[`cost assumptions`](product/bom/README.md) cover proposed program expenses.
Component selections still require joint-level engineering, supplier quotes,
and physical validation. Real open-hardware CAD sources and licenses are listed
in [`ASSET_SOURCES.md`](ASSET_SOURCES.md).
