speedandcurrent 1.0.0 → 1.1.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 CHANGED
@@ -4,7 +4,15 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
 
7
- ## [0.1.0] - 2025-1-? First version
7
+ ## [1.0.1] - 2025-1-27
8
8
  ### Added
9
9
  - basic functionality to estimate speed, leeway and current using Kalman filters
10
10
  - basic functionality for a webapp that shows what is going on
11
+
12
+ ## [1.1.0] - 2025-8-20
13
+ ### Changed
14
+ - Path names for current. It now is self.environment.current.setTrue and self.environment.current.drift
15
+ ### Fixed
16
+ - Case error in filename that prevented the webapp from displaying the correction table
17
+ - Corrected speed through water is now calculated when the correction table is fixed
18
+
package/README.md CHANGED
@@ -74,12 +74,12 @@ The graphical representation of the speed vectors, current vector, and correctio
74
74
  - A correction table stores speed errors for steps in speed and heel angle.
75
75
  - Each cell in the correction table contains a **Kalman filter** that updates speed corrections with new measurements.
76
76
  - The speed measurement is corrected by subtracting the correction from the correction table. The correction is **interpolated** based on nearby table cells, weighted by the uncertainty provided by the Kalman filter.
77
- - ![correction model](correctionModel.png)
77
+ - ![correction model](https://github.com/Asw1n/speedandcurrent/raw/main/correctionModel.png)
78
78
 
79
79
  ### **2. Current Estimation Model**
80
80
  - The water current is estimated as a **slowly changing** vector.
81
81
  - A **Kalman filter** updates the current based on the difference between GPS speed and corrected speed.
82
- - ![current estimation model](currentModel.png)
82
+ - ![current estimation model](https://github.com/Asw1n/speedandcurrent/raw/main/currentModel.png)
83
83
 
84
84
  ---
85
85
 
package/index.js CHANGED
@@ -12,7 +12,7 @@ module.exports = function (app) {
12
12
  let isRunning = false;
13
13
  let corrTable = null;
14
14
  let lastSave = null;
15
- var residual, heading, attitude, boatSpeed, boatSpeedPolar, correctedBoatSpeed, groundSpeed, current, currentDelta, speedCorrection, reporter;
15
+ var residual, heading, attitude, boatSpeed, boatSpeedPolar, correctedBoatSpeed, groundSpeed, current, speedCorrection, reporter;
16
16
 
17
17
 
18
18
  const plugin = {};
@@ -237,8 +237,7 @@ module.exports = function (app) {
237
237
  attitude.subscribe(app, plugin.id, unsubscribes);
238
238
 
239
239
  // current
240
- currentDelta = new DeltaBase("environment.current");
241
- current = new PolarDeltaBase();
240
+ current = new PolarDeltaBase("self.environment.current.drift","self.environment.current.setTrue");
242
241
  current.setDisplayAttributes("current", "ref_ground", "current");
243
242
 
244
243
  const currentStat = new PolarStat(current);
@@ -370,14 +369,8 @@ module.exports = function (app) {
370
369
 
371
370
 
372
371
  // Send calculated delta's
373
- if (options.estimateCurrent) {
374
- // translate current into signalK data structure
375
- const c = current.getPValue();
376
- const cc = { drift: current.speed, setTrue: current.angle, setMagnetic: (current.angle - variance.value + Math.PI) % (2 * Math.PI) - Math.PI };
377
- currentDelta.setValue(cc);
378
- DeltaBase.sendDeltas(app, plugin.id, [currentDelta]);
379
- }
380
- if (options.estimateBoatSpeed) PolarDeltaBase.sendDeltas(app, plugin.id, [correctedBoatSpeed]);
372
+ if (options.estimateCurrent) PolarDeltaBase.sendDeltas(app, plugin.id, [current]);
373
+ if (options.estimateBoatSpeed) PolarDeltaBase.sendDeltas(app, plugin.id, [correctedBoatSpeed]);
381
374
 
382
375
  // Save correction table
383
376
  // periodically
@@ -535,7 +528,7 @@ module.exports = function (app) {
535
528
  // locked table
536
529
  options.doStartFresh = false;
537
530
  options.updateCorrectionTable = false;
538
- options.estimateBoatSpeed = false;
531
+ options.estimateBoatSpeed = true;
539
532
  options.assumeCurrent = true;
540
533
  options.estimateCurrent = true;
541
534
  options.currentStability = 2;
@@ -576,7 +569,6 @@ module.exports = function (app) {
576
569
  correctedBoatSpeed = null;
577
570
  groundSpeed = null;
578
571
  current = null;
579
- currentDelta = null;
580
572
  speedCorrection = null;
581
573
  reporter = null;
582
574
  isRunning = false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "speedandcurrent",
3
- "version": "1.0.0",
4
- "description": "An experimental plugin that uses sensor fusion to get boat speed, current and leeway.",
3
+ "version": "1.1.0",
4
+ "description": "A plugin that automatically corrects boat speed and calculates current and leeway using sensor fusion.",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
package/public/app.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const API_BASE_URL = "/plugins/speedandcurrent"; // Adjust based on your server configuration
2
- import TableRenderer from './tableRenderer.js';
2
+ import TableRenderer from './TableRenderer.js';
3
3
 
4
4
 
5
5
  let updateInterval = 1000;