forked from uscki/robot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
thuis.py
55 lines (41 loc) · 1.22 KB
/
thuis.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
52
53
54
55
import EventBus
from EventBus import ImageEvent
from game import GameStarter
from hogerlager import HogerLager
from SnorBot import SnorBot
from wieishet import WieIsHet
from Prolog import Prolog
from EventBus import ChatEvent
from CameraClient import CameraClient
from face import FaceDetector
from Moppen import Moppen
#from SmoBot import SmoBot
import cv2
def reply(b):
print b
EventBus.add(GameStarter(HogerLager, lambda m: (m == 'hogerlager') ))
EventBus.add(GameStarter(WieIsHet, lambda m: (m == 'wie is het') ))
EventBus.add(GameStarter(Prolog, lambda m: (m == 'swipl') ))
EventBus.add(GameStarter(Moppen, lambda m: ('mop' in m and 'vertel' in m) ))
EventBus.add(GameStarter(SnorBot, lambda m: (m == 'snor') ))
#EventBus.add(SmoBot())
""" Camera Test """
from bot import Bot
EventBus.add(CameraClient())
class ImageSaver(Bot):
def loop(self):
imgevent = EventBus.await(ImageEvent)
im = imgevent.image
cv2.imwrite("plaatje.jpeg", im)
EventBus.add(ImageSaver())
EventBus.add(FaceDetector())
""" End Camera Test """
inp = ''
while inp is not 'q':
inp = raw_input(':')
ev = ChatEvent()
ev.message = inp
ev.sender = 'benno'
ev.reply = reply
EventBus.trigger(ev)
EventBus.kill()