new function for InMoov hand


As I tried to show in an example ( I am working on a self levelling hand for InMoov.

Thought that it would be best have a new function available in MRL like LeftHand.StayHorizontal(). This should do 2 things

a) set a digital output to inform my arduino nano to take over bend (new) and wrist(existing) control of the hand

b) prevent output of pwm signals from the main Arduino to the wrist servo as it will be controlled by the new Arduino nano.

Just had an issue with my new odroid and Ale pointed me to a jar at this location:

So my question - where can I get this source code to start experimenting with these additions and can somebody point me to a similar function I can use as a guideline (I am using eclipse).



juerg's picture

no coder to help me? Thought

no coder to help me?

Thought I add variables into class InMoovHand like

private Boolean keep_horizontal = false;
private Integer keep_horizontal_outpin = 22;

Could not figure out from the mrl-code how to set the pin into output mode and how to perform a digital write.

Then I assume a 

public keep_horizontal_start() {
  keep_horizontal = true;
  <digital write> (1, keep_horizontal_outpin);
  wrist.detach();   // avoid output to wrist as it is handled by another arduino


public keep_horizontal_stop() {
  keep_horizontal = false;
  <digital write> (0, keep_horizontal_outpin);

Will it need anything else to make the functions callable from the python-script?

thanks for any help
GroG's picture

Ah .. I see what your doing

Ah .. I see what your doing .. it would be like this :


public keepHorizontalStart() {
  keepHorizontal = true;
  arduino.digitalWrite(keepHorizontalOutPin, 1);
  wrist.detach();   // avoid output to wrist as it is handled by another arduino

public keep_horizontal_stop() {
  keepHorizontal = false;

  arduino.digitalWrite(keepHorizontalOutPin, 0);


Hope this helps.


kwatters's picture


That is awesome!  In addition to the orientation control, I like the additional degree of freedom that you've added to the wrist!  


great work!

juerg's picture

Thanks Kevin Maybe you add

Thanks Kevin

Maybe you add the option that the eyes will follow the hand by themselfes? In my opinion it would add - like faceTracking and maybe in the future my levelling hands - some internal intelligence to InMoov. We might in the future then say "pass ball from left hand to right hand" without dozens of script adjustments and with greater accuracy?


P.S. and don't forget the tuto about programAB, haha

GroG's picture

Juerg !   Wow .. great Video

Juerg !   Wow .. great Video !
I like your idea ...

LeftHand.StayHorizontal() ... I really impressed with the results you have achieved.

You have a transistor or switch to change the digital input from the (existing" control of the hand?  Can you give more detail and perhaps I can help.

As far a getting an Arduino from InMoov - you can get any service if you know its name :
Here is an example (in Java) of getting the right hand's arduino and turning pin 13 on:

InMoov i01 = (InMoov)Runtime.start("i01", "InMoov");
InMoovHand hand =i01.startRightHand("COM15");
Arduino arduino = (Arduino)Runtime.getService("i01.right");
arduino.digitalWrite(13, 1);


juerg's picture

@GroG thanks, I think I can


thanks, I think I can add that to my source code.

For the PWM output of the 2 arduinos to my wrist servo I thought it would be good enough to provide common ground and avoid that both pins try to control the servo at the same time (detach wrist in MRL and a digital signal for the arduino nano that it has control now).

Not sure however, do you think I need an additional element for "or"ing the signals? 


juerg's picture

.. and looking at your java

.. and looking at your java example - could I also do everything in a python script (which would make it much easier for me)?

GroG's picture

Yep,  Pretty much anything in


Pretty much anything in MRL  in Java can be done in Python too ... 
Here's a quick conversion (have not tested it)

i01 = Runtime.start("i01", "InMoov")
hand = i01.startRightHand("COM15")
arduino = Runtime.getService("i01.right")
arduino.digitalWrite(13, 1)
Alessandruino's picture

That's a old way of

That's a old way of copy/paste code Greg :P 

Here is the github way :P ahah

#file : /home/juerg/ edit raw
i01 = Runtime.start("i01", "InMoov")
hand = i01.startRightHand("COM15")
arduino = Runtime.getService("i01.right")

keepHorizontalOutPin = 13
keepHorizontal = False

def keepHorizontalStart():
  global keepHorizontal
  arduino.digitalWrite(keepHorizontalOutPin, 1)
  keepHorizontal = True
def keepHorizontalStop():
  global keepHorizontal
  arduino.digitalWrite(keepHorizontalOutPin, 0)
  keepHorizontal = False
// then you can just call the keepHorizontalStart() and keepHorizontalStop() in python

GroG's picture

I think you have a good plan,

I think you have a good plan, it should work with the deactivated Arduino's pin in a high impedence mode..


juerg's picture

Hey - great thanks a lot for

Hey - great

thanks a lot for your help and hope I can show you my pharao style InMoov in the near future


MaVo's picture

this is a new very

this is a new very interesting approach ! Great work!

(One thing I'm worried about are the strings running to each finger as they will make a bending very hard.)

juerg's picture

Hi MaVo, thanks for your

Hi MaVo, thanks for your interest.

Right, there have been 2 challenges to begin with (more came for adjusting and printing the revised parts).

1) how can I get a better pulling position for the strings
2) how can I reduce friction on the strings

for 1 I added an elevation on both sides of the hand as you can see here:



for 2 I have added 3 redirection axis with nails and spacers to redirect the strings and avoid sharp turns.

To get a 180 degree wrist I first experimented with wrench servos. They however are slow and in spite of using other gear relation did not work out well. I changed then to a 180 degree servo and modified the wrist gears to a 1:1 ratio which now runs quite nicely. A challenge is still the best form for the hand bending pulley because the upper/lower strings travel different lentgth's when bending.

There is a lot of experiencing involved so it will take me some time to publish a working solution and some instructions. The programming of the servos with arduino and the adafruit.bno055 was luckily a peace of cake with the provided software.



kmcgerald's picture

Very Important work

This is very important work.  We need our robots to be able to hold our drinks without spilling them.