|
5 | 5 |
|
6 | 6 | The _Course API_ provides common course operations under the path `/signalk/v2/api/vessels/self/navigation/course` ensuring that all related Signal K data model values are maintained and consistent. This provides a set of data that can be confidently used for _course calculations_ and _autopilot operation_.
|
7 | 7 |
|
| 8 | +Additionally, the Course API persists course information on the server to ensure data is not lost in the event of a server restart. |
| 9 | + |
8 | 10 | Client applications use `HTTP` requests (`PUT`, `GET`,`DELETE`) to perform operations and retrieve course data.
|
9 | 11 |
|
10 |
| -Additionally, the Course API persists course information on the server to ensure data is not lost in the event of a server restart. |
| 12 | +The Course API also listens for destination information in the NMEA stream and will set / clear the destination accordingly _(e.g. NMEA0183 RMB sentence, NMEA2000 PGN 129284)_. See [Configuration](#Configuration) for more details. |
11 | 13 |
|
12 | 14 | _Note: You can view the _Course API_ OpenAPI definition in the Admin UI (Documentation => OpenApi)._
|
13 | 15 |
|
@@ -125,6 +127,7 @@ HTTP GET 'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course'
|
125 | 127 |
|
126 | 128 | The contents of the response will reflect the operation used to set the current course. The `nextPoint` & `previousPoint` sections will always contain values but `activeRoute` will only contain values when a route is being followed.
|
127 | 129 |
|
| 130 | + |
128 | 131 | #### 1. Operation: Navigate to a location _(lat, lon)_
|
129 | 132 |
|
130 | 133 | _Example response:_
|
@@ -235,19 +238,86 @@ _Example response:_
|
235 | 238 |
|
236 | 239 | ## Cancelling navigation
|
237 | 240 |
|
238 |
| -To cancel the current course navigation and clear the course data |
| 241 | +To cancel the current course navigation and clear the course data. |
239 | 242 |
|
240 | 243 | ```typescript
|
241 |
| -HTTP DELETE 'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/' |
| 244 | +HTTP DELETE 'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course' |
| 245 | +``` |
| 246 | + |
| 247 | +_Note: This operation will NOT change the destination information coming from the NMEA input stream! If the NMEA source device is still emitting destination data this will reappear as the current destination._ |
| 248 | + |
| 249 | +To ignore destination data from NMEA sources see [Configuration](#configuration) below. |
| 250 | + |
| 251 | + |
| 252 | + |
| 253 | +## Configuration |
| 254 | + |
| 255 | +The default configuration of the Course API will accept destination information from both API requests and NMEA stream data sources. |
| 256 | + |
| 257 | +For NMEA sources, Course API monitors the the following Signal K paths populated by both the `nmea0183-to-signalk` and `n2k-to-signalk` plugins: |
| 258 | +- _navigation.courseRhumbline.nextPoint.position_ |
| 259 | +- _navigation.courseGreatCircle.nextPoint.position_ |
| 260 | + |
| 261 | +HTTP requests are prioritised over NMEA data sources, so making an API request will overwrite the destination information received from and NMEA source. |
| 262 | + |
| 263 | +Note: when the destination cleared using an API request, if the NMEA stream is emitting an active destination position, this will then be used by the Course API to populate course data. |
| 264 | + |
| 265 | + |
| 266 | +#### Ignoring NMEA Destination Information |
| 267 | + |
| 268 | +The Course API can be configured to ignore destination data in the NMEA stream by enabling `apiOnly` mode. |
| 269 | + |
| 270 | +In `apiOnly` mode destination information can only be set / cleared using HTTP API requests. |
| 271 | + |
| 272 | +- **`apiOnly` Mode = Off _(default)_** |
| 273 | + |
| 274 | + - Destination data is accepted from both _HTTP API_ and _NMEA_ sources |
| 275 | + - Setting a destination using the HTTP API will override the destination data received via NMEA |
| 276 | + - When clearing the destination using the HTTP API, if destination data is received via NMEA this will then be used as the active destination. |
| 277 | + - To clear destination sourced via NMEA, clear the destination on the source device. |
| 278 | + |
| 279 | +- **`apiOnly` Mode = On** |
| 280 | + |
| 281 | + - Course operations are only accepted via the HTTP API |
| 282 | + - NMEA stream data is ignored |
| 283 | + - Switching to `apiOnly` mode when an NMEA sourced destination is active will clear the destination. |
| 284 | + |
| 285 | + |
| 286 | +#### Retrieving Course API Configuration |
| 287 | + |
| 288 | +To retrieve the Course API configuration settings, submit a HTTP `GET` request to `/signalk/v2/api/vessels/self/navigation/course/_config`. |
| 289 | + |
| 290 | +```typescript |
| 291 | +HTTP GET 'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/_config' |
| 292 | +``` |
| 293 | + |
| 294 | +_Example response:_ |
| 295 | +```JSON |
| 296 | +{ |
| 297 | + "apiOnly": false |
| 298 | +} |
| 299 | +``` |
| 300 | + |
| 301 | +#### Enable / Disable `apiOnly` mode |
| 302 | + |
| 303 | +To enable `apiOnly` mode, submit a HTTP `POST` request to `/signalk/v2/api/vessels/self/navigation/course/_config/apiOnly`. |
| 304 | + |
| 305 | +_Enable apiOnly mode:_ |
| 306 | +```typescript |
| 307 | +HTTP POST 'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/_config/apiOnly' |
| 308 | +``` |
| 309 | + |
| 310 | +To disable `apiOnly` mode, submit a HTTP `DELETE` request to `/signalk/v2/api/vessels/self/navigation/course/_config/apiOnly`. |
| 311 | + |
| 312 | +_Disable apiOnly mode:_ |
| 313 | +```typescript |
| 314 | +HTTP DELETE 'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/_config/apiOnly' |
242 | 315 | ```
|
243 | 316 |
|
244 |
| ---- |
245 | 317 |
|
246 | 318 | ## Course Calculations
|
247 | 319 |
|
248 | 320 | Whilst not performing course calculations, the _Course API_ defines the paths to accommodate the values calculated during course navigation.
|
249 | 321 |
|
250 | 322 | Click [here](./course_calculations.md) for details.
|
251 | 323 |
|
252 |
| - |
253 |
| - |
|
0 commit comments