Next version 'Nixie' is coming soon !

Help us to get ready with MyRobotLab version Nixie: try it !

http://myrobotlab.org/sites/default/files/2022-12/MiniMoov_Mug_0.png

Introducing MiniMoov aka "0x5A" aka Zaphod.

Basic concept was to create a Debug aid for setting up InMoov Senior.

As you see above it is hand sized and can be plonked next to your monitor as desktop companion.

Its quick and easy to build and will allow more users to jump into the realms of InMoov and MRL (MyRobotLab).

Setup

More info to come...

example

test

Javadoc link
Example configuration (from branch develop):
#file : InMoov2.py (github)
!!org.myrobotlab.service.config.InMoov2Config
data: {
  }
heartbeat: true
idleTimer: true
listeners: null
loadGestures: true
locale: en-US
peers:
  audioPlayer:
    autoStart: true
    name: inmoov2.audioPlayer
    type: AudioFile
  chatBot:
    autoStart: false
    name: inmoov2.chatBot
    type: ProgramAB
  controller3:
    autoStart: false
    name: inmoov2.controller3
    type: Arduino
  controller4:
    autoStart: false
    name: inmoov2.controller4
    type: Arduino
  ear:
    autoStart: false
    name: inmoov2.ear
    type: WebkitSpeechRecognition
  eyeTracking:
    autoStart: false
    name: inmoov2.eyeTracking
    type: Tracking
  fsm:
    autoStart: false
    name: inmoov2.fsm
    type: FiniteStateMachine
  head:
    autoStart: false
    name: inmoov2.head
    type: InMoov2Head
  headTracking:
    autoStart: false
    name: inmoov2.headTracking
    type: Tracking
  htmlFilter:
    autoStart: false
    name: inmoov2.htmlFilter
    type: HtmlFilter
  imageDisplay:
    autoStart: false
    name: inmoov2.imageDisplay
    type: ImageDisplay
  leap:
    autoStart: false
    name: inmoov2.leap
    type: LeapMotion
  left:
    autoStart: false
    name: inmoov2.left
    type: Arduino
  leftArm:
    autoStart: false
    name: inmoov2.leftArm
    type: InMoov2Arm
  leftHand:
    autoStart: false
    name: inmoov2.leftHand
    type: InMoov2Hand
  mouth:
    autoStart: false
    name: inmoov2.mouth
    type: MarySpeech
  mouthControl:
    autoStart: false
    name: inmoov2.mouthControl
    type: MouthControl
  neoPixel:
    autoStart: false
    name: inmoov2.neoPixel
    type: NeoPixel
  openWeatherMap:
    autoStart: false
    name: inmoov2.openWeatherMap
    type: OpenWeatherMap
  opencv:
    autoStart: false
    name: inmoov2.opencv
    type: OpenCV
  openni:
    autoStart: false
    name: inmoov2.openni
    type: OpenNi
  pid:
    autoStart: false
    name: inmoov2.pid
    type: Pid
  pir:
    autoStart: false
    name: inmoov2.pir
    type: Pir
  random:
    autoStart: false
    name: inmoov2.random
    type: Random
  right:
    autoStart: false
    name: inmoov2.right
    type: Arduino
  rightArm:
    autoStart: false
    name: inmoov2.rightArm
    type: InMoov2Arm
  rightHand:
    autoStart: false
    name: inmoov2.rightHand
    type: InMoov2Hand
  servoMixer:
    autoStart: false
    name: inmoov2.servoMixer
    type: ServoMixer
  simulator:
    autoStart: false
    name: inmoov2.simulator
    type: JMonkeyEngine
  torso:
    autoStart: false
    name: inmoov2.torso
    type: InMoov2Torso
  ultrasonicLeft:
    autoStart: false
    name: inmoov2.ultrasonicLeft
    type: UltrasonicSensor
  ultrasonicRight:
    autoStart: false
    name: inmoov2.ultrasonicRight
    type: UltrasonicSensor
pirEnableTracking: false
pirPlaySounds: true
pirWakeUp: false
shutdownStartupSpeed: 50.0
type: InMoov2
virtual: false

More info coming ...

Setup

Py4J enables Python programs running in a Python interpreter to dynamically access Java objects in a Java Virtual Machine. 

Methods are called as if the Java objects resided in the Python interpreter and Java collections can be accessed through standard Python collection methods.

Py4J also enables Java programs to call back Python objects. Py4J is distributed under the BSD Python 2.7 -to- 3.x is supported to use you will need the py4j lib in your python application.

https://pypi.org/project/py4j/  

More info here: https://www.py4j.org/ 

Javadoc link
Example code (from branch develop):
#file : Py4j.py (github)
################################
# Py4j.py
# more info here: https://www.py4j.org/
# Py4J enables Python programs running in a Python interpreter to dynamically access 
# Java objects in a Java Virtual Machine. 
# Methods are called as if the Java objects resided in the Python interpreter and 
# Java collections can be accessed through standard Python collection methods. 
# Py4J also enables Java programs to call back Python objects. Py4J is distributed under the BSD
# Python 2.7 -to- 3.x is supported
# In your python 3.x project
# pip install py4j
# you have full access to mrl instance that's running
# the gateway
 
import sys
from time import sleep
from py4j.clientserver import ClientServer, JavaParameters, PythonParameters
from py4j.java_collections import JavaList
 
from py4j.java_gateway import JavaGateway, CallbackServerParameters
from py4j.java_collections import JavaArray, JavaObject, JavaClass
 
runtime = None
 
class MessageHandler(object):
 
    def __init__(self):
        global runtime
        # initializing stdout and stderr
        self.name = None
        self.stdout = sys.stdout
        self.stderr = sys.stderr
        sys.stdout = self
        sys.stderr = self
        self.gateway = JavaGateway(callback_server_parameters=CallbackServerParameters(), python_server_entry_point=self)
        self.runtime = self.gateway.jvm.org.myrobotlab.service.Runtime.getInstance()
        runtime = self.runtime
        self.py4j = None # need to wait until name is set
 
    def write(self,string):
        if (self.py4j):
            self.py4j.handleStdOut(string)
 
    def setName(self, name):
        """Method called right after initialization from MRL
        responsible for 'naming' the MessageHandler
 
        Args:
            name (string): sets the name of the MessageHandler
        """
        self.name = name
        self.py4j = self.runtime.getService(name)
        print(self.runtime.getUptime())
 
        print("python started", sys.version)
        print("runtime attached", self.runtime.getVersion())
        # TODO print env vars PYTHONPATH etc
        return name
 
    def get_name(self):
        return self.name
    
    def exec(self, code):
        """executes python script
 
        Args:
            code (_type_): code to execute
        """
        try:
            exec(code)
        except Exception as e:
            print(e)
 
    def invoke(self, method, data=None):
        # convert to list
        params = list(data)
        eval(method)(*params)
 
    def flush(self):
        pass
 
    def shutdown(self):
        self.gateway.shutdown()
    
    def getInstance(self):
        return self.runtime
 
    def convert_array(self, array):
        result = []
        for item in array:
            if isinstance(item, JavaObject):
                item_class = item.getClass()
                if item_class == JavaClass.forName("java.lang.String"):
                    result.append(str(item))
                elif item_class == JavaClass.forName("java.lang.Integer"):
                    result.append(int(item))
                elif item_class == JavaClass.forName("java.lang.Double"):
                    result.append(float(item))
                elif item_class == JavaClass.forName("java.lang.Boolean"):
                    result.append(bool(item))
                elif item_class == JavaClass.forName("java.lang.Long"):
                    result.append(int(item))
                elif item_class == JavaClass.forName("java.lang.Short"):
                    result.append(int(item))
                elif item_class == JavaClass.forName("java.lang.Float"):
                    result.append(float(item))
                elif item_class == JavaClass.forName("java.lang.Byte"):
                    result.append(int(item))
                else:
                    raise ValueError("Unsupported type: {}".format(item_class))
            else:
                raise ValueError("Unsupported type: {}".format(type(item)))
        return result
 
    class Java:
        implements = ['org.myrobotlab.framework.interfaces.Invoker']
 
handler = MessageHandler()
runtime = handler.getInstance()
Example configuration (from branch develop):
#file : Py4j.py (github)
!!org.myrobotlab.service.config.ServiceConfig
listeners: null
peers: null
type: Py4j
Javadoc link
Example configuration (from branch develop):
!!org.myrobotlab.service.config.DiscordBotConfig
connect: true
listeners: null
peers: null
token: null
type: DiscordBot

A while back we added the DiscordBot service to MyRobotLab.  The Discord Bot service acts as a gateway.  

The DiscordBot service implements 2 interfaces in MyRobotLab, the first is UtterancePublisher and the UtteranceListener.  

The idea is that DiscordBot connects to a discord server using the Discord java API.  The DiscordBot logs into the server using a security token that is associated with a discord bot user. 

file taken from C:\mrl\resource\Arduino\MrlComm

trying to verify MrlComm before uploading to Arduino gives this error message

What is my best option?

 

Compilation error: cannot convert 'bool' to 'ListNode<Device*>*' in return

 

I am having a problem where the microphone in chrome doesn't  shut off  so Inmoov just keeps responding to himself. I have tried clean installs on 2 different windows tablets and get the same thing. Has anyone had this happe and found a solution? Thanks.

A while back we added the DiscordBot service to MyRobotLab.  The Discord Bot service acts as a gateway.  

The DiscordBot service implements 2 interfaces in MyRobotLab, the first is UtterancePublisher and the UtteranceListener.  

The idea is that DiscordBot connects to a discord server using the Discord java API.  The DiscordBot logs into the server using a security token that is associated with a discord bot user.