This is originally a script of Jhack, modified for my needs, since I use only 2 Arduino and Jhack uses 4.
What is nice here, is to be able to make the robot talk with jaw movements having one gesture called by voice command. This gesture "servo" has sub-gestures which roll following each phrase the robot says.
#file : jhacks_transformed.py
# a basic script for starting the InMoov service
# and attaching the right hand
# an Arduino is required, additionally a computer
# with a microphone and speakers is needed for voice
# control and speech synthesis
# ADDED SECOND STAGE CONFIRMATION
# inMoov say: did you say...? You confirm with yes/no or give the voice command again
# face tracking in InMoov ... activated by voice ...
inMoov = Runtime.createAndStart("inMoov", "InMoov")
rightSerialPort = "COM8"
leftSerialPort = "COM7"
cameraIndex = 1
# attach an arduinos to InMoov
# possible board types include uno atmega168 atmega328p atmega2560 atmega1280 atmega32u4
# the MRLComm.ino sketch must be loaded into the Arduino for MyRobotLab control
inMoov.attachArduino("right","uno",rightSerialPort)
inMoov.attachHand("right")
inMoov.attachArm("right")
inMoov.attachArduino("left","atmega1280", leftSerialPort)
inMoov.attachHand("left")
inMoov.attachArm("left")
inMoov.attachHead("left")
# attach the servo for jaw to Arduino right pin12, value position min 10, max 25
inMoov.attachMouthControl("right",12,10,25)
sleep(1)
mouthcontrol.setdelays(110,250,43)
# system check
inMoov.systemCheck()
inMoov.rest()
inMoov.setCameraIndex(cameraIndex)
# new process for verbal commands
ear = inMoov.getEar()
ear.addCommand("servo", "python", "servos")
def servos():
ear.pauseListening()
sleep(2)
inMoov.setHandSpeed("left", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
inMoov.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
inMoov.setArmSpeed("right", 0.85, 0.85, 0.85, 0.85)
inMoov.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
inMoov.setHeadSpeed(0.65, 0.65)
inMoov.moveHead(79,100)
inMoov.moveArm("left",0,119,28,15)
inMoov.moveArm("right",0,111,28,15)
inMoov.moveHand("left",42,58,87,55,71,35)
inMoov.moveHand("right",81,20,82,60,105,113)
mouth.speakBlocking("I currently have twenty five hobby servos installed in my body to give me life")
inMoov.setHandSpeed("left", 0.85, 0.85, 0.85, 0.85, 0.85, 0.85)
inMoov.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
inMoov.setArmSpeed("right", 0.85, 0.85, 0.85, 0.85)
inMoov.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
inMoov.setHeadSpeed(0.65, 0.65)
inMoov.moveHead(124,90)
inMoov.moveArm("left",89,94,91,35)
inMoov.moveArm("right",20,67,31,22)
inMoov.moveHand("left",106,41,161,147,138,90)
inMoov.moveHand("right",0,0,0,54,91,90)
mouth.speakBlocking("there's one servo for moving my mouth up and down")
sleep(1)
inMoov.setHandSpeed("left", 0.85, 0.85, 1.0, 0.85, 0.85, 0.85)
inMoov.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
inMoov.setArmSpeed("right", 0.85, 0.85, 0.85, 0.85)
inMoov.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
inMoov.setHeadSpeed(0.65, 0.65)
inMoov.moveHead(105,76);
inMoov.moveArm("left",89,106,103,35);
inMoov.moveArm("right",35,67,31,22);
inMoov.moveHand("left",106,41,31,147,138,7);
inMoov.moveHand("right",0,0,0,54,91,90);
mouth.speakBlocking("two for my eyes")
sleep(0.2)
inMoov.setHandSpeed("left", 0.85, 0.85, 1.0, 1.0, 1.0, 0.85)
inMoov.moveHand("left",106,41,31,31,31,7);
mouth.speakBlocking("and two more for my head")
sleep(0.5)
inMoov.setHandSpeed("left", 0.85, 0.9, 0.9, 0.9, 0.9, 0.85)
inMoov.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
inMoov.setArmSpeed("right", 0.85, 0.85, 0.85, 0.85)
inMoov.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
inMoov.setHeadSpeed(0.65, 0.65)
inMoov.moveHead(90,40);
inMoov.moveArm("left",89,106,103,35);
inMoov.moveArm("right",35,67,31,20);
inMoov.moveHand("left",106,140,140,140,140,7);
inMoov.moveHand("right",0,0,0,54,91,90);
mouth.speakBlocking("so i can look around")
sleep(0.5)
inMoov.setHeadSpeed(0.65, 0.65)
inMoov.moveHead(105,125);
inMoov.setArmSpeed("left", 0.9, 0.9, 0.9, 0.9)
inMoov.moveArm("left",60,100,85,30);
mouth.speakBlocking("and see who's there")
inMoov.setHeadSpeed(0.65, 0.65)
inMoov.moveHead(40,56);
sleep(0.5)
inMoov.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
inMoov.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
inMoov.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0);
inMoov.setArmSpeed("right", 0.5, 0.6, 0.5, 0.6);
inMoov.moveArm("left",87,41,64,10)
inMoov.moveArm("right",0,95,40,10)
inMoov.moveHand("left",98,150,160,160,160,104)
inMoov.moveHand("right",0,0,50,54,91,90);
mouth.speakBlocking("there's three servos in each shoulder")
inMoov.moveHead(40,67);
sleep(2)
inMoov.setHandSpeed("left", 0.8, 0.9, 0.8, 0.8, 0.8, 0.8)
inMoov.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
inMoov.setArmSpeed("right", 0.85, 0.85, 0.85, 0.85)
inMoov.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
inMoov.setHeadSpeed(0.8, 0.8)
inMoov.moveHead(43,69)
inMoov.moveArm("left",87,41,64,10)
inMoov.moveArm("right",0,95,40,42)
inMoov.moveHand("left",42,0,100,80,113,35)
inMoov.moveHand("left",42,10,160,160,160,35)
inMoov.moveHand("right",81,20,82,60,105,113)
mouth.speakBlocking("here is the first servo movement")
sleep(1)
inMoov.moveHead(37,60);
inMoov.setHandSpeed("left", 1.0, 1.0, 0.9, 0.9, 1.0, 0.8)
inMoov.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
inMoov.moveArm("right",0,95,67,42)
inMoov.moveHand("left",42,10,10,160,160,30)
mouth.speakBlocking("this is the second one")
sleep(1)
inMoov.moveHead(43,69);
inMoov.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
inMoov.moveArm("right",0,134,67,42)
inMoov.moveHand("left",42,10,10,10,160,35)
mouth.speakBlocking("now you see the third")
sleep(1)
inMoov.setArmSpeed("right", 0.8, 0.8, 0.8, 0.8)
inMoov.moveArm("right",20,90,45,16)
mouth.speakBlocking("they give me a more human like movement")
sleep(1)
inMoov.setHandSpeed("left", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
inMoov.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0);
inMoov.moveHead(43,72)
inMoov.moveArm("left",90,44,66,10)
inMoov.moveArm("right",90,100,67,26)
inMoov.moveHand("left",42,80,100,80,113,35)
inMoov.moveHand("right",81,0,82,60,105,69)
mouth.speakBlocking("but, i have only one servo, to move each elbow")
inMoov.setHandSpeed("left", 0.85, 0.85, 0.85, 0.85, 0.85, 0.85)
inMoov.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
inMoov.setArmSpeed("right", 0.85, 0.85, 0.85, 0.85)
inMoov.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
inMoov.setHeadSpeed(0.8, 0.8)
inMoov.moveHead(45,62)
inMoov.moveArm("left",72,44,90,10)
inMoov.moveArm("right",90,95,68,15)
inMoov.moveHand("left",42,0,100,80,113,35)
inMoov.moveHand("right",81,0,82,60,105,0)
mouth.speakBlocking("that, leaves me, with one servo per wrist")
inMoov.moveHead(40,60)
inMoov.setHandSpeed("left", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
inMoov.setHandSpeed("right", 0.9, 0.9, 0.9, 0.9, 0.9, 0.9)
inMoov.moveArm("left",72,44,90,9)
inMoov.moveArm("right",90,95,68,15)
inMoov.moveHand("left",42,0,100,80,113,35)
inMoov.moveHand("right", 10, 140,82,60,105,10)
mouth.speakBlocking("and one servo for each finger.")
sleep(0.5)
inMoov.moveHand("left",42,0,100,80,113,35)
inMoov.moveHand("right", 50, 51, 15,23, 30,140);
mouth.speakBlocking("these servos are located in my forearms")
inMoov.setHandSpeed("left", 0.8, 0.8, 0.8, 0.8,0.8, 0.8)
inMoov.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
inMoov.moveHand("left", 36, 52, 8,22, 20);
inMoov.moveHand("right", 120, 147, 130,110, 125);
further()
sleep(1)
mouth.speakBlocking("they are hooked up, by the use of tendons")
inMoov.moveHand("left",10,20,30,40,60,150);
inMoov.moveHand("right",110,137,120,100,105,130);
inMoov.setHeadSpeed(1,1)
inMoov.setArmSpeed("right", 1.0,1.0, 1.0, 1.0);
inMoov.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0);
further()
sleep(2)
ear.resumeListening()
Great videos JHack & Gael ! I
Great videos JHack & Gael !
I really like the concept of the robot explaining how he works. The details Gael are very good - now if he could only give you a "helping hand" in the shop to build more :D
Great Video!
I like the video and having InMoov explain how he moves. It'll help you save your voice at the next Maker Faire or show you go to. You could tell people to ask him rather than you. :)
Awesome video...
Gael,
this is an awesome video of InMoov self explaining how the servos work... great job.... congrats....
Amazing video Gael.. I really
Amazing video Gael.. I really like it :) can't wait to see my inmoov talking :)