RTK API
Description
This API is used to start RTK streaming and get RTK status information when developing your own applications.
Base URL
The base URL for all API requests is:
http://gcs-<serialnumber> or 10.10.0.1
Endpoints
/rtk_survey
Start and stop surveys and get the status of the survey.
Post
Start a new survey with the given duration and accuracy.
The survey can be used for future use if the save and name parameters are set.
Parameters
accuracy- Float - The lowest accuracy in meters to stop the survey at. Must be greater than 0.duration- Int - The minimum duration in seconds of the survey. Must be greater than 0.save- Boolean - True to save the survey for future use, otherwise Falsename- String - (Optional) Name to save survey as when survey is complete.Max 20 characters
Only alphanumerical characters, _ and -
Name must be unique
Response
Status code: 200
Example
Request:
POST /rtk_survey
Request Body:
{
"accuracy": 1.5,
"duration": 120,
"save": true,
"name": "Home"
}
Python Example:
import requests
import json
url = "http://gcs-12180/rtk_survey"
payload = json.dumps({
"accuracy": 1.5,
"duration": 120,
"save": true,
"name": "Home"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
Error Codes
400 : Invalid data in fields
Get
Returns the status of current survey.
Response
Status code: 200
in_progress- Boolean - True if a RTK survey currently in progress, otherwise false.streaming_rtk- Boolean - True if RTK corrections are being streamed, otherwise false.duration- Int - If a survey is still in progress this is the length in seconds it has been running for. If a survey is already complete, this is how long the survey took to complete in seconds. If no survey is in progress or complete returns 0.accuracy- Float - If a survey is still in progress this is the current accuracy in meters. If a survey is already complete, this is the final accuracy of the survey. If no survey is in progress or complete returns 0.latitude- Float - If a survey is still in progress this is the current latitude in decimal degrees reported by the survey. If a survey is already complete, this is the final latitude of the survey. If no survey is in progress or completed, this returns -1.longitude- Float - If a survey is still in progress this is the current longitude in decimal degrees reported by the survey. If a survey is already complete, this is the final longitude of the survey. If no survey is in progress or completed, this returns -1.altitude- Float - If a survey is still in progress this is the current altitude in meters reported by the survey. If a survey is already complete, this is the final altitude of the survey. If no survey is in progress or completed, this returns -1.
Example
Request:
GET /rtk_survey
Python Example:
import requests
url = "http://gcs-12180/rtk_survey"
payload = {}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
Response Body:
{
"in_progress": false,
"streaming_rtk": true,
"duration": 131,
"accuracy": 1.997,
"latitude": 44.15641861,
"longitude": -171.235900166,
"altitude": 23.4
}
Patch
Stops the progress of the current survey. The provisional result at that time can either be used as is for an RTK stream, or deleted.
Parameters
delete- Boolean - True to delete the current survey result, otherwise the RTK stream will begin with the current survey result.
Response
Status code: 200
Example
Request:
PATCH /rtk_survey
Request Body:
{
"delete": false
}
Python Example:
import requests
import json
url = "http://gcs-12180/rtk_survey"
payload = json.dumps({
"delete": False
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("PATCH", url, headers=headers, data=payload)
Error Codes
400 : No Survey Started
/rtk_stream
Start and stop RTK streaming and get the status of the RTK stream.
Post
Start streaming RTK data from known position. Fixed position source can be manually entered Lat/Lon position, or from a previously saved location.
Note: RTK stream will begin immediately on completion of a survey.
Parameters
Option 1
latitude- Float - The Latitude in decimal degrees of the RTK position.longitude- Float - The Longitude in decimal degrees of the RTK position.altitude- Float - The altitude in meters of the RTK position.accuracy- Float - The accuracy in meters of the RTK position. Must be greater than 0.
Option 2
name- String - The name of the saved position to use as the RTK position.
Response
Status code: 200
Examples
Option 1
Request:
POST /rtk_stream
Request Body:
{
"latitude": 44.15641861,
"longitude": -171.235900166,
"altitude": 23.4,
"accuracy": 1.997
}
Python Example:
import requests
import json
url = "http://gcs-12180/rtk_stream"
payload = json.dumps({
"latitude": 44.15641861,
"longitude": -171.235900166,
"altitude": 23.4,
"accuracy": 1.997
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
Option 2
Request:
POST /rtk_stream
Request Body:
{
"name": "Home"
}
Python Example:
import requests
import json
url = "http://gcs-12180/rtk_stream"
payload = json.dumps({
"name": "Home"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
Error Codes
400 : Invalid position or name
Get
Returns the status of RTK position being streamed.
Response
Status code: 200
source- Int - The source of the position being streamed for RTK positioning.0 = Survey
1 = Manually Entered
2 = From Saved Location
latitude- Float - The Latitude in decimal degrees of the RTK position.latitude- Float - The Longitude in decimal degrees of the RTK position.altitude- Float - The altitude in meters of the RTK position.accuracy- Float - The reported accuracy of the streamed position.name- String - If the RTK position being streamed is from a saved location, this it the name of the location, otherwise this field is empty.
Example
Option 1:
Request:
GET /rtk_stream
Python Example:
import requests
url = "http://gcs-12180/rtk_stream"
payload = {}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
Response Body:
{
"source": 2,
"latitude": 44.15641861,
"longitude": -171.235900166,
"altitude": 23.4,
"accuracy": 1.997,
"name": "Home"
}
Error Codes
400 : No RTK stream started
Delete
Stops streaming RTK data.
Response
Status code: 200
Example
Request:
DELETE /rtk_stream
Python Example:
import requests
url = "http://gcs-12180/rtk_stream"
payload = {}
headers = {}
response = requests.request("DELETE", url, headers=headers, data=payload)
Error Codes
400 : No RTK stream running.
/rtk_locations
Get, add and delete saved RTK locations.
Post
Adds manually entered location to saved locations database.
Parameters
name- String - The name to save the position as.Max 20 characters
Only alphanumerical characters, _ and -
Name must be unique
latitude- Float - The Latitude in decimal degrees of the RTK position.latitude- Float - The Longitude in decimal degrees of the RTK position.altitude- Float - The altitude in meters of the RTK position.accuracy- Float - The accuracy in meters of the RTK position. Must be greater than 0.
Response
Status code: 200
Example
Request:
POST /rtk_locations
Request Body:
{
"name": "Home",
"latitude": 44.15641861,
"longitude": -171.235900166,
"altitude": 23.4,
"accuracy": 1.997
}
Python Example:
import requests
import json
url = "http://gcs-12180/rtk_locations"
payload = json.dumps({
"name": "Home",
"latitude": 44.15641861,
"longitude": -171.235900166,
"altitude": 23.4,
"accuracy": 1.997
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
Error Codes
400 : Invalid field.
Get
Returns a list of saved RTK positions in Lat/Lon/Alt format. RTK positions within the list are sorted in order of entry.
Response
Status code: 200
results- List of saved RTK positions.name- String - Name of the saved positionlatitude- Float - Latitude in decimal degrees.longitude- Float - Longitude in decimal degrees.altitude- Float - Altitude in meters.accuracy- Float - Accuracy in meters.
Example
Request:
GET /rtk_locations
Python Example:
import requests
url = "http://gcs-12180/rtk_locations"
payload = {}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
Response Body:
{
"results": [
{
"name": "Home",
"latitude": 44.15641861,
"longitude": -171.235900166,
"altitude": 23.4,
"accuracy": 1.997,
},
{
"name": "Work",
"latitude": 45.2134586,
"longitude": -171.329500166,
"altitude": 87.1,
"accuracy": 0.928,
},
]
}
Delete
Deletes the given position from saved locations database.
Parameters
name- String - The name of the saved position to remove.
Response
Status code: 200
Example
Request:
DELETE /rtk_locations
Request Body:
{
"name": "Home"
}
Python Example:
import requests
import json
url = "http://gcs-12180/rtk_locations"
payload = json.dumps({
"name": "Home"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("DELETE", url, headers=headers, data=payload)
Error Codes
400 : No saved position with given name
/gps_status
Get the GPS status.
Get
Returns the status of RTK position in Lat/Lon/Alt format.
Response
Status code: 200
fix_type- Int - Fix type of the GPS.0 = No Fix
1 = Dead Reckoning Only
2 = 2D Fix
3 = 3D Fix
4 = GPS + dead reckoning combined
5 = Time Fix Only (This will be the fix type if outputting RTK stream)
latitude- Float - Latitude reported by the GPS in decimal degrees.longitude- Float - Longitude reported by the GPS in decimal degrees.altitude- Float - Altitude reported by GPS in meters.hdop- Float - Horizontal Dilution of Precision. HDOP = 99.9 if fix type is 5.
Example
Request:
GET /gps_status
Response Body:
{
"fix_type": 3,
"latitude": 44.15641861,
"longitude": -171.235900166,
"altitude": 23.4,
"hdop": 0.6
}
Python Example:
import requests
url = "http://gcs-12180/gps_status"
payload = {}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)