signalk-compass-calibrator 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ ## [0.2.0] - 2026-05-27
4
+
5
+ Initial public release.
6
+
7
+ ### Added
8
+
9
+ - Signal K plugin and embeddable admin webapp for magnetic heading calibration.
10
+ - Historical source discovery from Prometheus/VictoriaMetrics data.
11
+ - Batch calibration workflow with navigation period selection, stable COG filtering, coverage review, and correction table generation.
12
+ - Saved calibration table management and runtime activation.
13
+ - Frugal runtime correction publishing to `navigation.headingMagnetic`.
14
+ - Shared Signal K plugin CI workflow.
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # Signal K Compass Calibrator
2
+
3
+ Signal K plugin that calibrates a selected magnetic heading source from source-aware historical navigation data, then publishes a corrected `navigation.headingMagnetic` value as a distinct Signal K source.
4
+
5
+ ## Status
6
+
7
+ Initial implementation for testing on real Signal K installations.
8
+
9
+ The calibration step currently uses a Prometheus-compatible history backend such as VictoriaMetrics. This is intentional for now: the Signal K History API does not expose the Signal K `source` label needed to calibrate one physical heading source against matching historical COG/SOG/variation data.
10
+
11
+ Use [macjl/signalk-prometheus-exporter-macjl](https://github.com/macjl/signalk-prometheus-exporter-macjl) to export source-aware Signal K data to Prometheus/VictoriaMetrics until source-aware history is available directly from Signal K.
12
+
13
+ Once a profile is accepted and activated, runtime publishing is intentionally frugal: the active correction table is compiled in memory and the plugin only publishes the corrected `navigation.headingMagnetic` value. Runtime calibration is inactive until both a saved table and a live Signal K input source are explicitly selected in the web app.
14
+
15
+ ## Features
16
+
17
+ - Select one raw magnetic heading source to calibrate.
18
+ - Select COG, SOG, and magnetic variation reference sources.
19
+ - Discover historical sources through Prometheus/VictoriaMetrics labels.
20
+ - Run explicit batch calibration over a selected time range, with coarse preselection of useful moving periods, 1-second boundary refinement, and stable COG sub-segment selection.
21
+ - Review timelines, zoomed navigation periods, radial heading coverage, correction bins, adaptive per-period thresholds, quality metrics, warnings, and a labelled correction plot.
22
+ - Save or discard candidate tables, view/delete saved tables, and select the runtime table and live Signal K input source separately.
23
+ - Publish only the corrected heading at runtime on `navigation.headingMagnetic`.
24
+ - Avoid feedback loops by ignoring the plugin's own Signal K source.
25
+
26
+ ## Installation
27
+
28
+ From a Signal K server environment:
29
+
30
+ ```sh
31
+ npm install github:macjl/signalk-compass-calibrator
32
+ ```
33
+
34
+ Then enable the plugin from the Signal K plugin configuration UI.
35
+
36
+ After restarting Signal K, open the app from the Admin UI Web Apps menu. It is registered as an embeddable webapp, so the Signal K admin navigation stays visible while the calibrator runs in the content area.
37
+
38
+ ## Configuration
39
+
40
+ The plugin configuration page intentionally has no operational fields. Configuration is done in the Compass Calibrator web app:
41
+
42
+ - Prometheus/VictoriaMetrics base URL and optional basic auth.
43
+ - metric names for heading, COG, SOG, and variation.
44
+ - Signal K context, inferred from historical `navigation.magneticVariation` and selectable before calibration.
45
+ - historical source selections for heading, COG, SOG, and variation.
46
+ - saved calibration table and live Signal K input source for runtime publishing.
47
+
48
+ Speeds are shown in knots in the web app. Final calibration samples are fetched at a fixed 1-second resolution from useful navigation sub-periods selected by the adaptive calibration algorithm.
49
+
50
+ Default runtime output:
51
+
52
+ ```text
53
+ navigation.headingMagnetic
54
+ ```
55
+
56
+ Default Signal K output source:
57
+
58
+ ```text
59
+ signalk-compass-calibrator
60
+ ```
61
+
62
+ ## Development
63
+
64
+ ```sh
65
+ npm test
66
+ ```
67
+
68
+ GitHub Actions uses the shared Signal K plugin CI workflow to validate the package on pushes and pull requests.
69
+
70
+ The CI workflow also runs Signal K integration checks, verifies App Store packaging, validates the plugin schema, checks Node 20 compatibility for Cerbo GX/Venus OS, and simulates App Store installation with `npm install --ignore-scripts`.
71
+
72
+ ## Author
73
+
74
+ Jean-Laurent Girod, [@macjl](https://github.com/macjl)
75
+
76
+ ## License
77
+
78
+ Apache-2.0