signalk-server
Version:
An implementation of a [Signal K](http://signalk.org) server for boats.
147 lines (127 loc) • 37.2 kB
HTML
<html class="default" lang="en" data-base="../../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Course API | Signal K</title><meta name="description" content="Documentation for Signal K"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../../assets/style.css?cache=1767726585343"/><link rel="stylesheet" href="../../assets/highlight.css?cache=1767726585343"/><script defer src="../../assets/main.js?cache=1767726585343"></script><script async src="../../assets/icons.js?cache=1767726585343" id="tsd-icons-script"></script><script async src="../../assets/search.js?cache=1767726585343" id="tsd-search-script"></script><script async src="../../assets/navigation.js?cache=1767726585343" id="tsd-nav-script"></script><script async src="../../assets/hierarchy.js?cache=1767726585343" id="tsd-hierarchy-script"></script><link rel="stylesheet" href="../../assets/theme.css"/></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../../index.html" class="title"><img src="../../assets/logo.svg" alt="Signal K"/></a><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../../assets/icons.svg#icon-search"></use></svg><span class="visible@s">Search</span></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><div id="tsd-toolbar-links"><a href="https://discord.gg/uuZrwz4dCS" target="_blank" rel="noopener" class="toolbar-icon visible@s" aria-label="Discord"><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M524.5 69.8a1.5 1.5 0 0 0 -.8-.7A485.1 485.1 0 0 0 404.1 32a1.8 1.8 0 0 0 -1.9 .9 337.5 337.5 0 0 0 -14.9 30.6 447.8 447.8 0 0 0 -134.4 0 309.5 309.5 0 0 0 -15.1-30.6 1.9 1.9 0 0 0 -1.9-.9A483.7 483.7 0 0 0 116.1 69.1a1.7 1.7 0 0 0 -.8 .7C39.1 183.7 18.2 294.7 28.4 404.4a2 2 0 0 0 .8 1.4A487.7 487.7 0 0 0 176 479.9a1.9 1.9 0 0 0 2.1-.7A348.2 348.2 0 0 0 208.1 430.4a1.9 1.9 0 0 0 -1-2.6 321.2 321.2 0 0 1 -45.9-21.9 1.9 1.9 0 0 1 -.2-3.1c3.1-2.3 6.2-4.7 9.1-7.1a1.8 1.8 0 0 1 1.9-.3c96.2 43.9 200.4 43.9 295.5 0a1.8 1.8 0 0 1 1.9 .2c2.9 2.4 6 4.9 9.1 7.2a1.9 1.9 0 0 1 -.2 3.1 301.4 301.4 0 0 1 -45.9 21.8 1.9 1.9 0 0 0 -1 2.6 391.1 391.1 0 0 0 30 48.8 1.9 1.9 0 0 0 2.1 .7A486 486 0 0 0 610.7 405.7a1.9 1.9 0 0 0 .8-1.4C623.7 277.6 590.9 167.5 524.5 69.8zM222.5 337.6c-29 0-52.8-26.6-52.8-59.2S193.1 219.1 222.5 219.1c29.7 0 53.3 26.8 52.8 59.2C275.3 311 251.9 337.6 222.5 337.6zm195.4 0c-29 0-52.8-26.6-52.8-59.2S388.4 219.1 417.9 219.1c29.7 0 53.3 26.8 52.8 59.2C470.7 311 447.5 337.6 417.9 337.6z"></path></svg></a><a href="https://github.com/SignalK/signalk-server" target="_blank" rel="noopener" class="toolbar-icon visible@s" aria-label="Discord"><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3 .3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5 .3-6.2 2.3zm44.2-1.7c-2.9 .7-4.9 2.6-4.6 4.9 .3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3 .7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3 .3 2.9 2.3 3.9 1.6 1 3.6 .7 4.3-.7 .7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3 .7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3 .7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"></path></svg></a><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="../../Developing.html">Developing</a></li><li><a href="../REST_APIs.html">REST APIs</a></li><li><a href="" aria-current="page">Course API</a></li></ul></div><div class="tsd-panel tsd-typography"><h1 id="course-api" class="tsd-anchor-link">Course API<a href="#course-api" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h1><p>The <em>Course API</em> provides common course operations under the path <code>/signalk/v2/api/vessels/self/navigation/course</code> 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 <em>course calculations</em> and <em>autopilot operation</em>.</p>
<p>Additionally, the Course API persists course information on the server to ensure data is not lost in the event of a server restart.</p>
<p>Client applications use <code>HTTP</code> requests (<code>PUT</code>, <code>GET</code>,<code>DELETE</code>) to perform operations and retrieve course data.</p>
<p>The Course API also listens for destination information in the NMEA stream and will set / clear the destination accordingly <em>(e.g. NMEA0183 RMB sentence, NMEA2000 PGN 129284)</em>. See <a href="#Configuration">Configuration</a> for more details.</p>
<p><em>Note: You can view the _Course API</em> OpenAPI definition in the Admin UI (Documentation => OpenApi)._</p>
<hr>
<h2 id="setting-a-course" class="tsd-anchor-link">Setting a Course<a href="#setting-a-course" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>The Course API provides endpoints for:</p>
<ol>
<li>Navigate to a location <em>(lat, lon)</em></li>
<li>Navigate to a waypoint <em>(href to waypoint resource)</em></li>
<li>Follow a Route <em>(href to a route resource)</em>.</li>
</ol>
<h3 id="1-navigate-to-a-location" class="tsd-anchor-link">1. Navigate to a Location<a href="#1-navigate-to-a-location" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>To navigate to a point submit a HTTP <code>PUT</code> request to <code>/signalk/v2/api/vessels/self/navigation/course/destination</code> and supply the latitude & longitude of the destination point.</p>
<pre><code class="typescript"><span class="hl-2">HTTP</span><span class="hl-0"> </span><span class="hl-2">PUT</span><span class="hl-0"> </span><span class="hl-4">'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/destination'</span><span class="hl-0"> {</span><span class="hl-4">"position"</span><span class="hl-0">: {</span><span class="hl-4">"latitude"</span><span class="hl-0">: </span><span class="hl-1">-</span><span class="hl-2">60.5</span><span class="hl-0">, </span><span class="hl-4">"longitude"</span><span class="hl-0">: </span><span class="hl-1">-</span><span class="hl-2">166.7</span><span class="hl-0">}}</span>
</code><button type="button">Copy</button></pre>
<h3 id="2-navigate-to-a-waypoint" class="tsd-anchor-link">2. Navigate to a Waypoint<a href="#2-navigate-to-a-waypoint" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>To navigate to a point submit a HTTP <code>PUT</code> request to <code>/signalk/v2/api/vessels/self/navigation/course/destination</code> and supply a reference to a waypoint resource entry under <code>/resources/waypoints</code></p>
<pre><code class="typescript"><span class="hl-2">HTTP</span><span class="hl-0"> </span><span class="hl-2">PUT</span><span class="hl-0"> </span><span class="hl-4">'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/destination'</span><span class="hl-0"> {</span><span class="hl-4">"href"</span><span class="hl-0">: </span><span class="hl-4">"/resources/waypoints/5242d307-fbe8-4c65-9059-1f9df1ee126f"</span><span class="hl-0">}</span>
</code><button type="button">Copy</button></pre>
<h3 id="3-follow-a-route" class="tsd-anchor-link">3. Follow a Route<a href="#3-follow-a-route" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>To follow a route submit a HTTP <code>PUT</code> request to <code>/signalk/v2/api/vessels/self/navigation/course/activeRoute</code> and supply a reference to a route resource entry under <code>/resources/routes</code>.</p>
<pre><code class="typescript"><span class="hl-2">HTTP</span><span class="hl-0"> </span><span class="hl-2">PUT</span><span class="hl-0"> </span><span class="hl-4">'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/activeRoute'</span><span class="hl-0"> {</span><span class="hl-4">"href"</span><span class="hl-0">: </span><span class="hl-4">"/resources/routes/5242d307-fbe8-4c65-9059-1f9df1ee126f"</span><span class="hl-0">}</span>
</code><button type="button">Copy</button></pre>
<p>Additional parameters can be set when following a route including:</p>
<ul>
<li>Defining the point along the route to start at</li>
<li>The direction to follow the route (forward / reverse)</li>
</ul>
<p><em>Example: Following a route in reverse direction:</em></p>
<pre><code class="typescript"><span class="hl-2">HTTP</span><span class="hl-0"> </span><span class="hl-2">PUT</span><span class="hl-0"> </span><span class="hl-4">'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/activeRoute'</span><br/><span class="hl-0">{</span><br/><span class="hl-0"> </span><span class="hl-4">"href"</span><span class="hl-0">: </span><span class="hl-4">"/resources/routes/5242d307-fbe8-4c65-9059-1f9df1ee126f"</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-4">"reverse"</span><span class="hl-0">: </span><span class="hl-2">true</span><br/><span class="hl-0">}</span>
</code><button type="button">Copy</button></pre>
<h4 id="advancing-along-a-route" class="tsd-anchor-link">Advancing along a Route<a href="#advancing-along-a-route" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>As progress along a route is made, you can use the following endpoints to update the destination.</p>
<p>To set the destination to the next point along the route:</p>
<pre><code class="typescript"><span class="hl-2">HTTP</span><span class="hl-0"> </span><span class="hl-2">PUT</span><span class="hl-0"> </span><span class="hl-4">'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/activeRoute/nextPoint'</span>
</code><button type="button">Copy</button></pre>
<p>To advance the destination to a point <code>n</code> places beyond the current destination point, supply a positive number representing the number of points to advance:</p>
<pre><code class="typescript"><span class="hl-2">HTTP</span><span class="hl-0"> </span><span class="hl-2">PUT</span><span class="hl-0"> </span><span class="hl-4">'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/activeRoute/nextPoint'</span><span class="hl-0"> {</span><span class="hl-4">"value"</span><span class="hl-0">: </span><span class="hl-2">2</span><span class="hl-0">}</span>
</code><button type="button">Copy</button></pre>
<p><em>Sets destination to the point after the next in sequence.</em></p>
<p>To set the destination to the previous point along the route:</p>
<pre><code class="typescript"><span class="hl-2">HTTP</span><span class="hl-0"> </span><span class="hl-2">PUT</span><span class="hl-0"> </span><span class="hl-4">'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/activeRoute/nextPoint'</span><span class="hl-0"> {</span><span class="hl-4">"value"</span><span class="hl-0">: </span><span class="hl-1">-</span><span class="hl-2">1</span><span class="hl-0">}</span>
</code><button type="button">Copy</button></pre>
<p>To set the destination to a point <code>n</code> places prior the current destination point, supply a negative number representing the number of points prior:</p>
<pre><code class="typescript"><span class="hl-2">HTTP</span><span class="hl-0"> </span><span class="hl-2">PUT</span><span class="hl-0"> </span><span class="hl-4">'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/activeRoute/nextPoint'</span><span class="hl-0"> {</span><span class="hl-4">"value"</span><span class="hl-0">: </span><span class="hl-1">-</span><span class="hl-2">2</span><span class="hl-0">}</span>
</code><button type="button">Copy</button></pre>
<p><em>Sets destination to the point two prior to the current destination.</em></p>
<p>To set the destination to a specific point along the route, supply the zero-based index of the point:</p>
<p><em>Example: 4th point along the route.</em></p>
<pre><code class="typescript"><span class="hl-2">HTTP</span><span class="hl-0"> </span><span class="hl-2">PUT</span><span class="hl-0"> </span><span class="hl-4">'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/activeRoute/pointIndex'</span><span class="hl-0"> {</span><span class="hl-4">"value"</span><span class="hl-0">: </span><span class="hl-2">3</span><span class="hl-0">}</span>
</code><button type="button">Copy</button></pre>
<p><em>Value contains the 'zero-based' index of the point along the route (i.e. 0 = 1st point, 1 = 2nd point, etc.)</em></p>
<p>To reverse the direction along the route:</p>
<pre><code class="typescript"><span class="hl-2">HTTP</span><span class="hl-0"> </span><span class="hl-2">PUT</span><span class="hl-0"> </span><span class="hl-4">'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/activeRoute/reverse'</span>
</code><button type="button">Copy</button></pre>
<h4 id="delta-messages" class="tsd-anchor-link">Delta Messages<a href="#delta-messages" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>The Course API emits delta messages with the following paths when course information has been changed.</p>
<p><em>Note: Delta values reflect the relevant property of the Course Information data object as detailed in the
<a href="#retrieving-course-information">Retrieving Course Information</a> section.</em></p>
<ul>
<li><code>navigation.course.startTime</code></li>
<li><code>navigation.course.targetArrivalTime</code></li>
<li><code>navigation.course.arrivalCircle</code></li>
<li><code>navigation.course.activeRoute</code></li>
<li><code>navigation.course.nextPoint</code></li>
<li><code>navigation.course.previousPoint</code></li>
</ul>
<h2 id="retrieving-course-information" class="tsd-anchor-link">Retrieving Course Information<a href="#retrieving-course-information" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Course information is retrieved by submitting a HTTP <code>GET</code> request to <code>/signalk/v2/api/vessels/self/navigation/course</code>.</p>
<pre><code class="typescript"><span class="hl-2">HTTP</span><span class="hl-0"> </span><span class="hl-2">GET</span><span class="hl-0"> </span><span class="hl-4">'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course'</span>
</code><button type="button">Copy</button></pre>
<p>The contents of the response will reflect the operation used to set the current course. The <code>nextPoint</code> & <code>previousPoint</code> sections will always contain values but <code>activeRoute</code> will only contain values when a route is being followed.</p>
<h4 id="1-operation-navigate-to-a-location-lat-lon" class="tsd-anchor-link">1. Operation: Navigate to a location <em>(lat, lon)</em><a href="#1-operation-navigate-to-a-location-lat-lon" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h4><p><em>Example response:</em></p>
<pre><code class="JSON"><span class="hl-0">{</span><br/><span class="hl-0"> </span><span class="hl-3">"startTime"</span><span class="hl-0">: </span><span class="hl-4">"2023-01-27T01:47:39.785Z"</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"targetArrivalTime"</span><span class="hl-0">: </span><span class="hl-4">"2022-06-10T01:29:27.592Z"</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"arrivalCircle"</span><span class="hl-0">: </span><span class="hl-2">4000</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"activeRoute"</span><span class="hl-0">: </span><span class="hl-2">null</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"nextPoint"</span><span class="hl-0">: {</span><br/><span class="hl-0"> </span><span class="hl-3">"type"</span><span class="hl-0">: </span><span class="hl-4">"Location"</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"position"</span><span class="hl-0">: {</span><br/><span class="hl-0"> </span><span class="hl-3">"latitude"</span><span class="hl-0">: </span><span class="hl-2">-34.92084502261776</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"longitude"</span><span class="hl-0">: </span><span class="hl-2">131.54823303222656</span><br/><span class="hl-0"> }</span><br/><span class="hl-0"> },</span><br/><span class="hl-0"> </span><span class="hl-3">"previousPoint"</span><span class="hl-0">: {</span><br/><span class="hl-0"> </span><span class="hl-3">"type"</span><span class="hl-0">:</span><span class="hl-4">"VesselPosition"</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"position"</span><span class="hl-0">: {</span><br/><span class="hl-0"> </span><span class="hl-3">"latitude"</span><span class="hl-0">: </span><span class="hl-2">-34.82084502261776</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"longitude"</span><span class="hl-0">: </span><span class="hl-2">131.04823303222656</span><br/><span class="hl-0"> }</span><br/><span class="hl-0"> }</span><br/><span class="hl-0">}</span>
</code><button type="button">Copy</button></pre>
<h4 id="2-operation-navigate-to-a-waypoint-href-to-waypoint-resource" class="tsd-anchor-link">2. Operation: Navigate to a waypoint <em>(href to waypoint resource)</em><a href="#2-operation-navigate-to-a-waypoint-href-to-waypoint-resource" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h4><p><em>Example response:</em></p>
<pre><code class="JSON"><span class="hl-0">{</span><br/><span class="hl-0"> </span><span class="hl-3">"startTime"</span><span class="hl-0">: </span><span class="hl-4">"2023-01-27T01:47:39.785Z"</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"targetArrivalTime"</span><span class="hl-0">: </span><span class="hl-4">"2022-06-10T01:29:27.592Z"</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"arrivalCircle"</span><span class="hl-0">: </span><span class="hl-2">4000</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"activeRoute"</span><span class="hl-0">: </span><span class="hl-2">null</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"nextPoint"</span><span class="hl-0">: {</span><br/><span class="hl-0"> </span><span class="hl-3">"href"</span><span class="hl-0">: </span><span class="hl-4">"/resources/waypoints/f24d72e4-e04b-47b1-920f-66b78e7b033e"</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"type"</span><span class="hl-0">: </span><span class="hl-4">"Waypoint"</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"position"</span><span class="hl-0">: {</span><br/><span class="hl-0"> </span><span class="hl-3">"latitude"</span><span class="hl-0">: </span><span class="hl-2">-34.92084502261776</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"longitude"</span><span class="hl-0">: </span><span class="hl-2">131.54823303222656</span><br/><span class="hl-0"> }</span><br/><span class="hl-0"> },</span><br/><span class="hl-0"> </span><span class="hl-3">"previousPoint"</span><span class="hl-0">: {</span><br/><span class="hl-0"> </span><span class="hl-3">"type"</span><span class="hl-0">:</span><span class="hl-4">"VesselPosition"</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"position"</span><span class="hl-0">: {</span><br/><span class="hl-0"> </span><span class="hl-3">"latitude"</span><span class="hl-0">: </span><span class="hl-2">-34.82084502261776</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"longitude"</span><span class="hl-0">: </span><span class="hl-2">131.04823303222656</span><br/><span class="hl-0"> }</span><br/><span class="hl-0"> }</span><br/><span class="hl-0">}</span>
</code><button type="button">Copy</button></pre>
<h4 id="3-operation-follow-a-route-href-to-a-route-resource" class="tsd-anchor-link">3. Operation: Follow a Route <em>(href to a route resource)</em>.<a href="#3-operation-follow-a-route-href-to-a-route-resource" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h4><p><em>Example response:</em></p>
<pre><code class="JSON"><span class="hl-0">{</span><br/><span class="hl-0"> </span><span class="hl-3">"startTime"</span><span class="hl-0">: </span><span class="hl-4">"2023-01-27T01:47:39.785Z"</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"targetArrivalTime"</span><span class="hl-0">: </span><span class="hl-4">"2022-06-10T01:29:27.592Z"</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"arrivalCircle"</span><span class="hl-0">: </span><span class="hl-2">1000</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"activeRoute"</span><span class="hl-0">: {</span><br/><span class="hl-0"> </span><span class="hl-3">"href"</span><span class="hl-0">: </span><span class="hl-4">"/resources/routes/e24d72e4-e04b-47b1-920f-66b78e7b0331"</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"pointIndex"</span><span class="hl-0">: </span><span class="hl-2">0</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"pointTotal"</span><span class="hl-0">: </span><span class="hl-2">5</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"reverse"</span><span class="hl-0">: </span><span class="hl-2">false</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"name"</span><span class="hl-0">: </span><span class="hl-4">"my route"</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"waypoints"</span><span class="hl-0">: [</span><br/><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-3">"latitude"</span><span class="hl-0">: </span><span class="hl-2">-34.92084502261776</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"longitude"</span><span class="hl-0">: </span><span class="hl-2">131.54823303222656</span><br/><span class="hl-0"> },</span><br/><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-3">"latitude"</span><span class="hl-0">: </span><span class="hl-2">-34.86621482446046</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"longitude"</span><span class="hl-0">: </span><span class="hl-2">132.10166931152344</span><span class="hl-0">,</span><br/><span class="hl-0"> },</span><br/><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-3">"latitude"</span><span class="hl-0">: </span><span class="hl-2">-34.6309479733581</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"longitude"</span><span class="hl-0">: </span><span class="hl-2">132.23350524902344</span><br/><span class="hl-0"> },</span><br/><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-3">"latitude"</span><span class="hl-0">: </span><span class="hl-2">-34.63546778783319</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"longitude"</span><span class="hl-0">: </span><span class="hl-2">131.8867492675781</span><br/><span class="hl-0"> },</span><br/><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-3">"latitude"</span><span class="hl-0">: </span><span class="hl-2">-34.71000915922492</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"longitude"</span><span class="hl-0">: </span><span class="hl-2">131.82289123535156</span><br/><span class="hl-0"> }</span><br/><span class="hl-0"> ]</span><br/><span class="hl-0"> },</span><br/><span class="hl-0"> </span><span class="hl-3">"nextPoint"</span><span class="hl-0">: {</span><br/><span class="hl-0"> </span><span class="hl-3">"type"</span><span class="hl-0">: </span><span class="hl-4">"RoutePoint"</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"position"</span><span class="hl-0">: {</span><br/><span class="hl-0"> </span><span class="hl-3">"latitude"</span><span class="hl-0">: </span><span class="hl-2">-34.92084502261776</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"longitude"</span><span class="hl-0">: </span><span class="hl-2">131.54823303222656</span><br/><span class="hl-0"> }</span><br/><span class="hl-0"> },</span><br/><span class="hl-0"> </span><span class="hl-3">"previousPoint"</span><span class="hl-0">: {</span><br/><span class="hl-0"> </span><span class="hl-3">"type"</span><span class="hl-0">:</span><span class="hl-4">"VesselPosition"</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"position"</span><span class="hl-0">: {</span><br/><span class="hl-0"> </span><span class="hl-3">"latitude"</span><span class="hl-0">: </span><span class="hl-2">-34.82084502261776</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-3">"longitude"</span><span class="hl-0">: </span><span class="hl-2">131.04823303222656</span><br/><span class="hl-0"> }</span><br/><span class="hl-0"> }</span><br/><span class="hl-0">}</span>
</code><button type="button">Copy</button></pre>
<h2 id="cancelling-navigation" class="tsd-anchor-link">Cancelling navigation<a href="#cancelling-navigation" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>To cancel the current course navigation and clear the course data.</p>
<pre><code class="typescript"><span class="hl-2">HTTP</span><span class="hl-0"> </span><span class="hl-2">DELETE</span><span class="hl-0"> </span><span class="hl-4">'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course'</span>
</code><button type="button">Copy</button></pre>
<p><em>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.</em></p>
<p>To ignore destination data from NMEA sources see <a href="#configuration">Configuration</a> below.</p>
<h2 id="configuration" class="tsd-anchor-link">Configuration<a href="#configuration" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>The default configuration of the Course API will accept destination information from both API requests and NMEA stream data sources.</p>
<p>For NMEA sources, Course API monitors the the following Signal K paths populated by both the <code>nmea0183-to-signalk</code> and <code>n2k-to-signalk</code> plugins:</p>
<ul>
<li><em>navigation.courseRhumbline.nextPoint.position</em></li>
<li><em>navigation.courseGreatCircle.nextPoint.position</em></li>
</ul>
<p>HTTP requests are prioritised over NMEA data sources, so making an API request will overwrite the destination information received from and NMEA source.</p>
<p>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.</p>
<h4 id="ignoring-nmea-destination-information" class="tsd-anchor-link">Ignoring NMEA Destination Information<a href="#ignoring-nmea-destination-information" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>The Course API can be configured to ignore destination data in the NMEA stream by enabling <code>apiOnly</code> mode.</p>
<p>In <code>apiOnly</code> mode destination information can only be set / cleared using HTTP API requests.</p>
<ul>
<li>
<p><strong><code>apiOnly</code> Mode = Off <em>(default)</em></strong></p>
<ul>
<li>Destination data is accepted from both <em>HTTP API</em> and <em>NMEA</em> sources</li>
<li>Setting a destination using the HTTP API will override the destination data received via NMEA</li>
<li>When clearing the destination using the HTTP API, if destination data is received via NMEA this will then be used as the active destination.</li>
<li>To clear destination sourced via NMEA, clear the destination on the source device.</li>
</ul>
</li>
<li>
<p><strong><code>apiOnly</code> Mode = On</strong></p>
<ul>
<li>Course operations are only accepted via the HTTP API</li>
<li>NMEA stream data is ignored</li>
<li>Switching to <code>apiOnly</code> mode when an NMEA sourced destination is active will clear the destination.</li>
</ul>
</li>
</ul>
<h4 id="retrieving-course-api-configuration" class="tsd-anchor-link">Retrieving Course API Configuration<a href="#retrieving-course-api-configuration" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>To retrieve the Course API configuration settings, submit a HTTP <code>GET</code> request to <code>/signalk/v2/api/vessels/self/navigation/course/_config</code>.</p>
<pre><code class="typescript"><span class="hl-2">HTTP</span><span class="hl-0"> </span><span class="hl-2">GET</span><span class="hl-0"> </span><span class="hl-4">'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/_config'</span>
</code><button type="button">Copy</button></pre>
<p><em>Example response:</em></p>
<pre><code class="JSON"><span class="hl-0">{</span><br/><span class="hl-0"> </span><span class="hl-3">"apiOnly"</span><span class="hl-0">: </span><span class="hl-2">false</span><br/><span class="hl-0">}</span>
</code><button type="button">Copy</button></pre>
<h4 id="enable--disable-apionly-mode" class="tsd-anchor-link">Enable / Disable <code>apiOnly</code> mode<a href="#enable--disable-apionly-mode" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>To enable <code>apiOnly</code> mode, submit a HTTP <code>POST</code> request to <code>/signalk/v2/api/vessels/self/navigation/course/_config/apiOnly</code>.</p>
<p><em>Enable apiOnly mode:</em></p>
<pre><code class="typescript"><span class="hl-2">HTTP</span><span class="hl-0"> </span><span class="hl-2">POST</span><span class="hl-0"> </span><span class="hl-4">'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/_config/apiOnly'</span>
</code><button type="button">Copy</button></pre>
<p>To disable <code>apiOnly</code> mode, submit a HTTP <code>DELETE</code> request to <code>/signalk/v2/api/vessels/self/navigation/course/_config/apiOnly</code>.</p>
<p><em>Disable apiOnly mode:</em></p>
<pre><code class="typescript"><span class="hl-2">HTTP</span><span class="hl-0"> </span><span class="hl-2">DELETE</span><span class="hl-0"> </span><span class="hl-4">'http://hostname:3000/signalk/v2/api/vessels/self/navigation/course/_config/apiOnly'</span>
</code><button type="button">Copy</button></pre>
<h2 id="course-calculations" class="tsd-anchor-link">Course Calculations<a href="#course-calculations" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Whilst not performing course calculations, the <em>Course API</em> defines the paths to accommodate the values calculated during course navigation.</p>
<p>Click <a href="../Plugins/Course_Providers.html">here</a> for details.</p>
</div></div><div class="col-sidebar"><div class="page-menu"><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../../assets/icons.svg#icon-chevronDown"></use></svg><h3>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#setting-a-course"><span>Setting a <wbr/>Course</span></a><ul><li><a href="#1-navigate-to-a-location"><span>1. <wbr/>Navigate to a <wbr/>Location</span></a></li><li><a href="#2-navigate-to-a-waypoint"><span>2. <wbr/>Navigate to a <wbr/>Waypoint</span></a></li><li><a href="#3-follow-a-route"><span>3. <wbr/>Follow a <wbr/>Route</span></a></li></ul><a href="#retrieving-course-information"><span>Retrieving <wbr/>Course <wbr/>Information</span></a><a href="#cancelling-navigation"><span>Cancelling navigation</span></a><a href="#configuration"><span>Configuration</span></a><a href="#course-calculations"><span>Course <wbr/>Calculations</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../../modules.html">Signal K</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>