Skip to content

Commit

Permalink
fix Koala command lost issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nxi committed Sep 24, 2024
1 parent beee504 commit 6163cad
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? "<EMPTY>" : galilState));
// String galilState = galilStatusController.getValue().toString();
// throw new KoalaServerException(err + ", galil state = " + (galilState.length() == 0 ? "<EMPTY>" : galilState));
throw new KoalaServerException(err);
}
try {
Thread.sleep(CHECK_CYCLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions bragg/nbi/au.gov.ansto.bragg.nbi.workbench/gumtree.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6163cad

Please sign in to comment.