Run It
Every instrument is mocked, so the example runs without hardware.
bash
git clone https://github.com/tofupilot/panelscd panelstofupilot run airspeedThe procedure
procedure.yaml
name: Airspeed Indicatorversion: 1.0.0plugs: - key: pitot name: Pitot probe python: plugs.pitot:PitotProbemain: - key: airspeed name: Airspeed sweep python: phases.airspeed:sweep measurements: - key: cruise_ias name: Cruise indicated airspeed unit: kt validators: - operator: ">=" expected_value: 100 - operator: "<=" expected_value: 130 ui: panel: panels/airspeed.htmlThe panel
panels/airspeed.html
<div class="asi" data-bind="ui.overspeed"> <div class="dial"> <svg viewBox="38 7 210 210" role="img" aria-label="Airspeed indicator"> <rect x="43" y="12" width="200" height="200" rx="18" fill="#1b1f24"/> <circle cx="54" cy="23" r="4" fill="#4a525b"/><circle cx="232" cy="23" r="4" fill="#4a525b"/> <circle cx="54" cy="201" r="4" fill="#4a525b"/><circle cx="232" cy="201" r="4" fill="#4a525b"/> <circle cx="143" cy="112" r="94" fill="#2a3037"/> <circle cx="143" cy="112" r="90" fill="#0c0e10"/> <path d="M87.7 177.9A86 86 0 0 1 172.4 31.2" fill="none" stroke="#2fbf6a" stroke-width="6"/> <path d="M172.4 31.2A86 86 0 0 1 228.8 106.0" fill="none" stroke="#f2c230" stroke-width="6"/> <path d="M102.0 183.0L98.5 189.1M90.3 174.8L85.8 180.2M80.2 164.7L74.8 169.2M65.9 140.0L59.4 142.4M62.2 126.2L55.4 127.5M61.0 112.0L54.0 112.0M65.9 84.0L59.4 81.6M72.0 71.0L65.9 67.5M80.2 59.3L74.8 54.8M102.0 41.0L98.5 34.9M115.0 34.9L112.6 28.4M128.8 31.2L127.5 24.4M157.2 31.2L158.5 24.4M171.0 34.9L173.4 28.4M184.0 41.0L187.5 34.9M205.8 59.3L211.2 54.8M214.0 71.0L220.1 67.5M220.1 84.0L226.6 81.6M225.0 112.0L232.0 112.0M223.8 126.2L230.6 127.5M220.1 140.0L226.6 142.4M205.8 164.7L211.2 169.2M195.7 174.8L200.2 180.2M184.0 183.0L187.5 189.1" stroke="#f2f4f6" stroke-width="1"/> <path d="M117.7 181.5L112.6 195.6M78.9 149.0L65.9 156.5M70.1 99.2L55.4 96.5M95.4 55.3L85.8 43.8M143.0 38.0L143.0 23.0M190.6 55.3L200.2 43.8M215.9 99.2L230.6 96.5M207.1 149.0L220.1 156.5M168.3 181.5L173.4 195.6" stroke="#f2f4f6" stroke-width="2.2"/> <path d="M216.8 106.8L232.8 105.7" stroke="#e5383b" stroke-width="3.5"/> <text x="121.8" y="176.3" class="num">40</text><text x="89.3" y="149.0" class="num">60</text><text x="81.9" y="107.2" class="num">80</text><text x="103.1" y="70.5" class="num">100</text><text x="143.0" y="56.0" class="num">120</text><text x="182.9" y="70.5" class="num">140</text><text x="204.1" y="107.2" class="num">160</text><text x="196.7" y="149.0" class="num">180</text><text x="164.2" y="176.3" class="num">200</text> <g class="sweep" data-bind="ui.ias"> <path class="track" d="M128.6 151.5A42 42 0 1 1 157.4 151.5" pathLength="100"/> <path class="arc" d="M128.6 151.5A42 42 0 1 1 157.4 151.5" pathLength="100"/> <circle class="tip" cx="143" cy="70" r="4.5"/> </g> </svg> <div class="value"> <b data-bind="ui.ias" data-format="0">0</b> <span>KT</span> </div> </div></div><style> .asi { display: flex; justify-content: center; padding: 0 16px; } .dial { position: relative; width: min(360px, 90vw); } .dial svg { display: block; width: 100%; height: auto; } .num { font: 700 15px "Barlow Condensed", "Arial Narrow", sans-serif; fill: #f2f4f6; text-anchor: middle; } .track, .arc { fill: none; stroke-width: 7; stroke-linecap: round; } .track { stroke: #22282f; } /* The sweep fills from 40 kt, the bottom of the scale, to the reading. */ .arc { stroke: #4aa8ff; stroke-dasharray: calc((clamp(40, var(--value, 40), 200) - 40) / 160 * 100) 200; transition: stroke-dasharray .12s linear, stroke .2s; } .tip { fill: #f2f4f6; transform-box: view-box; transform-origin: 143px 112px; transform: rotate(calc((clamp(40, var(--value, 40), 200) - 120) * 2deg)); transition: transform .12s linear, fill .2s; } .value { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; pointer-events: none; } .value b { font: 600 30px/1 ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; color: #f2f4f6; transition: color .2s; } .value span { font: 600 10px system-ui, sans-serif; letter-spacing: .12em; color: #8a949e; } /* Past the red line the sweep, its tip and the reading turn red. */ .asi[data-value=true] .arc { stroke: #e5383b; } .asi[data-value=true] .tip { fill: #e5383b; } .asi[data-value=true] .value b { color: #ff8a84; }</style>The phase
phases/airspeed.py
"""Sweeps the indicated airspeed like a short flight. The panel's arc follows`ui.ias`, a value only the panel shows, and turns red past the 163 kt redline with `ui.overspeed`. The run records the cruise airspeed."""import timedef sweep(ui, measurements, pitot): ui.overspeed = False ias = 0.0 for _ in range(pitot.length()): ias = pitot.read() ui.ias = ias ui.overspeed = ias > 163 time.sleep(0.1) measurements.cruise_ias = ias time.sleep(2)The mocked instrument
plugs/pitot.py
"""Mock pitot probe: replays a short flight, one indicated airspeed per read.Replace it with your air data test set's driver on a real bench."""import math# Takeoff roll, climb, level off, an overspeed in the descent, then cruise.PROFILE = [(0, 65, 40), (65, 95, 30), (95, 140, 30), (140, 172, 25), (172, 124, 30)]class PitotProbe: def __init__(self): self.samples = [] for v0, v1, steps in PROFILE: for i in range(steps + 1): eased = 0.5 - 0.5 * math.cos(math.pi * i / steps) self.samples.append(v0 + (v1 - v0) * eased + 0.6 * math.sin(i * 1.7)) self.index = 0 def length(self): return len(self.samples) def read(self): """Indicated airspeed in kt.""" ias = self.samples[min(self.index, len(self.samples) - 1)] self.index += 1 return round(ias, 1)