|
|
@ -31,7 +31,7 @@ public class HbotLargeBottleBSPosCalibration { |
|
|
|
static Logger logger = org.slf4j.LoggerFactory.getLogger(HbotLargeBottleBSPosCalibration.class); |
|
|
|
|
|
|
|
@Resource |
|
|
|
PipetteCtrlDriver pipetteCtrlDriver; |
|
|
|
PipetteCtrlDriver pipetteCtrlDriver; |
|
|
|
@Resource |
|
|
|
HbotDriver hbotDriver; |
|
|
|
@Resource |
|
|
@ -88,96 +88,137 @@ public class HbotLargeBottleBSPosCalibration { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<LargeBottleConsumableRefPoint> refpoints = new java.util.ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
@ExtApiFn(name = "开始标定大瓶坐标", group = "标定大瓶缓液XY坐标", order = 30) |
|
|
|
public void startCalibrate() throws AppException { |
|
|
|
refpoints = new java.util.ArrayList<>(); |
|
|
|
moveToZero(); |
|
|
|
disableModule(); |
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "添加大瓶参考点", group = "标定大瓶缓液XY坐标", order = 31) |
|
|
|
public Object addRefPoint(ConsumableGroup group) throws AppException { |
|
|
|
// List<LargeBottleConsumableRefPoint> refpoints = new java.util.ArrayList<>(); |
|
|
|
// |
|
|
|
// |
|
|
|
// @ExtApiFn(name = "开始标定大瓶坐标", group = "标定大瓶缓液XY坐标", order = 30) |
|
|
|
// public void startCalibrate() throws AppException { |
|
|
|
// refpoints = new java.util.ArrayList<>(); |
|
|
|
// moveToZero(); |
|
|
|
// disableModule(); |
|
|
|
// } |
|
|
|
// |
|
|
|
// @ExtApiFn(name = "添加大瓶参考点", group = "标定大瓶缓液XY坐标", order = 31) |
|
|
|
// public Object addRefPoint(ConsumableGroup group) throws AppException { |
|
|
|
// enableModule(); |
|
|
|
// Pos2d xypos = hbotDriver.readPos(); |
|
|
|
// // pipetteCtrlModule.zMotorMeasureDistance(); |
|
|
|
// // Integer z = pipetteCtrlModule.zMotorReadMeasureDistanceResult(); |
|
|
|
// LargeBottleConsumableRefPoint refPoints = new LargeBottleConsumableRefPoint(group, new Pos3d(xypos.x, xypos.y, 0)); |
|
|
|
// this.refpoints.add(refPoints); |
|
|
|
// disableModule(); |
|
|
|
// ObjectNode node = ZJsonHelper.createObjectNode(); |
|
|
|
// node.put("newPoint", ZJsonHelper.createObjectNode(refPoints)); |
|
|
|
// node.put("computeResult", ZJsonHelper.createObjectNode(computeLittleBottlePosInfo())); |
|
|
|
// return node; |
|
|
|
// } |
|
|
|
// |
|
|
|
// @ExtApiFn(name = "移除最后一个参考点", group = "标定大瓶缓液XY坐标", order = 32) |
|
|
|
// public void removeTheLastRefPoint() { |
|
|
|
// if (!refpoints.isEmpty()) { |
|
|
|
// refpoints.remove(refpoints.size() - 1); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// |
|
|
|
// |
|
|
|
// @ExtApiFn(name = "读取坐标计算结果", group = "标定大瓶缓液XY坐标", order = 33) |
|
|
|
// public LargeBottoleConsumablePosInfo computeLittleBottlePosInfo() { |
|
|
|
// //第一排x求平均 |
|
|
|
// // x[0] = ZSimplAlgo.computeAverage( |
|
|
|
// // littleBottleConsumableRefPoint.stream().filter(point -> point.group.ordinal() % 3 == 0 && point.index % 5 == 0). |
|
|
|
// // map(point -> point.pos.x).toList() |
|
|
|
// // ); |
|
|
|
// |
|
|
|
// var p00 = refpoints.stream().filter(point -> point.group == ConsumableGroup.GROUP0).findFirst().orElse(null); |
|
|
|
// Double x, y, dx = null, dy = null; |
|
|
|
// |
|
|
|
// x = ZSimplAlgo.computeAverage( |
|
|
|
// refpoints.stream().filter(point -> point.group.ordinal() / 3 == 0). |
|
|
|
// map(point -> point.pos.x).toList()); |
|
|
|
// //第一列y求平均 |
|
|
|
// y = ZSimplAlgo.computeAverage( |
|
|
|
// refpoints.stream().filter(point -> point.group.ordinal() % 3 == 0). |
|
|
|
// map(point -> point.pos.y).toList()); |
|
|
|
// //除了第一列的所有点,减少x,相加,求平均 |
|
|
|
// if (p00 != null) { |
|
|
|
// dx = ZSimplAlgo.computeAverage( |
|
|
|
// refpoints.stream().filter(point -> point.getCol() != 0). |
|
|
|
// map(point -> (point.pos.x - p00.pos.x) * 1.0 / point.getCol()).toList()); |
|
|
|
// //除了第一排的所有点,减少y,相加,求平均 |
|
|
|
// dy = ZSimplAlgo.computeAverage( |
|
|
|
// refpoints.stream().filter(point -> point.getRow() != 0). |
|
|
|
// map(point -> (point.pos.y - p00.pos.y) * 1.0 / point.getRow()).toList()); |
|
|
|
// } |
|
|
|
// |
|
|
|
// return new LargeBottoleConsumablePosInfo(new Pos3d(x.intValue(), y.intValue(), 0), dx, dy); |
|
|
|
// } |
|
|
|
// |
|
|
|
// @ExtApiFn(name = "保存计算结果", group = "标定大瓶缓液XY坐标", order = 34) |
|
|
|
// public void savePosInfo() throws AppException { |
|
|
|
// posMgr.setLargeBufferGroupPosInfo(computeLittleBottlePosInfo()); |
|
|
|
// } |
|
|
|
// |
|
|
|
// @ExtApiFn(name = "读取所有参考点", group = "标定大瓶缓液XY坐标", order = 35) |
|
|
|
// public Object readAllRefPoint() throws AppException { |
|
|
|
// return refpoints; |
|
|
|
// } |
|
|
|
@ExtApiFn(name = "标定1号耗材坐标", group = "标定耗材1号坐标", order = 30) |
|
|
|
public Pos2d calibrationPos1() throws AppException { |
|
|
|
enableModule(); |
|
|
|
Pos2d xypos = hbotDriver.readPos(); |
|
|
|
// pipetteCtrlModule.zMotorMeasureDistance(); |
|
|
|
// Integer z = pipetteCtrlModule.zMotorReadMeasureDistanceResult(); |
|
|
|
LargeBottleConsumableRefPoint refPoints = new LargeBottleConsumableRefPoint(group, new Pos3d(xypos.x, xypos.y, 0)); |
|
|
|
this.refpoints.add(refPoints); |
|
|
|
disableModule(); |
|
|
|
ObjectNode node = ZJsonHelper.createObjectNode(); |
|
|
|
node.put("newPoint", ZJsonHelper.createObjectNode(refPoints)); |
|
|
|
node.put("computeResult", ZJsonHelper.createObjectNode(computeLittleBottlePosInfo())); |
|
|
|
return node; |
|
|
|
posMgr.setPos0(xypos); |
|
|
|
return xypos; |
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "移除最后一个参考点", group = "标定大瓶缓液XY坐标", order = 32) |
|
|
|
public void removeTheLastRefPoint() { |
|
|
|
if (!refpoints.isEmpty()) { |
|
|
|
refpoints.remove(refpoints.size() - 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Pos2d pos01; |
|
|
|
Pos2d pos06; |
|
|
|
|
|
|
|
@ExtApiFn(name = "读取坐标计算结果", group = "标定大瓶缓液XY坐标", order = 33) |
|
|
|
public LargeBottoleConsumablePosInfo computeLittleBottlePosInfo() { |
|
|
|
//第一排x求平均 |
|
|
|
// x[0] = ZSimplAlgo.computeAverage( |
|
|
|
// littleBottleConsumableRefPoint.stream().filter(point -> point.group.ordinal() % 3 == 0 && point.index % 5 == 0). |
|
|
|
// map(point -> point.pos.x).toList() |
|
|
|
// ); |
|
|
|
|
|
|
|
var p00 = refpoints.stream().filter(point -> point.group == ConsumableGroup.GROUP0).findFirst().orElse(null); |
|
|
|
Double x, y, dx = null, dy = null; |
|
|
|
|
|
|
|
x = ZSimplAlgo.computeAverage( |
|
|
|
refpoints.stream().filter(point -> point.group.ordinal() / 3 == 0). |
|
|
|
map(point -> point.pos.x).toList()); |
|
|
|
//第一列y求平均 |
|
|
|
y = ZSimplAlgo.computeAverage( |
|
|
|
refpoints.stream().filter(point -> point.group.ordinal() % 3 == 0). |
|
|
|
map(point -> point.pos.y).toList()); |
|
|
|
//除了第一列的所有点,减少x,相加,求平均 |
|
|
|
if (p00 != null) { |
|
|
|
dx = ZSimplAlgo.computeAverage( |
|
|
|
refpoints.stream().filter(point -> point.getCol() != 0). |
|
|
|
map(point -> (point.pos.x - p00.pos.x) * 1.0 / point.getCol()).toList()); |
|
|
|
//除了第一排的所有点,减少y,相加,求平均 |
|
|
|
dy = ZSimplAlgo.computeAverage( |
|
|
|
refpoints.stream().filter(point -> point.getRow() != 0). |
|
|
|
map(point -> (point.pos.y - p00.pos.y) * 1.0 / point.getRow()).toList()); |
|
|
|
} |
|
|
|
@ExtApiFn(name = "步骤1.测量1号坐标", group = "标定Dy和Dy", order = 31) |
|
|
|
public Pos2d measurePos01() throws AppException { |
|
|
|
enableModule(); |
|
|
|
pos01 = hbotDriver.readPos(); |
|
|
|
disableModule(); |
|
|
|
return pos01; |
|
|
|
} |
|
|
|
|
|
|
|
return new LargeBottoleConsumablePosInfo(new Pos3d(x.intValue(), y.intValue(), 0), dx, dy); |
|
|
|
@ExtApiFn(name = "步骤2.测量6号坐标", group = "标定Dy和Dy", order = 32) |
|
|
|
public Pos2d measurePos25() throws AppException { |
|
|
|
enableModule(); |
|
|
|
pos06 = hbotDriver.readPos(); |
|
|
|
disableModule(); |
|
|
|
return pos06; |
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "保存计算结果", group = "标定大瓶缓液XY坐标", order = 34) |
|
|
|
public void savePosInfo() throws AppException { |
|
|
|
posMgr.setLargeBufferGroupPosInfo(computeLittleBottlePosInfo()); |
|
|
|
@ExtApiFn(name = "步骤3.计算Dx和Dy", group = "标定Dy和Dy", order = 33) |
|
|
|
public Object computeDxAndDy() throws AppException { |
|
|
|
ObjectNode node = ZJsonHelper.createObjectNode(); |
|
|
|
node.put("dx", (pos06.x - pos01.x) / 2.0); |
|
|
|
node.put("dy", (pos06.y - pos01.y)); |
|
|
|
return node; |
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "读取所有参考点", group = "标定大瓶缓液XY坐标", order = 35) |
|
|
|
public Object readAllRefPoint() throws AppException { |
|
|
|
return refpoints; |
|
|
|
@ExtApiFn(name = "步骤4.设置Dx和Dy", group = "标定Dy和Dy", order = 34) |
|
|
|
public void setDxAndDy(Double dx, Double dy) throws AppException { |
|
|
|
posMgr.setDxAndDy(dx, dy); |
|
|
|
} |
|
|
|
|
|
|
|
// |
|
|
|
// 标定Z轴 |
|
|
|
// |
|
|
|
public void setZPos(HbotLargeBottleBSPos posName) throws AppException { |
|
|
|
public void setZPos(HbotLargeBottleBSPos posName, Integer off) throws AppException { |
|
|
|
enableModule(); |
|
|
|
pipetteCtrlDriver.zMotorMeasureDistance(); |
|
|
|
posMgr.setParam(posName, pipetteCtrlDriver.zMotorReadMeasureDistanceResult()); |
|
|
|
posMgr.setParam(posName, pipetteCtrlDriver.zMotorReadMeasureDistanceResult() + off); |
|
|
|
disableModule(); |
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "校准.大瓶缓冲液Z轴位置", group = "标定Z轴", order = 104) |
|
|
|
public void setLargeBSSSampleZPos() throws AppException {setZPos(HbotLargeBottleBSPos.LargeBSSSampleZPos);} |
|
|
|
public void setLargeBSSSampleZPos() throws AppException {setZPos(HbotLargeBottleBSPos.LargeBSSSampleZPos, 0);} |
|
|
|
|
|
|
|
@ExtApiFn(name = "校准.大瓶缓冲液Z轴结束位置", group = "标定Z轴", order = 105) |
|
|
|
public void setLargeBSSSampleEndZPos() throws AppException {setZPos(HbotLargeBottleBSPos.LargeBSSSampleEndZPos);} |
|
|
|
public void setLargeBSSSampleEndZPos() throws AppException {setZPos(HbotLargeBottleBSPos.LargeBSSSampleEndZPos, -20);} |
|
|
|
|
|
|
|
// |
|
|
|
// 校验 |
|
|
@ -187,11 +228,14 @@ public class HbotLargeBottleBSPosCalibration { |
|
|
|
public void testMoveToLargeBufferPos() throws AppException { |
|
|
|
resetStopFlag(); |
|
|
|
enableModule(); |
|
|
|
pipetteCtrlDriver.zMotorMoveZeroBlock(); |
|
|
|
for (ConsumableGroup group : ConsumableGroup.values()) { |
|
|
|
hbotCtrlService.moveToLargeBufferPos(group); |
|
|
|
hbotCtrlService.moveToLargeBufferPosEnd(group); |
|
|
|
pipetteCtrlDriver.zMotorMoveToZeroPointQuickBlock(); |
|
|
|
if (checkStopFlag()) |
|
|
|
return; |
|
|
|
break; |
|
|
|
} |
|
|
|
disableModule(); |
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "停止校验", group = "校验", order = 304) |
|
|
|