|
|
@ -104,45 +104,54 @@ public class HbotConsumablePosCalibration { |
|
|
|
|
|
|
|
TipGroup tipGroup; |
|
|
|
List<TipRefPoint> tipRefPosList; |
|
|
|
Pos3d tip000 = new Pos3d(0, 0, 0); |
|
|
|
Pos3d tip000; |
|
|
|
Double tipdx; |
|
|
|
Double tipdy; |
|
|
|
|
|
|
|
// TipRefPoint findTipRefPoint(TipRowNum row, TipColumnNum col) { |
|
|
|
// for (TipRefPoint tipRefPoint : tipRefPosList) { |
|
|
|
// if (tipRefPoint.row == row && tipRefPoint.col == col) { |
|
|
|
// return tipRefPoint; |
|
|
|
// } |
|
|
|
// } |
|
|
|
// return null; |
|
|
|
// } |
|
|
|
|
|
|
|
@ExtApiFn(name = "开始标定Tip坐标", group = "标定TIP坐标", order = 20) |
|
|
|
public void startCalibrateTipPos(TipGroup tipGroup) { |
|
|
|
public void startCalibrateTipPos(TipGroup tipGroup) throws AppException { |
|
|
|
this.tipGroup = tipGroup; |
|
|
|
tipRefPosList = new java.util.ArrayList<>(); |
|
|
|
deviceReset(); |
|
|
|
disableModule(); |
|
|
|
tipdx = 0.0; |
|
|
|
tipdy = 0.0; |
|
|
|
tip000 = new Pos3d(0, 0, 0); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ExtApiFn(name = "添加Tip参考点", group = "标定TIP坐标", order = 21) |
|
|
|
public void addTipPosRefPoint(TipRowNum row, TipColumnNum columnNum) throws AppException { |
|
|
|
public Object addTipPosRefPoint(TipRowNum row, TipColumnNum columnNum) throws AppException { |
|
|
|
enableModule(); |
|
|
|
Pos2d xypos = hbotModule.readPos(); |
|
|
|
pipetteCtrlModule.zMotorMeasureDistance(); |
|
|
|
Integer z = pipetteCtrlModule.zMotorReadMeasureDistanceResult(); |
|
|
|
pipetteCtrlModule.putTipBlock(); |
|
|
|
tipRefPosList.add(new TipRefPoint(row, columnNum, new Pos3d(xypos.x, xypos.y, z))); |
|
|
|
TipRefPoint tipRefPoint = new TipRefPoint(row, columnNum, new Pos3d(xypos.x, xypos.y, z)); |
|
|
|
tipRefPosList.add(tipRefPoint); |
|
|
|
disableModule(); |
|
|
|
|
|
|
|
Map<String, Object> ret = new java.util.HashMap<>(); |
|
|
|
ret.put("newPoint", tipRefPoint); |
|
|
|
ret.put("computeResult", computeTipGroupPos()); |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "获取Tip参考点", group = "标定TIP坐标", order = 22) |
|
|
|
public List<TipRefPoint> getTipRefPosList() { |
|
|
|
return tipRefPosList; |
|
|
|
@ExtApiFn(name = "删除上一个Tip参考点", group = "标定TIP坐标", order = 22) |
|
|
|
public Object removeTipPosRefPoint() throws AppException { |
|
|
|
if (!tipRefPosList.isEmpty()) { |
|
|
|
tipRefPosList.remove(tipRefPosList.size() - 1); |
|
|
|
} |
|
|
|
Map<String, Object> ret = new java.util.HashMap<>(); |
|
|
|
ret.put("computeResult", computeTipGroupPos()); |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ExtApiFn(name = "计算Tip坐标", group = "标定TIP坐标", order = 23) |
|
|
|
public ObjectNode computeTipGroupPos() throws AppException { |
|
|
|
TipRefPoint tip_ref_01_01 = tipRefPosList.stream().filter(tipRefPoint -> tipRefPoint.eq(TipRowNum.ROW01, TipColumnNum.Colu01)).findFirst().orElse(null); |
|
|
|
TipRefPoint tip_ref_01_01 = tipRefPosList.stream().filter(tipRefPoint -> tipRefPoint.eq(TipRowNum.ROW00, TipColumnNum.Colu00)).findFirst().orElse(null); |
|
|
|
|
|
|
|
if (tip_ref_01_01 == null) { |
|
|
|
throw new AppException(A8kEcode.CALIBRATION_TIP_REF_POINT_NOT_ENOUGH); |
|
|
@ -151,13 +160,13 @@ public class HbotConsumablePosCalibration { |
|
|
|
|
|
|
|
//计算tip01_01_x,取所有第一列tip坐标x的平局值 |
|
|
|
Double tip01_01_x = ZSimplAlgo.computeAverage( |
|
|
|
tipRefPosList.stream().filter(tipRefPoint -> tipRefPoint.col == TipColumnNum.Colu01). |
|
|
|
tipRefPosList.stream().filter(tipRefPoint -> tipRefPoint.col == TipColumnNum.Colu00). |
|
|
|
map(tipRefPoint -> Double.valueOf(tipRefPoint.pos.x)).toList() |
|
|
|
); |
|
|
|
|
|
|
|
//计算tip01_01_y,取所有第1行tip坐标y的平局值 |
|
|
|
Double tip01_01_y = ZSimplAlgo.computeAverage( |
|
|
|
tipRefPosList.stream().filter(tipRefPoint -> tipRefPoint.row == TipRowNum.ROW01). |
|
|
|
tipRefPosList.stream().filter(tipRefPoint -> tipRefPoint.row == TipRowNum.ROW00). |
|
|
|
map(tipRefPoint -> Double.valueOf(tipRefPoint.pos.y)).toList() |
|
|
|
); |
|
|
|
|
|
|
@ -167,12 +176,12 @@ public class HbotConsumablePosCalibration { |
|
|
|
); |
|
|
|
//计算dx,所有点到tip01_01的距离除以行数 之后的平均值 |
|
|
|
Double dx = ZSimplAlgo.computeAverage( |
|
|
|
tipRefPosList.stream().filter(point -> !point.col.equals(TipColumnNum.Colu01)). |
|
|
|
tipRefPosList.stream().filter(point -> !point.col.equals(TipColumnNum.Colu00)). |
|
|
|
map(point -> Math.abs(point.pos.x - Double.valueOf(tip_ref_01_01.pos.x)) / point.col.ordinal()).toList() |
|
|
|
); |
|
|
|
//计算dy,所有点到tip01_01的距离除以列数 之后的平均值 |
|
|
|
Double dy = ZSimplAlgo.computeAverage( |
|
|
|
tipRefPosList.stream().filter(point -> !point.row.equals(TipRowNum.ROW01)). |
|
|
|
tipRefPosList.stream().filter(point -> !point.row.equals(TipRowNum.ROW00)). |
|
|
|
map(point -> Math.abs(point.pos.y - Double.valueOf(tip_ref_01_01.pos.y)) / point.row.ordinal()).toList() |
|
|
|
); |
|
|
|
|
|
|
@ -190,6 +199,7 @@ public class HbotConsumablePosCalibration { |
|
|
|
return node; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ExtApiFn(name = "保存计算结果", group = "标定TIP坐标", order = 24) |
|
|
|
public void saveTipGroupPos() throws AppException { |
|
|
|
hbotConsumablePosMgr.setTipGroupParam(tipGroup, tip000, tipdx, tipdy); |
|
|
|