From 6163cadb761a1df449cb88e1e6f3973eaf510dd0 Mon Sep 17 00:00:00 2001 From: nxi Date: Tue, 24 Sep 2024 12:09:46 +1000 Subject: [PATCH] fix Koala command lost issue --- .../bragg/koala/ui/sics/CollectionHelper.java | 5 ++-- .../bragg/koala/ui/sics/ControlHelper.java | 30 ++++++++++++++++++- .../gumtree.properties | 7 +++-- .../org/gumtree/control/imp/SicsChannel.java | 2 +- 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/bragg/koala/au.gov.ansto.bragg.koala.ui/src/au/gov/ansto/bragg/koala/ui/sics/CollectionHelper.java b/bragg/koala/au.gov.ansto.bragg.koala.ui/src/au/gov/ansto/bragg/koala/ui/sics/CollectionHelper.java index 46352fb41..65a6c8a08 100644 --- a/bragg/koala/au.gov.ansto.bragg.koala.ui/src/au/gov/ansto/bragg/koala/ui/sics/CollectionHelper.java +++ b/bragg/koala/au.gov.ansto.bragg.koala.ui/src/au/gov/ansto/bragg/koala/ui/sics/CollectionHelper.java @@ -390,8 +390,9 @@ public void collect(final int exposure, final int retry) throws KoalaServerExcep while (!isStarted && ct <= START_TIMEOUT * 1000) { String err = getErrorMessage(); if (err != null && err.length() > 0) { - String galilState = galilStatusController.getValue().toString(); - throw new KoalaServerException(err + ", galil state = " + (galilState.length() == 0 ? "" : galilState)); +// String galilState = galilStatusController.getValue().toString(); +// throw new KoalaServerException(err + ", galil state = " + (galilState.length() == 0 ? "" : galilState)); + throw new KoalaServerException(err); } try { Thread.sleep(CHECK_CYCLE); diff --git a/bragg/koala/au.gov.ansto.bragg.koala.ui/src/au/gov/ansto/bragg/koala/ui/sics/ControlHelper.java b/bragg/koala/au.gov.ansto.bragg.koala.ui/src/au/gov/ansto/bragg/koala/ui/sics/ControlHelper.java index 33b224ed1..ba3938cb3 100644 --- a/bragg/koala/au.gov.ansto.bragg.koala.ui/src/au/gov/ansto/bragg/koala/ui/sics/ControlHelper.java +++ b/bragg/koala/au.gov.ansto.bragg.koala.ui/src/au/gov/ansto/bragg/koala/ui/sics/ControlHelper.java @@ -109,6 +109,7 @@ public String getText() { public static final String GUMTREE_USER_NAME = "gumtree.koala.username"; public static final String GALIL_STATE = "gumtree.koala.galilState"; public static final String GALIL_STATUS = "gumtree.koala.galilStatus"; + public static final String GALIL_STATUS_MESSAGE = "gumtree.koala.galilStatusMsg"; private final static Color BUSY_COLOR = Display.getDefault().getSystemColor(SWT.COLOR_GREEN); private final static Color IDLE_COLOR = Display.getDefault().getSystemColor(SWT.COLOR_BLACK); @@ -611,6 +612,7 @@ public static String getGalilError() { String err = ""; try { ISicsController device = getProxy().getSicsModel().findController(System.getProperty(GALIL_STATUS)); + ISicsController msgDevice = getProxy().getSicsModel().findController(System.getProperty(GALIL_STATUS_MESSAGE)); if (device != null) { int status = ((IDynamicController) device).getControllerDataValue().getIntData(); if (status < 0) { @@ -677,6 +679,32 @@ public static String getGalilError() { + "engineering team for help."; break; } + } else if (status > 0) { + err = "GALIL_STATUS = " + status + "; "; + switch (status) { + case 1: + err += "Motion disabled. Please ensure it's safe to drive motors and use the control " + + "panel on the wall to enable motion control."; + break; + case 2: + err += "Axis B forward limit switch activated. Contact instrument scientist for further instructions."; + break; + case 4: + err += "Axis B Reverse limit switch activated. Contact instrument scientist for further instructions."; + break; + case 8: + err += "Sample not within ±12mm of beam height. Use the the 'Move Sample Z to Beam' button in " + + "the footbar of this window to drive sample into the beam."; + break; + default: + break; + } + if (msgDevice != null) { + String msg = ((IDynamicController) msgDevice).getControllerDataValue().getStringData(); + if (msg != null && msg.trim().length() > 0) { + err += "\nGalil Status message: " + msg.trim(); + } + } } } } catch (Exception e) { @@ -824,7 +852,7 @@ public void updateTarget(Object oldValue, Object newValue) { public static class SampleZHelper { - public static final String MOVE_Z_UP = "Sample Stage Up "; + public static final String MOVE_Z_UP = "Move Sample Stage Up "; public static final String MOVE_Z_BACK = "Move Sample Z to Beam "; private Button samzButton; diff --git a/bragg/nbi/au.gov.ansto.bragg.nbi.workbench/gumtree.properties b/bragg/nbi/au.gov.ansto.bragg.nbi.workbench/gumtree.properties index 92f945236..b44543c35 100644 --- a/bragg/nbi/au.gov.ansto.bragg.nbi.workbench/gumtree.properties +++ b/bragg/nbi/au.gov.ansto.bragg.nbi.workbench/gumtree.properties @@ -920,7 +920,7 @@ gumtree.platform.defaultNewWindow[instr@bilby] = au.gov.ansto.bragg.nbi.ui.s ############################################################################### gumtree.sics.useNewProxy[instr@emu][env@dev,test] = true -gumtree.control.serverHost[instr@emu][env@dev,test] = tcp://ics1-emu.nbi.ansto.gov.au +gumtree.control.serverHost[instr@emu][env@dev,test] = tcp://ics4-koala-test.nbi.ansto.gov.au gumtree.startExperimentLayout[instr@emu][mode@experiment] = true gumtree.startExperimentLayout[instr@emu][mode@analysis] = false @@ -986,9 +986,9 @@ gumtree.sics.useNewProxy[instr@koala] = true gumtree.koala.virtualServer[instr@koala][env@prod] = false gumtree.koala.virtualServer[instr@koala][env@dev,test] = false -gumtree.control.serverHost[env@dev][instr@koala] = tcp://localhost +#gumtree.control.serverHost[env@dev,test][instr@koala] = tcp://localhost #gumtree.control.serverHost[env@dev][instr@koala] = tcp://ics1-wombat.nbi.ansto.gov.au -#gumtree.control.serverHost[env@dev][instr@koala] = tcp://ics1-koala.nbi.ansto.gov.au +gumtree.control.serverHost[env@dev][instr@koala] = tcp://ics1-koala.nbi.ansto.gov.au #gumtree.control.serverHost[env@dev][instr@koala] = tcp://ics1-emu.nbi.ansto.gov.au gumtree.control.serverHost[env@prod][instr@koala] = tcp://ics1-koala.nbi.ansto.gov.au gumtree.koala.vlcpath[env@test,dev] = C:/Program Files/VideoLAN/VLC.17 @@ -1079,6 +1079,7 @@ gumtree.path.gumtreestatus[instr@koala] = /experiment/gumtree_status gumtree.path.gumtreetime[instr@koala] = /experiment/gumtree_time_estimate gumtree.koala.galilState[instr@koala] = /instrument/image/galil_api/STATE gumtree.koala.galilStatus[instr@koala] = /instrument/image/galil_api/STATUS +gumtree.koala.galilStatusMsg[instr@koala] = /instrument/image/galil_api/status_msg gumtree.koala.samplename[instr@koala] = /sample/name gumtree.koala.comments[instr@koala] = /sample/description gumtree.koala.username[instr@koala] = /user/name diff --git a/framework/sics/org.gumtree.control.core/src/org/gumtree/control/imp/SicsChannel.java b/framework/sics/org.gumtree.control.core/src/org/gumtree/control/imp/SicsChannel.java index e273ede54..0b115fa86 100644 --- a/framework/sics/org.gumtree.control.core/src/org/gumtree/control/imp/SicsChannel.java +++ b/framework/sics/org.gumtree.control.core/src/org/gumtree/control/imp/SicsChannel.java @@ -90,7 +90,7 @@ public SicsChannel(SicsProxy sicsProxy) { clientSocket.setSendTimeOut(SEND_TIMEOUT); clientSocket.setLinger(0); // clientSocket.setBacklog(1); - clientSocket.setConflate(true); +// clientSocket.setConflate(true); // clientSocket.setReceiveTimeOut(COMMAND_TIMEOUT); clientSocket.setIdentity(id.getBytes(ZMQ.CHARSET)); messageHandler = new MessageHandler(sicsProxy);