Skip to content

Complete V2 autopilot provider API (route, dodge, gybe, mode, actions)#63

Open
motamman wants to merge 2 commits intoSignalK:masterfrom
motamman:fix/setTarget-mode
Open

Complete V2 autopilot provider API (route, dodge, gybe, mode, actions)#63
motamman wants to merge 2 commits intoSignalK:masterfrom
motamman:fix/setTarget-mode

Conversation

@motamman
Copy link
Copy Markdown

@motamman motamman commented Mar 21, 2026

Summary

Completes the V2 autopilot provider API by implementing all previously stubbed methods and adding route mode support across all backends.

Route mode

  • Added route as a valid autopilot state in the emulator, Raymarine N2K, and SeaTalk NG backends
  • putAdjustHeading now accepts route mode in all three backends
  • Emulator emits heading target and initializes current heading when entering route mode

Mode and state fixes

  • getMode / setMode now functional — Raymarine/Simrad conflate mode and state, so setMode validates and delegates to putStatePromise
  • setTarget falls back to apData.state when apData.mode is null
  • engage immediately updates apData.state and apData.mode
  • State change handler syncs apData.mode = apData.state

Dodge

  • Full dodge implementation: saves pre-dodge state and target, switches route to auto, decomposes heading adjustments into ±10° and ±1° keystrokes, restores original state/target on cancel

Gybe, tack, and waypoint operations

  • gybe delegates to putTackPromise (Raymarine uses the same keystroke; the pilot decides based on wind angle)
  • courseCurrentPoint engages route mode to steer to the active waypoint
  • courseNextPoint calls putAdvanceWaypoint and advances the SignalK course API point index
  • Emulator putTack and putAdvanceWaypoint now validate state and input instead of returning "Unsupported"

Dynamic actions

  • buildActions() computes available UI actions (tack, gybe, advance waypoint, steer to waypoint, dodge) based on current state and dodge status
  • State changes broadcast updated actions to clients via app.autopilotUpdate

@motamman motamman changed the title fix: V2 API setTarget always returns 500 — apData.mode never populated Complete V2 autopilot provider API (route, dodge, gybe, mode, actions) Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant