From f407cb6ded2d314de1cf2daafd82bec43bca21cf Mon Sep 17 00:00:00 2001 From: Langevin Gael Date: Sun, 28 Apr 2024 19:25:44 +0200 Subject: [PATCH 1/5] Update InMoov2Config.java --- src/main/java/org/myrobotlab/service/config/InMoov2Config.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/myrobotlab/service/config/InMoov2Config.java b/src/main/java/org/myrobotlab/service/config/InMoov2Config.java index aa806863f0..e8de9b0307 100644 --- a/src/main/java/org/myrobotlab/service/config/InMoov2Config.java +++ b/src/main/java/org/myrobotlab/service/config/InMoov2Config.java @@ -111,7 +111,7 @@ public class InMoov2Config extends ServiceConfig { */ public boolean reportOnBoot = true; - public boolean robotCanMoveHeadWhileSpeaking = true; + public boolean robotCanMoveHeadWhileSpeaking = false; /** * startup and shutdown will pause inmoov - set the speed to this value then From 902d190e3bb858a28d1c52d460d2b1f947fd7180 Mon Sep 17 00:00:00 2001 From: supertick Date: Sun, 28 Apr 2024 12:45:31 -0700 Subject: [PATCH 2/5] audio select file and other small fixes --- src/main/java/org/myrobotlab/service/AudioFile.java | 6 ++++++ src/main/java/org/myrobotlab/service/InMoov2.java | 2 +- .../myrobotlab/service/config/InMoov2Config.java | 3 +++ .../resource/WebGui/app/service/js/AudioFileGui.js | 13 +++++++++---- .../WebGui/app/service/views/AudioFileGui.html | 2 +- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/myrobotlab/service/AudioFile.java b/src/main/java/org/myrobotlab/service/AudioFile.java index 26abd0b9f7..5a621ab556 100644 --- a/src/main/java/org/myrobotlab/service/AudioFile.java +++ b/src/main/java/org/myrobotlab/service/AudioFile.java @@ -123,6 +123,11 @@ public class AudioFile extends Service implements AudioPublishe transient Map processors = new HashMap(); final private transient PlaylistPlayer playlistPlayer = new PlaylistPlayer(this); + + /** + * last file played + */ + protected String lastPlayed; public void attach(Attachable attachable) { if (attachable instanceof AudioListener) { @@ -418,6 +423,7 @@ public AudioData publishAudioStart(AudioData data) { @Override public AudioData publishAudioEnd(AudioData data) { log.debug("Audio File publishAudioEnd"); + lastPlayed = data.getFileName(); return data; } diff --git a/src/main/java/org/myrobotlab/service/InMoov2.java b/src/main/java/org/myrobotlab/service/InMoov2.java index d91636e406..53d1c447c1 100644 --- a/src/main/java/org/myrobotlab/service/InMoov2.java +++ b/src/main/java/org/myrobotlab/service/InMoov2.java @@ -1417,7 +1417,7 @@ public void processMessage(String method) { */ public void processMessage(String method, Object... data) { // User processing should not occur until after boot has completed - if (!state.equals("boot")) { + if (!state.equals("boot") && config.execScript) { // FIXME - this needs to be in config // FIXME - change peer name to "processor" // String processor = getPeerName("py4j"); diff --git a/src/main/java/org/myrobotlab/service/config/InMoov2Config.java b/src/main/java/org/myrobotlab/service/config/InMoov2Config.java index e8de9b0307..771fc09ce3 100644 --- a/src/main/java/org/myrobotlab/service/config/InMoov2Config.java +++ b/src/main/java/org/myrobotlab/service/config/InMoov2Config.java @@ -111,6 +111,9 @@ public class InMoov2Config extends ServiceConfig { */ public boolean reportOnBoot = true; + /** + * script related config - idea is good, but shouldn't be implemented with global scripts + */ public boolean robotCanMoveHeadWhileSpeaking = false; /** diff --git a/src/main/resources/resource/WebGui/app/service/js/AudioFileGui.js b/src/main/resources/resource/WebGui/app/service/js/AudioFileGui.js index 989556d08e..45c54fc62b 100644 --- a/src/main/resources/resource/WebGui/app/service/js/AudioFileGui.js +++ b/src/main/resources/resource/WebGui/app/service/js/AudioFileGui.js @@ -46,6 +46,7 @@ angular.module('mrlapp.service.AudioFileGui', []).controller('AudioFileGuiCtrl', if (firstUpdate){ $scope.selectedPlaylist = $scope.service.config.currentPlaylist + firstUpdate = false } @@ -65,9 +66,8 @@ angular.module('mrlapp.service.AudioFileGui', []).controller('AudioFileGuiCtrl', $scope.activity = 'playing' } - if (!$scope.inputSelectedFile){ - $scope.inputSelectedFile = $scope.selectedFile - } + $scope.selectedFile = service.lastPlayed.filename; + } @@ -81,13 +81,18 @@ angular.module('mrlapp.service.AudioFileGui', []).controller('AudioFileGuiCtrl', case 'onAudioStart': $scope.playing = data.filename $scope.activity = 'playing' + if (!$scope.selectedFile || $scope.selectedFile == ""){ + $scope.selectedFile = data.filename + } $scope.$apply() break case 'onAudioEnd': $scope.playing = data.filename $scope.activity = 'stopped' + if (!$scope.selectedFile || $scope.selectedFile == ""){ + $scope.selectedFile = data.filename + } $scope.$apply() - $scope.service.lastPlayed = data.filename break case 'onPeak': $scope.peak = Math.round(data/* * 100 */) diff --git a/src/main/resources/resource/WebGui/app/service/views/AudioFileGui.html b/src/main/resources/resource/WebGui/app/service/views/AudioFileGui.html index cc488c620b..d9bca941c9 100644 --- a/src/main/resources/resource/WebGui/app/service/views/AudioFileGui.html +++ b/src/main/resources/resource/WebGui/app/service/views/AudioFileGui.html @@ -9,7 +9,7 @@ From 325f6590e085e557c207529100f065d7c44c8a00 Mon Sep 17 00:00:00 2001 From: supertick Date: Sun, 28 Apr 2024 13:47:54 -0700 Subject: [PATCH 3/5] default now to publishPeak --- .../myrobotlab/service/config/InMoov2Config.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/myrobotlab/service/config/InMoov2Config.java b/src/main/java/org/myrobotlab/service/config/InMoov2Config.java index 771fc09ce3..8052dea636 100644 --- a/src/main/java/org/myrobotlab/service/config/InMoov2Config.java +++ b/src/main/java/org/myrobotlab/service/config/InMoov2Config.java @@ -530,9 +530,6 @@ public Plan getDefault(Plan plan, String name) { log.listeners.add(new Listener("publishErrors", name)); // service --to--> InMoov2 - // mouth_audioFile.listeners.add(new Listener("publishAudioEnd", name)); - // mouth_audioFile.listeners.add(new Listener("publishAudioStart", name)); - // InMoov2 --to--> service listeners.add(new Listener("publishEvent", getPeerName("chatBot"), "getResponse")); listeners.add(new Listener("publishFlash", getPeerName("neoPixel"))); @@ -554,9 +551,6 @@ public Plan getDefault(Plan plan, String name) { listeners.add(new Listener("publishMoveTorso", getPeerName("torso"), "onMove")); // service --to--> InMoov2 - AudioFileConfig mouth_audioFile = (AudioFileConfig) plan.get(getPeerName("mouth.audioFile")); - mouth_audioFile.listeners.add(new Listener("publishPeak", name)); - htmlFilter.listeners.add(new Listener("publishText", name)); OakDConfig oakd = (OakDConfig) plan.get(getPeerName("oakd")); @@ -565,6 +559,15 @@ public Plan getDefault(Plan plan, String name) { webxr.listeners.add(new Listener("publishJointAngles", name)); + // service --to--> service + AudioFileConfig mouth_audioFile = (AudioFileConfig) plan.get(getPeerName("mouth.audioFile")); + mouth_audioFile.listeners.add(new Listener("publishPeak", name)); + mouth_audioFile.listeners.add(new Listener("publishPeak", name + ".head.jaw", "moveTo")); + mouth_audioFile.peakDelayMs = 150L; + mouth_audioFile.peakMultiplier = 200.0; + mouth_audioFile.peakSampleInterval = 2.0; + mouth_audioFile.publishPeakResetDelayMs = 100L; + // mouth_audioFile.listeners.add(new Listener("publishAudioEnd", name)); // mouth_audioFile.listeners.add(new Listener("publishAudioStart", name)); From 988a471aeada2f0a481264dc5711bbbb10b83620 Mon Sep 17 00:00:00 2001 From: supertick Date: Sun, 28 Apr 2024 18:56:11 -0700 Subject: [PATCH 4/5] apply bots fix --- src/main/java/org/myrobotlab/service/ProgramAB.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/myrobotlab/service/ProgramAB.java b/src/main/java/org/myrobotlab/service/ProgramAB.java index 4d8b547004..9d6c09198c 100644 --- a/src/main/java/org/myrobotlab/service/ProgramAB.java +++ b/src/main/java/org/myrobotlab/service/ProgramAB.java @@ -813,8 +813,6 @@ public String addBotPath(String path) { bots.put(botInfo.name, botInfo); botInfo.img = getBotImage(botInfo.name); - - broadcastState(); } else { error("invalid bot path %s - a bot must be a directory with a subdirectory named \"aiml\"", path); return null; @@ -1115,10 +1113,11 @@ public ProgramABConfig getConfig() { public ProgramABConfig apply(ProgramABConfig c) { super.apply(c); if (c.bots != null && c.bots.size() > 0) { - // bots.clear(); + bots.clear(); for (String botPath : c.bots) { addBotPath(botPath); } + broadcastState(); } if (c.currentUserName != null) { From d7a0f227fcd43dbeda4482e380bdc290ebf4b81b Mon Sep 17 00:00:00 2001 From: supertick Date: Mon, 29 Apr 2024 09:15:00 -0700 Subject: [PATCH 5/5] error arm not started changed to info level --- src/main/java/org/myrobotlab/service/InMoov2.java | 4 ++-- .../resource/WebGui/app/service/views/RuntimeGui.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/myrobotlab/service/InMoov2.java b/src/main/java/org/myrobotlab/service/InMoov2.java index 53d1c447c1..4f3fac9546 100644 --- a/src/main/java/org/myrobotlab/service/InMoov2.java +++ b/src/main/java/org/myrobotlab/service/InMoov2.java @@ -1734,7 +1734,7 @@ public boolean setAllVirtual(boolean virtual) { public void setArmSpeed(String which, Double bicep, Double rotate, Double shoulder, Double omoplate) { InMoov2Arm arm = getArm(which); if (arm == null) { - warn("%s arm not started", which); + info("%s arm not started", which); return; } arm.setSpeed(bicep, rotate, shoulder, omoplate); @@ -1768,7 +1768,7 @@ public void setHandSpeed(String which, Double thumb, Double index, Double majeur public void setHandSpeed(String which, Double thumb, Double index, Double majeure, Double ringFinger, Double pinky, Double wrist) { InMoov2Hand hand = getHand(which); if (hand == null) { - warn("%s hand not started", which); + info("%s hand not started", which); return; } hand.setSpeed(thumb, index, majeure, ringFinger, pinky, wrist); diff --git a/src/main/resources/resource/WebGui/app/service/views/RuntimeGui.html b/src/main/resources/resource/WebGui/app/service/views/RuntimeGui.html index 95ed4df813..ec31fa23e2 100644 --- a/src/main/resources/resource/WebGui/app/service/views/RuntimeGui.html +++ b/src/main/resources/resource/WebGui/app/service/views/RuntimeGui.html @@ -10,7 +10,7 @@

{{service.platform.arch}}.{{service.platform.jvmBitness}}.{{service.platfor

- +
  -