-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathface_emotion_client.py
47 lines (39 loc) · 1.54 KB
/
face_emotion_client.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
'''
'''
import uuid
from self.topics.topic_client import TopicClient
from self.agents.face_emotion_agent import FaceEmotionAgent
from self.agents.example_agent import ExampleAgent
from self.agents.agent_society import AgentSociety
from self.gestures.gesture_manager import GestureManager
from self.gestures.speech_gesture import SpeechGesture
from self.blackboard.thing import ThingEventType
from self.blackboard.thing import Thing
from self.blackboard.thing import ThingCategory
from self.blackboard.blackboard import Blackboard
class FaceEmotionClient(object):
def run_thread(headers):
print("run_thread")
def on_connected(self):
print("On Connected function!")
agent_id = str(uuid.uuid4())
print("on_connect(), agent id: " + agent_id)
agent = FaceEmotionAgent('FaceEmotionAgent', agent_id)
AgentSociety.get_instance().subscribe()
AgentSociety.get_instance().add_agent(agent, False)
def run(self):
try:
self_id = str(uuid.uuid4())
print("self id: " + self_id)
headers = [('selfId', self_id), ('token', '')]
topic = TopicClient.start_instance('127.0.0.1', 9443, headers)
TopicClient.get_instance().setHeaders(self_id, "")
TopicClient.get_instance().set_callback(self.on_connected)
topic.start()
except KeyboardInterrupt:
exit()
except ConnectionRefusedError:
print("connection error: ")
if __name__ == "__main__":
print("hey")
FaceEmotionClient().run()