-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver_request_tests.py
More file actions
57 lines (51 loc) · 1.1 KB
/
server_request_tests.py
File metadata and controls
57 lines (51 loc) · 1.1 KB
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
import requests
import json
from leader_waypoints import wypts
host = '127.0.0.1'
port = '5000'
waypoints = json.dumps(
{"waypoints": [
[
41.71462,
-86.24179,
10
],
[
41.71462,
-86.24239,
10
],
[
41.71498,
-86.24239,
10
],
[
41.71498,
-86.24179,
10
],
[
41.71462,
-86.24179,
10
]
]})
server_addr = '127.0.0.1'
port = '5000'
r = requests.post('http://' + server_addr + ':' + port + '/createLeadDrone', data=json.dumps(wypts))
if r.status_code == 200:
resp = json.loads(r.content)
else:
print('Error: {} Response'.format(r.status_code))
sys.exit(1)
waypoints=resp['waypoints']
print "Leader Waypoints::"
print waypoints
print '\n\n'
r = requests.get('http://' + server_addr + ':' + port + '/computeStraightLinePath')
if r.status_code == 200:
resp = json.loads(r.content)
waypoints = resp['waypoints'] #dict(resp['waypoints'])
print 'Aux Waypoints::'
print waypoints