def run(self, behaviour):
     #if behavior starts with sound
     stand_position()
     if "sound" in str(behaviour):
         if "1" in behaviour:
             return sound_1()
         if "2" in behaviour:
             return sound_2()
         if "3" in behaviour:
             return sound_3()
     elif "left" in str(behaviour):
         print("randomly calling left")
         return self.leftKey()
     elif "right" in str(behaviour):
         print("randomly calling right")
         return self.rightKey()
     elif "up" in str(behaviour):
         print("randomly calling up")
         return self.upKey()
     elif "down" in str(behaviour):
         print("randomly calling down")
         return self.downKey()
     #else
     else:
         managerProxy = ALProxy("ALBehaviorManager", IP_ADDRESS, PORT)
         managerProxy.runBehavior(
             str(self.movement_mappings_dict[behaviour]))
Пример #2
0
 def react_movement(self):
     stand_position()
     print(self.movement_mappings_dict.keys())
     movement = random.choice(list(self.movement_mappings_dict.keys()))
     self.writeToFile(movement)
     print("random movement: " + str(movement))
     managerProxy = ALProxy("ALBehaviorManager", IP_ADDRESS, PORT)
     managerProxy.runBehavior(str(movement))
Пример #3
0
def eye_color():
    session = qi.Session()
    session.connect("tcp://" + IP_ADDRESS + ":9559")
    leds_service = session.service("ALLeds")

    # Example showing how to fade the eyes to green 
    stand_position()
    name = 'FaceLeds'
    leds_service.rasta(2)
Пример #4
0
def make_sound():
    stand_position()
    x = random.choice([0, 1, 2])
    print("x is " + str(x))
    if x == 0:
        return sound_1()
    if x == 1: 
        return sound_2()
    if x == 2:
        return sound_3()
Пример #5
0
def gaze_follow():
    stand_position()
    next_move = gazeFollowInteration.get_next_move()
    if next_move == GazeFollowInteraction.LEFT_HEAD_MOVE:
        move_head_diagonal(0.45, 0.45)
    elif next_move == GazeFollowInteraction.RIGHT_HEAD_MOVE:
        move_head_diagonal(0.45, -0.45)
    
    #hold for 5 seconds
    time.sleep(5)
    stand_position()

    return
Пример #6
0
 def make_sound(self):
     stand_position()
     print("in make sound")
     stand_position()
     x = random.choice([0, 1, 2])
     print("x is " + str(x))
     self.writeToFile("sound_" + str(x))
     if x == 0:
         return sound_1()
     if x == 1:
         return sound_2()
     if x == 2:
         return sound_3()
Пример #7
0
    def gaze_follow(self):

        stand_position()
        #choose random jingle sound
        self.play_sound()
        time.sleep(2)
        next_move = self.gazeFollowInteration.get_next_move()
        if next_move == GazeFollowInteraction.LEFT_HEAD_MOVE:
            self.move_head_diagonal(0.45, 0.45)
        elif next_move == GazeFollowInteraction.RIGHT_HEAD_MOVE:
            self.move_head_diagonal(0.45, -0.45)

        elif next_move == "6/6 done":
            print("all done")
            tkMessageBox.showinfo("End of Experiment",
                                  "6/6 gaze following done")
        #hold for 5 seconds
        time.sleep(5)
        stand_position()
        return
Пример #8
0
def come_on_func():
    stand_position()
    managerProxy = ALProxy("ALBehaviorManager", IP_ADDRESS, PORT)

    managerProxy.runBehavior("animations/Stand/Gestures/ComeOn_1")
Пример #9
0
def hand_wave_func():
    stand_position()
    managerProxy = ALProxy("ALBehaviorManager", IP_ADDRESS, PORT)
    managerProxy.runBehavior("animations/Stand/Gestures/Hey_1")
Пример #10
0
def dance():
    stand_position()
    managerProxy = ALProxy("ALBehaviorManager", IP_ADDRESS, PORT)
    managerProxy.runBehavior('gangnamstyle4-9610b3/GangnamStyle')
Пример #11
0
import Tkinter as tk
from StartPage import StartPage
from Timer import TimerApp
from settings import IP_ADDRESS
from settings import PORT
from naoqi import ALProxy
from stand_position import stand_position

stand_position()


class MainApp(tk.Tk):
    def __init__(self):
        tk.Tk.__init__(self)
        self._frame = None
        self.switch_frame(StartPage)
        self.bind('<Left>', self.leftKey)
        self.bind('<Right>', self.rightKey)
        self.bind('<Up>', self.upKey)
        self.bind('<Down>', self.downKey)

    def switch_frame(self, frame_class):
        new_frame = frame_class(self)
        if self._frame is not None:
            self._frame.destroy()
        self._frame = new_frame
        self._frame.pack()

    def leftKey(self, event):
        print "Left key pressed"
        self.changeAngles("HeadYaw", 0.3)
Пример #12
0
    def peekaboo(self):
        stand_position()
        managerProxy = ALProxy("ALBehaviorManager", IP_ADDRESS, PORT)

        managerProxy.runBehavior("animations/Stand/Waiting/HideEyes_1")
        self.writeToFile("animations/Stand/Waiting/HideEyes_1")
Пример #13
0
    def wave(self):
        stand_position()
        managerProxy = ALProxy("ALBehaviorManager", IP_ADDRESS, PORT)

        managerProxy.runBehavior("animations/Stand/Gestures/Hey_1")
        self.writeToFile("animations/Stand/Gestures/Hey_1")