forked from KRSSG/robocup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_goalie.py
52 lines (39 loc) · 1.12 KB
/
run_goalie.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
KUB_ID = 0
import rospy,sys
from utils.geometry import Vector2D
from utils.functions import *
from krssg_ssl_msgs.msg import point_2d
from krssg_ssl_msgs.msg import BeliefState
from krssg_ssl_msgs.msg import gr_Commands
from krssg_ssl_msgs.msg import gr_Robot_Command
from krssg_ssl_msgs.msg import BeliefState
from multiprocessing import Process
from kubs import kubs
from math import atan2,pi
from utils.functions import *
from tactics import Goalie
pub = rospy.Publisher('/grsim_data',gr_Commands,queue_size=1000)
import memcache
shared = memcache.Client(['127.0.0.1:11211'],debug=False)
# _Goalie_.main()
flag = True
kub = kubs.kubs(0,pub)
def function(id_,state):
# global flag
# print(kub.kubs_id)
g_fsm = Goalie.Goalie()
# print(kub.kubs_id+1)
g_fsm.add_kub(kub)
# print(kub.kubs_id+2)
# g_fsm.as_graphviz()
# g_fsm.write_diagram_png()
g_fsm.spin()
# print(kub.kubs_id+3)
rospy.init_node('goalie',anonymous=False)
start_time = rospy.Time.now()
start_time = 1.0*start_time.secs + 1.0*start_time.nsecs/pow(10,9)
while True:
state = shared.get('state')
if state:
kub.update_state(state)
function(KUB_ID,state)