Force Gauge

A digital force gauge on a test stand pushing a connector into its header: live force and the held peak on the LCD, and the force against travel with the insertion window.

STATIONCLI/PROCEDUREForce Gauge

Connector insertion

PASS00:24.11Connector insertion (1/1)Passed

Run It

Every instrument is mocked, so the example runs without hardware.

bash
git clone https://github.com/tofupilot/panelscd panelstofupilot run force-gauge

The procedure

procedure.yaml
name: Force Gaugeversion: 1.0.0plugs:  - key: force_gauge    name: Force gauge    python: plugs.force_gauge:ForceGaugemain:  - key: insertion    name: Connector insertion    python: phases.force_gauge:insert    measurements:      - key: insertion_peak        name: Insertion force peak        unit: "N"        validators:          - operator: ">="            expected_value: 10          - operator: "<="            expected_value: 35      - key: peak_travel        name: Travel at the peak        unit: "mm"        validators:          - operator: ">="            expected_value: 1.5          - operator: "<="            expected_value: 4.5    ui:      panel: panels/gauge.html

The panel

panels/gauge.html
<div class="inst"><svg viewBox="0 0 320 210" role="img"><defs><linearGradient id="lcd" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#c3cdb0"/><stop offset="1" stop-color="#a9b597"/></linearGradient></defs><rect x="1" y="1" width="318" height="208" rx="10" fill="#22262b" stroke="#0a0b0d" stroke-width="2"/><circle cx="11" cy="11" r="3.2" fill="#2a2f35" stroke="#0a0b0d"/><path d="M9 11h4" stroke="#0a0b0d"/><circle cx="309" cy="11" r="3.2" fill="#2a2f35" stroke="#0a0b0d"/><path d="M307 11h4" stroke="#0a0b0d"/><circle cx="11" cy="199" r="3.2" fill="#2a2f35" stroke="#0a0b0d"/><path d="M9 199h4" stroke="#0a0b0d"/><circle cx="309" cy="199" r="3.2" fill="#2a2f35" stroke="#0a0b0d"/><path d="M307 199h4" stroke="#0a0b0d"/><rect x="20" y="20" width="280" height="70" rx="4" fill="#4a5048"/><rect x="24" y="24" width="272" height="62" rx="2" fill="url(#lcd)"/><g class="lcdd"><g class="d7" data-bind="ui.f0" transform="translate(40.0 36.0) skewX(-7)"><rect class="sa" x="3.2" y="0.0" width="14.1" height="4.6" rx="2.3"/><rect class="sd" x="3.2" y="33.4" width="14.1" height="4.6" rx="2.3"/><rect class="sg" x="3.2" y="16.7" width="14.1" height="4.6" rx="2.3"/><rect class="sf" x="0.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="se" x="0.0" y="19.9" width="4.6" height="14.8" rx="2.3"/><rect class="sb" x="16.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="sc" x="16.0" y="19.9" width="4.6" height="14.8" rx="2.3"/></g><g class="d7" data-bind="ui.f1" transform="translate(69.6 36.0) skewX(-7)"><rect class="sa" x="3.2" y="0.0" width="14.1" height="4.6" rx="2.3"/><rect class="sd" x="3.2" y="33.4" width="14.1" height="4.6" rx="2.3"/><rect class="sg" x="3.2" y="16.7" width="14.1" height="4.6" rx="2.3"/><rect class="sf" x="0.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="se" x="0.0" y="19.9" width="4.6" height="14.8" rx="2.3"/><rect class="sb" x="16.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="sc" x="16.0" y="19.9" width="4.6" height="14.8" rx="2.3"/></g><g class="d7" data-bind="ui.f2" transform="translate(99.3 36.0) skewX(-7)"><rect class="sa" x="3.2" y="0.0" width="14.1" height="4.6" rx="2.3"/><rect class="sd" x="3.2" y="33.4" width="14.1" height="4.6" rx="2.3"/><rect class="sg" x="3.2" y="16.7" width="14.1" height="4.6" rx="2.3"/><rect class="sf" x="0.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="se" x="0.0" y="19.9" width="4.6" height="14.8" rx="2.3"/><rect class="sb" x="16.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="sc" x="16.0" y="19.9" width="4.6" height="14.8" rx="2.3"/></g><g class="d7" data-bind="ui.f3" transform="translate(128.9 36.0) skewX(-7)"><rect class="sa" x="3.2" y="0.0" width="14.1" height="4.6" rx="2.3"/><rect class="sd" x="3.2" y="33.4" width="14.1" height="4.6" rx="2.3"/><rect class="sg" x="3.2" y="16.7" width="14.1" height="4.6" rx="2.3"/><rect class="sf" x="0.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="se" x="0.0" y="19.9" width="4.6" height="14.8" rx="2.3"/><rect class="sb" x="16.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="sc" x="16.0" y="19.9" width="4.6" height="14.8" rx="2.3"/></g><g class="dp on" transform="translate(91.7 36.0) skewX(-7)"><rect x="0" y="33.4" width="4.6" height="4.6" rx="1.5"/></g></g><text x="186" y="74" text-anchor="start" style="font: 700 14px system-ui, sans-serif; letter-spacing: 0; fill: #1b2115">N</text><text x="212" y="42" text-anchor="start" style="font: 700 7px ui-monospace, Menlo, monospace; letter-spacing: .1em; fill: #1b2115">PEAK</text><text x="288" y="68" text-anchor="end" data-bind="ui.peak" style="font: 600 19px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #1b2115">0.00</text><text x="288" y="80" text-anchor="end" style="font: 700 7px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #1b2115">N</text><rect x="30" y="102" width="260" height="84" fill="#0b0d10"/><path d="M30.0 102V186" stroke="#2a3138" stroke-width=".6"/><text x="30.0" y="195" text-anchor="middle" style="font: 600 6.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #7d8791">0</text><path d="M73.3 102V186" stroke="#2a3138" stroke-width=".6"/><text x="73.3" y="195" text-anchor="middle" style="font: 600 6.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #7d8791">1</text><path d="M116.7 102V186" stroke="#2a3138" stroke-width=".6"/><text x="116.7" y="195" text-anchor="middle" style="font: 600 6.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #7d8791">2</text><path d="M160.0 102V186" stroke="#2a3138" stroke-width=".6"/><text x="160.0" y="195" text-anchor="middle" style="font: 600 6.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #7d8791">3</text><path d="M203.3 102V186" stroke="#2a3138" stroke-width=".6"/><text x="203.3" y="195" text-anchor="middle" style="font: 600 6.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #7d8791">4</text><path d="M246.7 102V186" stroke="#2a3138" stroke-width=".6"/><text x="246.7" y="195" text-anchor="middle" style="font: 600 6.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #7d8791">5</text><path d="M290.0 102V186" stroke="#2a3138" stroke-width=".6"/><text x="290.0" y="195" text-anchor="middle" style="font: 600 6.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #7d8791">6</text><path d="M30 186.0H290" stroke="#2a3138" stroke-width=".6"/><text x="26" y="188.5" text-anchor="end" style="font: 600 6.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #7d8791">0</text><path d="M30 165.0H290" stroke="#2a3138" stroke-width=".6"/><text x="26" y="167.5" text-anchor="end" style="font: 600 6.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #7d8791">10</text><path d="M30 144.0H290" stroke="#2a3138" stroke-width=".6"/><text x="26" y="146.5" text-anchor="end" style="font: 600 6.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #7d8791">20</text><path d="M30 123.0H290" stroke="#2a3138" stroke-width=".6"/><text x="26" y="125.5" text-anchor="end" style="font: 600 6.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #7d8791">30</text><path d="M30 102.0H290" stroke="#2a3138" stroke-width=".6"/><text x="26" y="104.5" text-anchor="end" style="font: 600 6.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #7d8791">40</text><rect x="95.0" y="112.5" width="130.0" height="52.5" fill="#38e07a" fill-opacity=".08" stroke="#38e07a" stroke-opacity=".6" stroke-dasharray="3 2"/><g class="cp" data-bind="ui.c0" style="--x: 27.7px"><rect/></g><g class="cp" data-bind="ui.c1" style="--x: 31.6px"><rect/></g><g class="cp" data-bind="ui.c2" style="--x: 35.4px"><rect/></g><g class="cp" data-bind="ui.c3" style="--x: 39.3px"><rect/></g><g class="cp" data-bind="ui.c4" style="--x: 43.1px"><rect/></g><g class="cp" data-bind="ui.c5" style="--x: 47.0px"><rect/></g><g class="cp" data-bind="ui.c6" style="--x: 50.8px"><rect/></g><g class="cp" data-bind="ui.c7" style="--x: 54.7px"><rect/></g><g class="cp" data-bind="ui.c8" style="--x: 58.5px"><rect/></g><g class="cp" data-bind="ui.c9" style="--x: 62.4px"><rect/></g><g class="cp" data-bind="ui.c10" style="--x: 66.2px"><rect/></g><g class="cp" data-bind="ui.c11" style="--x: 70.1px"><rect/></g><g class="cp" data-bind="ui.c12" style="--x: 73.9px"><rect/></g><g class="cp" data-bind="ui.c13" style="--x: 77.8px"><rect/></g><g class="cp" data-bind="ui.c14" style="--x: 81.6px"><rect/></g><g class="cp" data-bind="ui.c15" style="--x: 85.5px"><rect/></g><g class="cp" data-bind="ui.c16" style="--x: 89.3px"><rect/></g><g class="cp" data-bind="ui.c17" style="--x: 93.2px"><rect/></g><g class="cp" data-bind="ui.c18" style="--x: 97.0px"><rect/></g><g class="cp" data-bind="ui.c19" style="--x: 100.9px"><rect/></g><g class="cp" data-bind="ui.c20" style="--x: 104.7px"><rect/></g><g class="cp" data-bind="ui.c21" style="--x: 108.6px"><rect/></g><g class="cp" data-bind="ui.c22" style="--x: 112.4px"><rect/></g><g class="cp" data-bind="ui.c23" style="--x: 116.3px"><rect/></g><g class="cp" data-bind="ui.c24" style="--x: 120.1px"><rect/></g><g class="cp" data-bind="ui.c25" style="--x: 124.0px"><rect/></g><g class="cp" data-bind="ui.c26" style="--x: 127.8px"><rect/></g><g class="cp" data-bind="ui.c27" style="--x: 131.7px"><rect/></g><g class="cp" data-bind="ui.c28" style="--x: 135.6px"><rect/></g><g class="cp" data-bind="ui.c29" style="--x: 139.4px"><rect/></g><g class="cp" data-bind="ui.c30" style="--x: 143.3px"><rect/></g><g class="cp" data-bind="ui.c31" style="--x: 147.1px"><rect/></g><g class="cp" data-bind="ui.c32" style="--x: 151.0px"><rect/></g><g class="cp" data-bind="ui.c33" style="--x: 154.8px"><rect/></g><g class="cp" data-bind="ui.c34" style="--x: 158.7px"><rect/></g><g class="cp" data-bind="ui.c35" style="--x: 162.5px"><rect/></g><g class="cp" data-bind="ui.c36" style="--x: 166.4px"><rect/></g><g class="cp" data-bind="ui.c37" style="--x: 170.2px"><rect/></g><g class="cp" data-bind="ui.c38" style="--x: 174.1px"><rect/></g><g class="cp" data-bind="ui.c39" style="--x: 177.9px"><rect/></g><g class="cp" data-bind="ui.c40" style="--x: 181.8px"><rect/></g><g class="cp" data-bind="ui.c41" style="--x: 185.6px"><rect/></g><g class="cp" data-bind="ui.c42" style="--x: 189.5px"><rect/></g><g class="cp" data-bind="ui.c43" style="--x: 193.3px"><rect/></g><g class="cp" data-bind="ui.c44" style="--x: 197.2px"><rect/></g><g class="cp" data-bind="ui.c45" style="--x: 201.0px"><rect/></g><g class="cp" data-bind="ui.c46" style="--x: 204.9px"><rect/></g><g class="cp" data-bind="ui.c47" style="--x: 208.7px"><rect/></g><g class="cp" data-bind="ui.c48" style="--x: 212.6px"><rect/></g><g class="cp" data-bind="ui.c49" style="--x: 216.4px"><rect/></g><g class="cp" data-bind="ui.c50" style="--x: 220.3px"><rect/></g><g class="cp" data-bind="ui.c51" style="--x: 224.1px"><rect/></g><g class="cp" data-bind="ui.c52" style="--x: 228.0px"><rect/></g><g class="cp" data-bind="ui.c53" style="--x: 231.8px"><rect/></g><g class="cp" data-bind="ui.c54" style="--x: 235.7px"><rect/></g><g class="cp" data-bind="ui.c55" style="--x: 239.6px"><rect/></g><g class="cp" data-bind="ui.c56" style="--x: 243.4px"><rect/></g><g class="cp" data-bind="ui.c57" style="--x: 247.3px"><rect/></g><g class="cp" data-bind="ui.c58" style="--x: 251.1px"><rect/></g><g class="cp" data-bind="ui.c59" style="--x: 255.0px"><rect/></g><g class="cp" data-bind="ui.c60" style="--x: 258.8px"><rect/></g><g class="cp" data-bind="ui.c61" style="--x: 262.7px"><rect/></g><g class="cp" data-bind="ui.c62" style="--x: 266.5px"><rect/></g><g class="cp" data-bind="ui.c63" style="--x: 270.4px"><rect/></g><g class="pkx" data-bind="ui.pkx"><g class="pky" data-bind="ui.pky"><path d="M0 -2l-3 -5h6z" fill="#ff9a2e"/></g></g></svg></div><style>  .inst { width: min(560px, 100%); margin: 0 auto; }  .inst svg { display: block; width: 100%; height: auto; }  .inst text { font-family: system-ui, sans-serif; }  .dp rect { fill: var(--off); }  .dp.on rect, .dp[data-value=true] rect { fill: var(--on); }  .led circle { fill: #2a2f35; transition: fill .15s; }  .led[data-value=true] circle { fill: var(--led, #38e07a); }  .ann text { fill: var(--off); transition: fill .15s; }  .ann[data-value=true] text { fill: var(--on); }  .d7 rect { fill: var(--off); transition: fill .08s; }  .d7[data-value="0"] :is(.sa, .sb, .sc, .sd, .se, .sf) { fill: var(--on); }  .d7[data-value="1"] :is(.sb, .sc) { fill: var(--on); }  .d7[data-value="2"] :is(.sa, .sb, .sd, .se, .sg) { fill: var(--on); }  .d7[data-value="3"] :is(.sa, .sb, .sc, .sd, .sg) { fill: var(--on); }  .d7[data-value="4"] :is(.sb, .sc, .sf, .sg) { fill: var(--on); }  .d7[data-value="5"] :is(.sa, .sc, .sd, .sf, .sg) { fill: var(--on); }  .d7[data-value="6"] :is(.sa, .sc, .sd, .se, .sf, .sg) { fill: var(--on); }  .d7[data-value="7"] :is(.sa, .sb, .sc) { fill: var(--on); }  .d7[data-value="8"] :is(.sa, .sb, .sc, .sd, .se, .sf, .sg) { fill: var(--on); }  .d7[data-value="9"] :is(.sa, .sb, .sc, .sd, .sf, .sg) { fill: var(--on); }  .d7[data-value="-"] :is(.sg) { fill: var(--on); }  .d7[data-value="E"] :is(.sa, .sd, .se, .sf, .sg) { fill: var(--on); }  .d7[data-value="U"] :is(.sb, .sc, .sd, .se, .sf) { fill: var(--on); }  .d7[data-value="r"] :is(.se, .sg) { fill: var(--on); }  .lcdd { --on: #1b2115; --off: #a9b597; }  .cp { opacity: 0; transform: translate(var(--x), calc(186px - clamp(0, var(--value, 0), 40) / 40 * 84px)); }  .cp[data-value] { opacity: 1; }  .cp rect { x: 0; y: -1px; width: 4.6px; height: 2px; fill: #ffd34d; }  .pkx { opacity: 0; transform: translateX(calc(30px + var(--value, 0) / 6 * 260px)); transition: transform .12s linear; }  .pkx[data-value] { opacity: 1; }  .pky { transform: translateY(calc(186px - var(--value, 0) / 40 * 84px)); transition: transform .12s linear; }</style>

The phase

phases/force_gauge.py
"""Pushes the connector in on the test stand and reads the force gauge. `ui.f*`drive the LCD's live force, `ui.peak` the held peak, `ui.c0` to `ui.c63` theforce-travel curve and `ui.pkx` / `ui.pky` the peak marker. The run recordsthe insertion peak and where it occurred."""import timedef show(ui, prefix, text):    """One 7-segment glyph per character, decimal points left to the panel."""    for k, ch in enumerate(c for c in text if c != "."):        setattr(ui, f"{prefix}{k}", "_" if ch == " " else ch)POINTS, TRAVEL_MM, WINDOW_MM = 64, 5.6, (1.5, 4.5)def insert(ui, measurements, force_gauge):    peak, at = 0.0, 0.0    for _ in range(3):        for k in range(POINTS):            mm = k / (POINTS - 1) * TRAVEL_MM            newtons = force_gauge.read(mm)            setattr(ui, f"c{k}", round(newtons, 2))            show(ui, "f", f"{max(0.0, min(newtons, 99.99)):5.2f}")            if WINDOW_MM[0] <= mm <= WINDOW_MM[1] and newtons > peak:                peak, at = newtons, mm                ui.peak = f"{peak:.2f}"                ui.pkx, ui.pky = round(at, 2), round(peak, 2)            time.sleep(0.1)        time.sleep(0.8)        if _ < 2:            peak = 0.0    measurements.insertion_peak = round(peak, 2)    measurements.peak_travel = round(at, 2)    time.sleep(1.5)

The mocked instrument

plugs/force_gauge.py
"""Mock digital force gauge on a motorised test stand pushing a connectorinto its header: spring rise, the latch peak near 2.9 mm, the drop past thelatch, then seated. Replace it with your gauge's driver."""import mathdef insertion(mm):    if mm < 2.9:        return 23.6 * (mm / 2.9) ** 1.6    if mm < 3.3:        return 23.6 - (mm - 2.9) / 0.4 * 15.2    return 8.4 + max(0.0, mm - 5.4) * 60class ForceGauge:    def __init__(self):        self.k = 0    def read(self, mm):        """Force in N at a stand position in mm."""        self.k += 1        return insertion(mm) + 0.12 * math.sin(self.k * 1.4)

Run your first test in minutes