MCPcopy
hub / github.com/cpaczek/skylight / assembleState

Method assembleState

tracker/src/loop.ts:810–888  ·  view source on GitHub ↗
(
    now: number,
    cfg: TrackerConfig,
    pose: CameraPose | null,
    candidates: TrackerState["candidates"],
    targetAc: Aircraft | undefined,
    prediction: Prediction | null,
    commandedPanTilt: PanTilt | null,
    hfovDeg: number | null,
    angularSizeDeg: number | null,
  )

Source from the content-addressed store, hash-verified

808 }
809
810 private assembleState(
811 now: number,
812 cfg: TrackerConfig,
813 pose: CameraPose | null,
814 candidates: TrackerState["candidates"],
815 targetAc: Aircraft | undefined,
816 prediction: Prediction | null,
817 commandedPanTilt: PanTilt | null,
818 hfovDeg: number | null,
819 angularSizeDeg: number | null,
820 ): TrackerState {
821 return {
822 now,
823 mode: this.mode,
824 targetMode: cfg.targetMode,
825 driver: this.driver().diagnostics(),
826 pose,
827 commanded: this.lastCommanded,
828 target: {
829 hex: this.current?.hex ?? null,
830 flight: targetAc?.flight,
831 predicted: prediction?.azEl ?? null,
832 commandedPanTilt,
833 leadSec: prediction?.leadSec ?? 0,
834 hfovDeg,
835 angularSizeDeg,
836 },
837 candidates,
838 calibration: this.calibration.state(cfg.site, now),
839 recording: this.recorder.recording,
840 videoRec: this.videoRecStatus(),
841 video: {
842 ...this.video.status(),
843 mseRunning: this.mseStatus().running,
844 mseGen: this.mseStatus().gen,
845 },
846 vision: {
847 enabled: cfg.vision.enabled,
848 applying: cfg.vision.applyCorrection,
849 lockWide: cfg.vision.lockWide,
850 detection: this.lastDetection
851 ? {
852 cx: this.lastDetection.cx,
853 cy: this.lastDetection.cy,
854 boxX: this.lastDetection.box.x,
855 boxY: this.lastDetection.box.y,
856 boxW: this.lastDetection.box.w,
857 boxH: this.lastDetection.box.h,
858 contrastSigma: this.lastDetection.contrastSigma,
859 offAzDeg: this.lastDetection.offAzDeg,
860 offElDeg: this.lastDetection.offElDeg,
861 ageMs: now - this.lastDetection.t,
862 }
863 : null,
864 correctionAzDeg: this.corrAzApp,
865 correctionElDeg: this.corrElApp,
866 tracks: this.tracks.all().map((t) => {
867 const v = t.velocity();

Callers 1

tickMethod · 0.95

Calls 9

stateMethod · 0.80
allMethod · 0.80
velocityMethod · 0.80
latestMethod · 0.80
lockedTrackMethod · 0.80
diagnosticsMethod · 0.65
isConnectedMethod · 0.65
getAircraftMethod · 0.65
statusMethod · 0.45

Tested by

no test coverage detected