Robyn is singing again!

 

 

 

Time markers were made by running the "I'm a Little Teapot" mp3 first with the script below.  Then gestures and mouth could be synchronized.


#file : home/Markus/importTimeMillis.py edit raw
import time 
millis = time.time()
 
keyboard = Runtime.createAndStart("keyboard", "Keyboard")
keyboard.addListener("keyCommand", python.getName(), "input")
 
leftPort = "COM3"
rightPort = "COM7"
 
 
i01 = Runtime.createAndStart("i01", "InMoov")
 
# starts everything
i01.startAll(leftPort, rightPort)
 
torso = i01.startTorso("COM3")
 
left = Runtime.getService("i01.left")
right = Runtime.getService("i01.right")
 
 
####################################################################
# Markus Mod
 
i01.leftArm.omoplate.map(10,80,80,20)
i01.rightArm.omoplate.map(10,80,80,10)
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.systemCheck()
 
# 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")
 
 
##################################################################
 
 
def input(cmd):
    global millis
    
 
    if (cmd == "C"):
        i01.captureGesture()
    
    if (cmd == "A"):
        i01.mouth.audioFile.playFile("C:\Users\Markus\Music\little teapot.mp3", False)
        millis = time.time()
    
    if (cmd == "S"):
       interval = time.time() -  millis
       millis = time.time()
       print ("    sleep(" + str(round(interval,2) - (0.2)) + ")")
       print ("    i01.head.jaw.moveTo(50)")
       print ("    sleep(0.2)")
       print ("    i01.head.jaw.moveTo(10)")
       i01.head.jaw.moveTo(50)
       sleep(0.2)
       i01.head.jaw.moveTo(10)
 
 
    if (cmd == "1"):
       interval = time.time() -  millis
       millis = time.time()
       print ("    sleep(" + str(round(interval,2)) + ")")
       print ('    i01.moveArm("right",90,40,30,46)')
       i01.moveArm("right",90,40,30,46)
 
    if (cmd == "2"):
       interval = time.time() -  millis
       millis = time.time()
       print ("    sleep(" + str(round(interval,2)) + ")")
       print ('    i01.moveArm("left",90,150,30,65)')
       i01.moveArm("left",90,150,30,65)
 
 
    if (cmd == "3"):
       interval = time.time() -  millis
       millis = time.time()
       print ("    sleep(" + str(round(interval,2)) + ")")
       print ("    i01.moveTorso(117,90,90)")
       i01.moveTorso(117,90,90)
 
    if (cmd == "4"):
       interval = time.time() -  millis
       millis = time.time()
       print ("    sleep(" + str(round(interval,2)) + ")")
       print ("    i01.moveTorso(86,90,90)")
       i01.moveTorso(86,90,90)
 
 
    if (cmd == "5"):
       interval = time.time() -  millis
       millis = time.time()
       print ("    sleep(" + str(round(interval,2)) + ")")
       print ('    i01.moveArm("left",5,90,30,10)')
       print ('    i01.moveArm("right",5,90,30,10)')
       i01.moveArm("left",5,90,30,10)
       i01.moveArm("right",5,90,30,10)


#file : home/Markus/readInput.py edit raw
from org.myrobotlab.service import Speech
mouth = Runtime.createAndStart("mouth","Speech")

arduino = Runtime.createAndStart("arduino","Arduino")
arduino.connect("COM4")

pin0 = None
pin1 = None

Ana0 = 10

arduino.arduino.enablePin(Pin0)
arduino.arduino.enablePin(Pin1)

# make friendly sample rate
# arduino.setSampleRate(8000)

arduino.addListener("publishPin", "python", "publishPin")

# my call-back
def publishPin(pin):

  #print pin.value

  if (pin.pin == 14):
    print("pin14.value ", pin.value)
    pin0 = pin
    if (pin.value >= 500):
      mouth.speak("pin 0")
      sleep(2)
    
  elif (pin.pin == 15):
    print("pin15.value ", pin.value)
    pin1 = pin
    if (pin.value >= 500):
      mouth.speak("pin 1")
      sleep(2)
  
  if (pin0.value >= pin1.value ):
    print("pin0 is greater than pin1")


#  print pin.pin, pin.value, pin.type, pin.source,

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
dwilli9013's picture

BRAVO

Another awesome video Markus. Love it.

GroG's picture

YOU DID IT ! :D

Ahahaah .. that made my day ! :D

 

It comes to mind that MouthControl would benefit possibly by adding the functionality of movement in relation to amplitutde of sound - that way text & mp3 files could be processed without specifying all the values.

 

Great Work !

beetlejuice's picture

Excellent !! I'm lovin' it !

Excellent !! I'm lovin' it !

hairygael's picture

Great Markus!! another of

Great Markus!! another of these cool videos!!

Grog your suggestion is definitly something that could need some digging!