Run It
Every instrument is mocked, so the example runs without hardware.
bash
git clone https://github.com/tofupilot/panelscd panelstofupilot run camera-extrinsicsThe procedure
procedure.yaml
name: Camera Extrinsicsversion: 1.0.0plugs: - key: pose_results name: Calibration results python: plugs.pose_results:PoseResultsmain: - key: poses name: Check poses python: phases.camera_extrinsics:check_poses measurements: - key: min_tilt name: Smallest target tilt unit: "°" validators: - operator: ">=" expected_value: 20 - operator: "<=" expected_value: 45 - key: max_distance name: Farthest target unit: "m" validators: - operator: "<=" expected_value: 1.5 ui: panel: panels/extrinsics.htmlThe panel
panels/extrinsics.html
<div class="inst"><svg viewBox="0 0 640 478" role="img"><rect x="1" y="1" width="638" height="476" rx="10" fill="#05070a" stroke="#20262c" stroke-width="1.5"/><polygon points="248.0,114.5 515.2,121.1 488.4,307.9 256.9,284.1" fill="#4aa8ff" fill-opacity=".04" stroke="#2c5a86" stroke-width="1"/><path d="M275.8 436.8L248.0 114.5" stroke="#2c5a86" stroke-width="1"/><path d="M275.8 436.8L515.2 121.1" stroke="#2c5a86" stroke-width="1"/><path d="M275.8 436.8L488.4 307.9" stroke="#2c5a86" stroke-width="1"/><path d="M275.8 436.8L256.9 284.1" stroke="#2c5a86" stroke-width="1"/><polygon points="268.2,348.6 335.9,357.6 335.2,400.7 270.1,390.9" fill="#c3ccd5" fill-opacity=".1" stroke="#c3ccd5" stroke-width="1.5"/><path d="M275.8 436.8L268.2 348.6" stroke="#c3ccd5" stroke-width="1.5"/><path d="M275.8 436.8L335.9 357.6" stroke="#c3ccd5" stroke-width="1.5"/><path d="M275.8 436.8L335.2 400.7" stroke="#c3ccd5" stroke-width="1.5"/><path d="M275.8 436.8L270.1 390.9" stroke="#c3ccd5" stroke-width="1.5"/><path d="M275.8 436.8L320.0 444.4" stroke="#ff4d4f" stroke-width="2.5" stroke-linecap="round"/><path d="M275.8 436.8L277.3 471.2" stroke="#38e07a" stroke-width="2.5" stroke-linecap="round"/><path d="M275.8 436.8L288.6 406.4" stroke="#4aa8ff" stroke-width="2.5" stroke-linecap="round"/><g data-bind="ui.poses"><g class="rv bd" style="--k: 2"><polygon points="280.7,239.2 337.8,231.6 342.0,271.2 285.6,279.8" fill="#e8eaec" stroke="#f2c230" stroke-width="2.5"/><g fill="#15181c"><polygon points="280.7,239.2 286.6,238.4 287.3,244.2 281.5,245.0"/><polygon points="292.4,237.6 298.2,236.8 298.8,242.6 293.1,243.4"/><polygon points="303.9,236.1 309.6,235.3 310.3,241.1 304.6,241.9"/><polygon points="315.3,234.5 321.0,233.8 321.6,239.5 316.0,240.3"/><polygon points="326.6,233.0 332.2,232.3 332.8,238.0 327.2,238.8"/><polygon points="287.3,244.2 293.1,243.4 293.8,249.2 288.0,250.0"/><polygon points="298.8,242.6 304.6,241.9 305.2,247.6 299.5,248.4"/><polygon points="310.3,241.1 316.0,240.3 316.6,246.1 310.9,246.8"/><polygon points="321.6,239.5 327.2,238.8 327.9,244.5 322.3,245.3"/><polygon points="332.8,238.0 338.4,237.3 339.0,243.0 333.4,243.7"/><polygon points="282.2,250.8 288.0,250.0 288.7,255.8 282.9,256.7"/><polygon points="293.8,249.2 299.5,248.4 300.2,254.2 294.4,255.0"/><polygon points="305.2,247.6 310.9,246.8 311.6,252.6 305.9,253.4"/><polygon points="316.6,246.1 322.3,245.3 322.9,251.0 317.3,251.8"/><polygon points="327.9,244.5 333.4,243.7 334.1,249.4 328.5,250.2"/><polygon points="288.7,255.8 294.4,255.0 295.1,260.8 289.4,261.6"/><polygon points="300.2,254.2 305.9,253.4 306.6,259.1 300.9,260.0"/><polygon points="311.6,252.6 317.3,251.8 317.9,257.5 312.2,258.3"/><polygon points="322.9,251.0 328.5,250.2 329.1,255.9 323.5,256.7"/><polygon points="334.1,249.4 339.6,248.6 340.2,254.3 334.7,255.1"/><polygon points="283.6,262.5 289.4,261.6 290.0,267.4 284.3,268.2"/><polygon points="295.1,260.8 300.9,260.0 301.5,265.7 295.8,266.6"/><polygon points="306.6,259.1 312.2,258.3 312.9,264.0 307.2,264.9"/><polygon points="317.9,257.5 323.5,256.7 324.2,262.4 318.5,263.2"/><polygon points="329.1,255.9 334.7,255.1 335.3,260.8 329.7,261.6"/><polygon points="290.0,267.4 295.8,266.6 296.5,272.3 290.7,273.2"/><polygon points="301.5,265.7 307.2,264.9 307.9,270.6 302.2,271.4"/><polygon points="312.9,264.0 318.5,263.2 319.2,268.9 313.5,269.8"/><polygon points="324.2,262.4 329.7,261.6 330.4,267.2 324.8,268.1"/><polygon points="335.3,260.8 340.8,260.0 341.4,265.6 335.9,266.4"/><polygon points="284.9,274.0 290.7,273.2 291.4,278.9 285.6,279.8"/><polygon points="296.5,272.3 302.2,271.4 302.9,277.2 297.2,278.0"/><polygon points="307.9,270.6 313.5,269.8 314.2,275.4 308.5,276.3"/><polygon points="319.2,268.9 324.8,268.1 325.4,273.7 319.8,274.6"/><polygon points="330.4,267.2 335.9,266.4 336.5,272.0 331.0,272.9"/></g></g><g class="rv bd" style="--k: 3"><polygon points="396.9,235.8 452.4,253.0 442.1,294.6 388.4,274.8" fill="#e8eaec" stroke="#e879f9" stroke-width="2.5"/><g fill="#15181c"><polygon points="396.9,235.8 402.1,237.4 400.8,243.1 395.7,241.4"/><polygon points="407.3,239.0 412.7,240.6 411.4,246.4 406.1,244.7"/><polygon points="418.1,242.3 423.6,244.0 422.3,249.9 416.8,248.2"/><polygon points="429.2,245.8 434.9,247.5 433.5,253.5 427.8,251.7"/><polygon points="440.6,249.3 446.5,251.1 445.0,257.1 439.2,255.3"/><polygon points="400.8,243.1 406.1,244.7 404.8,250.5 399.6,248.8"/><polygon points="411.4,246.4 416.8,248.2 415.5,253.9 410.1,252.2"/><polygon points="422.3,249.9 427.8,251.7 426.4,257.5 420.9,255.7"/><polygon points="433.5,253.5 439.2,255.3 437.8,261.2 432.1,259.4"/><polygon points="445.0,257.1 450.9,259.0 449.4,265.0 443.5,263.1"/><polygon points="394.4,247.1 399.6,248.8 398.3,254.4 393.2,252.7"/><polygon points="404.8,250.5 410.1,252.2 408.8,257.9 403.5,256.1"/><polygon points="415.5,253.9 420.9,255.7 419.6,261.5 414.1,259.7"/><polygon points="426.4,257.5 432.1,259.4 430.7,265.2 425.1,263.4"/><polygon points="437.8,261.2 443.5,263.1 442.1,269.1 436.3,267.1"/><polygon points="398.3,254.4 403.5,256.1 402.3,261.8 397.1,260.0"/><polygon points="408.8,257.9 414.1,259.7 412.8,265.4 407.5,263.6"/><polygon points="419.6,261.5 425.1,263.4 423.7,269.2 418.2,267.3"/><polygon points="430.7,265.2 436.3,267.1 434.9,273.0 429.3,271.1"/><polygon points="442.1,269.1 447.9,271.0 446.5,277.0 440.6,275.0"/><polygon points="392.0,258.3 397.1,260.0 395.9,265.6 390.8,263.8"/><polygon points="402.3,261.8 407.5,263.6 406.2,269.2 401.0,267.4"/><polygon points="412.8,265.4 418.2,267.3 416.9,273.0 411.5,271.1"/><polygon points="423.7,269.2 429.3,271.1 427.9,276.9 422.4,274.9"/><polygon points="434.9,273.0 440.6,275.0 439.2,280.9 433.5,278.8"/><polygon points="395.9,265.6 401.0,267.4 399.8,273.0 394.6,271.2"/><polygon points="406.2,269.2 411.5,271.1 410.2,276.8 405.0,274.9"/><polygon points="416.9,273.0 422.4,274.9 421.0,280.7 415.6,278.7"/><polygon points="427.9,276.9 433.5,278.8 432.1,284.6 426.5,282.6"/><polygon points="439.2,280.9 445.0,282.9 443.6,288.8 437.8,286.7"/><polygon points="389.6,269.3 394.6,271.2 393.4,276.7 388.4,274.8"/><polygon points="399.8,273.0 405.0,274.9 403.7,280.5 398.5,278.6"/><polygon points="410.2,276.8 415.6,278.7 414.3,284.4 408.9,282.4"/><polygon points="421.0,280.7 426.5,282.6 425.2,288.4 419.7,286.3"/><polygon points="432.1,284.6 437.8,286.7 436.4,292.5 430.7,290.4"/></g></g><g class="rv bd" style="--k: 0"><polygon points="279.8,165.8 343.0,164.5 339.2,199.7 279.7,201.5" fill="#e8eaec" stroke="#4aa8ff" stroke-width="2.5"/><g fill="#15181c"><polygon points="279.8,165.8 286.2,165.7 286.2,171.1 279.8,171.2"/><polygon points="292.6,165.6 299.0,165.4 298.8,170.8 292.5,170.9"/><polygon points="305.4,165.3 311.7,165.2 311.4,170.5 305.1,170.7"/><polygon points="318.0,165.1 324.3,164.9 323.9,170.2 317.6,170.4"/><polygon points="330.6,164.8 336.8,164.7 336.3,170.0 330.1,170.1"/><polygon points="286.2,171.1 292.5,170.9 292.4,176.2 286.1,176.3"/><polygon points="298.8,170.8 305.1,170.7 304.9,175.9 298.6,176.1"/><polygon points="311.4,170.5 317.6,170.4 317.3,175.6 311.1,175.8"/><polygon points="323.9,170.2 330.1,170.1 329.6,175.3 323.5,175.5"/><polygon points="336.3,170.0 342.4,169.8 341.9,175.0 335.8,175.2"/><polygon points="279.8,176.5 286.1,176.3 286.0,181.5 279.8,181.7"/><polygon points="292.4,176.2 298.6,176.1 298.4,181.2 292.2,181.4"/><polygon points="304.9,175.9 311.1,175.8 310.8,180.9 304.6,181.1"/><polygon points="317.3,175.6 323.5,175.5 323.1,180.6 316.9,180.8"/><polygon points="329.6,175.3 335.8,175.2 335.3,180.3 329.2,180.5"/><polygon points="286.0,181.5 292.2,181.4 292.1,186.5 285.9,186.6"/><polygon points="298.4,181.2 304.6,181.1 304.4,186.1 298.3,186.3"/><polygon points="310.8,180.9 316.9,180.8 316.6,185.8 310.5,186.0"/><polygon points="323.1,180.6 329.2,180.5 328.7,185.5 322.7,185.7"/><polygon points="335.3,180.3 341.3,180.2 340.8,185.2 334.8,185.3"/><polygon points="279.7,186.8 285.9,186.6 285.9,191.6 279.7,191.8"/><polygon points="292.1,186.5 298.3,186.3 298.1,191.3 292.0,191.4"/><polygon points="304.4,186.1 310.5,186.0 310.2,190.9 304.2,191.1"/><polygon points="316.6,185.8 322.7,185.7 322.3,190.6 316.3,190.8"/><polygon points="328.7,185.5 334.8,185.3 334.3,190.3 328.3,190.4"/><polygon points="285.9,191.6 292.0,191.4 291.9,196.4 285.8,196.5"/><polygon points="298.1,191.3 304.2,191.1 303.9,196.0 297.9,196.2"/><polygon points="310.2,190.9 316.3,190.8 315.9,195.7 310.0,195.8"/><polygon points="322.3,190.6 328.3,190.4 327.9,195.3 321.9,195.5"/><polygon points="334.3,190.3 340.2,190.1 339.7,195.0 333.8,195.1"/><polygon points="279.7,196.7 285.8,196.5 285.7,201.4 279.7,201.5"/><polygon points="291.9,196.4 297.9,196.2 297.7,201.0 291.7,201.2"/><polygon points="303.9,196.0 310.0,195.8 309.7,200.6 303.7,200.8"/><polygon points="315.9,195.7 321.9,195.5 321.5,200.3 315.6,200.5"/><polygon points="327.9,195.3 333.8,195.1 333.3,199.9 327.4,200.1"/></g></g><g class="rv bd" style="--k: 1"><polygon points="397.4,163.8 456.7,171.3 449.6,219.0 392.1,207.7" fill="#e8eaec" stroke="#38e07a" stroke-width="2.5"/><g fill="#15181c"><polygon points="397.4,163.8 402.8,164.5 402.1,170.9 396.6,170.2"/><polygon points="408.4,165.2 414.1,165.9 413.3,172.4 407.6,171.7"/><polygon points="419.9,166.6 425.7,167.4 424.8,174.0 419.0,173.2"/><polygon points="431.7,168.1 437.8,168.9 436.9,175.7 430.8,174.9"/><polygon points="444.0,169.7 450.3,170.5 449.3,177.4 443.0,176.5"/><polygon points="402.1,170.9 407.6,171.7 406.8,178.1 401.3,177.3"/><polygon points="413.3,172.4 419.0,173.2 418.1,179.8 412.4,178.9"/><polygon points="424.8,174.0 430.8,174.9 429.9,181.5 424.0,180.7"/><polygon points="436.9,175.7 443.0,176.5 442.0,183.3 435.9,182.4"/><polygon points="449.3,177.4 455.7,178.3 454.7,185.2 448.3,184.2"/><polygon points="395.8,176.5 401.3,177.3 400.5,183.7 395.1,182.8"/><polygon points="406.8,178.1 412.4,178.9 411.6,185.4 406.0,184.5"/><polygon points="418.1,179.8 424.0,180.7 423.1,187.2 417.3,186.3"/><polygon points="429.9,181.5 435.9,182.4 435.0,189.1 429.0,188.1"/><polygon points="442.0,183.3 448.3,184.2 447.3,191.0 441.1,190.1"/><polygon points="400.5,183.7 406.0,184.5 405.2,190.9 399.7,190.0"/><polygon points="411.6,185.4 417.3,186.3 416.4,192.8 410.8,191.8"/><polygon points="423.1,187.2 429.0,188.1 428.1,194.7 422.2,193.7"/><polygon points="435.0,189.1 441.1,190.1 440.1,196.8 434.1,195.7"/><polygon points="447.3,191.0 453.6,192.0 452.6,198.8 446.3,197.8"/><polygon points="394.3,189.1 399.7,190.0 398.9,196.3 393.6,195.3"/><polygon points="405.2,190.9 410.8,191.8 410.0,198.2 404.4,197.2"/><polygon points="416.4,192.8 422.2,193.7 421.3,200.2 415.6,199.2"/><polygon points="428.1,194.7 434.1,195.7 433.1,202.3 427.2,201.3"/><polygon points="440.1,196.8 446.3,197.8 445.4,204.5 439.2,203.4"/><polygon points="398.9,196.3 404.4,197.2 403.6,203.5 398.2,202.5"/><polygon points="410.0,198.2 415.6,199.2 414.8,205.6 409.1,204.6"/><polygon points="421.3,200.2 427.2,201.3 426.3,207.8 420.5,206.7"/><polygon points="433.1,202.3 439.2,203.4 438.2,210.0 432.2,208.9"/><polygon points="445.4,204.5 451.6,205.6 450.6,212.3 444.4,211.2"/><polygon points="392.8,201.5 398.2,202.5 397.4,208.7 392.1,207.7"/><polygon points="403.6,203.5 409.1,204.6 408.3,210.9 402.8,209.8"/><polygon points="414.8,205.6 420.5,206.7 419.6,213.1 413.9,212.0"/><polygon points="426.3,207.8 432.2,208.9 431.3,215.4 425.4,214.2"/><polygon points="438.2,210.0 444.4,211.2 443.4,217.8 437.3,216.6"/></g></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); } .rv { opacity: clamp(0, calc((var(--value, -1) - var(--k)) * 4 + 1), 1); transition: opacity .15s linear; } .photo { opacity: .92; }</style>The phase
phases/camera_extrinsics.py
"""Reads each rig target's pose from the calibration: `ui.poses` revealsthe targets one by one in the 3D view. The run records the smallest tilt,which must be large enough to measure the focal length, and the farthesttarget."""import timedef check_poses(ui, measurements, pose_results): results = pose_results.results() for _ in range(3): for index in range(len(results["tilts"])): ui.poses = index time.sleep(0.8) time.sleep(2.0) ui.poses = -1 time.sleep(0.5) ui.poses = len(results["tilts"]) - 1 measurements.min_tilt = min(results["tilts"]) measurements.max_distance = max(results["distances"]) time.sleep(2)The mocked instrument
plugs/pose_results.py
"""Mock calibration results: each rig target's pose relative to the camera, from the OpenCV calibration. Replace it with your camera and the OpenCV calls of your station."""import jsonRESULTS = json.loads("{\"tilts\":[29.5,30.0,29.9,28.1],\"distances\":[1.217,1.194,1.219,1.227]}")class PoseResults: def results(self): return RESULTS