InMoovHand

javadoc

a sub service of InMoov  , to control the hand

Here is a script :


#file : /service/InMoovHand.py edit raw
# a very minimal script for InMoov
# although this script is very short you can still
# do voice control of a right hand or finger box
# for any command which you say - you will be required to say a confirmation
# e.g. you say -> open hand, InMoov will ask -> "Did you say open hand?", you will need to
# respond with a confirmation ("yes","correct","yeah","ya")

rightPort = "COM8"

i01 = Runtime.createAndStart("i01", "InMoov")
# starting parts
i01.startEar()
i01.startMouth()
#to tweak the default voice
i01.mouth.setGoogleURI("http://thehackettfamily.org/Voice_api/api2.php?voice=Ryan&txt=")
##############
i01.startRightHand(rightPort)
# tweaking defaults settings of right hand
#i01.rightHand.thumb.setMinMax(55,135)
#i01.rightHand.index.setMinMax(0,160)
#i01.rightHand.majeure.setMinMax(0,140)
#i01.rightHand.ringFinger.setMinMax(48,145)
#i01.rightHand.pinky.setMinMax(45,146)
#i01.rightHand.thumb.map(0,180,55,135)
#i01.rightHand.index.map(0,180,0,160)
#i01.rightHand.majeure.map(0,180,0,140)
#i01.rightHand.ringFinger.map(0,180,48,145)
#i01.rightHand.pinky.map(0,180,45,146)
#################

# verbal commands
ear = i01.ear

ear.addCommand("attach right hand", "i01.rightHand", "attach")
ear.addCommand("disconnect right hand", "i01.rightHand", "detach")
ear.addCommand("rest", i01.getName(), "rest")
ear.addCommand("open hand", "python", "handopen")
ear.addCommand("close hand", "python", "handclose")
ear.addCommand("capture gesture", ear.getName(), "captureGesture")
ear.addCommand("manual", ear.getName(), "lockOutAllGrammarExcept", "voice control")
ear.addCommand("voice control", ear.getName(), "clearLock")
 
ear.addComfirmations("yes","correct","yeah","ya")
ear.addNegations("no","wrong","nope","nah")

ear.startListening()

def handopen():
  i01.moveHand("left",0,0,0,0,0)
  i01.moveHand("right",0,0,0,0,0)

def handclose():
  i01.moveHand("left",180,180,180,180,180)
  i01.moveHand("right",180,180,180,180,180)

Examples:


#file : service/InMoovHand.py edit raw
# a very minimal script for InMoov
# although this script is very short you can still
# do voice control of a right hand or finger box
# for any command which you say - you will be required to say a confirmation
# e.g. you say -> open hand, InMoov will ask -> "Did you say open hand?", you will need to
# respond with a confirmation ("yes","correct","yeah","ya")

rightPort = "COM8"

i01 = Runtime.createAndStart("i01", "InMoov")
# starting parts
i01.startEar()
i01.startMouth()
#to tweak the default voice
i01.mouth.setGoogleURI("http://thehackettfamily.org/Voice_api/api2.php?voice=Ryan&txt=")
##############
i01.startRightHand(rightPort)
# tweaking defaults settings of right hand
#i01.rightHand.thumb.setMinMax(55,135)
#i01.rightHand.index.setMinMax(0,160)
#i01.rightHand.majeure.setMinMax(0,140)
#i01.rightHand.ringFinger.setMinMax(48,145)
#i01.rightHand.pinky.setMinMax(45,146)
#i01.rightHand.thumb.map(0,180,55,135)
#i01.rightHand.index.map(0,180,0,160)
#i01.rightHand.majeure.map(0,180,0,140)
#i01.rightHand.ringFinger.map(0,180,48,145)
#i01.rightHand.pinky.map(0,180,45,146)
#################

# verbal commands
ear = i01.ear

ear.addCommand("attach right hand", "i01.rightHand", "attach")
ear.addCommand("disconnect right hand", "i01.rightHand", "detach")
ear.addCommand("rest", i01.getName(), "rest")
ear.addCommand("open hand", "python", "handopen")
ear.addCommand("close hand", "python", "handclose")
ear.addCommand("capture gesture", ear.getName(), "captureGesture")
ear.addCommand("manual", ear.getName(), "lockOutAllGrammarExcept", "voice control")
ear.addCommand("voice control", ear.getName(), "clearLock")
 
ear.addComfirmations("yes","correct","yeah","ya")
ear.addNegations("no","wrong","nope","nah")

ear.startListening()

def handopen():
  i01.moveHand("left",0,0,0,0,0)
  i01.moveHand("right",0,0,0,0,0)

def handclose():
  i01.moveHand("left",180,180,180,180,180)
  i01.moveHand("right",180,180,180,180,180)

vaxus's picture

InMoov hand with Arduino 16-channel shield

Hello.

Does anyone know how to change InMoov service to work with servos that are not connected to Arduino board directly but over a PWM shields. Why ... because the shield I have does use only 2 pins for all (up to 16) servos. Search my sample on amazon.de with PCA9685 (11 euro now).

 

So instead of using digital outputs you use I2C controller of Arduino that sends commands to PCA685 board.

Can anyone get in touch with me, so we can work on it.

 

Vasily,

Vienna,Austra

GroG's picture

Ahoy Vasily ! you'd need to

Ahoy Vasily !

you'd need to create the controller services first with the correct name and services ...

Mats might have done this, I think he has the same board.

Right now we are in the middle of a huge refactoring ... so not sure if it will work..

but after we are done we need testing, and will support I2C Servo controllers 

Mats's picture

Hi Vasily. The namn of the

Hi Vasily.

The namn of the service you should use is Adafruit16CServoDriver. 

It was working a few days ago. 

I have an exemple script, but it needs a minor change.

 

I'm not at home now. I will write more when I'm at my PC

 

Mats's picture

Hi Vasily. The namn of the

Hi Vasily.

The namn of the service you should use is Adafruit16CServoDriver. 

It was working a few days ago. 

I have an exemple script, but it needs a minor change.

 

I'm not at home now. I will write more when I'm at my PC

 

vaxus's picture

sample script please

Hello Mat.

 

I would appresciate the example script.

So far I walked through robotlab Arduino script (the one installed on Arduino) and wanted to rewrite it for Adafruit board (or virtualize the SERVO class).

If your script need a change, I can do it, just tell me approx.where the problem is :-)

I am professional senior tester, I love to find bugs.

 
Mats's picture

Adafruit16CServoDriver using Arduino i2c

Hi

The sample script to use your board is here:

https://github.com/MyRobotLab/pyrobotlab/blob/master/home/Mats/AdafruitS...

I hope it works. I had some problems testing it today. It wouldn't move the servos. But that can be for several other reasons.

Please let me know if you need help to change the script for the hand.

/Mats

vaxus's picture

Adafruit script

Hi Mats.

I actully found your script already yesterday in repository.

But I do not understand how it can work on Arduino side because...I have installed ArduinoSimple module on my Uno board and inside it there is only Servo module used.

Is there any new version of Arduino-side program ?

 

I have that servo board and it definitelly working. So I can make tests and adjutments.

I am interested that as I am comleting my Inmoov-myrobotlab-LeapMotion integraton. The only missing part is software

Vasily

Mats's picture

MRLComm

Hi Vasily

MRL uses a Arduino side program called MRLComm.

When you start the Arduino service there will be a tab containing all the code needed.

Copy/Paste it into the Arduino sketch compiler and upload it to your Arduino.

/Mats

vaxus's picture

I did that. I would expect

I did that. I would expect into MRLComm there is some "include Adafruit".... but it is only standard "include servo.h". I am using latest 1.0.119 version

Therefore my assumption is to et Adafruit board working, the new MRLComm must be adapted.

Where am I wrong ?

p.s. to be clear, my integratin LeapMotion-myrobot-Arduino-Inmoov is working with basic servos. I just wanna use that Adafruit board and put it into the InMoov arm directly. So I will have only 5 wires to the arm (5V, V+, GND, SCL, SLA).

 

Txs for your time.

Mats's picture

Arduino i2c architecture. Now and future.

Hi

To avoid dependencies on external libraryes, much of the content of the Adafruit-PWM-Servo-Driver has been copied into MRLComm.  ( https://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library/blob/master/Adafruit_PWMServoDriver.cpp )

The external library for the i2c communication is wire, and I use it since it's installed with the Arduino IDE.

If you look in https://github.com/MyRobotLab/myrobotlab/blob/develop/src/resource/Arduino/MRLComm.c and search for Adafruit16CServoDriver you can see how it is done.

I will rewrite part of this soon, so that Arduino will implement the I2CControl interface, and all device specific information will be in the device driver ( like Adafruit16CServoDriver, AdafruitIna219, Mpu6050 and so on).

MRLComm will only be used to write and read i2c commands to the i2c bus, without any knowledge about any device specific details.

The methods for i2c read and write are defined in the I2CControler interface and it's currently implemented in the RasPi service, so all i2c devices can already be used from a Raspbery PI using the i2c GPIO pins. 

/Mats

vaxus's picture

Now I got it. I was thinking

Now I got it.

I was thinking to rewrite MRLComm instead, but u r right - leave basic I2C on Arduino and implemen the rest in Myrobolab. I will try current implementation and let you know.

IMHO. Once you will impelement also ICSP/SPI basic bus, than there will be no need to touch MRLComm at all.

 

Mats's picture

ICSP / SPI

I could implement it. But I don't have any SPI device yet, so it would be hard to test. Do you have a specific device that you would like to communicate with using SPI ? 

/Mats

 

vaxus's picture

The cheapest device is SDCARD

The cheapest device is SDCARD reader/writer for Aduino

I bought and tested this one:

https://www.roboter-bausatz.de/735/sd-card-reader-adapter-modul-fuer-ard...

(which is the same as)

https://www.roboter-bausatz.de/735/sd-card-reader-adapter-modul-fuer-ard...

Mats's picture

SPI Device

OK

I ordered one. Thanks for the suggestion.

/Mats

mike95vl's picture

No-WORKY

If I start up the script of right hand voice control it wont work. I get this massage en the speach recognition won't work. Somebody any idea what this can be? Google Chrome is my homebrowser.