Run It
Every instrument is mocked, so the example runs without hardware.
bash
git clone https://github.com/tofupilot/panelscd panelstofupilot run reaction-wheelsThe procedure
procedure.yaml
name: Reaction Wheelsversion: 1.0.0plugs: - key: telemetry name: Spacecraft telemetry python: plugs.telemetry:WheelTelemetrymain: - key: acs name: Attitude control test python: phases.reaction_wheels:watch_wheels measurements: - key: max_wheel_speed name: Highest wheel speed unit: "rpm" validators: - operator: "<=" expected_value: 6000 ui: panel: panels/wheels.htmlThe panel
panels/wheels.html
<div class="inst"><svg viewBox="0 0 320 210" role="img"><rect x="1" y="1" width="318" height="208" rx="10" fill="#0d1014" stroke="#20262c" stroke-width="1.5"/><text x="20" y="30" text-anchor="start" style="font: 600 7.5px system-ui, sans-serif; letter-spacing: .16em; fill: #7d8791">REACTION WHEELS</text><text x="296" y="30" text-anchor="end" data-bind="ui.h" style="font: 600 8px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #7d8791">ΣH 0.00 Nms</text><g class="row" data-bind="ui.rw1s"><text x="20" y="66" text-anchor="start" style="font: 600 8px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #c9cfd5">RW1</text><text class="rv" x="62" y="66" text-anchor="end" data-bind="ui.rw1" data-format="0" style="font: 600 8px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #f2f4f6">0</text><rect x="70" y="58" width="216" height="8" rx="4" fill="#1a1f25"/><rect x="70.0" y="58" width="18.0" height="8" rx="2" fill="#f2c230" opacity="0.22"/><rect x="268.0" y="58" width="18.0" height="8" rx="2" fill="#f2c230" opacity="0.22"/><rect x="70.0" y="58" width="9.0" height="8" rx="2" fill="#e5383b" opacity="0.35"/><rect x="277.0" y="58" width="9.0" height="8" rx="2" fill="#e5383b" opacity="0.35"/><g data-bind="ui.rw1"><rect class="wb" x="178.0" y="59.5" width="108.0" height="5" rx="2.5"/></g><path d="M178.0 55V69" stroke="#3a424b"/></g><g class="row" data-bind="ui.rw2s"><text x="20" y="100" text-anchor="start" style="font: 600 8px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #c9cfd5">RW2</text><text class="rv" x="62" y="100" text-anchor="end" data-bind="ui.rw2" data-format="0" style="font: 600 8px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #f2f4f6">0</text><rect x="70" y="92" width="216" height="8" rx="4" fill="#1a1f25"/><rect x="70.0" y="92" width="18.0" height="8" rx="2" fill="#f2c230" opacity="0.22"/><rect x="268.0" y="92" width="18.0" height="8" rx="2" fill="#f2c230" opacity="0.22"/><rect x="70.0" y="92" width="9.0" height="8" rx="2" fill="#e5383b" opacity="0.35"/><rect x="277.0" y="92" width="9.0" height="8" rx="2" fill="#e5383b" opacity="0.35"/><g data-bind="ui.rw2"><rect class="wb" x="178.0" y="93.5" width="108.0" height="5" rx="2.5"/></g><path d="M178.0 89V103" stroke="#3a424b"/></g><g class="row" data-bind="ui.rw3s"><text x="20" y="134" text-anchor="start" style="font: 600 8px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #c9cfd5">RW3</text><text class="rv" x="62" y="134" text-anchor="end" data-bind="ui.rw3" data-format="0" style="font: 600 8px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #f2f4f6">0</text><rect x="70" y="126" width="216" height="8" rx="4" fill="#1a1f25"/><rect x="70.0" y="126" width="18.0" height="8" rx="2" fill="#f2c230" opacity="0.22"/><rect x="268.0" y="126" width="18.0" height="8" rx="2" fill="#f2c230" opacity="0.22"/><rect x="70.0" y="126" width="9.0" height="8" rx="2" fill="#e5383b" opacity="0.35"/><rect x="277.0" y="126" width="9.0" height="8" rx="2" fill="#e5383b" opacity="0.35"/><g data-bind="ui.rw3"><rect class="wb" x="178.0" y="127.5" width="108.0" height="5" rx="2.5"/></g><path d="M178.0 123V137" stroke="#3a424b"/></g><g class="row" data-bind="ui.rw4s"><text x="20" y="168" text-anchor="start" style="font: 600 8px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #c9cfd5">RW4</text><text class="rv" x="62" y="168" text-anchor="end" data-bind="ui.rw4" data-format="0" style="font: 600 8px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #f2f4f6">0</text><rect x="70" y="160" width="216" height="8" rx="4" fill="#1a1f25"/><rect x="70.0" y="160" width="18.0" height="8" rx="2" fill="#f2c230" opacity="0.22"/><rect x="268.0" y="160" width="18.0" height="8" rx="2" fill="#f2c230" opacity="0.22"/><rect x="70.0" y="160" width="9.0" height="8" rx="2" fill="#e5383b" opacity="0.35"/><rect x="277.0" y="160" width="9.0" height="8" rx="2" fill="#e5383b" opacity="0.35"/><g data-bind="ui.rw4"><rect class="wb" x="178.0" y="161.5" width="108.0" height="5" rx="2.5"/></g><path d="M178.0 157V171" stroke="#3a424b"/></g><text x="70" y="196" text-anchor="start" style="font: 600 6.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #4b545d">−6000</text><text x="178.0" y="196" text-anchor="middle" style="font: 600 6.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #4b545d">0 RPM</text><text x="286" y="196" text-anchor="end" style="font: 600 6.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #4b545d">+6000</text></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); } .wb { fill: #4aa8ff; transform-box: fill-box; transform-origin: left center; transform: scaleX(clamp(-1, var(--value, 0) / 6000, 1)); transition: transform .12s linear, fill .2s; } .row[data-value=warn] .wb { fill: #f2c230; } .row[data-value=alarm] .wb { fill: #e5383b; } .row[data-value=warn] .rv { fill: #f2c230 !important; } .row[data-value=alarm] .rv { fill: #ff8a84 !important; }</style>The phase
phases/reaction_wheels.py
"""Watches the four reaction wheels in spacecraft telemetry during anattitude control test. `ui.rw1` to `ui.rw4` are the speeds in rpm oncenter-zero bars, `ui.rw1s` to `ui.rw4s` their state (amber past 5000 rpm,red past 5500 rpm), `ui.h` the total angular momentum. The run records thehighest wheel speed."""import mathimport timeWARN_RPM, SATURATION_RPM, INERTIA = 5000, 5500, 0.0016 # kg·m² per wheeldef watch_wheels(ui, measurements, telemetry): peak = 0.0 for _ in range(telemetry.length()): speeds = telemetry.read() for k, rpm in enumerate(speeds, start=1): setattr(ui, f"rw{k}", round(rpm)) setattr(ui, f"rw{k}s", "alarm" if abs(rpm) > SATURATION_RPM else "warn" if abs(rpm) > WARN_RPM else "ok") peak = max(peak, abs(rpm)) h = sum(rpm * 2 * math.pi / 60 * INERTIA for rpm in speeds) ui.h = f"ΣH {h:.2f} Nms" time.sleep(0.1) measurements.max_wheel_speed = round(peak) time.sleep(1.5)The mocked instrument
plugs/telemetry.py
"""Mock spacecraft telemetry: the speeds of four reaction wheels in apyramid during an attitude control test, wheel 3 driven toward saturation.Replace it with your telemetry client."""import mathclass WheelTelemetry: def __init__(self): self.k = 0 def length(self): return 200 def read(self): """[wheel speeds in rpm, RW1 to RW4]""" t = self.k * 0.5 self.k += 1 phases = [0, 1.7, 3.1, 4.4] return [3200 * math.sin(t * 0.22 + p) + (2500 * max(0.0, math.sin(t * 0.11)) if w == 2 else 0) + 20 * math.sin(t * 3 + w) for w, p in enumerate(phases)]