-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api_spec.yml
386 lines (386 loc) · 11 KB
/
api_spec.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
openapi: 3.0.2
info:
title: MissionPlanner Scripts
version: 2.0.0
description: "This is the API that the MissionPlanner Scripts server exposes to GCOM."
contact:
name: Amin Fahiminia, Hansen Dan
servers:
- url: http://localhost:9000
tags:
- name: queue
description: Access to the waypoint queue
- name: status
description: Access to aircraft status
- name: takeoff
description: Access to takeoff and arming motors
- name: landing
description: Access to landing, RTL, and home waypoint
- name: options
description: Access to flight options
paths:
/:
get:
summary: Call this to see if the server's running.
responses:
"200":
description: server is running
/queue:
get:
tags:
- queue
summary: Returns the current list of waypoints remaining in the queue
description: >-
Returns the current list of queue of waypoints to hit.
Waypoints that have been passed and removed from the queue are not displayed.
responses:
"200":
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Waypoint"
post:
tags:
- queue
summary: Overwrite the queue with a new list of waypoints
description: >-
POST request containing a list of waypoints with names and longitude,
latitude, and altitude values. If the altitude for a waypoint is null,
uses the altitude of the previous waypoint (in the case of the first
waypoint, uses the current altitude of the drone).
The existing waypoint queue will be overwritten and lost.
Longitude, name, and latitude must not be null/empty. Returns a Bad
Request status code and error message in that case. Longitude and
latitude in degrees, altitude in meters.
requestBody:
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Waypoint"
responses:
"200":
description: successful operation
"400":
description: bad request
/insert:
post:
tags:
- queue
summary: Inserts waypoints immediately before the current waypoint
requestBody:
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Waypoint"
responses:
"200":
description: successful operation
"400":
description: bad request
/clear:
get:
tags:
- queue
summary: Clear the waypoint queue.
description: >-
Idempotent with POST'ing an empty queue to /queue.
responses:
"200":
description: Queue successfully emptied.
/status:
get:
tags:
- status
summary: Obtain the aircraft status
description: >-
GET request returns the aircraft status. Velocity in m/s. Altitude
in meters and is relative to sea level. Longitude, latitude, heading
in degrees.
responses:
"200":
description: Successful operation
content:
application/json:
schema:
$ref: "#/components/schemas/Status"
/takeoff:
post:
tags:
- takeoff
summary: Lift off to a given altitude
description: >-
POST request containing an altitude to take off to.
Don't put an altitude that would be underground.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
altitude:
type: number
format: float64
responses:
"200":
description: Successful operation
"400":
description: Takeoff unsuccessful or motors disarmed
/rtl:
get:
tags:
- landing
summary: return to launch
description: >-
Aircraft returns to home waypoint and lands (return-to-launch).
Returns a Bad Request status code and error message if the drone
could not execute the operation.
responses:
"200":
description: Successful, drone has initiated RTL procedure
"400":
description: Could not initiate RTL
post:
tags:
- landing
summary: return to launch at specified altitude
description: >-
Aircraft returns to home waypoint and lands (return-to-launch).
Returns a Bad Request status code and error message if the drone
could not execute the operation.
POST request body contains the altitude the drone should be at
while transiting back towards the launch point.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
altitude:
type: number
format: float64
responses:
"200":
description: Successful, drone has initiated RTL procedure
"400":
description: Could not initiate RTL
/land:
get:
tags:
- landing
summary: immediately descend and land
description: >-
Aircraft stops at its current position and lands.
Returns a Bad Request status code and error message if the drone
could not execute the operation.
responses:
"200":
description: Successful, drone has started landing procedure
"400":
description: Could not initiate landing
post:
tags:
- landing
summary: land at designated location
description: >-
Land at the location in the request.
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Waypoint"
responses:
"200":
description: Successful, drone has started landing procedure
"400":
description: Invalid coordinates - latitude and/or longitude value was null
/home:
post:
tags:
- landing
summary: set the home waypoint of the drone
description: >-
POST request containing a waypoint whose longitude, latitiude and
altitiude will be the basis for the new home waypoint. All other
fields will be ignored.
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Waypoint"
responses:
"200":
description: Successfully set new home position
"400":
description: Home position could not be set
/diversion:
post:
tags:
- queue
summary: divert the aircraft around an exclusion zone
description: >-
Include the waypoints that define the exclusion polygon in
order in the exclude array, and the waypoint to rejoin the
normal queue at in the rejoin_at property. The server will
process the information, produce a diverted path, and pass
that to the aircraft, returning 200. Note that 200 will be
returned whether or not the new path is applied or not.
requestBody:
content:
application/json:
schema:
type: object
properties:
exclude:
type: array
items:
$ref: '#/components/schemas/Waypoint'
rejoin_at:
$ref: '#/components/schemas/Waypoint'
responses:
"200":
description: Diversion processed
/flightmode:
put:
tags:
- options
summary: Change flight mode of the aircraft
description: >-
Set the flight mode of the aircraft to Loiter, Stabilize, Auto, or Guided, or set the current aircraft type to Copter or Plane.
requestBody:
content:
application/json:
schema:
type: object
properties:
mode:
type: string
enum: ['copter', 'plane', 'loiter', 'stabilize', 'auto', 'guided']
responses:
"200":
description: Operation processed
"400":
description: Unrecognized mode
/arm:
put:
tags:
- takeoff
summary: Arm or disarm the motors. Take care.
requestBody:
content:
application/json:
schema:
type: object
properties:
arm:
type: integer
enum: [0, 1]
responses:
"200":
description: Arm/disarm successful.
"400":
description: Arm/disarm failed - drone is NOT in the requested state
/altstandard:
put:
tags:
- options
summary: UNIMPLEMENTED
description: >-
UNIMPLEMENTED
requestBody:
content:
application/json:
schema:
type: object
properties:
standard:
type: string
enum: ['AGL', 'MSL']
responses:
"410":
description: "UNIMPLEMENTED"
components:
schemas:
Waypoint:
type: object
properties:
id:
type: number
format: integer
name:
type: string
longitude:
type: number
format: float64
latitude:
type: number
format: float64
altitude:
type: number
format: float64
command:
type: string
description: "Put the waypoint command here as in MissionPlanner, i.e., `LOITER_UNLIM` or `DO_CHANGE_SPEED`. Default value: `WAYPOINT`"
param1:
type: number
format: integer
param2:
type: number
format: integer
param3:
type: number
format: integer
param4:
type: number
format: integer
Status:
type: object
properties:
timestamp:
type: integer
current_wpn:
type: integer
latitude:
type: number
format: float64
longitude:
type: number
format: float64
altitude:
type: number
format: float64
roll:
type: number
format: float64
pitch:
type: number
format: float64
yaw:
type: number
format: float64
airspeed:
type: number
format: float64
groundspeed:
type: number
format: float64
heading:
type: number
format: float64
batteryvoltage:
type: number
format: float64
winddirection:
type: number
format: float64
windvelocity:
type: number
format: float64