All:
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(Py.java:201)
at org.python.core.Py.IOError(Py.java:171)
at org.python.core.io.StreamIO.readinto(StreamIO.java:121)
at org.python.core.io.BufferedReader.peek(BufferedReader.java:86)
at org.python.core.io.BufferedReader.read1(BufferedReader.java:100)
at org.python.core.io.TextIOBase.readChunk(TextIOBase.java:241)
at org.python.core.io.TextIOWrapper.readline(TextIOWrapper.java:243)
at org.python.core.PyFile.file_readline(PyFile.java:265)
at org.python.core.PyFile.readline(PyFile.java:273)
at org.python.core.__builtin__.readline(__builtin__.java:963)
at org.python.core.__builtin__.raw_input(__builtin__.java:979)
at org.python.core.__builtin__.raw_input(__builtin__.java:995)
at org.python.core.BuiltinFunctions.__call__(__builtin__.java:102)
at org.python.core.PyObject.__call__(PyObject.java:391)
at org.python.pycode._pyx2.f$0(<string>:1)
at org.python.pycode._pyx2.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(Unknown 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.
Hello bytemewb,I believe you
Hello bytemewb,
I believe you should be able to append this script, or replace Sphinx code in #file : InMoov.minimal.py
on the InMoov service page - http://myrobotlab.org/service/inmoov
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.
Noobie questions always
Noobie questions always welcomed...
And thanks for point out it did not have a service page - I've created one for it now
http://myrobotlab.org/service/keyboard
Thanks
GroG:
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.
A new web gui will be
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 - http://myrobotlab.org/content/myrobotlab-ajax-json-jquery
For the limits - everything should be accessable after the InMoov service has been created and initialized.
e.g.
Overriding methods in the InMoov service?
All: Thanks for the helpful replies. Hopefully I will get some time this weekend to work on and finish
hand.
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.
You say Up I say Down
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
inMoov.handRight.index.setInverted(True);
or you can set all the servos of a hand as inverted in one call like this
inMoov.handRight.setInverted(True)
GroG Rocks!!!!
GroG: You Rock Man. I will download and test hopefully tomorrow.
Thanks :)
Yeah, let me know how it goes.. unfortunately I was not able to test yet.. so its just a little more than theory ;)