The Robot with Two Brains

With the great post from Astro that allowed me to get over the hurdle I was stuck on with streaming video I have been able to move forward with splitting Junior's processing to run on two computers. Currently he has a RaspPi3 with a Pi cam that is running MarySpeech, 2 OLED screens for his eyes and eventually motor controls for his head and neck which will be controlled from a I2C 16-channel servo controller. The Pi is also using uv4l to stream the video from the Pi Cam

The other computer is still a Mac Mini but will soon be a NUC, it is running: ProgramAB, WebKitSpeechToText, and OpenCV consuming the video stream from the RaspPi! I did some initial tests with RemoteAdapter and I thought I understood it but it seems to not work the way I expected. I am a little confused still which should be the host and which should connect to the host. I would think that I should use the NUC or MacMini as the Host and then have the other mrl instance attach to it.

My current problem is how I attach the "mouth" (MarySpeech) running on the Pi to webkit like wksr.addMouth(mouth) but where mouth would be on a Remote instance.  I have seen the video of Mats showing RemoteAdapter working but I have not seen any code examples for bridging across the two instances.  

Possibly I am trying to use this service for something it was not intended and if there is another way to do it that works too. If there is not a way to currently do this does anyone have a great idea of how to architect a service like this.

Many thanks!

Kyle


Comment viewing options

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

Watch your motor loads

I have been using four I2C 16-channel servo controllers in Fred for a while, I just discovered i have had my second driver failure.

The one in the head is still working fine, and so is the one in the right arm, haven't tested the left recently, however the one in the back has failed for the second time.

It would seem if you use too many of the big servos on the  I2C 16-channel servo controller, the reverse polarity protection mosfet will over heat and burn out.

Only use these servo drivers with the smaller servos or by-pass the reverse polarity protection mosfet.

 

kyle.clinton's picture

Test Code for RemoteAdapter Split Services

###RemoteAdapterHost.py remoteAdapterHost = Runtime.createAndStart("remoteAdapterHost","RemoteAdapter") remoteAdapterHost.startListening() mouth = Runtime.createAndStart("MarySpeech", "MarySpeech") mouth.setVoice("cmu-bdl-hsmm") #removing scale makes him less monotone and rate seems to mess up things when I use MaryXML or EmotionML mouth.setAudioEffects("TractScaler(amount=1.4) + F0Add(f0Add=60.0) + Robot(amount=8.0) ") #####for testing mouth.speakBlocking("Happy Birthday Kyle!") ###RemoteAdapterChild.py remoteAdapterChild = Runtime.createAndStart("RemoteAdapterChild","RemoteAdapter") remoteAdapterChild.connect("tcp://192.168.1.129:6767") from java.lang import String python = Runtime.getService("python") # create a ProgramAB service and start a session junior = Runtime.createAndStart("junior", "ProgramAB") junior.startSession("ProgramAB", "default", "junior") ###################################################################### # create the speech recognition service # Speech recognition is based on WebSpeechToolkit API ###################################################################### # Start the new WebGuiREST API for MRL webgui = Runtime.createAndStart("webgui","WebGui") ###################################################################### # Create the webkit speech recognition gui # This service works in Google Chrome only with the WebGui ###################################################################### wksr = Runtime.createAndStart("webkitspeechrecognition", "WebkitSpeechRecognition") ###################################################################### # create the html filter to filter the output of program ab # this service will strip out any html markup and return only the text # from the output of ProgramAB ###################################################################### htmlfilter = Runtime.createAndStart("htmlfilter", "HtmlFilter") ###################################################################### # MRL Routing webkitspeechrecognition -> program ab -> htmlfilter -> mouth ###################################################################### # add a link between the webkit speech to publish text to ProgramAB wksr.addTextListener(junior) # Add route from Program AB to publish text to the html filter junior.addTextListener(htmlfilter) # Add route to publish text from html filter to mouth htmlfilter.addTextListener(remoteAdapterHost.mouth) #stop Junior from listening to himself speak wksr.addMouth(remoteAdapterHost.mouth)

kyle.clinton's picture

Comments On my Code

I am thinking I may need a sleep after attempting to connect to RemoteAdapterHost, but I am not sure if I still understand the syntax for utilizing the remote services...

Any direction would be helpful!

Kyle

kyle.clinton's picture

Comments On my Code

I am thinking I may need a sleep after attempting to connect to RemoteAdapterHost, but I am not sure if I still understand the syntax for utilizing the remote services...

Any direction would be helpful!

Kyle

Ray.Edgley's picture

Warning Will Robinson. Warning

May i suggest that setup all other sections of your code before you start on the RemoteAdapter service.

If you create another service after you setup the RemoteAdapter service you risk causing one of the un-documented features crashing your system with the creation of duplicate service replicated on both the host and client machines.

I have uploaded the current Fred project to here https://github.com/Cyber-One/Small_Projects 

You are welcome to look at he code, but note it not yet complete and still contains many bug.

 

Ray

kyle.clinton's picture

python.subscribe(...) syntax

So I have been looking at Ray's code and it seems to not throw errors, but... he does...

python.subscribe("fred01", "mouth", "speakBlocking", "I have finished starting up.")

I have been trying to do something really simple to just test my configuration like this but it seems to not work???

On this computer I am running a py script like...

 
Junior01ipAddress = "192.168.1.130" ### First RaspPi in head
 
 
junior01 = Runtime.createAndStart("junior01","RemoteAdapter")
junior01.connect("tcp://"+Junior01ipAddress+":6767")
python.subscribe("junior01", "mouth", "speakBlocking", "Hello!")
 
on the rasp pi I am running....
 
from java.lang import String
from time import sleep
 
mouth = Runtime.createAndStart("mouth", "MarySpeech")
mouth.setVoice("cmu-bdl-hsmm")
mouth.setAudioEffects("TractScaler(amount=1.4)  + F0Scale(f0Scale=0.0) + F0Add(f0Add=60.0) + Robot(amount=8.0) + Rate(amount=1.75)")
 
#####for testing
mouth.speakBlocking("Testing 1, 2, 3")
 
remote = Runtime.createAndStart("remote", "RemoteAdapter")
remote.startListening();
 
Am I using the subscribe method correctly?  I do not seem to see anything for it in the Java log on the rasp pi instance of MRL for receiving this at all?
 
Any direction you can provided is appreciated as always!

 

GroG's picture

So .. I'm dragging my feet ..

So .. I'm dragging my feet .. waiting as long as I can for auto-magical unit tests for Manticore release ...
The more tests .. the faster we can run & release the "next" build, because we will use these tests in the future to verify the crazy shit we add doesn't break whatever people have currently working with Manticore..
That's goodtimes...

But just as a heads up...  the networking in Manticore "sucks"

The "networking" in the upcoming development is "big-time" better..   its "so" better, other languages can easily inter-operate with MRL..   MRL will spread into Node.js and native Python ... that's goodtimes..

I know distributed computing is "real" robotics .. and this is where we are headed.

At the moment it just pains me to see issues with RemoteAdapter which will be void coming up..

Its not worth pulling your hair out .. hang tight .. better times are coming ..