Run It
Every instrument is mocked, so the example runs without hardware.
bash
git clone https://github.com/tofupilot/panelscd panelstofupilot run aruco-markersThe procedure
procedure.yaml
name: ArUco Markersversion: 1.0.0plugs: - key: aruco_camera name: Station camera python: plugs.aruco_camera:ArucoCameramain: - key: markers name: Find markers python: phases.aruco_markers:find_markers measurements: - key: markers_found name: Markers identified unit: "" validators: - operator: ">=" expected_value: 6 - operator: "<=" expected_value: 6 ui: panel: panels/markers.htmlThe panel
panels/markers.html
<div class="inst"><svg viewBox="0 0 640 478" role="img"><image class="photo" href="images/aruco.jpg" x="0" y="0" width="640" height="478"/><g data-bind="ui.step"><polygon class="rv mk" style="--k: 0" points="149.4,206.4 198.1,190.4 213.5,238.5 164.9,254.3"/><line class="rv ax" style="--k: 1; stroke: #ff4d4f" x1="181.5" y1="222.3" x2="217.1" y2="210.7"/><line class="rv ax" style="--k: 1; stroke: #38e07a" x1="181.5" y1="222.3" x2="170.2" y2="187.2"/><line class="rv ax" style="--k: 1; stroke: #4aa8ff" x1="181.5" y1="222.3" x2="187.0" y2="226.1"/><polygon class="rv mk" style="--k: 2" points="271.6,167.4 317.0,153.0 332.0,199.3 286.1,214.1"/><line class="rv ax" style="--k: 3; stroke: #ff4d4f" x1="301.8" y1="183.5" x2="335.0" y2="172.8"/><line class="rv ax" style="--k: 3; stroke: #38e07a" x1="301.8" y1="183.5" x2="290.9" y2="149.2"/><line class="rv ax" style="--k: 3; stroke: #4aa8ff" x1="301.8" y1="183.5" x2="296.1" y2="184.8"/><polygon class="rv mk" style="--k: 4" points="391.7,128.3 438.0,113.7 453.2,160.6 406.9,175.3"/><line class="rv ax" style="--k: 5; stroke: #ff4d4f" x1="422.5" y1="144.5" x2="456.3" y2="133.7"/><line class="rv ax" style="--k: 5; stroke: #38e07a" x1="422.5" y1="144.5" x2="411.4" y2="110.1"/><line class="rv ax" style="--k: 5; stroke: #4aa8ff" x1="422.5" y1="144.5" x2="415.6" y2="149.4"/><polygon class="rv mk" style="--k: 6" points="192.0,330.8 238.1,315.7 253.0,362.4 207.7,377.2"/><line class="rv ax" style="--k: 7; stroke: #ff4d4f" x1="222.6" y1="346.5" x2="256.3" y2="335.5"/><line class="rv ax" style="--k: 7; stroke: #38e07a" x1="222.6" y1="346.5" x2="211.4" y2="312.4"/><line class="rv ax" style="--k: 7; stroke: #4aa8ff" x1="222.6" y1="346.5" x2="229.8" y2="341.9"/><polygon class="rv mk" style="--k: 8" points="311.6,291.3 358.0,276.5 372.4,322.6 326.3,337.4"/><line class="rv ax" style="--k: 9; stroke: #ff4d4f" x1="342.1" y1="306.9" x2="375.9" y2="296.1"/><line class="rv ax" style="--k: 9; stroke: #38e07a" x1="342.1" y1="306.9" x2="331.5" y2="273.1"/><line class="rv ax" style="--k: 9; stroke: #4aa8ff" x1="342.1" y1="306.9" x2="339.5" y2="302.9"/><polygon class="rv mk" style="--k: 10" points="429.4,252.8 478.0,237.1 492.8,284.7 444.6,301.2"/><line class="rv ax" style="--k: 11; stroke: #ff4d4f" x1="461.2" y1="269.1" x2="496.8" y2="257.2"/><line class="rv ax" style="--k: 11; stroke: #38e07a" x1="461.2" y1="269.1" x2="450.2" y2="233.7"/><line class="rv ax" style="--k: 11; stroke: #4aa8ff" x1="461.2" y1="269.1" x2="453.5" y2="264.0"/></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); } .rv { opacity: clamp(0, calc((var(--value, -1) - var(--k)) * 4 + 1), 1); transition: opacity .15s linear; } .photo { opacity: .92; } .mk { fill: none; stroke: #38e07a; stroke-width: 2.4; } .ax { stroke-width: 3.5; stroke-linecap: round; }</style>The phase
phases/aruco_markers.py
"""Identifies the six ArUco markers on the fixture plate and estimates eachone's pose: `ui.step` reveals each outline, then its axes. The run recordshow many markers it identified."""import timedef find_markers(ui, measurements, aruco_camera): results = aruco_camera.results() total = 2 * len(results["ids"]) for _ in range(3): for step in range(total + 1): ui.step = step time.sleep(0.35) time.sleep(1.5) ui.step = -1 time.sleep(0.4) ui.step = total measurements.markers_found = len(results["ids"]) time.sleep(2)The mocked instrument
plugs/aruco_camera.py
"""Mock station camera: the six ArUco markers and their poses OpenCV found on the fixture-plate photo. Replace it with your camera and the OpenCV calls of your station."""import jsonRESULTS = json.loads("{\"ids\":[3,41,12,26,19,7]}")class ArucoCamera: def results(self): return RESULTS