InMoov Python problems

Hello

I have the file of Gael on my InMoov rewrite!

https://github.com/MyRobotLab/pyrobotlab/tree/master/home/hairygael

The bots in ProgramAB/bots/maWebKit/aiml copy

And gestures in ProgramAB

But my Roby only understands Hello and to the rest he only says "I have no answer for that"!

And the mouth does not move then only when booting!

Please help

 

 

===============================================

from java.lang import String
import threading
import time
import random
from org.myrobotlab.net import BareBonesBrowserLaunch
##
import urllib, urllib2
import json

from datetime import datetime
#######################
import io
import itertools
import textwrap
import codecs
import socket
import os
import shutil
import hashlib
import subprocess
import csv
from subprocess import Popen, PIPE

#############################################################
# This is the InMoov script
# InMoov is powered by MyRobotLab
# Initially we'll start simple
# It will use ProgramAB & Webkit for all interactions with
# the bot.
#############################################################
# All bot specific hardware configuration goes here.
leftPort = "/dev/cu.usbmodem1A12231"
rightPort = "/dev/cu.usbmodem1A1211"
headPort = leftPort

gesturesPath = "/Users/michaelpfeifer/Desktop/MyRobotLab/ProgramAB/gestures"

aimlPath = "/Users/michaelpfeifer/Desktop/MyRobotLab/ProgramAB"
aimlBotName = "myWebKit"
aimlUserName = "Michael"
#botVoice = "Ryan"
#############################################################
# LANGUAGE ( FR/EN )
lang="EN"
Voice="cmu-slt-hsmm" # Default female for MarySpeech
#Voice="cmu-bdl-hsmm" #Male US voice.You need to add the necessary file.jar to myrobotlab.1.0.XXXX/library/jar
#https://github.com/MyRobotLab/pyrobotlab/blob/ff6e2cef4d0642e47ee15e353ef934ac6701e713/home/hairygael/voice-cmu-bdl-5.2.jar
#Voice="upmc-pierre-hsmm" #French voice
voiceType = Voice

##Create your free Id and key https://datamarket.azure.com/dataset/bing/microsofttranslator
#client_id = "your_id"
#client_secret = "yoursecret_key"

global human
global inmoov
global weathervar
global walkingThread
#############################################################

# toggle to only load program ab  and skip the inmoov services
startInMoov = True

######################################################################
# helper function help debug the recognized text from webkit/sphinx
######################################################################
def heard(data):
  print "Speech Recognition Data:"+str(data)

######################################################################
#
# MAIN ENTRY POINT  - Start and wire together all the services.
#
######################################################################

# launch the swing gui?
# gui = Runtime.createAndStart("gui", "GUIService");

######################################################################
# Create ProgramAB chat bot ( This is the inmoov "brain" )
######################################################################
#neopixel = Runtime.createAndStart("neopixel","Serial")
#neopixel.connect("COM3", 57600, 8, 1, 0)
myWebKit = Runtime.createAndStart("myWebKit", "ProgramAB")
myWebKit.setPath(aimlPath)
myWebKit.startSession(aimlUserName, aimlBotName)

######################################################################
# Html filter to clean the output from programab.  (just in case)
htmlfilter = Runtime.createAndStart("htmlfilter", "HtmlFilter")

######################################################################
# mouth service, speech synthesis
mouth = Runtime.createAndStart("i01.mouth", "MarySpeech")
#mouth.setVoice(botVoice)
mouth.setVoice(voiceType)
#Volume(amount=2.0)
#TractScaler(amount=1.4)
#F0Scale(f0Add=2.0)
#F0Add(f0Add=60.0)
#Robot(amount=0.0)
#Rate(amount=3.75)
#Whisper(amount=100.0)
#Stadium(amount=100.0)
#Chorus(delay=1.466;amp1=0.54)
#FIRFilter(type=3;fc1=500.0;fc2=2)
#mouth.setAudioEffects("Volume(amount=1.75) + TractScaler(amount=0.95) + F0Scale(f0Add=3.0)")
#mouth.setLanguage(lang)

######################################################################
# the "ear" of the inmoov TODO: replace this with just base inmoov ear?
ear = Runtime.createAndStart("i01.ear", "WebkitSpeechRecognition")
ear.addListener("publishText", python.name, "heard");
ear.addMouth(mouth)
######################################################################
WebkitSpeechRecognitionFix = Runtime.start("WebkitSpeechRecognitionFix","Clock")
WebkitSpeechRecognitionFix.setInterval(1000)
WebkitSpeechRecognitionFix.startClock()
######################################################################
# MRL Routing webkitspeechrecognition/ear -> program ab -> htmlfilter -> mouth
######################################################################
ear.addTextListener(myWebKit)
myWebKit.addTextListener(htmlfilter)
htmlfilter.addTextListener(mouth)
######################################################################
#Gets the battery level
level = Runtime.getBatteryLevel()
######################################################################
# Start up the inmoov and attach stuff.
######################################################################
i01 = Runtime.create("i01", "InMoov")
##############
head = Runtime.create("i01.head","InMoovHead")
##############
# tweaking default settings of jaw
head.jaw.setMinMax(45,100)
head.jaw.map(0,180,45,100)
head.jaw.setRest(45)
# tweaking default settings of eyes
head.eyeY.map(0,180,80,120)
head.eyeY.setMinMax(0,180)
head.eyeY.setRest(100)
head.eyeX.map(0,180,80,120)
head.eyeX.setMinMax(0,180)
head.eyeX.setRest(100)
head.neck.map(0,180,1,100)
head.neck.setMinMax(0,180)
head.neck.setRest(50)
head.rothead.map(0,180,60,120)
head.rothead.setMinMax(0,180)
head.rothead.setRest(90)
head.rollNeck.map(0,180,60,120)
head.rollNeck.setMinMax(0,180)
head.rollNeck.setRest(90)
head.rollNeck.moveTo(90)
##############

#################
i01 = Runtime.start("i01","InMoov")
i01.setMute(False)
#################
if startInMoov:
   i01.startAll(leftPort, rightPort)
   #i01.startMouth()
   #i01.startMouthControl(leftPort)
   i01.mouthControl.setmouth(43,99)
#################
   #i01.startEyesTracking(leftPort)
   #i01.startHeadTracking(leftPort)
#################
   #to tweak the default PID values
   i01.eyesTracking.pid.setPID("eyeX",12.0,1.0,0.1)
   i01.eyesTracking.pid.setPID("eyeY",12.0,1.0,0.1)
   i01.headTracking.pid.setPID("rothead",5.0,1.0,0.1)
   i01.headTracking.pid.setPID("neck",5.0,1.0,0.1)
#################
   #i01.startEar()
   #i01.startRightArm(rightPort)
   #i01.startRightHand(rightPort,"atmega2560")
   #i01.startLeftArm(leftPort)
   #i01.startLeftHand(leftPort)
   #i01.startTorso("COM20")
#################
   i01.startPIR("/dev/cu.usbmodem1A12231",23)

else:
  i01.mouth = mouth
    

#################
#Sets FaceRecognizer
#fr=i01.opencv.addFilter("FaceRecognizer")
#lastName=fr.getLastRecognizedName()
#################
##Velocity settings

head.eyeX.setVelocity(0)
head.eyeY.setVelocity(0)

head.neck.setVelocity(0)
head.rothead.setVelocity(0)
head.jaw.setVelocity(0)

######################################################################
# Launch the web gui and create the webkit speech recognition gui
# This service works in Google Chrome only with the WebGui
#################################################################
webgui = Runtime.create("webgui","WebGui")
webgui.autoStartBrowser(False)
webgui.startService()
BareBonesBrowserLaunch.openURL("http://localhost:8888/#service/i01.ear")

######################################################################
# END MAIN SERVICE SETUP SECTION
######################################################################
if lang=="EN":
   ear.setLanguage("en-EN")
python.subscribe(ear.getName(),"publishText")

######################################################################
# Helper functions and various gesture definitions
######################################################################
i01.loadGestures(gesturesPath)

================================================

moz4r's picture

Hi xmike ! Script old but you

Hi xmike ! Script old but you can it worky.

You can try

aimlPath = "/Users/michaelpfeifer/Desktop/MyRobotLab/ProgramAB/"

instead of

aimlPath = "/Users/michaelpfeifer/Desktop/MyRobotLab/ProgramAB"

 

xmike's picture

Hello moz4r   You say my

Hello moz4r
 
You say my script is old Do you have a new script for me?
 
 LG xmike
xmike's picture

Hello moz4r I've found this

Hello moz4r

I've found this from you!

https://github.com/MyRobotLab/pyrobotlab/tree/master/home/moz4r/Inmoov

But it does not work

------TypeError: compile() expected string without null bytes at org.python.core.Py.TypeError(Py.java:259)

LG xmike

moz4r's picture

that was personnal unstable

that was personnal unstable work deprecated at this time

xmike's picture

Hello moz4r When starting

Hello moz4r

When starting start_inmoov.sh with my Mac OS, the program always breaks when it activates virtual InMoov (MyRobotLab exits)

Can I disable virtual InMoov?

MRL last version

LG xmike

moz4r's picture

HI ! you can kill this line :

HI ! you can kill this line : https://github.com/MyRobotLab/inmoov/blob/develop/InMoov/system/InitChec...

xmike's picture

kill this line

Hi moz4r

I kill this line :    i01.startVinMoov()

start up inmoov and the line is back again after the break

xmike

moz4r's picture

ok, just selected dualboot to

ok, just selected dualboot to linux. it seem ressources ares extracted at every startup inside linux os. or it is me. waiting cleaner solution and other debugs you can delete /repo/org.myrobotlab.inmoov/zips/InMoov * . so no overwrite at startup