Hello everybody!

I have a problem with the jaw. I am not able to get that the jaw moves when inmoov speaks. 

This is my code that I have modified from different people.

from java.lang import String
import subprocess
 
######################################################################
# Inmoov portions 
###################################################################### 
#starting the InMoov-service 
i01 = Runtime.createAndStart("i01", "InMoov")
headPort = "COM6"
 
#starting the mouth
i01.startMouth()
#i01.mouthControl.setmouth(33,140)
 
#start the (InMoov-)head(-service) 
head = i01.startHead(headPort)
 
#start the ear(-service)
i01.startEar()
 
 
######################################################################
# Create ProgramAB chat bot
######################################################################
lloyd = Runtime.createAndStart("sara", "ProgramAB")
#lloyd.startSession("c:/dev/workspace.kmw/pyrobotlab/home/kwatters", "default", "lloyd")
lloyd.startSession("sara", "sara")
 
######################################################################
# create the speech recognition service
# Speech recognition is based on WebSpeechToolkit API
######################################################################
 
######################################################################
# Create the webkit speech recognition gui
######################################################################
wksr = Runtime.createAndStart("webkitspeechrecognition", "WebkitSpeechRecognition")
######################################################################
# create the html filter to filter the output of program ab
######################################################################
htmlfilter = Runtime.createAndStart("htmlfilter", "HtmlFilter")
 
######################################################################
# create the speech to text service (named the same as the inmoov's)
######################################################################
i01.mouth = Runtime.createAndStart("i01.mouth", "AcapelaSpeech")
i01.mouth.setVoice("Antonio")
 
######################################################################
# MRL Routing webkitspeechrecognition -> program ab -> htmlfilter -> inmoov
######################################################################
# add a route from Sphinx to ProgramAB
# sphinx.addTextListener(lloyd)
# debugging in python route.
# sphinx.addListener("publishText", python.name, "heard", String().getClass());
 
# add a link between the webkit speech to publish to ProgramAB
wksr.addTextListener(lloyd)
wksr.addListener("publishText","python","heard");
 
# Add route from Program AB to html filter
lloyd.addTextListener(htmlfilter)
# Add route from html filter to mouth
htmlfilter.addTextListener(i01.mouth)
 
# make sure the ear knows if it's speaking.
# TODO: how does this jive with webspeech ?!
# sphinx.attach(mouth)

Please, could you help me?

Thank you very much

Mats

8 years 7 months ago

You also need to start MouthControl like this:

i01.startMouthControl(headPort)

Then you need to override the default setting for the jaw movement:

i01.mouthControl.setmouth(90,120)
 
And assign the AcapelaSpeech service to the mouth.
 
i01.mouthControl.setMouth(i01.mouth)
 
I know. It's a bit confusing that MouthControl has two methods ( setmouth and setMouth ) that have almost the same name. I will discuss with GroG and Kwatters if we should change name on one or both.   
 
 

antoninovara

8 years 7 months ago

In reply to by Mats

Hello again, 

I have tried your advice, but I still have a problem. I have modified the code and this is my new one:

from java.lang import String
import subprocess
 
######################################################################
# Inmoov portions 
###################################################################### 
#starting the InMoov-service 
i01 = Runtime.createAndStart("i01", "InMoov")
headPort = "COM6"
 
#starting the mouth
i01.startMouth()
i01.startMouthControl(headPort)
i01.mouthControl.setmouth(33,140)
 
#start the (InMoov-)head(-service) 
head = i01.startHead(headPort)
 
#start the ear(-service)
i01.startEar()
 
 
######################################################################
# Create ProgramAB chat bot
######################################################################
lloyd = Runtime.createAndStart("sara", "ProgramAB")
#lloyd.startSession("c:/dev/workspace.kmw/pyrobotlab/home/kwatters", "default", "lloyd")
lloyd.startSession("sara", "sara")
 
######################################################################
# create the speech recognition service
# Speech recognition is based on WebSpeechToolkit API
######################################################################
 
######################################################################
# Create the webkit speech recognition gui
######################################################################
wksr = Runtime.createAndStart("webkitspeechrecognition", "WebkitSpeechRecognition")
######################################################################
# create the html filter to filter the output of program ab
######################################################################
htmlfilter = Runtime.createAndStart("htmlfilter", "HtmlFilter")
 
######################################################################
# create the speech to text service (named the same as the inmoov's)
######################################################################
i01.mouth = Runtime.createAndStart("i01.mouth", "AcapelaSpeech")
i01.mouth.setVoice("Antonio")
 
i01.mouthControl.setMouth(i01.mouth)
 
######################################################################
# MRL Routing webkitspeechrecognition -> program ab -> htmlfilter -> inmoov
######################################################################
# add a route from Sphinx to ProgramAB
# sphinx.addTextListener(lloyd)
# debugging in python route.
# sphinx.addListener("publishText", python.name, "heard", String().getClass());
 
# add a link between the webkit speech to publish to ProgramAB
wksr.addTextListener(lloyd)
wksr.addListener("publishText","python","heard");
 
# Add route from Program AB to html filter
lloyd.addTextListener(htmlfilter)
# Add route from html filter to mouth
htmlfilter.addTextListener(i01.mouth)
 
# make sure the ear knows if it's speaking.
# TODO: how does this jive with webspeech ?!
# sphinx.attach(mouth)
 
*******************************************************************************************************
 
And now I get this error:
 
------Traceback (most recent call last):  File string, line 51, in moduleAttributeError: org.myrobotlab.service.MouthControl object has no attribute setMouth at org.python.core.Py.AttributeError(Py.java:166) at org.python.core.PyObject.noAttributeError(PyObject.java:930) at org.python.core.PyObject.__getattr__(PyObject.java:925) at org.python.pycode._pyx5.f$0(string:68) at org.python.pycode._pyx5.call_function(string) at org.python.core.PyTableCode.call(PyTableCode.java:165) at org.python.core.PyCode.call(PyCode.java:18) at org.python.core.Py.runCode(Py.java:1261) at org.python.core.Py.exec(Py.java:1305) at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:206) at org.myrobotlab.service.Python$PIThread.run(Python.java:179)------
 
*******************************************************************************************************
 
Thank you again. You always help me.

Hi

You need to download th latest MRL, because the setMouth metod was created just a few days ago.

You can find a link to the latest build in the shoutbox on the left side of this page.

/Mats

 

Thank you very much.

I'm going to try and I will post the result.

I really like this project and their members. 

Antonino

Hello Mats,

I had some problem with my code but I have found yours and I have modified a little and now, EVERYTHING WORKS GREAT.

Thank you very much for your help. It's amazing.

I really love this project.

Thanks for showing it. This video makes me very happy. Young kids and an engaged teacher working on a project that would have been impossible just 5 years ago.