|
|
@ -13,7 +13,10 @@ import a8k.type.*; |
|
|
|
import a8k.type.cfg.Pos2d; |
|
|
|
import a8k.type.cfg.Pos3d; |
|
|
|
import a8k.type.exception.AppException; |
|
|
|
import a8k.utils.ZJsonHelper; |
|
|
|
import a8k.utils.ZSimplAlgo; |
|
|
|
import com.fasterxml.jackson.databind.JsonNode; |
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode; |
|
|
|
import jakarta.annotation.Resource; |
|
|
|
import org.aspectj.lang.annotation.Aspect; |
|
|
|
import org.slf4j.Logger; |
|
|
@ -57,9 +60,9 @@ public class HbotLittleBottleConsumableCalibration { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ExtApiFn(name = "获取所有坐标", group = "基础", order = 1) |
|
|
|
public Object getPoss() throws AppException { |
|
|
|
return hbotConsumablePosMgr.getParams(); |
|
|
|
@ExtApiFn(name = "获取坐标", group = "基础", order = 1) |
|
|
|
public Object getPoss(LittleBottleConsumableType type) throws AppException { |
|
|
|
return hbotConsumablePosMgr.getLittleBottleConsumablePosInfo(type); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -84,9 +87,10 @@ public class HbotLittleBottleConsumableCalibration { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
LittleBottleConsumableType littleBottleConsumableType = LittleBottleConsumableType.BufferSolution; |
|
|
|
List<LittleBottleConsumableRefPoint> littleBottleConsumableRefPoint; |
|
|
|
LittleBottleConsumableType littleBottleConsumableType = LittleBottleConsumableType.BufferSolution; |
|
|
|
List<LittleBottleConsumableRefPoint> littleBottleConsumableRefPoint = new java.util.ArrayList<>(); |
|
|
|
LittleBottleConsumablePosInfo littleBottleConsumablePosInfo; |
|
|
|
List<Integer> zpos = new java.util.ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
@ExtApiFn(name = "开始标定小瓶坐标", group = "标定小瓶坐标", order = 30) |
|
|
@ -94,6 +98,7 @@ public class HbotLittleBottleConsumableCalibration { |
|
|
|
littleBottleConsumablePosInfo = null; |
|
|
|
littleBottleConsumableRefPoint = new java.util.ArrayList<>(); |
|
|
|
littleBottleConsumableType = type; |
|
|
|
zpos.clear(); |
|
|
|
moveToZero(); |
|
|
|
disableModule(); |
|
|
|
} |
|
|
@ -107,10 +112,23 @@ public class HbotLittleBottleConsumableCalibration { |
|
|
|
LittleBottleConsumableRefPoint littleBufferRefPoint = new LittleBottleConsumableRefPoint(group, off0To24, new Pos3d(xypos.x, xypos.y, z)); |
|
|
|
this.littleBottleConsumableRefPoint.add(littleBufferRefPoint); |
|
|
|
disableModule(); |
|
|
|
return computeLittleBottlePosInfo(); |
|
|
|
ObjectNode node = ZJsonHelper.createObjectNode(); |
|
|
|
node.put("newPoint", ZJsonHelper.createObjectNode(littleBufferRefPoint)); |
|
|
|
node.put("computeResult", ZJsonHelper.createObjectNode(computeLittleBottlePosInfo())); |
|
|
|
return node; |
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "删除上一个小瓶参考点", group = "标定小瓶坐标", order = 32) |
|
|
|
@ExtApiFn(name = "添加Z轴坐标点", group = "标定小瓶坐标", order = 32) |
|
|
|
public Object addLittleBottleGroupRefPoint() throws AppException { |
|
|
|
enableModule(); |
|
|
|
pipetteCtrlModule.zMotorMeasureDistance(); |
|
|
|
Integer z = pipetteCtrlModule.zMotorReadMeasureDistanceResult(); |
|
|
|
zpos.add(z); |
|
|
|
disableModule(); |
|
|
|
return z; |
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "计算坐标", group = "标定小瓶坐标", order = 32) |
|
|
|
public LittleBottleConsumablePosInfo computeLittleBottlePosInfo() { |
|
|
|
//计算y0,所有group==0,1,2,同时0<=off<5的点,求平均 |
|
|
|
Double[] y = new Double[2]; |
|
|
@ -119,7 +137,16 @@ public class HbotLittleBottleConsumableCalibration { |
|
|
|
Double[] dys = new Double[6]; |
|
|
|
Double dx; |
|
|
|
Double dy; |
|
|
|
Double z; |
|
|
|
double z = 0.0; |
|
|
|
|
|
|
|
LittleBottleConsumableRefPoint[] gx_00 = new LittleBottleConsumableRefPoint[6]; |
|
|
|
|
|
|
|
gx_00[0] = littleBottleConsumableRefPoint.stream().filter(point -> point.group == ConsumableGroup.GROUP0 && point.index == 0).findFirst().orElse(null); |
|
|
|
gx_00[1] = littleBottleConsumableRefPoint.stream().filter(point -> point.group == ConsumableGroup.GROUP1 && point.index == 0).findFirst().orElse(null); |
|
|
|
gx_00[2] = littleBottleConsumableRefPoint.stream().filter(point -> point.group == ConsumableGroup.GROUP2 && point.index == 0).findFirst().orElse(null); |
|
|
|
gx_00[3] = littleBottleConsumableRefPoint.stream().filter(point -> point.group == ConsumableGroup.GROUP3 && point.index == 0).findFirst().orElse(null); |
|
|
|
gx_00[4] = littleBottleConsumableRefPoint.stream().filter(point -> point.group == ConsumableGroup.GROUP4 && point.index == 0).findFirst().orElse(null); |
|
|
|
gx_00[5] = littleBottleConsumableRefPoint.stream().filter(point -> point.group == ConsumableGroup.GROUP5 && point.index == 0).findFirst().orElse(null); |
|
|
|
|
|
|
|
y[0] = ZSimplAlgo.computeAverage( |
|
|
|
littleBottleConsumableRefPoint.stream().filter(point -> point.group.ordinal() < 3 && point.index < 5). |
|
|
@ -131,89 +158,96 @@ public class HbotLittleBottleConsumableCalibration { |
|
|
|
map(point -> point.pos.y).toList() |
|
|
|
); |
|
|
|
|
|
|
|
//计算y0,所有group==0,3,同时off==0,5,10,15,20的点,求y平均 |
|
|
|
//计算x0,所有group==0,3,同时off==0,5,10,15,20的点,求y平均 |
|
|
|
x[0] = ZSimplAlgo.computeAverage( |
|
|
|
littleBottleConsumableRefPoint.stream().filter(point -> point.group.ordinal() % 3 == 0 && point.index % 5 == 0). |
|
|
|
map(point -> point.pos.y).toList() |
|
|
|
map(point -> point.pos.x).toList() |
|
|
|
); |
|
|
|
//计算y1,所有group==1,4,同时off==0,5,10,15,20的点,求y平均 |
|
|
|
//计算x1,所有group==1,4,同时off==0,5,10,15,20的点,求y平均 |
|
|
|
x[1] = ZSimplAlgo.computeAverage( |
|
|
|
littleBottleConsumableRefPoint.stream().filter(point -> point.group.ordinal() % 3 == 1 && point.index % 5 == 0). |
|
|
|
map(point -> point.pos.y).toList() |
|
|
|
map(point -> point.pos.x).toList() |
|
|
|
); |
|
|
|
//计算y2 |
|
|
|
//计算x2 |
|
|
|
x[2] = ZSimplAlgo.computeAverage( |
|
|
|
littleBottleConsumableRefPoint.stream().filter(point -> point.group.ordinal() % 3 == 2 && point.index % 5 == 0). |
|
|
|
map(point -> point.pos.y).toList() |
|
|
|
); |
|
|
|
// |
|
|
|
z = ZSimplAlgo.computeAverage( |
|
|
|
littleBottleConsumableRefPoint.stream().map(point -> point.pos.z).toList() |
|
|
|
map(point -> point.pos.x).toList() |
|
|
|
); |
|
|
|
z = ZSimplAlgo.computeAverage(zpos); |
|
|
|
//计算d0x,所有 非0,5,10,15,20的点,到x0的距离/偏移差值,求平均 |
|
|
|
for (int i = 0; i < 6; i++) { |
|
|
|
int finalI = i; |
|
|
|
dxs[i] = ZSimplAlgo.computeAverage( |
|
|
|
|
|
|
|
if (gx_00[i] == null) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
Double val = ZSimplAlgo.computeAverage( |
|
|
|
littleBottleConsumableRefPoint.stream().filter(point -> point.group.ordinal() == finalI && point.getColOff() != 0). |
|
|
|
map(point -> point.pos.x - x[finalI % 3] / (point.getColOff())).toList() |
|
|
|
map(point -> (point.pos.x - gx_00[finalI].pos.x) / (point.getColOff())).toList() |
|
|
|
); |
|
|
|
dxs[i] = val; |
|
|
|
} |
|
|
|
dx = ZSimplAlgo.computeAverage(dxs); |
|
|
|
//计算dy, |
|
|
|
for (int i = 0; i < 6; i++) { |
|
|
|
int finalI = i; |
|
|
|
if (gx_00[i] == null) |
|
|
|
continue; |
|
|
|
|
|
|
|
dys[i] = ZSimplAlgo.computeAverage( |
|
|
|
littleBottleConsumableRefPoint.stream().filter(point -> point.group.ordinal() == finalI && point.getRowOff() != 0). |
|
|
|
map(point -> point.pos.y - y[finalI / 3] / (point.getRowOff())).toList() |
|
|
|
map(point -> (point.pos.y - gx_00[finalI].pos.y) / (point.getRowOff())).toList() |
|
|
|
); |
|
|
|
} |
|
|
|
dy = ZSimplAlgo.computeAverage(dys); |
|
|
|
|
|
|
|
littleBottleConsumablePosInfo = new LittleBottleConsumablePosInfo(); |
|
|
|
littleBottleConsumablePosInfo.g0_000 = new Pos3d(x[0].intValue(), y[0].intValue(), z.intValue()); |
|
|
|
littleBottleConsumablePosInfo.g1_000 = new Pos3d(x[1].intValue(), y[0].intValue(), z.intValue()); |
|
|
|
littleBottleConsumablePosInfo.g2_000 = new Pos3d(x[2].intValue(), y[0].intValue(), z.intValue()); |
|
|
|
littleBottleConsumablePosInfo.g3_000 = new Pos3d(x[0].intValue(), y[1].intValue(), z.intValue()); |
|
|
|
littleBottleConsumablePosInfo.g4_000 = new Pos3d(x[1].intValue(), y[1].intValue(), z.intValue()); |
|
|
|
littleBottleConsumablePosInfo.g5_000 = new Pos3d(x[2].intValue(), y[1].intValue(), z.intValue()); |
|
|
|
littleBottleConsumablePosInfo.g0_000 = new Pos3d(x[0].intValue(), y[0].intValue(), (int) z); |
|
|
|
littleBottleConsumablePosInfo.g1_000 = new Pos3d(x[1].intValue(), y[0].intValue(), (int) z); |
|
|
|
littleBottleConsumablePosInfo.g2_000 = new Pos3d(x[2].intValue(), y[0].intValue(), (int) z); |
|
|
|
littleBottleConsumablePosInfo.g3_000 = new Pos3d(x[0].intValue(), y[1].intValue(), (int) z); |
|
|
|
littleBottleConsumablePosInfo.g4_000 = new Pos3d(x[1].intValue(), y[1].intValue(), (int) z); |
|
|
|
littleBottleConsumablePosInfo.g5_000 = new Pos3d(x[2].intValue(), y[1].intValue(), (int) z); |
|
|
|
littleBottleConsumablePosInfo.dx = dx; |
|
|
|
littleBottleConsumablePosInfo.dy = dy; |
|
|
|
return littleBottleConsumablePosInfo; |
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "保存小瓶坐标", group = "标定小瓶坐标", order = 33) |
|
|
|
@ExtApiFn(name = "保存计算结果", group = "标定小瓶坐标", order = 33) |
|
|
|
public void saveLittleBottleConsumablePosInfo() throws AppException { |
|
|
|
hbotConsumablePosMgr.setLittleBottleConsumablePosInfo(littleBottleConsumableType, littleBottleConsumablePosInfo); |
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "读取所有参考点", group = "标定小瓶坐标", order = 33) |
|
|
|
public Object readAllRefPoint() throws AppException { |
|
|
|
return littleBottleConsumableRefPoint; |
|
|
|
} |
|
|
|
|
|
|
|
// |
|
|
|
// 校验 |
|
|
|
// |
|
|
|
|
|
|
|
@ExtApiFn(name = "校验小瓶缓冲液坐标", group = "校验", order = 301) |
|
|
|
public void testMoveToLittleBufferPos() throws AppException { |
|
|
|
public void testMoveToLittleBufferPos(ConsumableGroup group) throws AppException { |
|
|
|
resetStopFlag(); |
|
|
|
enableModule(); |
|
|
|
for (ConsumableGroup group : ConsumableGroup.values()) { |
|
|
|
for (int i = 0; i < AppConstant.CONSUMABLE_NUM; i++) { |
|
|
|
hbotControler.moveToLittleBufferPos(group, i); |
|
|
|
if (checkStopFlag()) |
|
|
|
return; |
|
|
|
} |
|
|
|
for (int i = 0; i < AppConstant.CONSUMABLE_NUM; i++) { |
|
|
|
hbotControler.moveToLittleBufferPos(group, i); |
|
|
|
pipetteCtrlModule.zMotorMoveToZeroPointQuickBlock(); |
|
|
|
if (checkStopFlag()) |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "校验探测物质坐标", group = "校验", order = 302) |
|
|
|
public void testMoveToProbeSubstancePos() throws AppException { |
|
|
|
public void testMoveToProbeSubstancePos(ConsumableGroup group) throws AppException { |
|
|
|
resetStopFlag(); |
|
|
|
enableModule(); |
|
|
|
for (ConsumableGroup group : ConsumableGroup.values()) { |
|
|
|
for (int i = 0; i < AppConstant.CONSUMABLE_NUM; i++) { |
|
|
|
hbotControler.moveToProbeSubstancePos(group, i); |
|
|
|
if (checkStopFlag()) |
|
|
|
return; |
|
|
|
} |
|
|
|
for (int i = 0; i < AppConstant.CONSUMABLE_NUM; i++) { |
|
|
|
hbotControler.moveToProbeSubstancePos(group, i); |
|
|
|
pipetteCtrlModule.zMotorMoveToZeroPointQuickBlock(); |
|
|
|
if (checkStopFlag()) |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|