speedandcurrent 1.6.0 → 1.7.1
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/README.md +81 -59
- package/correctionTable.js +1 -1
- package/index.js +392 -264
- package/package.json +5 -2
- package/public/TableRenderer.js +114 -210
- package/public/app.js +804 -447
- package/public/index.html +257 -96
- package/public/main.css +79 -158
- package/public/vectors.html +0 -30
- package/public/vectors.js +0 -145
package/README.md
CHANGED
|
@@ -5,10 +5,11 @@ This SignalK plugin estimates **corrected speed through water**, **leeway**, and
|
|
|
5
5
|
|
|
6
6
|
## Quick Start
|
|
7
7
|
1. Install / enable the plugin in the Signal K Server admin UI.
|
|
8
|
-
2.
|
|
9
|
-
3.
|
|
10
|
-
4.
|
|
11
|
-
5.
|
|
8
|
+
2. Open the plugin webapp (Signal K: Apps → Speed and Current).
|
|
9
|
+
3. Go to **Correction Table** and click **New** to create your first correction table (or use the default that was created for you).
|
|
10
|
+
4. Start learning by enabling **Correction Table Learning** in the webapp.
|
|
11
|
+
5. Once your correction table is filled enable **Boatspeed Estimation** in the webapp.
|
|
12
|
+
6. Watch the corrected speed, leeway, and current fields begin populating as data arrives. Initial stabilization may take some sailing at varying speeds and heel angles.
|
|
12
13
|
|
|
13
14
|
## Requirements & Data Inputs
|
|
14
15
|
The plugin automatically starts collecting and learning once enabled, but waits the first ~60 seconds before producing estimates to stabilize.
|
|
@@ -43,104 +44,125 @@ At the heart of the plugin is a correction table that provides a correction vect
|
|
|
43
44
|
Every time the paddle wheel provides a measurement the plugin does two things. First it corrects boat speed and estimates leeway and current using the correction table. Second, using boat speed, ground speed and current estimation the correction table is updated. So the correction table is used and updated simultaneously.
|
|
44
45
|
|
|
45
46
|
## Configuration
|
|
46
|
-
All settings are managed from the Signal K
|
|
47
|
+
All settings are managed from the plugin webapp. The Signal K admin UI is not used for configuration.
|
|
47
48
|
|
|
48
49
|
### Core
|
|
49
50
|
| Setting | Default | Description | When to Change |
|
|
50
51
|
|---------|---------|-------------|----------------|
|
|
51
|
-
| Estimate Boat Speed |
|
|
52
|
-
| Update Correction Table |
|
|
53
|
-
| Start with new table | false | Discards existing table and starts fresh. | Only if you want to start all over with correcting. |
|
|
52
|
+
| Estimate Boat Speed | Off | Enables speed correction, leeway and current estimation. | Turn on after creating a correction table. |
|
|
53
|
+
| Update Correction Table | On | Learns / refines correction table. | Temporarily disable in abnormal conditions (heavy seas, abnormal current). |
|
|
54
54
|
|
|
55
55
|
### Learning & Stability
|
|
56
56
|
| Setting | Default | Description | Guidance |
|
|
57
57
|
|---------|---------|-------------|----------|
|
|
58
58
|
| Correction Table Stability | 7 | Higher = slower changes (more conservative). | Increase once table broadly populated; lower briefly if you think the sensor error has changed. |
|
|
59
|
-
| Assume Current (experimental) |
|
|
59
|
+
| Assume Current (experimental) | Off | Learns table while assuming a current may be present. | Enable cautiously on tidal waters. |
|
|
60
|
+
| Show Statistics | Off | Displays σ (standard deviation) next to smoothed values. | Enable for debugging or to inspect signal quality. |
|
|
61
|
+
|
|
62
|
+
### Smoother
|
|
63
|
+
Controls how raw sensor signals are smoothed before being fed into the correction and learning calculations. The smoother type and its parameter apply to heading, boat speed, ground speed, and attitude.
|
|
60
64
|
|
|
61
|
-
### Table Definition
|
|
62
65
|
| Setting | Default | Description |
|
|
63
66
|
|---------|---------|-------------|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
67
|
+
| Smoother type | Moving average (window) | Moving average (window), Exponential (τ), or Kalman filter. |
|
|
68
|
+
| Window (s) | 5 s | (Moving average) Integration window in seconds. Minimum 2 s. |
|
|
69
|
+
| Time constant τ (s) | 3 s | (Exponential) Exponential decay time constant in seconds. Minimum 1 s. |
|
|
70
|
+
| Steady-state gain | 0.2 | (Kalman) Kalman gain at steady state. Range 0.01–0.99. Lower = smoother but slower. |
|
|
71
|
+
|
|
72
|
+
### Table Dimensions
|
|
73
|
+
Table dimensions are set when creating or resizing a table via the webapp (New / Resize buttons). The parameters are:
|
|
74
|
+
|
|
75
|
+
| Parameter | Default | Description |
|
|
76
|
+
|-----------|---------|-------------|
|
|
77
|
+
| Name | — | Identifier used as the filename on disk. |
|
|
78
|
+
| Max speed (kn) | 9 kn | Upper speed coverage. |
|
|
79
|
+
| Speed step (kn) | 1 kn | Speed increment for table rows. |
|
|
80
|
+
| Max heel (°) | 32° | Max absolute heel covered (± value). |
|
|
81
|
+
| Heel step (°) | 8° | Heel increment for table columns (positive & negative). |
|
|
68
82
|
|
|
69
83
|
### Data Sources (optional overrides)
|
|
70
84
|
| Setting | Description |
|
|
71
85
|
|---------|-------------|
|
|
72
86
|
| Heading Source | Force a specific source for navigation.headingTrue. |
|
|
73
87
|
| Boat Speed Source | Force a specific source for navigation.speedThroughWater. |
|
|
74
|
-
| Course over ground (COG Source) | Source for navigation.courseOverGroundTrue. |
|
|
75
88
|
| Ground Speed Source (SOG Source) | Source for navigation.speedOverGround. |
|
|
76
89
|
| Attitude Source | Source for navigation.attitude (roll/heel). |
|
|
77
90
|
|
|
78
|
-
|
|
91
|
+
Leave a source blank or set to *(any)* to accept values from all sources. If multiple sources exist for a path, you can also set source priorities in the Signal K Server settings (under data sources).
|
|
79
92
|
|
|
80
93
|
### Output Behavior
|
|
81
94
|
| Setting | Default | Description | Notes |
|
|
82
95
|
|---------|---------|-------------|-------|
|
|
83
|
-
| Prevent duplication of boat speed |
|
|
96
|
+
| Prevent duplication of boat speed | On | Overwrites navigation.speedThroughWater with corrected value. | Disable to compare raw vs corrected via distinct source attributes under the same path. |
|
|
97
|
+
| SOG fallback | Off | Copy navigation.speedOverGround (GPS) to navigation.speedThroughWater (Paddle wheel) if paddle wheel malfunction is detected. | SOG fallback activates when navigation.speedThroughWater = 0 and navigation.speedOverGround > treshold.|
|
|
84
98
|
|
|
85
99
|
### Tips
|
|
86
|
-
1. Be patient with the correction table. Its corrections will improve over time.
|
|
100
|
+
1. Be patient with the correction table. Its corrections will improve over time.
|
|
87
101
|
2. Once corrections stabilize, raise Stability to lock in values.
|
|
88
102
|
3. Freeze learning (disable Update Correction Table) before performance-sensitive events (e.g., racing) or in unstable conditions (waves, currents).
|
|
89
103
|
4. After paddle wheel cleaning or if fouling suspected: temporarily LOWER Stability (e.g., from 7 → 5) to let corrections adapt, then raise again; do not rebuild unless the grid itself must change.
|
|
90
104
|
5. The plugin will always estimate currents when Estimate boat speed is enabled. Even when Assume currents is disabled, as this setting is only used in updating the correction table.
|
|
91
105
|
|
|
92
106
|
## Persistence & Data Storage
|
|
93
|
-
|
|
107
|
+
Each correction table is saved as a `.json` file in Signal K's plugin data directory (typically `~/.signalk/plugin-config-data/speedandcurrent/`). The active table name is stored in the plugin options and reloaded automatically on restart. While learning is active, the table is written to disk approximately every 5 seconds.
|
|
94
108
|
|
|
95
109
|
Safety & backup:
|
|
96
|
-
-
|
|
110
|
+
- Tables can be copied to a new name with the **Copy** button before experimenting.
|
|
111
|
+
- The data directory can be backed up directly; each table is a self-contained `.json` file.
|
|
97
112
|
|
|
98
113
|
## Experimental Note
|
|
99
|
-
The "Assume Current" option is experimental. It works best on a stable correction table as it takes time for the plugin to properly distinguish currents from paddle wheel
|
|
114
|
+
The "Assume Current" option is experimental. It works best on a stable correction table as it takes time for the plugin to properly distinguish currents from paddle wheel errors.
|
|
100
115
|
|
|
101
116
|
## WebApp Usage Guide
|
|
102
117
|
Open via Signal K Server: Apps → Speed and current.
|
|
103
118
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
-
|
|
138
|
-
-
|
|
119
|
+
The webapp has a collapsible sidebar with four sections, and a status message in the top-right of the nav bar (blue = stabilizing, amber = SOG fallback active, red = error or stopped).
|
|
120
|
+
|
|
121
|
+
### Inputs
|
|
122
|
+
The **Inputs** section contains two sub-sections:
|
|
123
|
+
- **Signal K Sources**: Drop-downs to pin specific Signal K sources for heading, boat speed, SOG, and attitude. Leave blank to accept any source.
|
|
124
|
+
- **Live Values**: Real-time display of the raw sensor values being fed into the plugin.
|
|
125
|
+
|
|
126
|
+
### Boatspeed Estimation
|
|
127
|
+
The **Boatspeed Estimation** section has an On/Off toggle at the top of the card and contains:
|
|
128
|
+
- **Settings**: `SOG fallback` and `Prevent duplication of boat speed`.
|
|
129
|
+
- **Inputs**: The raw signal values used for correction (heading, raw STW, SOG, attitude).
|
|
130
|
+
- **Intermediates**: Internally derived quantities such as the correction vector and leeway.
|
|
131
|
+
- **Outputs**: Corrected STW, leeway angle, and estimated current.
|
|
132
|
+
|
|
133
|
+
### Correction Table Learning
|
|
134
|
+
The **Correction Table Learning** section has an On/Off toggle and contains:
|
|
135
|
+
- **Settings**: Stability, Assume Current, and Show Statistics (σ display toggle).
|
|
136
|
+
- **Smoother**: Type selector (Moving average / Exponential / Kalman) and its single tuning parameter. Only the parameter relevant to the selected smoother is shown.
|
|
137
|
+
- **Inputs**: Smoothed values fed into the learning algorithm. When Show Statistics is on, σ values are shown.
|
|
138
|
+
- **Intermediates**: Derived observations used to update correction table cells.
|
|
139
|
+
|
|
140
|
+
### Correction Table
|
|
141
|
+
The **Correction Table** section shows the current correction table grid. Table management buttons appear top-right:
|
|
142
|
+
- **New** — create a new table, setting its name and grid dimensions.
|
|
143
|
+
- **Load** — switch to a previously saved table.
|
|
144
|
+
- **Copy** — duplicate the current table under a new name.
|
|
145
|
+
- **Resize** — resize the grid (existing cells are mapped to the new grid; some data may be lost).
|
|
146
|
+
|
|
147
|
+
Each populated cell shows:
|
|
148
|
+
- **Factor** (±%): how much the paddle wheel over- or under-reads at this speed and heel (green = reads slow, orange = reads fast).
|
|
149
|
+
- **Leeway** (°): the estimated sideways drift angle at this speed and heel.
|
|
150
|
+
|
|
151
|
+
Cell highlighting:
|
|
152
|
+
- **Bold border**: the most recently updated table cell.
|
|
153
|
+
- **Faint blue tint**: cells contributing to the current interpolation. Deeper = higher weight.
|
|
154
|
+
- **No content**: not yet populated by learning.
|
|
139
155
|
|
|
140
156
|
### Correction Table Health Checklist
|
|
141
|
-
- Leeway ≈ 0 at zero heel; increases logically with heel. Non
|
|
142
|
-
-
|
|
143
|
-
- Port / starboard symmetry: similar magnitudes at ± matching heel angles. Large asymmetry can indicate paddle wheel
|
|
157
|
+
- Leeway ≈ 0 at zero heel; increases logically with heel. Non-zero leeway at zero heel may indicate a heading offset.
|
|
158
|
+
- Speed corrections should trend consistently with adjacent cells (direction & magnitude smooth across the table).
|
|
159
|
+
- Port / starboard symmetry: similar magnitudes at ± matching heel angles. Large asymmetry can indicate a paddle wheel mounting offset.
|
|
160
|
+
|
|
161
|
+
### Interpreting Live Values
|
|
162
|
+
- **Corrected Speed vs Raw**: Stable, plausible separation between the two indicates the table is working.
|
|
163
|
+
- **Corrected speed** includes leeway and therefore is not aligned with the ship's axis.
|
|
164
|
+
- **Residual**: Remaining ground-speed discrepancy after applying corrected STW and estimated current. Should trend toward small values as learning progresses.
|
|
165
|
+
- **Trace**: Uncertainty indicator derived from internal variance (higher = less reliable). Shown alongside most values.
|
|
144
166
|
|
|
145
167
|
|
|
146
168
|
|
package/correctionTable.js
CHANGED
|
@@ -28,7 +28,7 @@ class CorrectionTable extends Table2D{
|
|
|
28
28
|
* @returns {CorrectionTable}
|
|
29
29
|
*/
|
|
30
30
|
static resample(oldTable, newRow, newCol, stability = 5, varianceFloor = 1e-4) {
|
|
31
|
-
const newTable = new CorrectionTable(
|
|
31
|
+
const newTable = new CorrectionTable(oldTable.id, newRow, newCol, stability);
|
|
32
32
|
|
|
33
33
|
const nRows = Math.round((newRow.max - newRow.min) / newRow.step) + 1;
|
|
34
34
|
const nCols = Math.round((newCol.max - newCol.min) / newCol.step) + 1;
|