InMoov.py - the "Service Page" script !!!

Ahoy !!
We've done a tonne of work !  Close 50+ bugs (https://github.com/orgs/MyRobotLab/projects/1)

But wait there's more !  ... We've made better documentation, now all our Services Pages which document our MRL building blocks have an auto-magically linked Python example at the bottom ... called "Examples"

But wait there's more ! ..  A MRL service called the Test service - can auto-magically test each and every one of these python scripts - not only during each build, but on different devices too !

So I'm now in the process of virtualizing hardware in all the scripts to make them worky without hardware.  I do it in a way that I hope is clear, and you can turn off virtualization simply by changing someVirtualThingy = False at the top of the scripts.

Let's take a peek at the InMoov "Service Page"

http://myrobotlab.org/service/Inmoov

When you scroll to the bottom of the documentation you'll see an 

Examples:

and below you'll see our awesome InMoov script ... but its not so awesome..  I think it can be much more awesome since I have virtualized the hardware.  I'm curious about the differences of this script vs "other" official & non-offical scripts, perhaps its time we normalize ?  What is the difference between using startup batch files too ?  
 
"As a user" .. I want the service/InMoov.py to do lots of cool things, and be worky every release !! (Is that too much to ask for ? .. I don't think so)
 
This script is pretty  "weenie" .. needs more meat !

USE THIS LINK FOR THIS PAGE - SINCE IT IS THE DEVELOP BRANCH  !!! - http://myrobotlab.org/content/inmoovpy-service-page-script?branch=develop


#file : service/InMoov.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")
useRightVirtualArduino = True
useLeftVirtualArduino = True
useVirtualInMoov = True

useVirtualArduinos = True

rightPort = "COM8"
leftPort = "COM10"

i01 = Runtime.start("i01", "InMoov")

if (useRightVirtualArduino):
    rightVirtual = Runtime.start("rightVirtual","VirtualArduino")
    rightVirtual.connect(rightPort)

if (useLeftVirtualArduino):
    leftVirtual  = Runtime.start("leftVirtual","VirtualArduino")
    leftVirtual.connect(leftPort)


# starting parts
i01.startEar()
i01.startMouth()
#to tweak the default voice
##############
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)

 


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
hairygael's picture

Super great update Grog! I

Super great update Grog!

I always love your posts!

But why using an old script with Min and Max for the demo/exemple?

The correct scripts are located here:

https://github.com/MyRobotLab/inmoov/tree/develop/InMoov/testScripts

GroG's picture

Hi Gael ! I'm glad you

Hi Gael !

I'm glad you asked,

because when scripts are under pyrobotlab/service/{serviceName}.py they become Auto-Magical !

They are "auto-magically" included in documentation at the end for each Service Page.
They are "auto-magically" referenced in help menus.
They are "auto-magically" included in "examples"

/service/{serviceName}.py most "auto-magical" aspect is :

Testing Every Build !

Wuh ? did I hear that right. Someone is going to test these python scripts every single build.  So testing everytime the code changes ?  Who has that dedication ?  Who has that stamina ?  Who can be testing 24/7 365 days a year ?

Auto-magical Elves !  That's who 

Ok, so thanks for the direction .. I'll look at the scripts references you sent and start updating

/service/InMoov.py
/service/InMoovHead.py etc ...

Because the elves are very eccentric and particular, they will only look at scripts which are placed in :
/service/{serviceName}.py

They also live in the virtual world....
And don't really see "real" hardware, but must use virtual hardware..

They are funny that way ..

moz4r's picture

InMoov service need

InMoov service need documentation refresh !!! and little inventory...

- We need testing script for humans ( sometime humans like to do the job of auto-magical Elves , and they like to understand how a single file with few code lines worky , for education )

- We need testing for Auto-magical Elves

- We need a switches to launch the magic, out of the box

- We need to merge !

 

First, the inventory, about what I know ( lot of things ?? )

Minimal testing scripts used by humans :

https://github.com/MyRobotLab/inmoov/blob/develop/InMoov/testScripts/

Magical script ( start_inmoov.bat is the switch )

https://github.com/MyRobotLab/inmoov/blob/master/InMoov/Inmoov.py

Service script & documentation

https://github.com/MyRobotLab/pyrobotlab/blob/master/service/InMoov.py ( InMoov.* )

Test script used by compilater

( Is this Service script ? )

 

So. Maybe we can use Minimal testing scripts used by humans, for Auto-magical Elves.

By exemple if they see rightPort = "COM42" -> They decide to mount a virtual arduino

Maybe auto-magical Elves can test Magical script too ? By default it launch allready virtual things. Ant It will be usefull for us.

 

GroG's picture

Thanks for the map and

Thanks for the map and directions moz4r ...
I'll hike around a bit, and look ..