Preliminary implementation of SwissMX RT

This commit is contained in:
2023-04-26 09:22:59 +02:00
parent f961ee0758
commit a904eac8eb
9 changed files with 321 additions and 137 deletions

View File

@@ -55,11 +55,19 @@ public class MainPanel extends Panel {
public enum BasePlateLayout {
normal,
sf,
x06da
x06da,
rt
}
public static final BasePlateLayout BASE_PLATE_LAYOUT = App.hasArgument("sf") ? BasePlateLayout.sf :
( App.hasArgument("6d") ? BasePlateLayout.x06da : BasePlateLayout.normal);
public static final BasePlateLayout BASE_PLATE_LAYOUT =
App.hasArgument("sf") ? BasePlateLayout.sf :
( App.hasArgument("6d") ? BasePlateLayout.x06da :
( App.hasArgument("rt") ? BasePlateLayout.rt : BasePlateLayout.normal)
);
public static boolean isRt(){
return App.hasArgument("rt");
}
public MainPanel() {
initComponents();
getContext().getPluginManager().addDynamicClass(PuckDetection.class);
@@ -69,10 +77,15 @@ public class MainPanel extends Panel {
setDefaultDetail();
panelTablePucks.getVerticalScrollBar().setPreferredSize(new Dimension(20, 0));
panelTableSamples.getVerticalScrollBar().setPreferredSize(new Dimension(20, 0));
if (isRt()){
panelLegend.setVisible(false);
}
((DefaultTableModel)tablePucks.getModel()).setNumRows(BasePlate.numberOfPucks);
int row = 0;
for (String segment : new String[]{"A", "B", "C", "D", "E", "F"}) {
for (int puck = 1; puck <= 5; puck++) {
for (int puck = 1; puck <= BasePlate.numberOfPucksPerSegments; puck++) {
tablePucks.getModel().setValueAt(segment + puck, row++, 0);
}
}
@@ -153,84 +166,88 @@ public class MainPanel extends Panel {
@Override
public void onInitialize(int runCount) {
stopTimer();
Controller.getInstance().onInitialize(runCount);
panelDisplayMode.setVisible(Controller.getInstance().isRoomTempEnabled());
panelBeamlineStatus.setVisible(Controller.getInstance().isBeamlineStatusEnabled());
if (basePlatePanel.getDevice() != (Device) getDevice("BasePlate")) {
basePlatePanel.setDevice((Device) getDevice("BasePlate"));
}
try {
devicesPanel.initialize();
((Device) getDevice("dewar_level")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateLevel(value);
}
});
updateLevel(((Device) getDevice("dewar_level")).take());
((Device) getDevice("air_pressure_ok")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateAirPressure(value);
}
});
updateAirPressure(((Device) getDevice("air_pressure_ok")).take());
((Device) getDevice("n2_pressure_ok")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateN2Pressure(value);
}
});
updateN2Pressure(((Device) getDevice("n2_pressure_ok")).take());
((Device) getDevice("feedback_local_safety")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateLocalSafety(value);
}
});
updateLocalSafety(((Device) getDevice("feedback_local_safety")).take());
updateN2Pressure(((Device) getDevice("n2_pressure_ok")).take());
((Device) getDevice("gripper_dryer")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateDryer(value);
}
});
updateDryer(((Device) getDevice("gripper_dryer")).take());
((Device) getDevice("feedback_psys_safety")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updatePsysSafety(value);
}
});
updatePsysSafety(((Device) getDevice("feedback_psys_safety")).take());
((Device) getDevice("robot")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateMode(value);
}
public void onStateChanged(Device device, State state, State former) {
if (!state.isNormal()) {
updateMode(null);
try{
Controller.getInstance().onInitialize(runCount);
panelDisplayMode.setVisible(Controller.getInstance().isRoomTempEnabled());
panelBeamlineStatus.setVisible(Controller.getInstance().isBeamlineStatusEnabled());
if (basePlatePanel.getDevice() != (Device) getDevice("BasePlate")) {
basePlatePanel.setDevice((Device) getDevice("BasePlate"));
}
try {
devicesPanel.initialize();
((Device) getDevice("dewar_level")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateLevel(value);
}
}
});
updateMode(((Device) getDevice("robot")).take());
} catch (Exception ex) {
this.getLogger().log(Level.SEVERE, null, ex);
});
updateLevel(((Device) getDevice("dewar_level")).take());
((Device) getDevice("air_pressure_ok")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateAirPressure(value);
}
});
updateAirPressure(((Device) getDevice("air_pressure_ok")).take());
((Device) getDevice("n2_pressure_ok")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateN2Pressure(value);
}
});
updateN2Pressure(((Device) getDevice("n2_pressure_ok")).take());
((Device) getDevice("feedback_local_safety")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateLocalSafety(value);
}
});
updateLocalSafety(((Device) getDevice("feedback_local_safety")).take());
updateN2Pressure(((Device) getDevice("n2_pressure_ok")).take());
((Device) getDevice("gripper_dryer")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateDryer(value);
}
});
updateDryer(((Device) getDevice("gripper_dryer")).take());
((Device) getDevice("feedback_psys_safety")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updatePsysSafety(value);
}
});
updatePsysSafety(((Device) getDevice("feedback_psys_safety")).take());
((Device) getDevice("robot")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateMode(value);
}
public void onStateChanged(Device device, State state, State former) {
if (!state.isNormal()) {
updateMode(null);
}
}
});
updateMode(((Device) getDevice("robot")).take());
} catch (Exception ex) {
this.getLogger().log(Level.SEVERE, null, ex);
}
setPuckDatamatrix(null);
setSampleDatamatrix(null);
setBackgroundUpdate(true);
startTimer(3000, 1000);
updateCameraView();
} catch (Exception ex){
getLogger().log(Level.SEVERE, null, ex);
}
setPuckDatamatrix(null);
setSampleDatamatrix(null);
setBackgroundUpdate(true);
startTimer(3000, 1000);
updateCameraView();
}
@Override
@@ -490,7 +507,7 @@ public class MainPanel extends Panel {
buttonCalibrateCover.setVisible(expert);
devicesPanel.setActive(expert);
panelViewType.setVisible(expert);
panelDetection.setVisible(expert);
panelDetection.setVisible(expert && !isRt());
buttonDetectCover.setVisible(expert);
buttonConfig.setVisible(expert);
Puck.setDisplayDetectionError(expert);
@@ -575,6 +592,13 @@ public class MainPanel extends Panel {
}
}
);
if (isRt()){
for (int i=0; i<3; i++){
tableSamples.getColumnModel().getColumn(i).setMinWidth(0);
tableSamples.getColumnModel().getColumn(i).setMaxWidth(0);
tableSamples.getColumnModel().getColumn(i).setWidth(0);
}
}
}
void onSelectionChanged(String segment, Integer puck, Integer sample) {
@@ -876,18 +900,18 @@ public class MainPanel extends Panel {
panelHexiposiLayout.setHorizontalGroup(
panelHexiposiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelHexiposiLayout.createSequentialGroup()
.addContainerGap(13, Short.MAX_VALUE)
.addContainerGap(9, Short.MAX_VALUE)
.addGroup(panelHexiposiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(buttonDetectCover)
.addComponent(hexiposiPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(14, Short.MAX_VALUE))
.addContainerGap(9, Short.MAX_VALUE))
);
panelHexiposiLayout.setVerticalGroup(
panelHexiposiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelHexiposiLayout.createSequentialGroup()
.addContainerGap(15, Short.MAX_VALUE)
.addContainerGap(14, Short.MAX_VALUE)
.addComponent(hexiposiPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 9, Short.MAX_VALUE)
.addComponent(buttonDetectCover)
.addContainerGap())
);
@@ -914,11 +938,11 @@ public class MainPanel extends Panel {
panelViewTypeLayout.setHorizontalGroup(
panelViewTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelViewTypeLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap(8, Short.MAX_VALUE)
.addGroup(panelViewTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(buttonDrawing)
.addComponent(buttonCamera))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(8, Short.MAX_VALUE))
);
panelViewTypeLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonCamera, buttonDrawing});
@@ -1374,9 +1398,9 @@ public class MainPanel extends Panel {
.addGroup(panelDevicesLayout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(devicesPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelExpert, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(30, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panelDevicesLayout.setVerticalGroup(
panelDevicesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -1385,7 +1409,7 @@ public class MainPanel extends Panel {
.addGroup(panelDevicesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelExpert, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(devicesPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 235, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(8, Short.MAX_VALUE))
);
javax.swing.GroupLayout panelRightLayout = new javax.swing.GroupLayout(panelRight);
@@ -1404,7 +1428,7 @@ public class MainPanel extends Panel {
panelRightLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelRightLayout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(panelDetail, javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE)
.addComponent(panelDetail, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)
.addGap(0, 0, 0)
.addComponent(panelDevices, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
@@ -1575,7 +1599,7 @@ public class MainPanel extends Panel {
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(panelTop, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(0, 0, 0)
.addComponent(panelBottom, javax.swing.GroupLayout.DEFAULT_SIZE, 74, Short.MAX_VALUE)
.addComponent(panelBottom, javax.swing.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE)
.addGap(1, 1, 1))
);
}// </editor-fold>//GEN-END:initComponents