Skip to content

Commit

Permalink
Merge branch 'develop' of github.com-myrobotlab:MyRobotLab/myrobotlab…
Browse files Browse the repository at this point in the history
… into inmoov2-heart
  • Loading branch information
supertick committed Mar 13, 2024
2 parents 0e5a9c3 + c5f87ac commit 92d98a9
Show file tree
Hide file tree
Showing 8 changed files with 224 additions and 156 deletions.
225 changes: 125 additions & 100 deletions src/main/java/org/myrobotlab/framework/Service.java

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/main/java/org/myrobotlab/service/FiniteStateMachine.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ public void fire(String event) {
stateMachine.send(event);
current = stateMachine.getCurrent();

log.info("fired event ({}) -> ({}) moves to ({})", event, last == null ? null : last.getName(), current == null ? null : current.getName());
log.info("fired event ({}) -> ({}) moves to ({})", event, last == null ? null : last.getName(),
current == null ? null : current.getName());

if (last != null && !last.equals(current)) {
StateChange stateChange = new StateChange(current.getName(), event);
Expand Down
121 changes: 77 additions & 44 deletions src/main/java/org/myrobotlab/service/InMoov2.java

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/main/java/org/myrobotlab/service/Runtime.java
Original file line number Diff line number Diff line change
Expand Up @@ -2916,6 +2916,7 @@ public Runtime(String n, String id) {
log.info("hostname {}", platform.getHostname());
log.info("ivy [runtime,{}.{}.{}]", platform.getArch(), platform.getJvmBitness(), platform.getOS());
log.info("version {} branch {} commit {} build {}", platform.getVersion(), platform.getBranch(), platform.getCommit(), platform.getBuild());
System.out.println(String.format("version {} branch {} commit {} build {}", platform.getVersion(), platform.getBranch(), platform.getCommit(), platform.getBuild()));
log.info("platform manifest {}", Platform.getManifest());
log.info("platform [{}}]", platform);
log.info("version [{}]", platform.getVersion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ public Plan getDefault(Plan plan, String name) {
// setup name references to different services
MarySpeechConfig mouth = (MarySpeechConfig) plan.get(getPeerName("mouth"));
mouth.voice = "Mark";

// == Peer - ear =============================
// setup name references to different services
WebkitSpeechRecognitionConfig ear = (WebkitSpeechRecognitionConfig) plan.get(getPeerName("ear"));
Expand Down Expand Up @@ -549,6 +548,8 @@ public Plan getDefault(Plan plan, String name) {

htmlFilter.listeners.add(new Listener("publishText", name));

htmlFilter.listeners.add(new Listener("publishText", name));

OakDConfig oakd = (OakDConfig) plan.get(getPeerName("oakd"));
oakd.listeners.add(new Listener("publishClassification", name));
oakd.getPeer("py4j").name = getPeerName("py4j");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ public class ProgramABConfig extends ServiceConfig {

@Deprecated /* unused text filters */
public String[] textFilters;

/**
* explicit bot directories
*/
Expand Down
20 changes: 13 additions & 7 deletions src/test/java/org/myrobotlab/service/RandomTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ public void testService() throws Exception {

assertTrue("should have method", random.getKeySet().contains("clock.setInterval"));

assertTrue(String.format("random method 1 should be %d => 5000 values", clock.getInterval()), 5000 <= clock.getInterval());
assertTrue(String.format("random method 1 should be %d <= 10000 values", clock.getInterval()), clock.getInterval() <= 10000);
assertTrue(String.format("random method 1 should be %d => 5000 values", clock.getInterval()),
5000 <= clock.getInterval());
assertTrue(String.format("random method 1 should be %d <= 10000 values", clock.getInterval()),
clock.getInterval() <= 10000);

random.remove("clock.setInterval");

assertTrue("should not have method", !random.getKeySet().contains("clock.setInterval"));

random.addRandom(0, 200, "clock", "setInterval", 5000, 10000);
random.addRandom(0, 100, "clock", "startClock");
random.addRandom(0, 200, "clock", "startClock");

sleep(500);
assertTrue("clock should be started 1", clock.isClockRunning());
Expand All @@ -70,8 +72,10 @@ public void testService() throws Exception {
sleep(200);
clock.setInterval(9999);
assertTrue("clock should not be started 3", !clock.isClockRunning());
assertTrue(String.format("random method 2 should be %d => 5000 values", clock.getInterval()), 5000 <= clock.getInterval());
assertTrue(String.format("random method 2 should be %d <= 10000 values", clock.getInterval()), clock.getInterval() <= 10000);
assertTrue(String.format("random method 2 should be %d => 5000 values", clock.getInterval()),
5000 <= clock.getInterval());
assertTrue(String.format("random method 2 should be %d <= 10000 values", clock.getInterval()),
clock.getInterval() <= 10000);

// disable all
random.disable();
Expand All @@ -85,8 +89,10 @@ public void testService() throws Exception {
random.enable();
sleep(1000);
assertTrue("clock should not be started 5", !clock.isClockRunning());
assertTrue(String.format("random method 3 should be %d => 5000 values", clock.getInterval()), 5000 <= clock.getInterval());
assertTrue(String.format("random method 3 should be %d <= 10000 values", clock.getInterval()), clock.getInterval() <= 10000);
assertTrue(String.format("random method 3 should be %d => 5000 values", clock.getInterval()),
5000 <= clock.getInterval());
assertTrue(String.format("random method 3 should be %d <= 10000 values", clock.getInterval()),
clock.getInterval() <= 10000);

clock.stopClock();
random.purge();
Expand Down
6 changes: 4 additions & 2 deletions src/test/java/org/myrobotlab/test/AbstractTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ static protected void installAll() {
*/
public static void releaseServices() {

log.info("end of test - id {} remaining services {}", Runtime.getInstance().getId(), Arrays.toString(Runtime.getServiceNames()));
log.info("end of test - id {} remaining services {}", Runtime.getInstance().getId(),
Arrays.toString(Runtime.getServiceNames()));

// release all including runtime - be careful of default runtime.yml
Runtime.releaseAll(true, true);
Expand All @@ -175,7 +176,8 @@ public static void releaseServices() {
Set<Thread> threadSetEnd = Thread.getAllStackTraces().keySet();
Set<String> threadsRemaining = new TreeSet<>();
for (Thread thread : threadSetEnd) {
if (!threadSetStart.contains(thread) && !"runtime_outbox_0".equals(thread.getName()) && !"runtime".equals(thread.getName())) {
if (!threadSetStart.contains(thread) && !"runtime_outbox_0".equals(thread.getName())
&& !"runtime".equals(thread.getName())) {
threadsRemaining.add(thread.getName());
}
}
Expand Down

0 comments on commit 92d98a9

Please sign in to comment.