CoolFace
Apppublic

build-small-hackathon/microfactory-lab

sourceHugging Facemitupdated 3mo agoView on Hugging Face
2likes
SIMULATION.md52 linesDownload Raw Back to reference
1# What's Simulated, What's Real, and What the Physical World Needs2 3The Chief Engineer's value is a **closed learning loop**: propose settings →4observe the outcome → learn → do better next time. To demo that loop without a5printer farm — and to keep it reproducible for judges — the *outcome* step runs6in a deterministic simulator. Everything else is real.7 8## Honest-claims table9 10| Component | Status | Notes |11|-----------|--------|-------|12| Environment-keyed retrieval (RAG) | **Real** | `core/ledger.py` — exact match + normalized env-distance |13| Chief Engineer reasoning (LLM) | **Real** | `core/chief_engineer.py` — real Ollama (gemma4), with deterministic fallback |14| Learned policy (parametric) | **Real** | `learn/policy.py` — offsets per (material, geometry, env-bucket), persisted |15| Spine safety veto | **Real** | `core/spine.py` — clamps unsafe settings; LLM proposes, code decides |16| Knowledge ingestion | **Real** | `ingest/` — slicer/firmware configs → references; research → lessons |17| **Print outcome** | **Simulated** | `sim/outcome.py` — physics-lite stand-in for the printer + sensors |18| Capability mesh (6 nodes) | **Context** | one node's logic is real; the others render as available capacity |19| Weight-level fine-tuning | **Framed frontier** | `ingest/modal_app.py` stub; the ledger becomes training data |20 21## The one simulated boundary22 23`sim/outcome.py` is the **only** stand-in for physical reality. It models the24same physics the seed lessons describe (cooling vs. overhang sag, humidity →25stringing, ABS warp, bed temp → adhesion, and **build-plate position** — edges/26corners of a heated bed run cooler + draftier, so warp/adhesion suffer there,27worst for high-shrink materials) and returns an outcome + a 0–1 quality score.28It is deterministic, so the learning curve is reproducible.29 30Critically, this is **not the model grading its own work**. The Chief Engineer31proposes; this separate world returns an outcome the model never sees in32advance — exactly the role a printer and its sensors play.33 34## Swapping in the physical world35 36Replace `sim.outcome.simulate(settings, job, env)` with a real adapter that37returns the same `SimResult`. Three interfaces are needed:38 391. **Actuation — stream settings to the printer.** Generate g-code from the40   proposed `PrintSettings` (the readout in `viewer.gcode_readout` is the seed41   of this) and stream over USB/serial (Marlin) or the Moonraker/Klipper API.42   *Frontier on the roadmap: node → Ender serial control.*432. **Sensing — read the environment.** A temp/humidity sensor (e.g. a BME280 on44   a Pi) feeds the `Environment` that today comes from the sliders.453. **Outcome detection — judge the print.** A camera + a defect classifier46   (the **3D-ADAM** taxonomy already encoded in `ingest/distill.py`) maps an47   image to `outcome` + `quality`. This replaces the simulator's scoring.48 49Each is a clean substitution behind the existing types — the loop, the policy,50the ledger, and the UI do not change. That is the point of keeping the51simulated boundary this narrow.52