-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsimulate_position.py
More file actions
89 lines (73 loc) · 2.49 KB
/
Copy pathsimulate_position.py
File metadata and controls
89 lines (73 loc) · 2.49 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
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
import time
import requests
import sys
#simulated positions
pairs = [(-10033.67, -5673.19),
(-10032.39, -5673.09),
(-10029.74, -5672.30),
(-10027.78, -5672.11),
(-10025.82, -5671.91),
(-10023.89, -5671.71),
(-10021.89, -5671.71),
(-10018.06, -5669.16),
(-10015.51, -5668.97),
(-10014.83, -5668.42),
(-10013.85, -5668.38),
(-10012.83, -5667.21),
(-10010.98, -5666.55),
(-10008.94, -5667.30),
(-10006.58, -5666.91),
(-10004.26, -5665.53),
(-10002.26, -5665.53),
(-10000.99, -5662.20),
(-10000.11, -5661.12),
(-9999.32, -5695.55),
(-9999.32, -5695.55),
(-10000.11, -5661.12),
(-10000.99, -5662.20),
(-10002.26, -5665.53),
(-10004.26, -5665.53),
(-10006.58, -5666.91),
(-10008.94, -5667.30),
(-10010.98, -5666.55),
(-10012.83, -5667.21),
(-10013.85, -5668.38),
(-10014.83, -5668.42),
(-10015.51, -5668.97),
(-10018.06, -5669.16),
(-10021.89, -5671.71),
(-10023.89, -5671.71),
(-10025.82, -5671.91),
(-10027.78, -5672.11),
(-10029.74, -5672.30),
(-10032.39, -5673.09),
(-10033.67, -5673.19)]
TIMEOUT_TIME = 4
server = "http://" + sys.argv[1] + ":14141"
def simulate_pos():
i = 0
while True:
#
print("Position: ", pairs[i])
rover_data_x = {'rover_posx': pairs[i][1]} #X correspnds to longitude which is 2nd
rover_data_y = {'rover_posy': pairs[i][0]} #Y corresponds to latitude which is 1st
eva1_data_x = {'imu_eva1_posx': pairs[i][1]} #X correspnds to longitude which is 2nd
eva1_data_y = {'imu_eva1_posy': pairs[i][0]} #Y corresponds to latitude which is 1st
eva2_data_x = {'imu_eva2_posx': pairs[i][1]} #X correspnds to longitude which is 2nd
eva2_data_y = {'imu_eva2_posy': pairs[i][0]} #Y corresponds to latitude which is 1st
#send the rover data to TSS
r = requests.post(url = server, data = rover_data_x, timeout = TIMEOUT_TIME)
time.sleep(1)
r = requests.post(url = server, data = rover_data_y, timeout = TIMEOUT_TIME)
#send eva1 data to TSS
r = requests.post(url = server, data = eva1_data_x, timeout = TIMEOUT_TIME)
r = requests.post(url = server, data = eva1_data_y, timeout = TIMEOUT_TIME)
#send eva2 data to TSS
r = requests.post(url = server, data = eva2_data_x, timeout = TIMEOUT_TIME)
r = requests.post(url = server, data = eva2_data_y, timeout = TIMEOUT_TIME)
#go back to start once were at the end if not just increment
i = (i + 1) % len(pairs)
#wait a little bit :)
time.sleep(0.55)
#run script
simulate_pos()