From d6b17bd2416bebe2a10429a60ac6a1b36ea7295a Mon Sep 17 00:00:00 2001 From: Langevin Gael Date: Thu, 12 Oct 2023 02:27:22 +0200 Subject: [PATCH] mouth listen servoMixer.java (#1345) * mouth listen servoMixer.java * Update InMoov2Config.java * Update InMoov2Config.java * add chatBot listener to servoMixer * Update InMoov2Config.java * Update InMoov2Config.java * Update InMoov2Config.java * Update InMoov2Config.java * Update InMoov2.java * Update InMoov2.java * Update InMoov2.java * Update InMoov2.java * Update InMoov2.java --- .../java/org/myrobotlab/service/InMoov2.java | 12 +++++++++++ .../service/config/InMoov2Config.java | 21 +++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/myrobotlab/service/InMoov2.java b/src/main/java/org/myrobotlab/service/InMoov2.java index 83af38c94d..03035b6d2f 100644 --- a/src/main/java/org/myrobotlab/service/InMoov2.java +++ b/src/main/java/org/myrobotlab/service/InMoov2.java @@ -163,6 +163,8 @@ public InMoov2Config apply(InMoov2Config c) { setLocale(getSupportedLocale(Runtime.getInstance().getLocale().toString())); } + loadAppsScripts(); + loadInitScripts(); if (c.loadGestures) { @@ -637,6 +639,16 @@ public boolean isMute() { return mute; } + /** + * execute python scripts in the app directory on startup of the service + * + * @throws IOException + */ + public void loadAppsScripts() throws IOException { + loadScripts(getResourceDir() + fs + "gestures/InMoovApps/Rock_Paper_Scissors"); + loadScripts(getResourceDir() + fs + "gestures/InMoovApps/Kids_WordsGame"); + } + public void loadGestures() { loadGestures(getResourceDir() + fs + "gestures"); } diff --git a/src/main/java/org/myrobotlab/service/config/InMoov2Config.java b/src/main/java/org/myrobotlab/service/config/InMoov2Config.java index ecb2d59c4e..af16e23a04 100644 --- a/src/main/java/org/myrobotlab/service/config/InMoov2Config.java +++ b/src/main/java/org/myrobotlab/service/config/InMoov2Config.java @@ -178,6 +178,13 @@ public Plan getDefault(Plan plan, String name) { mouth.voice = "Mark"; mouth.speechRecognizers = new String[] { name + ".ear" }; + // == Peer - servoMixer ============================= + // setup name references to different services + ServoMixerConfig servoMixer = (ServoMixerConfig) plan.get(getPeerName("servoMixer")); + servoMixer.listeners = new ArrayList<>(); + servoMixer.listeners.add(new Listener("publishText", name + ".mouth", "onText")); + //servoMixer.listeners.add(new Listener("publishText", name + ".chatBot", "onText")); + // == Peer - ear ============================= // setup name references to different services WebkitSpeechRecognitionConfig ear = (WebkitSpeechRecognitionConfig) plan.get(getPeerName("ear")); @@ -337,23 +344,25 @@ public Plan getDefault(Plan plan, String name) { PidConfig pid = (PidConfig) plan.get(getPeerName("pid")); PidData tiltPid = new PidData(); - tiltPid.ki = 0.001; - tiltPid.kp = 30.0; + tiltPid.ki = -0.001; + tiltPid.kp = -40.0; + tiltPid.inverted = true; pid.data.put(headTracking.getPeer("tilt").name, tiltPid); PidData panPid = new PidData(); panPid.ki = 0.001; - panPid.kp = 15.0; + panPid.kp = 40.0; pid.data.put(headTracking.getPeer("pan").name, panPid); PidData eyeTiltPid = new PidData(); - eyeTiltPid.ki = 0.001; - eyeTiltPid.kp = 10.0; + eyeTiltPid.ki = -0.001; + eyeTiltPid.kp = -30.0; + eyeTiltPid.inverted = true; pid.data.put(eyeTracking.getPeer("tilt").name, eyeTiltPid); PidData eyePanPid = new PidData(); eyePanPid.ki = 0.001; - eyePanPid.kp = 10.0; + eyePanPid.kp = 30.0; pid.data.put(eyeTracking.getPeer("pan").name, eyePanPid); NeoPixelConfig neoPixel = (NeoPixelConfig) plan.get(getPeerName("neoPixel"));