I am working on some demonstration scripts for my InMoov robotic hand.  Having not had good success with voice input I wanted to create a simple python script that would call some movement routines.

When I tried the standard: python raw_input('Enter Command: ')   approach

I get the following:

File "<string>", line 2, in <module>

IOError: The handle is invalid
at org.python.core.Py.fromIOException(
at org.python.core.Py.IOError(
at org.python.core.PyFile.file_readline(
at org.python.core.PyFile.readline(
at org.python.core.__builtin__.readline(
at org.python.core.__builtin__.raw_input(
at org.python.core.__builtin__.raw_input(
at org.python.core.BuiltinFunctions.__call__(
at org.python.core.PyObject.__call__(
at org.python.pycode._pyx2.f$0(<string>:1)
at org.python.pycode._pyx2.call_function(<string>)
at org.python.core.Py.runCode(
at org.python.core.Py.exec(
at org.python.util.PythonInterpreter.exec(
at org.myrobotlab.service.Python$ Source)

I am starting to see how the keyboard service would work, but the Javadoc for that service has a bad link and is unavailable.   I am browsing through the MRL source code but thought I might ask and save some time.


10 years 10 months ago

Hello bytemewb,

I believe you should be able to append this script, or replace Sphinx code in  #file :
on the InMoov service page -

It will add a keyboard service - and it subscribes python to the keyboard's "keyCommand" method which publishes key commands when the large button has focus.

Let me know how it goes - send a no-worky if you have nay troubles.


keyboard = Runtime.createAndStart("keyboard", "Keyboard")
python.subscribe("keyCommand", keyboard.getName(), "input")
def input():
    # print 'python object is ', msg_clock_pulse
    cmd =[0]
    print 'python data is ', cmd
    if (cmd == "A"):
    elif (cmd == "B"):


10 years 10 months ago


    Thanks.  I got part of that working last night.    I was hoping to come up with some way to implement an old fashion text based menu system for quick and dirty testing.

      My long term goal is to hook it into a a web page based control system.  Any good examples of how to implement that?


Unrelated question:  Any way to set limits on the servo settings for InMoov?   I find that over about 160 my servos will break the strings and goint below 10 has them straining where I am afraid they will burn out.



10 years 10 months ago

In reply to by bytemedwb

A new web gui will be available in the future - but at the moment its just in the planning stage.
There was some work to support a robot-futball game online through a web interface - you can see some of the gui here -


For the limits - everything should be accessable after the InMoov service has been created and initialized.




10 years 10 months ago

All:   Thanks for the helpful replies.  Hopefully I will get some time this weekend to work on and finish


Another question if I may.  It turns out that I seem to have run my control strings opposite of Gael.  Eg. when he ran the left side of the servo under the finger I ran the right side on the underside.

Is there an easy way to override the openhand/closehand etc.  methods in the InMoov service from Python?

Worst case is I can extend the current class to add methods to set what the open and close positions for each finger are.

This would help in another case.  As I have been testing due to different amounts of tension on each of the strings what the fully open and close positions (e.g. where the servo starts to stall and you risk burn out) for each finger are different.   I can address this by setting all the limits but I still have what I refer to as the reverse polarity in the servos.


10 years 10 months ago

You say Left I say Right...

Sounds like a  "Servo.setInverted(boolean)" would simplfy things greatly..
Just put it in version 1461 or higher - you can do a Blleeding Edge update

Individual servos can now be inverted like this


or you can set all the servos of a hand as inverted in one call like this




10 years 10 months ago

GroG:   You Rock Man.   I will download and test hopefully tomorrow.


Yeah, let me know how it goes..  unfortunately I was not able to test yet.. so its just a little more than theory ;)