something wrong with mouthcontrol and head servos

Hey guys, 

so im almost done with my inMoov project, but some little bug got in the way.

I got the mouthcontrol working (!), but when i try to initialize the head too, it doesnt work. The mouth control works fine when the head is not fired up, but when i start the head, all hell breaks loose.

I tried to start the head on the right arduion (com5), but the neck servos keep on trying to attach to the left arduino (com4)

 
print "starting inmoov..."
inMoov = Runtime.createAndStart("i01", "InMoov")
mouthControl = inMoov.startMouthControl("COM4")
 
leftHand = inMoov.startLeftHand("COM4") #port connection 
 
leftArm = inMoov.startLeftArm("COM4") 
mouth = Runtime.createAndStart("mouth","Speech")
#webgui = Runtime.createAndStart("webgui", "WebGUI")
inMoov.attach()
sleep(1)
#inMoov.leftHand.detach()
sleep(1)
#inMoov.leftHand.attach()
sleep(1)
#inMoov.leftArm.detach()
sleep(1)
#inMoov.leftArm.attach()
sleep(1)
i01.leftHand.wrist.detach()
sleep(1)
 
 
mouthControl.jaw.detach()
mouthControl.jaw.setPin(7)
mouthControl.jaw.attach()
mouthControl.setmouth(40,110)
sleep(1)
mouthControl.mouth.speak("Testing mouth control")
#sleep(1)
 
 
print "resting..."
 
#inMoov.leftHand.attach()
sleep(1)
#i01.head.jaw.detach()mouthControl.setmouth(114,64
 
#i01.leftHand.index.detach()
#i01.leftHand.majeure.detach()
 
#i01.leftHand.index.attach()
#i01.leftHand.majeure.attach()
 
#left.servoAttach(i01.head.jaw,8)
#inMoov.leftHand.detach()
mouthControl.mouth.speak("Moving to rest positions")
#inMoov.rightHand.attach()
inMoov.moveArm("left",180,65,140,75) 
inMoov.moveArm("right",180,65,125,100)
inMoov.moveHand("left",0,0,0,0,0,0)
inMoov.moveHand("right",0,0,0,0,0,0)
inMoov.moveHead(90,60)
 
 
rightArm = inMoov.startRightArm("COM5")
rightHand = inMoov.startRightHand("COM5")
head = inMoov.startHead(headPort)
sleep(1)
i01.leftHand.index.detach() #if index or middle dont respond
sleep(1)
i01.leftHand.index.attach()
#inMoov.leftHand.attach()
 
ear = runtime.createAndStart("ear","Sphinx")
 
 
#ear.attach(inMoov.head.mouthControl.mouth)
#.lockOutAllGrammarExcept("open hand","close hand","rest","raise arm","lower arm","test neck")
ear.addCommand("open hand", "python", "openhand")
ear.addCommand("close hand", "python", "closehand") 
ear.addCommand("rest","python","rest")     
ear.addCommand("raise arm","python","armup")
ear.addCommand("lower arm","python","armdown")      
ear.addCommand("test neck","python","necktest")  
ear.addCommand("count to five","python","counting") 
ear.addCommand("test jaw","python","testjaw")
#ear.addCommand("attach","python","attach")
 
#ear.addComfirmations("yes","correct","yeah","ya")
#ear.addNegations("no","wrong","nope","nah")
 
ear.startListening() #all commands before this line
 
(i took out all the commands to save space)
JCInMoov's picture

Should i just get an arduino

Should i just get 2 arduino megas?

would that solve it?

Alessandruino's picture

Is not your head on the left

Is not your head on the left arduino?

Alessandruino's picture

Btw i'm tweaking your

Btw i'm tweaking your script...there have been several changes to inmoov parts

Alessandruino's picture

print "starting

print "starting inmoov..."
inMoov = Runtime.createAndStart("inMoov", "InMoov")
head = inMoov.startHead("COM5")
 
inMoov.startEar()
 
mouthControl = inMoov.startMouthControl("COM4")
 
leftHand = inMoov.startLeftHand("COM4") #port connection 
 
leftArm = inMoov.startLeftArm("COM4") 
 
#webgui = Runtime.createAndStart("webgui", "WebGUI")
#inMoov.attach()
sleep(1)
#inMoov.leftHand.detach()
sleep(1)
#inMoov.leftHand.attach()
sleep(1)
#inMoov.leftArm.detach()
sleep(1)
#inMoov.leftArm.attach()
sleep(1)
inMoov.leftHand.wrist.detach()
sleep(1)
 
 
inMoov.head.jaw.detach()
inMoov.head.jaw.setPin(7)
inMoov.head.jaw.attach()
inMoov.mouthControl.setmouth(40,110)
sleep(1)
 
inMoov.startMouth()
 
inMoov.mouth.speak("Testing mouth control")
#sleep(1)
 
 
print "resting..."
 
#inMoov.leftHand.attach()
sleep(1)
#inMoov.head.jaw.detach()
 
#inMoov.leftHand.index.detach()
#inMoov.leftHand.majeure.detach()
 
#inMoov.leftHand.index.attach()
#inMoov.leftHand.majeure.attach()
 
#left.servoAttach(inMoov.head.jaw,8)
#inMoov.leftHand.detach()
inMoov.mouth.speak("Moving to rest positions")
#inMoov.rightHand.attach()
inMoov.moveArm("left",180,65,140,75) 
inMoov.moveArm("right",180,65,125,100)
inMoov.moveHand("left",0,0,0,0,0,0)
inMoov.moveHand("right",0,0,0,0,0,0)
inMoov.moveHead(90,60)
 
 
rightArm = inMoov.startRightArm("COM5")
rightHand = inMoov.startRightHand("COM5")
sleep(1)
inMoov.leftHand.index.detach() #if index or middle dont respond
sleep(1)
inMoov.leftHand.index.attach()
#inMoov.leftHand.attach()
 
ear = inMoov.ear
 
#.lockOutAllGrammarExcept("open hand","close hand","rest","raise arm","lower arm","test neck")
ear.addCommand("open hand", "python", "openhand")
ear.addCommand("close hand", "python", "closehand") 
ear.addCommand("rest","python","rest")     
ear.addCommand("raise arm","python","armup")
ear.addCommand("lower arm","python","armdown")      
ear.addCommand("test neck","python","necktest")  
ear.addCommand("count to five","python","counting") 
ear.addCommand("test jaw","python","testjaw")
#ear.addCommand("attach","python","attach")
 
#ear.addComfirmations("yes","correct","yeah","ya")
#ear.addNegations("no","wrong","nope","nah")
 
ear.startListening() 
JCInMoov's picture

still not worky...

Yeah so i tried the new code:

now the head servos and the jaw servo wont move when i try to move them

and the neck servos are still trying to connect to the left arduino (com4) instead of the right (com5)

when i try to put the head and mouthcontrol on the left arduiono, it doesnt work

Alessandruino's picture

Can you please post what are

Can you please post what are your connections? so what kind of arduinos and what is connected to what?

JCInMoov's picture

so i have two arduinos,  left

so i have two arduinos, 

left one is COM4

right one is COM5

pins 2-6 on each are connected to the fingers

pin 7 on the left is originally for the wrist but i had to make it for the jaw; i would like to use the wrist but its no biggie if i have to give up wrist mobility for the jaw working 

pins 8-11 are for the shoulder servos

12-13 on the left arduiono only are for the neck servos

Alessandruino's picture

So you need to start the head

So you need to start the head on com4, because neck servos are in the head and they are on left arduino (com4) ...right?

In this case you have to put COM4 in inMoov.startHead("COM4")

Another thing you need is the la test versione of MRL

Alessandruino's picture

Download myrobotlab.jar here

Download myrobotlab.jar here https://github.com/MyRobotLab/myrobotlab/releases/tag/br3 and copy paste it in your myrobotlab folder libraries/jar replacing the old jar