After spending some time with the new inmoov 2.0, i got the hands working with voice control, but i'm having trouble getting the arms working

here's the line that it keeps getting stuck on:

leftArm = inMoov.startleftArm(leftArmPort)

here are the errors:

gnu.io.PortInUseException: COM4
 
org.myrobotlab.serial.SerialDeviceException: port in use COM4
 
java.lang.NullPointerException
 
  File "<string>", line 20, in <module> (line 20 is the line that i posted above)
 
java.util.IllegalFormatConversionException: java.util.IllegalFormatConversionException: a != java.lang.String
 
thank you!
 
(and also how do i get the jaw servo connected)

 

GroG

10 years 1 month ago

Hi JC,

thanks for working on it.

Step 1 - always get the latest

I see 2 issues

One was a capitilization error startleftArm is now startLeftArm

and there was a formatting error in logging... 

both were fixed in the latest build..

head = inMoov.startHead("COM8")  

will fire up the head, 2 tracking services, 2 pids, and opencv, and the mouth control ... or at least should.. :)

JCInMoov

10 years 1 month ago

In the javadoc it says startleftArm instead of startLeftArm

is the latter the correct one?

GroG

10 years 1 month ago

Short answer .. Yes.

I appreciate you trying to use the javadocs... that's great.. but the javadocs can get out of sync with the code (working on rectifying this)....

I might suggest to you something which I use..   Try the WebGUI REST API...

step 1 - (use the latest mrl)

step 2 - in Python - add this to your InMoov script

webgui = Runtime.createAndStart("webgui", "WebGUI")

point a browser to http://localhost:7777 -  click REST API - you'll see all active services - if you click on any - they will expand and show you all the methods.

The difference between this and javadoc is this is NEVER out of sync, because it reflectively inspects the code that is running... so there is no possible way to be out of sync.

i got the arm services working fine just a couple of problems.

setting the limits for the servos doesnt seem to be doing anything because after i set the arm limits, the program keeps on trying to go above or below it and everytime i try to manually move it in the safe range it says 'out of range'

same thing happens with the jaw.

the jaw servo is attached (i think) and the limits are set but it keeps on trying to go out of its range

here is my code:

leftBicepMin = 45 #as int inc, arm extends out
leftBicepMax = 90 #keeping it the same bc it is having muscle spasms for some reason
leftRotateMin = 90 #70
leftRotateMax = 100 #125
leftShoulderMin = 70 #90 
leftShoulderMax = 85 #145
leftOmoplateMin = 95 #77
leftOmoplateMax = 120 #100
jawMax = 114
jawMin = 64
 
headPort = "COM4"
rightHandPort = "COM5" #declaration of port values
leftHandPort = "COM4"
leftArmPort = "COM4"
 
print "starting inmoov..."
inMoov = Runtime.createAndStart("i01", "InMoov")
rightHand = inMoov.startRightHand(rightHandPort)
leftHand = inMoov.startLeftHand(leftHandPort) #port connection 
head = inMoov.startHead(headPort)
leftArm = inMoov.startLeftArm(leftArmPort) 
webgui = Runtime.createAndStart("webgui", "WebGUI")
print "ports connected"
leftHand.setpins(2,3,4,5,6,13)           
rightHand.setpins(2,3,4,5,6,13)#set pins
#leftArm.setpins(7,8,9,10)
print "pins set..."
inMoov.head.attach()
inMoov.rightHand.attach() #attach all of the services
inMoov.leftHand.attach()
inMoov.leftArm.attach()
print "limbs attached"
leftArm.setLimits(leftBicepMin,leftBicepMax,leftRotateMin,leftRotateMax,leftShoulderMin,leftShoulderMax,leftOmoplateMin,leftOmoplateMax)
print "left arm limits set"
head.setJaw(i01.head.jaw) 
i01.head.jaw.setMinMax(jawMin,jawMax)
head.setLimits(0,180,0,180,0,180,0,180,64,114)
print "jaw limits set"
 
 
inMoov.head.rest()
inMoov.rightHand.rest()
inMoov.leftHand.rest() #initial rest functions
inMoov.leftArm.rest()
print "resting..."
 
 
ear = runtime.createAndStart("ear","Sphinx")
 
ear.attach(inMoov.head.mouthControl.mouth)
ear.addCommand("open hand", "python", "openhand")
ear.addCommand("close hand", "python", "closehand") 
ear.addCommand("rest","python","rest")              
 
ear.addComfirmations("yes","correct","yeah","ya")
ear.addNegations("no","wrong","nope","nah")
 
ear.startListening() #all commands before this line
 
def openhand():
print "opening hand"
inMoov.leftHand.open()
inMoov.rightHand.open()
 
def closehand():
print "closing hand"
inMoov.leftHand.close()
inMoov.rightHand.close()
 
def rest():
print "resting"
inMoov.leftHand.rest()
inMoov.rightHand.rest()
inMoov.head.rest()
inMoov.leftArm.rest()
 

Should be fine, 

Everyones Servos are slightly different.  Ale always has a tendency to find inverted ones.

My intention is to soon create a map function on the servos, so scripts and gestures can be the same,

but the actual values sent to the servo will differ.  Arduino sketch libraries have this function.

servo1.map(0, 180, 10, 150)

would be an example of where the input range (0, 180) is too large for the servo to handle correctly, either because of physical or eletrical (potentiometer) differences, and is remapped to a safe/working range of 10 - 150.

JCInMoov

10 years ago

also, nothing is coming out of the speakers when it tries to talk back.

is there any way to solve the 'out of range' problem with the jaw servo?

 

JCInMoov

10 years ago

is the no sound coming out problem related to the jaw out of range problem?

because the ear recognition and commands work fine, but nothing is coming is making a sound 

MouthControl is totally seperate - it should have no influence on the sound generation..

The last no-worky I have from you is 18-Feb-2014  ... and it was about the port in use problem, and a format error ...  (don't think that's related either)

can you send me another no worky after you try to get InMoov 2.0 to say something...

I have a pretty large update coming up - would like to see if your problem has already been addressed in it...

JCInMoov

10 years ago

alrighty just sent the no worky

i still says the jaw is moving out of range and it gets the audio files and eveything but it just doesnt run them through the speakers or anything i checked all my sound and stuff.

GroG

10 years ago

In reply to by JCInMoov

The mouth control I fixed but you have to wait for the next build...

I checked your no-worky - and see that it's at least "trying" to do the right thing.

380285 [i01.head.mouthControl.mouth] INFO  org.myrobotlab.service.Speech  - audioFile\google\en_gb\audrey\did you say. close hand.mp3 is found 
380286 [i01.head.mouthControl.mouth] INFO  org.myrobotlab.service.Speech  - isSpeaking true

 

This means the file (mrl install directory)\audioFile\google\en_gb\audrey\did you say. close hand.mp3 was found - I notice it has en_gb so this looks like a customized google url.

Manually go to the file and just try to play it - does it work then - just double clicking ? Are the 0 bytes ?

 

 

JCInMoov

10 years ago

yeah i think that may be the problem...

i can access all of the mp3 files but i cant play them for some reason. 

windows media player "encounters a problem" when trying to play those files. 

and theyre all around 960~ bytes so im not sure what the problem is 

The files are cached in the audioFile if they are bad files they will be played in silence again and again. I'd recommend moving or deleting that directory and trying again (without modifying google's url)