RFC: depth transducer offsets: one sign convention, transducer position, server-derived depths
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 10/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript, typescript
- Domain
- data, documentation
Research direction
This is a design RFC, not a bug to fix, so start by reading the Part 1 sign-convention table and the GNSS body-frame offsets the issue refers to in the specification repo. The open decisions are the sign convention for transducerToKeel, the new sensors.<id>.fromWaterline and sensorType values, and the .derived rules. Done means maintainers have agreed these points in the thread, not that a change has been written. Discuss the proposal there before proposing any wording.
Written by the indexing model from the issue text.
Description
Summary
A depth transducer measures depth below itself. People navigate by depth below the keel or below the surface. Getting from one to the other needs the transducer's position relative to the waterline and the keel. Signal K has paths for all of these values, but:
- The spec does not say which sign
transducerToKeelhas, and implementations disagree. - A transducer carries only one offset, so the bus delivers at most two of the three depths, and which two depends on how the transducer was set up.
- There is nowhere to say where a transducer sits, or which
$sourceit is, the waysensors.<id>now does for GNSS antennas.
Proposed:
- Part 1 (clarification):
transducerToKeelandsurfaceToTransducerare non-negative distances. Converters translate the signed NMEA offset. - Part 2 (additive): a depth transducer is a
sensors.<id>entry withsensorType: "depth"(antennas use"gnss"). It uses the existingfromBow/fromCenter, plus a newsensors.<id>.fromWaterline(+ve down). - Part 3 (server behaviour): a server may derive
belowSurfaceandbelowKeelper transducer and publish them under<$source>.derived, next to the untouched raw source.
No new depth paths are needed.
Part 1: sign of transducerToKeel
NMEA 0183 DPT and NMEA 2000 PGN 128267 carry one signed offset. canboat describes it as "Distance between transducer and surface (positive) or keel (negative)". Implementations map it onto the two Signal K paths differently:
| Implementation | transducerToKeel for a keel 1.0 m below the transducer |
How it is used |
|---|---|---|
nmea0183-signalk (src/hooks/DPT.ts) |
+1.0 | publishes -offset |
n2k-signalk (pgns/128267.js) |
-1.0 | passes the offset through; SignalK/n2k-signalk#362 changes it to +1.0 |
signalk-derived-data (depthBelowKeel2) |
expects + | belowKeel = belowTransducer - transducerToKeel |
signalk-to-nmea0183 (DPT.ts) |
either | writes -Math.abs(transducerToKeel) |
| @sailingnaturali/signalk-depth-offsets | expects - | belowKeel = belowTransducer + transducerToKeel, documented as the canonical convention |
The same transducer gives +1 over NMEA 0183 and -1 over NMEA 2000, and any consumer is wrong for one of the two.
Proposal: both paths are non-negative distances, which matches the existing wording ("depth from the transducer to the bottom of the keel"), nmea0183-signalk and derived-data. A positive NMEA offset becomes surfaceToTransducer, a negative one becomes transducerToKeel as its absolute value. This is breaking for n2k-signalk's current output and for consumers that assume the negative value, such as signalk-depth-offsets (cc @clarkbw). Consumers can stay compatible with both during the transition by reading the magnitude.
Part 2: where a transducer sits
sensors.<id>.fromWaterline: vertical distance from the design waterline, +ve down. It completes the body frame the spec documents for GNSS offsets (x forward, y starboard, z down), so a transducer is positive and an antenna negative. sensors.<id>.sensorType gets documented values gnss and depth. Several transducers can be described, each linked to its data by sensors.<id>.$source; a value on environment.depth.* from that source was measured at that position.
Part 3: server-derived depths
A server may publish belowSurface and belowKeel per transducer under <$source>.derived, with the raw value's timestamp, next to the untouched raw source, in the same way as <id>.ccrp for GNSS. Consumers choose with source priorities, which keeps raw and calibrated data apart by source.
- The transducer's depth below the waterline comes, in order, from the
surfaceToTransducerit sends, from the draft minus thetransducerToKeelit sends, or from the configuredfromWaterline. - A path the transducer sends itself is not derived.
- With a missing or stale input the server publishes nothing rather than assume an offset of 0, and a derived value goes null or times out with its input.
Real case: an Airmar DST810 with a keel offset of -1.000 m, 0.70 m below the waterline, draft 1.7 m. The bus carries belowTransducer 13.08 and belowKeel 12.08 and no surface reference. A Furuno display on the same bus applied the transducer's -1.0 and its own +0.7 and showed 12.8 m, while the depth below the surface was 13.78 m. With derivation the server adds belowSurface 13.78.
Implementation
- Spec change: dirkwa/specification
feat-depth-sensor-geometry(PR to follow, linked here) - n2k-signalk sign: SignalK/n2k-signalk#362
- Server derivation from device offsets: SignalK/signalk-server PR (link)
- Next: depth sensor configuration in the server (
/signalk/v2/api/vessels/self/sensors/depth, next to/gnss) forfromWaterline, for transducers that send no offset
Related
- SignalK/signalk-server#2729: offsets as data paths, raw vs calibrated by source
- SignalK/specification#76: derived values in
environment.depth
- Dominant language
- JavaScript
- Stars
- 105
- Forks
- 72
- Avg merge
- 11h 49m
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SignalK/specification
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
SignalK/specification#700 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
SignalK/specification#694 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 54/100
SignalK/specification#691 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
SignalK/specification#685 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
SignalK/specification#681 ·
All issues in SignalK/specification
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 83/100
TheOdinProject/curriculum#31596 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mailcow/mailcow-dockerized#7725 ·
Maintainers usually reply within 1 day
-
bug need-fix
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
hoverkraft-tech/ci-github-common#694 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 94/100
solana-foundation/solana-com#2579 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
vercel-labs/agent-skills#385 ·