Run It
Every instrument is mocked, so the example runs without hardware.
bash
git clone https://github.com/tofupilot/panelscd panelstofupilot run vertical-speedThe procedure
procedure.yaml
name: Vertical Speed Indicatorversion: 1.0.0plugs: - key: tester name: Pitot-static tester python: plugs.pitot_static:PitotStaticTestermain: - key: vsi name: Climb and descend python: phases.vertical_speed:climb_and_descend measurements: - key: climb_rate name: Vertical speed in the climb unit: fpm validators: - operator: ">=" expected_value: 900 - operator: "<=" expected_value: 1100 ui: panel: panels/vsi.htmlThe panel
panels/vsi.html
<div class="inst" data-bind="ui.sink"> <div class="dial"> <svg viewBox="38 7 210 210" role="img" aria-label="Vertical speed 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="M213.9 146.8L220.2 149.8M208.3 156.4L214.1 160.3M201.4 165.2L206.6 169.9M193.4 172.9L197.8 178.3M174.4 184.5L177.2 190.9M163.8 188.2L165.7 195.0M152.9 190.4L153.8 197.3M141.8 191.0L141.6 198.0M119.8 187.5L117.7 194.2M109.4 183.5L106.4 189.8M99.6 178.0L95.8 183.9M90.8 171.3L86.1 176.5M76.3 154.3L70.4 158.1M71.0 144.5L64.6 147.4M67.1 134.0L60.4 136.0M64.8 123.1L57.9 124.1M64.8 100.9L57.9 99.9M67.1 90.0L60.4 88.0M71.0 79.5L64.6 76.6M76.3 69.7L70.4 65.9M90.8 52.7L86.1 47.5M99.6 46.0L95.8 40.1M109.4 40.5L106.4 34.2M119.8 36.5L117.7 29.8M141.8 33.0L141.6 26.0M152.9 33.6L153.8 26.7M163.8 35.8L165.7 29.0M174.4 39.5L177.2 33.1M193.4 51.1L197.8 45.7M201.4 58.8L206.6 54.1M208.3 67.6L214.1 63.7M213.9 77.2L220.2 74.2" stroke="#f2f4f6" stroke-width="1"/> <path d="M213.4 134.9L224.8 138.6M181.7 175.1L187.9 185.3M131.4 185.1L129.5 196.9M86.7 160.1L77.6 167.9M69.0 112.0L57.0 112.0M86.7 63.9L77.6 56.1M131.4 38.9L129.5 27.1M181.7 48.9L187.9 38.7M213.4 89.1L224.8 85.4" stroke="#f2f4f6" stroke-width="2.2"/> <text x="201.0" y="130.9" class="num">20</text><text x="174.9" y="164.0" class="num">15</text><text x="133.5" y="172.2" class="num">10</text><text x="96.6" y="151.6" class="num">5</text><text x="82.0" y="112.0" class="num">0</text><text x="96.6" y="72.4" class="num">5</text><text x="133.5" y="51.8" class="num">10</text><text x="174.9" y="60.0" class="num">15</text><text x="201.0" y="93.1" class="num">20</text> <text x="87.4" y="92.0" class="cap">UP</text> <text x="87.4" y="137.0" class="cap">DN</text> <g class="sweep" data-bind="ui.vs"> <path class="track" d="M182.9 125.0A42 42 0 1 1 182.9 99.0"/> <path class="arc up" d="M101.0 112.0A42 42 0 0 1 182.9 99.0" pathLength="100"/> <path class="arc down" d="M101.0 112.0A42 42 0 0 0 182.9 125.0" pathLength="100"/> <circle class="tip" cx="143" cy="70" r="4.5"/> </g> </svg> <div class="readout"> <b data-bind="ui.vs" data-format="0">0</b> <span>FPM</span> </div> </div></div><style> .inst { 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; dominant-baseline: central; } .cap { font: 600 7px system-ui, sans-serif; fill: #8a949e; text-anchor: middle; letter-spacing: .12em; } .readout { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; pointer-events: none; } .readout b { font: 600 30px/1 ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; color: #f2f4f6; transition: color .2s; } .readout span { font: 600 10px system-ui, sans-serif; letter-spacing: .12em; color: #8a949e; } .track, .arc { fill: none; stroke-width: 7; stroke-linecap: round; } .track { stroke: #22282f; } .arc { stroke: #4aa8ff; transition: stroke-dasharray .12s linear, stroke .2s; } .tip { fill: #f2f4f6; transform-box: view-box; transform-origin: 143px 112px; transition: transform .12s linear, fill .2s; } /* A climb fills the upper arc from 0, a descent the lower one. */ .up { stroke-dasharray: calc(clamp(0, var(--value, 0), 2000) / 2000 * 100) 200; } .down { stroke-dasharray: calc(clamp(0, var(--value, 0) * -1, 2000) / 2000 * 100) 200; } .tip { transform: rotate(calc(clamp(-2000, var(--value, 0), 2000) / 2000 * 162deg - 90deg)); } /* Past the sink rate limit the descent, its tip and the reading turn red. */ .inst[data-value=true] .down { stroke: #e5383b; } .inst[data-value=true] .tip { fill: #e5383b; } .inst[data-value=true] .readout b { color: #ff8a84; }</style>The phase
phases/vertical_speed.py
"""Climbs and descends the unit on a pitot-static tester. The panel's arcsfollow `ui.vs`, a value only the panel shows, and turn red past a 1,500 fpmsink rate with `ui.sink`. The run records the mean vertical speed of thesteady climb."""import timeSINK_LIMIT_FPM = -1500def climb_and_descend(ui, measurements, tester): ui.sink = False climb = [] for _ in range(tester.length()): segment, fpm = tester.read() ui.vs = fpm ui.sink = fpm < SINK_LIMIT_FPM if segment == "climb": climb.append(fpm) time.sleep(0.1) measurements.climb_rate = round(sum(climb) / len(climb)) time.sleep(1.5)The mocked instrument
plugs/pitot_static.py
"""Mock pitot-static tester: replays a climb and a steep descent, onevertical speed per read. Replace it with your air data test set's driver ona real bench."""import math# Level, climb at 1,000 fpm, level, a steep descent, recover, level.PROFILE = [("level", 0, 0, 10), ("enter", 0, 1000, 25), ("climb", 1000, 1000, 40), ("level", 1000, 0, 20), ("descent", 0, -1700, 25), ("descent", -1700, -700, 20), ("level", -700, 0, 20)]class PitotStaticTester: def __init__(self): self.samples = [] for segment, v0, v1, steps in PROFILE: for i in range(steps): eased = 0.5 - 0.5 * math.cos(math.pi * (i + 1) / steps) self.samples.append((segment, v0 + (v1 - v0) * eased + 8 * math.sin(len(self.samples) * 1.7))) self.index = 0 def length(self): return len(self.samples) def read(self): """[flight segment, vertical speed in fpm, climb positive]""" segment, fpm = self.samples[min(self.index, len(self.samples) - 1)] self.index += 1 return [segment, round(fpm)]