-
Notifications
You must be signed in to change notification settings - Fork 0
/
src.py
51 lines (37 loc) · 1.11 KB
/
src.py
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
''' simulating the locatization of wifi emitting signal beacon.
**Note - this is the simulation that how the bot will trace the beacon, real practical model is
little bit different then this simulation.'''
# from cProfile import label
import matplotlib.pyplot as plt
from matplotlib import style
import globalVariables as gv
import method as md
plt.ion()
style.use('fivethirtyeight')
# Global variables import from globalVariables files
bot=gv.bot
beacon=gv.beacon
pathX=gv.X
pathY=gv.Y
# main function of the execution.
def main():
global bot
while True:
plt.clf()
if md.check(bot,beacon)==True:
print("Captured")
break
if md.check(bot,beacon)==False:
md.move(bot,beacon)
pathX.append(bot[0])
pathY.append(bot[1])
plt.scatter(bot[0],bot[1],label="bot")
plt.scatter(beacon[0],beacon[1],label="beacon")
plt.plot(pathX,pathY)
plt.legend(bbox_to_anchor=(0.75,1.15),ncol=2)
plt.xlim(0,50)
plt.ylim(0,50)
plt.show()
plt.pause(1)
if __name__ == "__main__":
main()