Robyn understands me!!!
this is no fake!!!!
He chose rock scissors paper by random and asks me what i have. 
Then he understand my voice command and use variables to count the score.
 

bhouston

9 years 5 months ago

That is fantasic Markus, Your Robyn is getting smarter !

GroG

9 years 5 months ago

You Cheated !  :D

I saw you said rock when you did paper !  We need to make Robyn smarter ! :DDD

Markus

9 years 5 months ago

sleep(1)#file : InMoov2.Robyn Inmoov
 
import random
 
keyboard = Runtime.createAndStart("keyboard", "Keyboard")
keyboard.addListener("keyCommand", python.getName(), "input")
 
 
leftPort = "COM3"
rightPort = "COM4"
 
i01 = Runtime.createAndStart("i01", "InMoov")
 
 
cleverbot = Runtime.createAndStart("cleverbot","CleverBot")
 
# starts everything
i01.startAll(leftPort, rightPort)
 
torso = i01.startTorso("COM3")
 
#############################################################################################
# Markus Mod
 
i01.leftArm.omoplate.map(10,80,80,20)
i01.rightArm.omoplate.map(10,80,80,20)
i01.leftArm.shoulder.map(0,180,170,15)
i01.rightArm.shoulder.map(0,180,190,50)
i01.leftArm.rotate.map(40,180,140,20)
i01.rightArm.rotate.map(40,180,140,20)
i01.leftArm.bicep.map(5,90,90,20)
i01.rightArm.bicep.map(5,90,90,20)
i01.head.rothead.map(30,150,150,30)
i01.torso.topStom.map(60,120,70,110)
i01.head.eyeX.map(60,100,90,50)
i01.head.eyeY.map(50,100,100,50)
i01.head.neck.map(20,160,160,20)
 
############################################################
#to tweak the default PID values
i01.headTracking.xpid.setPID(10.0,5.0,0.1)
i01.headTracking.ypid.setPID(10.0,5.0,0.1)
i01.eyesTracking.xpid.setPID(15.0,5.0,0.1)
i01.eyesTracking.ypid.setPID(15.0,5.0,0.1)
############################################################
 
 
i01.startPIR("COM4",12)
 
def input():
    print 'python object is ', msg_clock_pulse
    pin = msg_i01_right_publishPin.data[0]
    print 'pin data is ', pin.pin, pin.value
    if (pin.value == 1):
        powerup() 
        i01.mouth.speak("good morning")
        
#############################################################################################
 
helvar = 1
 
# play rock paper scissors
robyn = 0
human = 0
 
 
i01.systemCheck()
 
ear = i01.ear
 
##################################################################
# Hastighet vid start
 
i01.setHandSpeed("left", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
i01.setHeadSpeed(0.8, 0.8)
i01.mouth.speak("working on full speed")
 
##################################################################
 
# commands with i01.getName() use the InMoov service methods
ear.addCommand("attach head", "i01.head", "attach")
ear.addCommand("disconnect head", "i01.head", "detach")
ear.addCommand("attach eyes", "i01.head.eyeY", "attach")
ear.addCommand("disconnect eyes", "i01.head.eyeY", "detach")
ear.addCommand("attach right hand", "i01.rightHand", "attach")
ear.addCommand("disconnect right hand", "i01.rightHand", "detach")
ear.addCommand("attach left hand", "i01.leftHand", "attach")
ear.addCommand("disconnect left hand", "i01.leftHand", "detach")
ear.addCommand("attach everything", "i01", "attach")
ear.addCommand("disconnect everything", "i01", "detach")
ear.addCommand("attach left arm", "i01.leftArm", "attach")
ear.addCommand("disconnect left arm", "i01.leftArm", "detach")
ear.addCommand("attach right arm", "i01.rightArm", "attach")
ear.addCommand("disconnect right arm", "i01.rightArm", "detach")
ear.addCommand("start to move like me", "python", "startkinect")
ear.addCommand("you can stop now", "python", "offkinect")
ear.addCommand("open hand", "python", "handopen")
ear.addCommand("close hand", "python", "handclose")
ear.addCommand("servo", "python", "servos")
 
 
ear.addCommand("power down", i01.getName(), "powerDown")
ear.addCommand("power up", i01.getName(), "powerUp")
 
ear.addCommand("camera on", i01.getName(), "cameraOn")
ear.addCommand("off camera", i01.getName(), "cameraOff")
ear.addCommand("capture gesture", i01.getName(), "captureGesture")
 
# FIXME - lk tracking setpoint
ear.addCommand("track", i01.getName(), "track")
ear.addCommand("freeze track", i01.getName(), "clearTrackingPoints")
ear.addCommand("giving", i01.getName(), "giving")
ear.addCommand("be a fighter", i01.getName(), "fighter")
ear.addCommand("fist hips", i01.getName(), "fistHips")
ear.addCommand("look at this", i01.getName(), "lookAtThis")
ear.addCommand("victory", i01.getName(), "victory")
ear.addCommand("arms up", i01.getName(), "armsUp")
ear.addCommand("arms front", i01.getName(), "armsFront")
ear.addCommand("da vinci", i01.getName(), "daVinci")
 
ear.addCommand("manual", ear.getName(), "lockOutAllGrammarExcept", "voice control")
ear.addCommand("voice control", ear.getName(), "clearLock")
ear.addCommand("stop listening", ear.getName(), "stopListening")
 
##sets the servos back to full speed, anywhere in sequence or gestures
ear.addCommand("full speed", "python", "fullspeed")
ear.addCommand("search humans", "python", "trackHumans")
ear.addCommand("quit search", "python", "stopTracking")
ear.addCommand("relax", "python", "relax")
ear.addCommand("perfect", "python", "perfect")
ear.addCommand("finger", "python", "finger")
 
# play rock paper scissors
ear.addCommand("let's play rock paper scissors", "python", "rockpaperscissors")
 
ear.addCommand("arms down", "python", "armsdown")
ear.addCommand("torso", "python", "Torso")
ear.addCommand("move eye", "python", "moveeye")
ear.addCommand("move your mouth", "python", "movemouth")
ear.addCommand("disco time", "python", "discotime")
ear.addCommand("move your head", "python", "movehead")
 
ear.addComfirmations("yes","correct","ya") 
ear.addNegations("no","wrong","nope","nah")
 
ear.startListening("yes | no thanks | yes let's play again | i have rock | i have paper | i have scissors | look at the people | take a look around | good morning | very good | look to your right | look to your left |look down |look up |look strait forward |how are you | sorry | robyn | can i have your attention | how do you do | bye bye | i love you | thanks | thank you | nice | goodbye")
 
# set up a message route from the ear --to--> python method "heard"
ear.addListener("recognized", "python", "heard")
 
 
##########################################################################################
 
 
 
# play rock paper scissors
 
 
 
 
def rockpaperscissors():
    fullspeed()
    i01.mouth.speak("lets play first to 3 points win")
    sleep(4)
    rockpaperscissors2()
    
def rockpaperscissors2():
    x = (random.randint(1, 3))
    if x == 1:
        ready()
        sleep(2)
        rock()
        sleep(2)
        data = msg_i01_ear_recognized.data[0]
        if (data == "i have rock"):
            x = (random.randint(1, 3))
            if x == 1:
                i01.mouth.speak("oh no")
            if x == 2:
                i01.mouth.speak("that don't work")
            if x == 3:
                i01.mouth.speak("no points")
            sleep(1)
        if (data == "i have paper"):
            x = (random.randint(1, 3))
            if x == 1:
                i01.mouth.speak("paper beats rock")
            if x == 2:
                i01.mouth.speak("your point")
            if x == 3:
                i01.mouth.speak("you got this one")
            global human
            human += 1
            sleep(1)
        if (data == "i have scissors"):
            x = (random.randint(1, 3))
            if x == 1:
                i01.mouth.speak("1 point for me")
            if x == 2:
                i01.mouth.speak("going fine")
            if x == 3:
                i01.mouth.speak("rock beats scissors")
            global robyn
            robyn += 1
            sleep(1)
       
           
    if x == 2:
        ready()
        sleep(2)
        paper()
        sleep(2)
        data = msg_i01_ear_recognized.data[0]
        if (data == "i have rock"):
            x = (random.randint(1, 3))
            if x == 1:
                i01.mouth.speak("1 point")
            if x == 2:
                i01.mouth.speak("paper beats rock")
            if x == 3:
                i01.mouth.speak("my point")
            global robyn
            robyn += 1
            sleep(1)
        if (data == "i have paper"):
            x = (random.randint(1, 3))
            if x == 1:
                i01.mouth.speak("no points")
            if x == 2:
                i01.mouth.speak("ok lets try again")
                sleep(2)
            if x == 3:
                i01.mouth.speak("again")
            sleep(1)
        if (data == "i have scissors"):
            x = (random.randint(1, 3))
            if x == 1:
                i01.mouth.speak("oh no you get 1 point")
            if x == 2:
                i01.mouth.speak("this is not good for me")
            if x == 3:
                i01.mouth.speak("your point")
            global human
            human += 1
            sleep(1)
        
    if x == 3:
        ready()
        sleep(2)
        scissors()
        sleep(2)
        data = msg_i01_ear_recognized.data[0]
        if (data == "i have rock"):
            x = (random.randint(1, 3))
            if x == 1:
                i01.mouth.speak("oh no")
            if x == 2:
                i01.mouth.speak("rock beats scissors")
            if x == 3:
                i01.mouth.speak("i feel generous today")
            global human
            human += 1
            sleep(1)
        if (data == "i have paper"):
            x = (random.randint(1, 3))
            if x == 1:
                i01.mouth.speak("i've got you")
            if x == 2:
                i01.mouth.speak("my point")
            if x == 3:
                i01.mouth.speak("good")
            global robyn
            robyn += 1
            sleep(1)
        if (data == "i have scissors"):
            x = (random.randint(1, 3))
            if x == 1:
                i01.mouth.speak("no no")
            if x == 2:
                i01.mouth.speak("that don't work")
            if x == 3:
                i01.mouth.speak("no points")
            sleep(1)
    if robyn == 3 or human == 3:
        stoprockpaperscissors() 
    rockpaperscissors2()
 
            
def stoprockpaperscissors():
    armsdown()
    if robyn < human:
        i01.mouth.speak("congratulations you won with" + str(human - robyn) + "points")
        sleep(3)
        i01.mouth.speak(str(human) + "points to you and" + str(robyn) + "points to me")
    if robyn > human:
        i01.mouth.speak("yes yes i won with" + str(robyn - human) + "points")
        sleep(3)
        i01.mouth.speak("i've got " + str(robyn) + "points and you got" + str(human) + "points")
    if robyn == human:
        i01.mouth.speak("none of us won we both got" + str(robyn) + "points")
    global robyn
    robyn = 0
    global human
    human = 0
    i01.mouth.speak("that was fun")
    sleep(3)
    i01.mouth.speak("do you want to play again")
    sleep(10)
    data = msg_i01_ear_recognized.data[0]
    if (data == "yes let's play again"):
        rockpaperscissors2()
    if (data == "yes"):
        rockpaperscissors2()
    if (data == "no thanks"):
        i01.mouth.speak("maybe some other time")
        sleep(4)
    i01.mouth.speak("ok i'll find something else to do then")
    lookaroundyou()
        
 
def ready():
    i01.mouth.speak("ready")
    i01.mouth.speak("go")
    i01.moveHead(90,90,80,90,75)
    i01.moveArm("left",65,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    
    
 
def rock():
    
    i01.moveHead(90,90,80,90,75)
    i01.moveArm("left",70,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    sleep(.3)
    i01.setHeadSpeed(.8,.8)
    i01.moveHead(60,107,80,90,75)
    i01.moveArm("left",49,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    
    sleep(.3)
    
    i01.moveHead(60,107,80,90,75)
    i01.moveArm("left",70,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    sleep(.3)
    i01.moveHead(60,107,80,90,75)
    i01.moveArm("left",49,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    
    sleep(.3)
    i01.moveHead(60,107,80,90,75)
    i01.moveArm("left",70,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    sleep(.3)
    i01.moveHead(90,90,80,90,75)
    i01.moveArm("left",49,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,140)
    i01.moveHand("right",2,2,2,2,2,90)
    sleep(.3)
    x = (random.randint(1, 2))
    if x == 1:
        i01.mouth.speakBlocking("i have rock what do you have")
    if x == 2:
        i01.mouth.speakBlocking("what do you have")
 
 
def paper():
    i01.moveHead(90,90,80,90,75)
    i01.moveArm("left",70,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    sleep(.3)
    i01.setHeadSpeed(.8,.8)
    i01.moveHead(60,107,80,90,75)
    i01.moveArm("left",49,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    sleep(.3)
    i01.moveHead(60,107,80,90,75)
    i01.moveArm("left",70,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    sleep(.3)
    i01.moveHead(60,107,80,90,75)
    i01.moveArm("left",49,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    sleep(.3)
    i01.moveHead(60,107,80,90,75)
    i01.moveArm("left",70,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    sleep(.3)
    i01.moveHead(90,90,80,90,75)
    i01.moveArm("left",49,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",0,0,0,0,0,165)
    i01.moveHand("right",2,2,2,2,2,90)
    sleep(.3)
    x = (random.randint(1, 2))
    if x == 1:
        i01.mouth.speakBlocking("i have paper what do you have")
    if x == 2:
        i01.mouth.speakBlocking("what do you have")
 
 
 
def scissors():
    i01.moveHead(90,90,80,90,75)
    i01.moveArm("left",70,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    sleep(.3)
    i01.setHeadSpeed(0.8,0.8)
    i01.moveHead(60,107,80,90,75)
    i01.moveArm("left",49,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    sleep(.3)
    i01.moveHead(60,107,80,90,75)
    i01.moveArm("left",70,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    sleep(.3)
    i01.moveHead(60,107,80,90,75)
    i01.moveArm("left",49,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    sleep(.3)
    i01.moveHead(60,107,80,90,75)
    i01.moveArm("left",70,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",40,171,180,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    sleep(.3)
    i01.moveHead(90,90,80,90,75)
    i01.moveArm("left",49,90,75,10)
    i01.moveArm("right",5,90,30,10)
    i01.moveHand("left",50,0,0,180,180,90)
    i01.moveHand("right",2,2,2,2,2,90)
    sleep(.3)
    x = (random.randint(1, 2))
    if x == 1:
        i01.mouth.speakBlocking("i have scissors what do you have")
    if x == 2:
        i01.mouth.speakBlocking("what do you have")
 
 
 
##########################################################################################
 
def input(cmd):
    # print 'python object is',msg_[service]_[method]
    cmd = msg_keyboard_keyCommand.data[0]
    print 'python data is', cmd
 
    
    if (cmd == "S"):
      i01.mouth.speak("hej vad heter du?")
      i01.mouth.speak("heter du göran?")
      i01.mouth.speak("ja det gör jag")
      i01.mouth.speak("va trevligt att träffas")
      i01.mouth.speak("ja verkligen")
      i01.mouth.speak("vad heter du då?")
      i01.mouth.speak("jag heter Stina")
 
      
 
    if (cmd == "NumPad-8"):
      headupp()
 
    if (cmd == "NumPad-2"):
      headdown()
 
    if (cmd == "NumPad-4"):
      headleft()
    
    if (cmd == "NumPad-6"):
      headright()
 
    if (cmd == "NumPad-5"):
      headfront()
 
 
    if (cmd == "N"):
      i01.mouth.speak("yes it's about time the navel string got cut")
 
    if (cmd == "F"):
      i01.mouth.speak("whot the f")
 
    if (cmd == "D"):
      armsdown()
       
    if (cmd == "K"):
      startkinect()
 
    if (cmd == "C"):
      i01.mouth.speakBlocking(cleverbot.chat("how are you"))
 
 
 
    if (cmd == "1"):
        ear.lockOutAllGrammarExcept("robyn"  "how are you")
        sleep(30)
        i01.mouth.speak("i can hear again")
        ear.clearLock()
        
 
      
##########################################################################################
 
def heard(data):
    data = msg_i01_ear_recognized.data[0]
 
 
    if (data == "look at the people"):
        i01.setHeadSpeed(0.8, 0.8)
        for y in range(0, 10):
            x = (random.randint(1, 5))
            if x == 1:
                i01.head.neck.moveTo(90)
                eyeslooking()
                sleep(1)
                trackHumans()
                sleep(10)
                stopTracking()
            if x == 2:
                i01.head.rothead.moveTo(80)
                eyeslooking()
                sleep(1)
                trackHumans()
                sleep(10)
                stopTracking()
            if x == 3:
                headdown()
                eyeslooking()
                sleep(1)
                trackHumans()
                sleep(10)
                stopTracking()
            if x == 4:
                headright()
                eyeslooking()
                sleep(1)
                trackHumans()
                sleep(10)
                stopTracking()
            if x == 5:
                headleft()
                eyeslooking()
                sleep(1)
                trackHumans()
                sleep(10)
                stopTracking()
            sleep(1)
        headfront()
        eyesfront()
        sleep(3)
        i01.mouth.speak("nice to meet you all")
 
    if (data == "take a look around"):
        lookaroundyou()
 
    if (data == "good morning"):
        i01.mouth.speak("good morning")
        x = (random.randint(1, 4))
        if x == 1:
            i01.mouth.speak("i hope you had a good night sleep")
        if x == 2:
            i01.mouth.speak("nice to see you again")
        if x == 3:
            i01.mouth.speak("this is going to be a good day")   
 
    if (data == "very good"):
        i01.mouth.speak("thanks")
 
    if (data == "look to your right"):
        headright()
 
    if (data == "look to your left"):
        headleft()
 
    if (data == "look down"):
        headdown()
        
    if (data == "look up"):
        headupp()
        
    if (data == "look strait forward"):
        headfront()
        
        
    if (data == "how are you"):
        i01.mouth.speak("i'm fine thanks")
 
    if (data == "goodbye"):
        goodbye()
        
    if (data == "robyn"):
        i01.mouth.speak("yes")
        sleep(1)
        
 
            
    if (data == "sorry"):
        global helvar
        helvar = 1
        x = (random.randint(1, 3))
        if x == 1:
            i01.mouth.speak("no problems")
        if x == 2:
            i01.mouth.speak("it doesn't matter")
        if x == 3:
            i01.mouth.speak("it's okay")
 
    if (data == "nice"):
        x = (random.randint(1, 3))
        if x == 1:
            i01.mouth.speak("I know")
        if x == 2:
            i01.mouth.speak("yes, indeed")
        if x == 3:
            i01.mouth.speak("you are damn right")
 
    if (data == "bye bye"):
        i01.mouth.speak("see you soon")
        global helvar
        helvar = 1
        x = (random.randint(1, 2))
        if x == 1:
            i01.mouth.speak("i'm looking forward to see you again")
        if x == 2:
            i01.mouth.speak("goodbye")
 
    if (data == "thank you"):
        x = (random.randint(1, 3))
        if x == 1:
            i01.mouth.speak("you are welcome")
        if x == 2:
            i01.mouth.speak("my pleasure")
        if x == 3:
            i01.mouth.speak("it's okay")
 
    if (data == "thanks"):
        x = (random.randint(1, 2))
        if x == 1:
            i01.mouth.speak("it's okay")
        if x == 2:
            i01.mouth.speak("sure")    
 
 
    if (data == "how do you do"):
        if helvar <= 2:    
            i01.mouth.speak("I'm fine thank you")
            global helvar
            helvar += 1
        elif helvar == 3:
            i01.mouth.speak("you have already said that at least twice")
            i01.moveArm("left",43,88,22,10)
            i01.moveArm("right",20,90,30,10)
            i01.moveHand("left",0,0,0,0,0,119)
            i01.moveHand("right",0,0,0,0,0,119)
            sleep(2)
            armsdown()
            global helvar
            helvar += 1
        elif helvar == 4:
            i01.mouth.speak("what is your problem stop saying how do you do all the time")
            i01.moveArm("left",30,83,22,10)
            i01.moveArm("right",40,85,30,10)
            i01.moveHand("left",130,180,180,180,180,119)
            i01.moveHand("right",130,180,180,180,180,119)
            sleep(2)
            armsdown()
            global helvar
            helvar += 1
        elif helvar == 5:
            i01.mouth.speak("i will ignore you if you say how do you do one more time")
            sleep(4)
            armsdown()
            global helvar
            helvar += 1
  
 
    if (data == "i love you"):
        i01.mouth.speak("i love you too")
        i01.moveHead(116,80,87,80,70)
        i01.moveArm("left",85,93,42,16)
        i01.moveArm("right",87,93,37,18)
        i01.moveHand("left",124,82,65,81,41,143)
        i01.moveHand("right",59,53,89,61,36,21)
        i01.moveTorso(90,90,90)
        global helvar
        helvar = 1
        sleep(0.2)
        sleep(1)
        armsdown()
 
def stopit():
    headfront()
    eyesfront()
    if (data == "break"):
        i01.mouth.speak("yes") 
 
#############################################################################################
 
 
 
def discotime(): 
    i01.mouth.speak("it's disco time")
    for y in range(0, 3):
        i01.mouth.speak("disco")
        leftPort.digitalWrite(13, 1) # ON
        sleep(1)
        leftPort.digitalWrite(13, 0) # OFF 
        sleep(1)
        
#############################################################################################
 
 
def finger():
    i01.setHandSpeed("left", 0.85, 0.85, 0.85, 0.85, 0.85, 1.0)
    i01.setHandSpeed("right", 1.0, 0.85, 1.0, 1.0, 1.0, 1.0)
    i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
    i01.setArmSpeed("right", 0.90, 1.0, 1.0, 1.0)
    i01.setHeadSpeed(1.0, 0.90)
    i01.setTorsoSpeed(1.0, 1.0, 1.0)
    i01.moveHead(80,86,85,85,72)
    i01.moveArm("left",5,94,30,10)
    i01.moveArm("right",7,78,92,10)
    i01.moveHand("left",180,180,180,180,180,90)
    i01.moveHand("right",180,2,175,160,165,180)
    i01.moveTorso(90,90,90)
    sleep(4.5)
 
def fullspeed():
    i01.setHandSpeed("left", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
    i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
    i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
    i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
    i01.setHeadSpeed(0.7, 0.7)
 
 
def trackHumans():
    i01.headTracking.faceDetect()
    i01.eyesTracking.faceDetect()
 
def stopTracking():
    i01.headTracking.stopTracking()
    i01.eyesTracking.stopTracking()
 
def startkinect():
    i01.leftArm.shoulder.map(0,180,170,65)
    i01.rightArm.shoulder.map(0,180,190,110)
    i01.leftArm.omoplate.map(10,80,80,30)
    i01.rightArm.omoplate.map(10,80,100,40)
    i01.copyGesture(True)
 
def offkinect():
    i01.leftArm.shoulder.map(0,180,170,15)
    i01.rightArm.shoulder.map(0,180,190,50)
    i01.leftArm.omoplate.map(10,80,80,20)
    i01.rightArm.omoplate.map(10,80,80,20)
    i01.copyGesture(False)
    armsdown()
 
def handopen():
  i01.moveHand("left",0,0,0,0,0)
  i01.moveHand("right",0,0,0,0,0)
 
def handclose():
  i01.moveHand("left",180,180,180,180,180)
  i01.moveHand("right",180,180,180,180,180)
 
def servos():  
        ear.pauseListening()
        sleep(2)
        i01.setHandSpeed("left", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
        i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
        i01.setArmSpeed("right", 0.85, 0.85, 0.85, 0.85)
        i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
        i01.setHeadSpeed(0.65, 0.65)
        i01.moveHead(79,100)
        i01.moveArm("left",5,119,28,15)
        i01.moveArm("right",5,111,28,15)
        i01.moveHand("left",42,58,87,55,71,35)
        i01.moveHand("right",81,20,82,60,105,113)
        i01.mouth.speakBlocking("I currently have twenty five  hobby servos installed in my body to give me life")
        i01.setHandSpeed("left", 0.85, 0.85, 0.85, 0.85, 0.85, 0.85)
        i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
        i01.setArmSpeed("right", 0.85, 0.85, 0.85, 0.85)
        i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
        i01.setHeadSpeed(0.65, 0.65)
        i01.moveHead(124,90)
        i01.moveArm("left",89,94,91,35)
        i01.moveArm("right",20,67,31,22)
        i01.moveHand("left",106,0,161,147,138,90)
        i01.moveHand("right",0,0,0,54,91,90)
        i01.mouth.speakBlocking("there's one servo  for moving my mouth up and down")
        sleep(1)
        i01.setHandSpeed("left", 0.85, 0.85, 1.0, 0.85, 0.85, 0.85)
        i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
        i01.setArmSpeed("right", 0.85, 0.85, 0.85, 0.85)
        i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
        i01.setHeadSpeed(0.65, 0.65)
        i01.moveHead(105,76);
        i01.moveArm("left",89,106,103,35);
        i01.moveArm("right",35,67,31,22);
        i01.moveHand("left",106,0,0,147,138,7);
        i01.moveHand("right",0,0,0,54,91,90);
        i01.mouth.speakBlocking("two for my eyes")
        sleep(0.2)
        i01.setHandSpeed("left", 0.85, 0.85, 1.0, 1.0, 1.0, 0.85)
        i01.moveHand("left",106,0,0,0,0,7);
        i01.mouth.speakBlocking("and two more for my head")
        sleep(0.5)
        i01.setHandSpeed("left", 0.85, 0.9, 0.9, 0.9, 0.9, 0.85)
        i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
        i01.setArmSpeed("right", 0.85, 0.85, 0.85, 0.85)
        i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
        i01.setHeadSpeed(0.65, 0.65)
        i01.moveHead(90,40);
        i01.moveArm("left",89,106,103,35);
        i01.moveArm("right",35,67,31,20);
        i01.moveHand("left",106,140,140,140,140,7);
        i01.moveHand("right",0,0,0,54,91,90);
        i01.mouth.speakBlocking("so i can look around")
        sleep(0.5)
        i01.setHeadSpeed(0.65, 0.65)
        i01.moveHead(105,125);
        i01.setArmSpeed("left", 0.9, 0.9, 0.9, 0.9)
        i01.moveArm("left",60,100,85,30);
        i01.mouth.speakBlocking("and see who's there")
        i01.setHeadSpeed(0.65, 0.65)
        i01.moveHead(40,56);
        sleep(0.5)
        i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
        i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
        i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0);
        i01.setArmSpeed("right", 0.5, 0.6, 0.5, 0.6);
        i01.moveArm("left",87,41,64,11)
        i01.moveArm("right",5,95,40,11)
        i01.moveHand("left",98,150,160,160,160,104)
        i01.moveHand("right",0,0,50,54,91,90);
        i01.mouth.speakBlocking("there's three servos  in each shoulder")
        i01.moveHead(40,67);
        sleep(2)
        i01.setHandSpeed("left", 0.8, 0.9, 0.8, 0.8, 0.8, 0.8)
        i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
        i01.setArmSpeed("right", 0.85, 0.85, 0.85, 0.85)
        i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
        i01.setHeadSpeed(0.8, 0.8)
        i01.moveHead(43,69)
        i01.moveArm("left",87,41,64,11)
        i01.moveArm("right",5,95,40,42)
        i01.moveHand("left",42,0,100,80,113,35)
        i01.moveHand("left",42,10,160,160,160,35)
        i01.moveHand("right",81,20,82,60,105,113)
        i01.mouth.speakBlocking("here is the first servo movement")
        sleep(1)
        i01.moveHead(37,60);
        i01.setHandSpeed("left", 1.0, 1.0, 0.9, 0.9, 1.0, 0.8)
        i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
        i01.moveArm("right",5,95,67,42)
        i01.moveHand("left",42,10,10,160,160,30)
        i01.mouth.speakBlocking("this is the second one")
        sleep(1)
        i01.moveHead(43,69);
        i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
        i01.moveArm("right",5,134,67,42)
        i01.moveHand("left",42,10,10,10,160,35)
        i01.mouth.speakBlocking("now you see the third")
        sleep(1)
        i01.setArmSpeed("right", 0.8, 0.8, 0.8, 0.8)
        i01.moveArm("right",20,90,45,16)
        i01.mouth.speakBlocking("they give me a more human like movement")
        sleep(1)
        i01.setHandSpeed("left", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
        i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0);
        i01.moveHead(43,72)
        i01.moveArm("left",90,44,66,11)
        i01.moveArm("right",90,100,67,26)
        i01.moveHand("left",42,80,100,80,113,35)
        i01.moveHand("right",81,0,82,60,105,69)
        i01.mouth.speakBlocking("but, i have only  one servo, to move each elbow")
        i01.setHandSpeed("left", 0.85, 0.85, 0.85, 0.85, 0.85, 0.85)
        i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
        i01.setArmSpeed("right", 0.85, 0.85, 0.85, 0.85)
        i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
        i01.setHeadSpeed(0.8, 0.8)
        i01.moveHead(45,62)
        i01.moveArm("left",72,44,90,11)
        i01.moveArm("right",90,95,68,15)
        i01.moveHand("left",42,0,100,80,113,35)
        i01.moveHand("right",81,0,82,60,105,0)
        i01.mouth.speakBlocking("that, leaves me, with one servo per wrist")
        i01.moveHead(40,60)
        i01.setHandSpeed("left", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
        i01.setHandSpeed("right", 0.9, 0.9, 0.9, 0.9, 0.9, 0.9)
        i01.moveArm("left",72,44,90,9)
        i01.moveArm("right",90,95,68,15)
        i01.moveHand("left",42,0,100,80,113,35)
        i01.moveHand("right", 10, 140,82,60,105,10)
        i01.mouth.speakBlocking("and one servo for each finger.")
        sleep(0.5)
        i01.moveHand("left",42,0,100,80,113,35)
        i01.moveHand("right", 50, 51, 15,23, 30,140);
        i01.mouth.speakBlocking("these servos are located in my forearms")
        i01.setHandSpeed("left", 0.8, 0.8, 0.8, 0.8,0.8, 0.8)
        i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
        i01.moveHand("left", 36, 52, 8,22, 20);
        i01.moveHand("right", 120, 147, 130,110, 125);
        i01.setHandSpeed("left", 0.85, 0.85, 0.85, 0.85, 0.85, 0.85)
        i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
        i01.setArmSpeed("right", 0.75, 0.85, 0.95, 0.85)
        i01.setArmSpeed("left", 0.95, 0.65, 0.75, 0.75)
        i01.setHeadSpeed(0.75, 0.75)
        i01.moveHead(20,100)
        i01.moveArm("left",71,94,41,31)
        i01.moveArm("right",5,82,28,15)
        i01.moveHand("left",60,43,45,34,34,35)
        i01.moveHand("right",20,40,40,30,30,72)
        sleep(1)
        i01.mouth.speakBlocking("they are hooked up, by the use of tendons")
        i01.moveHand("left",10,20,30,40,60,150);
        i01.moveHand("right",110,137,120,100,105,130);
        i01.setHeadSpeed(1,1)
        i01.setArmSpeed("right", 1.0,1.0, 1.0, 1.0);
        i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0);
        relax()
        sleep(2)
        armsdown()
        ear.resumeListening()
 
def relax():
  i01.setHandSpeed("left", 0.85, 0.85, 0.85, 0.85, 0.85, 0.85)
  i01.setHandSpeed("right", 0.85, 0.85, 0.85, 0.85, 0.85, 0.85)
  i01.setArmSpeed("right", 0.75, 0.85, 0.65, 0.85)
  i01.setArmSpeed("left", 0.95, 0.65, 0.75, 0.75)
  i01.setHeadSpeed(0.85, 0.85, 1.0, 1.0, 1.0)
  i01.setTorsoSpeed(0.75, 0.55, 1.0)
  i01.moveHead(79,100,90,90,70)
  i01.moveArm("left",5,84,28,15)
  i01.moveArm("right",5,82,28,15)
  i01.moveHand("left",92,33,37,71,66,25)
  i01.moveHand("right",81,66,82,60,105,113)
  i01.moveTorso(90,90,90)
 
def perfect():
  i01.setHandSpeed("left", 0.80, 0.80, 1.0, 1.0, 1.0, 1.0)
  i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
  i01.setArmSpeed("left", 0.85, 0.85, 0.85, 0.95)
  i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
  i01.setHeadSpeed(0.65, 0.75)
  i01.moveHead(88,79)
  i01.moveArm("left",89,75,93,11)
  i01.moveArm("right",0,91,28,17)
  i01.moveHand("left",130,160,83,40,0,34)
  i01.moveHand("right",86,51,133,162,153,180)
     
#############################################################################################
   
 
def lookaroundyou(): 
    i01.setHeadSpeed(0.8, 0.8)
    for y in range(0, 20):
        x = (random.randint(1, 6))
        if x == 1:
            i01.head.neck.moveTo(90)
            eyeslooking()
        if x == 2:
            i01.head.rothead.moveTo(80)
            eyeslooking()
        if x == 3:
            headdown()
            eyeslooking()
        if x == 4:
            headupp()
            eyeslooking()
        if x == 5:
            headright()
            eyeslooking()
        if x == 6:
            headleft()
            eyeslooking()
        sleep(1)
    x = (random.randint(1, 6))
    if x == 1:
        i01.mouth.speak("looking nice")
    if x == 2:
        i01.mouth.speak("i like it here")
    if x == 3:
        i01.mouth.speak("time just flies away")
    if x == 4:
        i01.mouth.speak("ok let's do something")
        sleep(2)
        x = (random.randint(1, 4))
        if x == 1:
            Torso()
            Torso()
        if x == 2:
            perfect()
            sleep(2)
            armsdown()
        if x == 3:
            servos()
        if x == 4:
            finger()
            sleep(3)
            armsdown()
    lookaroundyou()
 
def eyeslooking():
    for y in range(0, 5):
        data = msg_i01_ear_recognized.data[0]
        if (data == "can i have your attention"):
            i01.mouth.speak("ok you have my attention")
            stopit()
        if (data == "robyn"):
            stopit()
        x = (random.randint(1, 6))
        if x == 1:
            i01.head.eyeX.moveTo(80)
        if x == 2:
            i01.head.eyeY.moveTo(80)
        if x == 3:
            eyesdown()
        if x == 4:
            eyesupp()
        if x == 5:
            eyesleft()
        if x == 6:
            eyesright()
        sleep(0.5)
    eyesfront()
        
 
def goodbye():    
    i01.mouth.speak("goodbye")
    global helvar
    helvar = 1
    x = (random.randint(1, 4))
    if x == 1:
        i01.mouth.speak("i'm looking forward to see you again")
    if x == 2:
        i01.mouth.speak("see you soon")
 
def movemouth():
    i01.moveHead(90,90,80,80,10)
    sleep(2)
    i01.head.jaw.moveTo(50)
    sleep(2)
    i01.moveHead(90,90,80,80,10)
    sleep(2)
    i01.head.jaw.moveTo(50)
    sleep(2)
    i01.moveHead(90,90,80,80,10)
    sleep(2)
 
 
def moveeye():
    eyesfront()
    sleep(1)
    eyesdown()
    sleep(1)
    eyesupp()
    sleep(1)
    eyesright()
    sleep(1)
    eyesleft()
    sleep(1)
    eyesfront()
        
 
def eyesfront():
    i01.head.eyeX.moveTo(80)
    i01.head.eyeY.moveTo(80)
    
def eyesdown():
    i01.head.eyeY.moveTo(100)
    
def eyesupp():
    i01.head.eyeY.moveTo(50)
 
def eyesright():
    i01.head.eyeX.moveTo(60)
 
def eyesleft():
    i01.head.eyeX.moveTo(100)
 
def movehead():
    i01.setHeadSpeed(0.7, 0.7)
    headfront()
    sleep(3)
    headdown()
    sleep(3)
    headupp()
    sleep(6)
    headfront()
    sleep(3)
    headright()
    sleep(3)
    headleft()
    sleep(6)
    headfront()
    sleep(3)
    headright()
    headdown()
    sleep(6)
    headdown()
    headleft()
    sleep(6)
    headupp()
    headleft()
    sleep(6)
    headupp()
    headright()
    sleep(6)
    headfront()
    sleep(3)
    
def headfront():
    i01.head.neck.moveTo(90)
    i01.head.rothead.moveTo(80)
 
def headdown():
    i01.head.neck.moveTo(20)
 
def headupp():
    i01.head.neck.moveTo(160)
    
def headright():
    i01.head.rothead.moveTo(30)
    
def headleft():
    i01.head.rothead.moveTo(140)
 
def armsdown():
    i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
    i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
    i01.moveArm("left",5,90,30,10)
    i01.moveArm("right",5,90,30,10)
 
 
def armsfront():
    i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
    i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
    i01.moveArm("left",5,90,110,10)
    i01.moveArm("right",5,90,110,10)
 
def Torso():
    i01.setTorsoSpeed(1.0, 1.0, 1.0)
    i01.moveTorso(60,90,90)
    sleep(2)
    i01.moveTorso(120,90,90)
    sleep(2)
    i01.moveTorso(90,90,90)
    sleep(2)
 
 
    ear.resumeListening()
 
 
 

Dear Markus

I am just getting started with Inmoov and the Programming and I am currently having trouble understanding two Lines of Code maybe you could help me out.
1. ear.addListener(“recognized”, “python”, “heard”) I am not sure how exactly it works or what it does

2. data = msg_i01_ear_recognized.data[0] I think this one stores the last heard words in data but I am not sure.

I am thankful for any help I can get :)

GroG

9 years 5 months ago

Heh I hope I did not offend you Markus, I was just making a joke.  I know that your script recognizes you telling Robyn what hand gesture you did.

Great Job ! - It's awesome.

I was only making a joke that you "could", be saying "Rock" when you actually did Scissors.  And Robyn needs to get smarter and look at your hand and see you really did "Rock" :D

Great Script Markus - Love it !

Haha
No problems!
I wrote it because Gaels comment on inmoov.fr

Gael Langevin replied 5 hours, 54 minutes ago
very nice extra features for the Rock Paper Scissors play game. It is interesting how it seems like he really can understand what you are playing. For someone who doesn’t know, it can be very tricky.

hairygael

9 years 5 months ago

Hey Markus,

Me neither I didn't mean to offend you.

here is what I wrote on InMoov.fr:

Oh yes I know, I didn’t mean it was a fake. :)
I also use the rock paper scissors on my script, and what you have added is really interesting because of the variables counted from your answers. I have modified a bit the movements of that gesture before going to New York, because people had a hard time understanding how to process for the counting before the “go”. We could share the scripts on the repository.

I see you posted your script, thanks very much!

I will update mine on the repository, so you can have access to the modified gesture if you like.

No worries!
:-)
Yes I like sharing the script.
I need to learn more about github and other stuff in the inmoov nation. Haha

Piace love and open source!