From 23bb2730ca3a3867ba71dee837feb99f2305ed9a Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 18 Jun 2023 21:10:10 -0400 Subject: [PATCH 01/15] kernel --- libraries/bowler-script-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/bowler-script-kernel b/libraries/bowler-script-kernel index 50aa5d1c8..882d94aad 160000 --- a/libraries/bowler-script-kernel +++ b/libraries/bowler-script-kernel @@ -1 +1 @@ -Subproject commit 50aa5d1c86395a7731db78f97b60fda852b1f69c +Subproject commit 882d94aadb2d87e5aa6ce7936914124de69249a2 From 35c540a9b64960f534b45867d6dc1daa25a97431 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 18 Jun 2023 21:46:54 -0400 Subject: [PATCH 02/15] kernel --- libraries/bowler-script-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/bowler-script-kernel b/libraries/bowler-script-kernel index 882d94aad..18d73b56f 160000 --- a/libraries/bowler-script-kernel +++ b/libraries/bowler-script-kernel @@ -1 +1 @@ -Subproject commit 882d94aadb2d87e5aa6ce7936914124de69249a2 +Subproject commit 18d73b56feed8f138cd8426bdcb1f738ea77e824 From de472e8015c3cf0fc0c8eadbeb36b6c50212b642 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 18 Jun 2023 22:24:15 -0400 Subject: [PATCH 03/15] fix y label --- src/main/java/com/neuronrobotics/bowlerstudio/threed/Axis.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/threed/Axis.java b/src/main/java/com/neuronrobotics/bowlerstudio/threed/Axis.java index 8f57f827f..2c813f8d6 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/threed/Axis.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/threed/Axis.java @@ -100,7 +100,7 @@ public Axis(int i) { Affine yp = new Affine(); yp.setTy(i / 2); - yText = CSG.unionAll(TextExtrude.text((double)strokWidth,"Y",font)).toYMin().rotz(90).movey(i).moveToCenterX(); + yText = CSG.unionAll(TextExtrude.text((double)strokWidth,"Y",font)).rotz(90).toYMin().movey(i).moveToCenterX(); //yText.getTransforms().add(yp); // zp.setTz(i/2); From c9494753af8b89059c81f2743932b647ebcb8c92 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Mon, 19 Jun 2023 08:59:45 -0400 Subject: [PATCH 04/15] kernel --- libraries/bowler-script-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/bowler-script-kernel b/libraries/bowler-script-kernel index 18d73b56f..6ef953c82 160000 --- a/libraries/bowler-script-kernel +++ b/libraries/bowler-script-kernel @@ -1 +1 @@ -Subproject commit 18d73b56feed8f138cd8426bdcb1f738ea77e824 +Subproject commit 6ef953c82ba6da7a5ae1d0d0802b54150080dd20 From cb9a8d582314297cb4f49d382da8bd87f9997754 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Mon, 19 Jun 2023 09:56:48 -0400 Subject: [PATCH 05/15] kernel mobile bse generation update --- libraries/bowler-script-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/bowler-script-kernel b/libraries/bowler-script-kernel index 6ef953c82..f019f054f 160000 --- a/libraries/bowler-script-kernel +++ b/libraries/bowler-script-kernel @@ -1 +1 @@ -Subproject commit 6ef953c82ba6da7a5ae1d0d0802b54150080dd20 +Subproject commit f019f054f60c15d3fc6fe93400891e618cf2e81a From b4cb96d757c73150ba8593d68d2f2d09b0562b48 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Mon, 19 Jun 2023 13:10:45 -0400 Subject: [PATCH 06/15] kernel --- libraries/bowler-script-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/bowler-script-kernel b/libraries/bowler-script-kernel index f019f054f..e9f91d7a7 160000 --- a/libraries/bowler-script-kernel +++ b/libraries/bowler-script-kernel @@ -1 +1 @@ -Subproject commit f019f054f60c15d3fc6fe93400891e618cf2e81a +Subproject commit e9f91d7a7722f2a96891549d0f3dfc60d193ae94 From e27cc0b54627d13e0abd31b74c5589b8b3901b34 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Mon, 19 Jun 2023 14:39:24 -0400 Subject: [PATCH 07/15] kernel --- libraries/bowler-script-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/bowler-script-kernel b/libraries/bowler-script-kernel index e9f91d7a7..aed22bff4 160000 --- a/libraries/bowler-script-kernel +++ b/libraries/bowler-script-kernel @@ -1 +1 @@ -Subproject commit e9f91d7a7722f2a96891549d0f3dfc60d193ae94 +Subproject commit aed22bff4b1e833cc6a3bc9340d81205907d2b40 From efa695e99953158b41dec13b20eda6df80e7583e Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Mon, 19 Jun 2023 14:56:35 -0400 Subject: [PATCH 08/15] kernel --- libraries/bowler-script-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/bowler-script-kernel b/libraries/bowler-script-kernel index aed22bff4..099ededde 160000 --- a/libraries/bowler-script-kernel +++ b/libraries/bowler-script-kernel @@ -1 +1 @@ -Subproject commit aed22bff4b1e833cc6a3bc9340d81205907d2b40 +Subproject commit 099ededdeea8aba891884eeba080377cda2df906 From 400de11c9fb1fb913a9395ad9e7036b051948bdb Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Mon, 19 Jun 2023 18:25:41 -0400 Subject: [PATCH 09/15] kernel --- libraries/bowler-script-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/bowler-script-kernel b/libraries/bowler-script-kernel index 099ededde..c5d72c2f1 160000 --- a/libraries/bowler-script-kernel +++ b/libraries/bowler-script-kernel @@ -1 +1 @@ -Subproject commit 099ededdeea8aba891884eeba080377cda2df906 +Subproject commit c5d72c2f184690db35acbe60e28cacad88a82dda From 484ff270ce99c50bfd39c98c29c5614b5ecd67f9 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Mon, 19 Jun 2023 19:06:14 -0400 Subject: [PATCH 10/15] kernel --- libraries/bowler-script-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/bowler-script-kernel b/libraries/bowler-script-kernel index c5d72c2f1..5dd735d9d 160000 --- a/libraries/bowler-script-kernel +++ b/libraries/bowler-script-kernel @@ -1 +1 @@ -Subproject commit c5d72c2f184690db35acbe60e28cacad88a82dda +Subproject commit 5dd735d9d035ed75d6f160d8112a61f63c60a26c From fbe52c9c80459ca12208df07c60c6cac31481762 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Mon, 19 Jun 2023 19:59:52 -0400 Subject: [PATCH 11/15] prevent the double clicking of the auto-regen thread --- .../bowlerstudio/creature/CreatureLab.java | 48 +++++++++++++++---- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java b/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java index 74076c61b..a97844aba 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java @@ -19,6 +19,8 @@ import com.neuronrobotics.sdk.util.ThreadUtil; import javafx.application.Platform; +import javafx.beans.InvalidationListener; +import javafx.beans.property.Property; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.fxml.FXMLLoader; @@ -49,7 +51,11 @@ public class CreatureLab extends AbstractBowlerStudioTab implements IOnEngineeri private CheckBox autoRegen = new CheckBox("Auto-Regen CAD"); Parent root; private BowlerJInputDevice gameController = null; - CreatureLabControlsTab tab = new CreatureLabControlsTab();; + CreatureLabControlsTab tab = new CreatureLabControlsTab(); + + private long timeSinceLastUpdate=0; + + private HBox radioOptions;; @Override public void onTabClosing() { @@ -68,11 +74,10 @@ public void initializeUI(BowlerAbstractDevice pm) { setGraphic(AssetFactory.loadIcon("CreatureLab-Tab.png")); this.pm = pm; autoRegen.setSelected(true); + + autoRegen.setDisable(true); autoRegen.setOnAction(event -> { - baseManager.setAutoRegen(autoRegen.isSelected()); - if (autoRegen.isSelected()) { - generateCad(); - } + regenFromUiEvent(); }); // TODO Auto-generated method stub setText(pm.getScriptingName()); @@ -119,6 +124,21 @@ public void initializeUI(BowlerAbstractDevice pm) { } } + private void regenFromUiEvent() { + if(System.currentTimeMillis()-timeSinceLastUpdate<500) { + return; + } + timeSinceLastUpdate = System.currentTimeMillis(); + if(autoRegen.isSelected()) { + autoRegen.setDisable(true); + if(radioOptions!=null)radioOptions.setDisable(true); + } + baseManager.setAutoRegen(autoRegen.isSelected()); + if (autoRegen.isSelected()) { + generateCad(); + } + } + private void finishLoading(MobileBase device) { TreeItem rootItem = null; @@ -232,7 +252,7 @@ public void run() { setCadMode(true); }); - HBox radioOptions = new HBox(10); + radioOptions = new HBox(10); radioOptions.getChildren().addAll(new Label("Cad"), rb1, rb2, new Label("Config")); pi = new ProgressIndicator(0); @@ -252,6 +272,17 @@ public void run() { setCadMode(true);// start the UI in config mode generateCad(); + pi.progressProperty().addListener(new ChangeListener() { + + @Override + public void changed(ObservableValue observable, Number oldValue, Number newValue) { + System.out.println("Progress listener "+newValue); + if(newValue.doubleValue()>0.99) { + autoRegen.setDisable(false); + if(radioOptions!=null)radioOptions.setDisable(false); + } + } + }); } private boolean hasWalking(MobileBase device) { @@ -261,10 +292,7 @@ private boolean hasWalking(MobileBase device) { private void setCadMode(boolean mode) { new Thread(() -> { baseManager.setConfigurationViewerMode(mode); - baseManager.setAutoRegen(autoRegen.isSelected()); - if (autoRegen.isSelected()) { - generateCad(); - } + regenFromUiEvent(); }).start(); } From 5eb54ffe0440423e2df99a8f49615338be31dc44 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Mon, 19 Jun 2023 20:09:03 -0400 Subject: [PATCH 12/15] ensure UI is edited on UI thread --- .../bowlerstudio/creature/CreatureLab.java | 47 +++++++++++-------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java b/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java index a97844aba..b9c3ed2ee 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java @@ -53,7 +53,7 @@ public class CreatureLab extends AbstractBowlerStudioTab implements IOnEngineeri private BowlerJInputDevice gameController = null; CreatureLabControlsTab tab = new CreatureLabControlsTab(); - private long timeSinceLastUpdate=0; + private long timeSinceLastUpdate = 0; private HBox radioOptions;; @@ -115,7 +115,7 @@ public void initializeUI(BowlerAbstractDevice pm) { // TODO Auto-generated catch block e1.printStackTrace(); } - while(getContent()==null) + while (getContent() == null) try { Thread.sleep(100); } catch (InterruptedException e) { @@ -125,18 +125,22 @@ public void initializeUI(BowlerAbstractDevice pm) { } private void regenFromUiEvent() { - if(System.currentTimeMillis()-timeSinceLastUpdate<500) { - return; - } - timeSinceLastUpdate = System.currentTimeMillis(); - if(autoRegen.isSelected()) { - autoRegen.setDisable(true); - if(radioOptions!=null)radioOptions.setDisable(true); - } - baseManager.setAutoRegen(autoRegen.isSelected()); - if (autoRegen.isSelected()) { - generateCad(); - } + BowlerStudio.runLater(() -> { + + if (System.currentTimeMillis() - timeSinceLastUpdate < 500) { + return; + } + timeSinceLastUpdate = System.currentTimeMillis(); + if (autoRegen.isSelected()) { + autoRegen.setDisable(true); + if (radioOptions != null) + radioOptions.setDisable(true); + } + baseManager.setAutoRegen(autoRegen.isSelected()); + if (autoRegen.isSelected()) { + generateCad(); + } + }); } private void finishLoading(MobileBase device) { @@ -190,8 +194,8 @@ private void finishLoading(MobileBase device) { rootItemFinal.setExpanded(true); MobileBaseCadManager.get(device, BowlerStudioController.getMobileBaseUI()); - MobleBaseMenueFactory.load(device, tree, mainBaseFinal, callbackMapForTreeitems, widgetMapForTreeitems, this, - true, creatureIsOwnedByUser); + MobleBaseMenueFactory.load(device, tree, mainBaseFinal, callbackMapForTreeitems, widgetMapForTreeitems, + this, true, creatureIsOwnedByUser); tree.setPrefWidth(325); tree.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); JogMobileBase walkWidget = new JogMobileBase(device); @@ -276,10 +280,13 @@ public void run() { @Override public void changed(ObservableValue observable, Number oldValue, Number newValue) { - System.out.println("Progress listener "+newValue); - if(newValue.doubleValue()>0.99) { - autoRegen.setDisable(false); - if(radioOptions!=null)radioOptions.setDisable(false); + System.out.println("Progress listener " + newValue); + if (newValue.doubleValue() > 0.99) { + BowlerStudio.runLater(() -> { + autoRegen.setDisable(false); + if (radioOptions != null) + radioOptions.setDisable(false); + }); } } }); From 1064e85c3808842db1011bc04a84c5c54029de63 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Mon, 19 Jun 2023 20:21:23 -0400 Subject: [PATCH 13/15] Cleaned up the cad generation buttons --- .../bowlerstudio/creature/CreatureLab.java | 26 +++++++++++++------ .../creature/CreatureLabControlsTab.java | 3 ++- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java b/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java index b9c3ed2ee..a83495022 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java @@ -48,7 +48,8 @@ public class CreatureLab extends AbstractBowlerStudioTab implements IOnEngineeri private ProgressIndicator pi; private MobileBaseCadManager baseManager; - private CheckBox autoRegen = new CheckBox("Auto-Regen CAD"); + private CheckBox autoRegen = new CheckBox("Auto-Generate CAD"); + private Button regen=new Button("Generate Cad Now"); Parent root; private BowlerJInputDevice gameController = null; CreatureLabControlsTab tab = new CreatureLabControlsTab(); @@ -79,6 +80,11 @@ public void initializeUI(BowlerAbstractDevice pm) { autoRegen.setOnAction(event -> { regenFromUiEvent(); }); + regen.setDisable(true); + regen.setOnAction(event -> { + autoRegen.setSelected(true); + regenFromUiEvent(); + }); // TODO Auto-generated method stub setText(pm.getScriptingName()); @@ -135,6 +141,7 @@ private void regenFromUiEvent() { autoRegen.setDisable(true); if (radioOptions != null) radioOptions.setDisable(true); + regen.setDisable(true); } baseManager.setAutoRegen(autoRegen.isSelected()); if (autoRegen.isSelected()) { @@ -263,14 +270,15 @@ public void run() { baseManager = MobileBaseCadManager.get(device, BowlerStudioController.getMobileBaseUI()); pi.progressProperty().bindBidirectional(baseManager.getProcesIndictor()); HBox progressIndicatorPanel = new HBox(10); - progressIndicatorPanel.getChildren().addAll(new Label("Cad Progress:"), pi); - progress.getChildren().addAll(progressIndicatorPanel, autoRegen, radioOptions); - progress.setStyle("-fx-background-color: #FFFFFF;"); - progress.setOpacity(.7); - progress.setMinHeight(100); - progress.setPrefSize(325, 150); - tab.setOverlayTop(progress); + progress.getChildren().addAll( regen,autoRegen, radioOptions); + progressIndicatorPanel.getChildren().addAll( progress,pi); + + progressIndicatorPanel.setStyle("-fx-background-color: #FFFFFF;"); + progressIndicatorPanel.setOpacity(.7); + progressIndicatorPanel.setMinHeight(100); + progressIndicatorPanel.setPrefSize(325, 150); + tab.setOverlayTop(progressIndicatorPanel); BowlerStudioModularFrame.getBowlerStudioModularFrame().showCreatureLab(); setCadMode(true);// start the UI in config mode @@ -286,6 +294,8 @@ public void changed(ObservableValue observable, Number oldValu autoRegen.setDisable(false); if (radioOptions != null) radioOptions.setDisable(false); + regen.setDisable(false); + }); } } diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLabControlsTab.java b/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLabControlsTab.java index 1a14b9fc0..750eab81b 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLabControlsTab.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLabControlsTab.java @@ -4,6 +4,7 @@ import javafx.fxml.FXML; import javafx.scene.control.TreeView; import javafx.scene.layout.AnchorPane; +import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; public class CreatureLabControlsTab { @@ -53,7 +54,7 @@ public void setTreeBox(AnchorPane treeBox) { } - public void setOverlayTop(VBox progress) { + public void setOverlayTop(HBox progress) { // TODO Auto-generated method stub BowlerStudio.runLater(()->{ progressBar.getChildren().clear(); From e29ebc261a9bf0683d6d2c1e230706bf74d3a025 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Mon, 19 Jun 2023 20:24:45 -0400 Subject: [PATCH 14/15] safly disable while other sourced regen --- .../bowlerstudio/creature/CreatureLab.java | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java b/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java index a83495022..bed1eeea5 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLab.java @@ -76,11 +76,10 @@ public void initializeUI(BowlerAbstractDevice pm) { this.pm = pm; autoRegen.setSelected(true); - autoRegen.setDisable(true); + disable(); autoRegen.setOnAction(event -> { regenFromUiEvent(); }); - regen.setDisable(true); regen.setOnAction(event -> { autoRegen.setSelected(true); regenFromUiEvent(); @@ -138,10 +137,7 @@ private void regenFromUiEvent() { } timeSinceLastUpdate = System.currentTimeMillis(); if (autoRegen.isSelected()) { - autoRegen.setDisable(true); - if (radioOptions != null) - radioOptions.setDisable(true); - regen.setDisable(true); + disable(); } baseManager.setAutoRegen(autoRegen.isSelected()); if (autoRegen.isSelected()) { @@ -150,6 +146,13 @@ private void regenFromUiEvent() { }); } + private void disable() { + autoRegen.setDisable(true); + if (radioOptions != null) + radioOptions.setDisable(true); + regen.setDisable(true); + } + private void finishLoading(MobileBase device) { TreeItem rootItem = null; @@ -291,17 +294,24 @@ public void changed(ObservableValue observable, Number oldValu System.out.println("Progress listener " + newValue); if (newValue.doubleValue() > 0.99) { BowlerStudio.runLater(() -> { - autoRegen.setDisable(false); - if (radioOptions != null) - radioOptions.setDisable(false); - regen.setDisable(false); - + enable(); + }); + }else { + BowlerStudio.runLater(() -> { + disable(); }); } } + + }); } - + private void enable() { + autoRegen.setDisable(false); + if (radioOptions != null) + radioOptions.setDisable(false); + regen.setDisable(false); + } private boolean hasWalking(MobileBase device) { return device.getLegs().size() > 0 || device.getSteerable().size() > 0 || device.getDrivable().size() > 0; } From 4774fa398202c5d7b4f5a396173fb2c64f6eaf0c Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Mon, 19 Jun 2023 20:31:42 -0400 Subject: [PATCH 15/15] kernel --- libraries/bowler-script-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/bowler-script-kernel b/libraries/bowler-script-kernel index 5dd735d9d..8c8b05934 160000 --- a/libraries/bowler-script-kernel +++ b/libraries/bowler-script-kernel @@ -1 +1 @@ -Subproject commit 5dd735d9d035ed75d6f160d8112a61f63c60a26c +Subproject commit 8c8b05934e2038fe4aece1ed26e5b8d61628c8d4