InMoov & My Robot Lab for Dummies (part 2)

inmoovita.png

In this second part we will install and configure My Robot Lab (with a special emphasis on setting Italian as the main language) on a Windows 10 machine (other versions are supported too) and an Arduino Mega or Uno.

Prerequistes:

  • You have InMoov head and torso alreay assembled (see part 1)
  • Java 8 or higher is already installed
  • Arduino is installed and you are able to use it

Oh, and if you have Linux there is a section for you too.

Installation

Download the jar from the download page (currently release name is “Manticore“) into a folder preferably without spaces (eg: C:/dev/mrl), then execute from terminal:

java -jar myrobotlab.jar -install

It will download a bunch of stuff (2 GB), so take some time and get a coffee ☕.

Once the download is completed, you can start My Robot Lab (MRL from now on) double clicking “START_INMOOV.bat” batch script.

It will take some time to boot, and when completed you’ll see a “virtual” InMoov, used for testing different stuff with a virtual Arduino…but we need to test on real hardware.

mrl01

Also a new page of your browser will be opened: http://localhost:8888/#/service/i01.ear

This is used for the speech recognition (for the “ear” service). It will only work on Chrome and default language is english. We will change the language.

mrl07.PNG

Once booted, the InMoov virtual robot will ask for his and your name: just respond to skip it from asking again.

You will notice that the boot is verbose, with a startup sound, and the robot that will say each component it is loading. I found it a bit annoying so I will disable it. We also want to connect our real Arduino to MRL (for me it is connected to COM5, just check yours in Windows Device Manager).

Close MRL to start editing our files.

Configuration

There are several types of InMoov modes to boot with. We have seen only “Virtual” (with a virtual Arduino and a virtual inMoov), but there are severeal ones available, all explained in the InMoov/config/_InMoov.config. For our purpouses we need to specify “LeftSide” which will be used to move head and torso.

Let’s edit _InMoov.config, setting these self explanatory values:

[MAIN]
ScriptType=LeftSide
Language=it

[VOCAL]
IsMute=True

[GENERAL]
StartupSound=False

Now let’s download the italian language pack zip file (not released yet) from my repo and unpack in InMoov/system/languagePack

In InMoov/chatbot/bots directory copy the directory “en” and paste renaming to “it”: this is the chatbot directory but there are no translations yet.

Edit InMoov/config/service_5_Mouth.config for changing the speech engine. For italian there are 2 speech engines: NaturalReaderSpeech and MarySpeech.

They both work offline: the first is a local operating system TTS, the latter is an open source one. More info in the links above.

I mainly use NaturalReaderSpeech so I set these values:

[TTS]
Speechengine=NaturalReaderSpeech
VoiceName=Italian_Francesco

You can use Maryspeech too, but you need to download the voices later (see below):

[TTS]
Speechengine=MarySpeech
VoiceName=istc-lucia-hsmm

Last step before the second boot: let’s specify the Arduino model and port we want to use. Edit InMoov/config/service_6_Arduino.config

[MAIN]
MyLeftPort=COM5
BoardTypeMyLeftPort="atmega2560"

Atmega2560 is Arduino Mega, if you have Arduino Uno set atmega328p.

Additional steps for Mary Speech

If you want to use Mary Speech, you need to download the component.

With MRL opened, click on the “python” tab, and paste this snippet:

mouth = Runtime.start("MarySpeech", "MarySpeech")
mouth.installComponentsAcceptLicense("istc-lucia-hsmm")

Then run the script (see the arrow below) to download. You’ll see the progress download on the terminal.

mrl06

Second boot

Start InMoov again, you’ll notice:

  • The speech recognition tab is now in italian
  • MRL has less tabs opened, because we have selected Left Arduino

mrl03

Let’s flash MRLComm (the Arduino program flashed on the board for communicating with MRL).

  • Select the “i01.left” tab
  • Click “browse” and select the Arduino binary
  • Click “Open in Arduino IDE”

The Arduino IDE will be opened, with MRLComm sketch loaded. Just select your board and COM port from Tools menu. In my case “Arduino Genuino / Mega or Mega 2560” and COM 5.

Upload the sketch (arrow button or CTRL + u):

mrl04

If the flashing is done OK, reboot MRL, and select the “i01.left” tab again, you’ll see a green light near to the COM port: Arduino is connected!

mrl05.PNG

Testing the speech

Just to test if the speech synthesizer work run this python script from the python tab.

Natural speech:

mouth = Runtime.createAndStart("i01.mouth", "NaturalReaderSpeech")
print ("available voices: ", mouth.getVoices())
voice="Italian_Francesco" #Italian_Francesca Italian_Giulia
mouth.setVoice(voice)
mouth.speak("Ciao, la mia voce e in italiano. Andatevene affanculo tutti")

Mary speech:

mouth = Runtime.createAndStart("MarySpeech", "MarySpeech")
print ("available voices: ", mouth.getVoices())
voice="istc-lucia-hsmm"
mouth.setVoice(voice)
mouth.speak("Ciao, la mia voce e in italiano. Andatevene affanculo tutti")

In the next tutorial I’ll explain how to write the code to make the InMoov….move 😎

Tip

To speedup inMoov boot, copy the startInmoov.bat file and chang this java invocation:

java -Dfile.encoding=UTF-8 -jar myrobotlab.jar -jvmargs=”-Dfile.encoding=UTF-8″ -invoke python execFile %cd%/InMoov/InMoov.py -service python Python

to this:

java -Dfile.encoding=UTF-8 -jar myrobotlab.jar -jvmargs=”-Dfile.encoding=UTF-8″ -service SwingGui SwingGui python Python

This will avoid to load unnecessary tabs

Linux users

There are few notes for Linux users. I’m using Ubuntu 18.04 on my iMac.

Packages needed not installed by default:

  • acpitool
  • openjdk-8-jre (not the headless version)
  • I don’t think openjdk-8-jdk is needed, but I code in Java so I’ve installed it too

Connect the Arduino via USB and check if /dev/ttyUSB0 (last number may vary). If not, you have probably an Arduino Mega, which doesn’t use that device.

Arduino Mega uses the /dev/ttyACM0 device, so first of all you need to check if it is created when you connect to the Arduino, then you need to create a symlink, because MRL uses /dev/ttyUSB0:

sudo ln -s /dev/ttyACM0 /dev/ttyUSB0

Also the user who need to MRL need to be added to the dialout group, so let’s add him:

sudo usermod -a -G dialout your_user

Don’t forget to change every “COMx” reference to /dev/ttyUSB0 (eg: service_6_Arduino.config) and also don’t forget to set “IuseLinux=True” in _InMoov.config.

No other changes needed so far.

Annunci

Un pensiero su “InMoov & My Robot Lab for Dummies (part 2)

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione /  Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...

This site uses Akismet to reduce spam. Learn how your comment data is processed.