|
|
@ -15,7 +15,6 @@ 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; |
|
|
@ -61,8 +60,8 @@ public class HbotLittleBottleConsumableCalibration { |
|
|
|
|
|
|
|
|
|
|
|
@ExtApiFn(name = "获取坐标", group = "基础", order = 1) |
|
|
|
public Object getPoss(LittleBottleConsumableType type) throws AppException { |
|
|
|
return hbotConsumablePosMgr.getLittleBottleConsumablePosInfo(type); |
|
|
|
public Object getPoss() throws AppException { |
|
|
|
return hbotConsumablePosMgr.getParams(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -90,20 +89,18 @@ public class HbotLittleBottleConsumableCalibration { |
|
|
|
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) |
|
|
|
@ExtApiFn(name = "开始标定小瓶坐标", group = "标定小瓶XY坐标", order = 30) |
|
|
|
public void startCalibrateLittleBottleGroup(LittleBottleConsumableType type) throws AppException { |
|
|
|
littleBottleConsumablePosInfo = null; |
|
|
|
littleBottleConsumableRefPoint = new java.util.ArrayList<>(); |
|
|
|
littleBottleConsumableType = type; |
|
|
|
zpos.clear(); |
|
|
|
moveToZero(); |
|
|
|
disableModule(); |
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "添加小瓶参考点", group = "标定小瓶坐标", order = 31) |
|
|
|
@ExtApiFn(name = "添加小瓶参考点", group = "标定小瓶XY坐标", order = 31) |
|
|
|
public Object addLittleBottleGroupRefPoint(ConsumableGroup group, Integer off0To24) throws AppException { |
|
|
|
enableModule(); |
|
|
|
Pos2d xypos = hbotModule.readPos(); |
|
|
@ -118,17 +115,8 @@ public class HbotLittleBottleConsumableCalibration { |
|
|
|
return node; |
|
|
|
} |
|
|
|
|
|
|
|
@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) |
|
|
|
@ExtApiFn(name = "计算坐标", group = "标定小瓶XY坐标", order = 32) |
|
|
|
public LittleBottleConsumablePosInfo computeLittleBottlePosInfo() { |
|
|
|
//计算y0,所有group==0,1,2,同时0<=off<5的点,求平均 |
|
|
|
Double[] y = new Double[2]; |
|
|
@ -137,7 +125,7 @@ public class HbotLittleBottleConsumableCalibration { |
|
|
|
Double[] dys = new Double[6]; |
|
|
|
Double dx; |
|
|
|
Double dy; |
|
|
|
double z = 0.0; |
|
|
|
// double z = 0.0; |
|
|
|
|
|
|
|
LittleBottleConsumableRefPoint[] gx_00 = new LittleBottleConsumableRefPoint[6]; |
|
|
|
|
|
|
@ -173,7 +161,7 @@ public class HbotLittleBottleConsumableCalibration { |
|
|
|
littleBottleConsumableRefPoint.stream().filter(point -> point.group.ordinal() % 3 == 2 && point.index % 5 == 0). |
|
|
|
map(point -> point.pos.x).toList() |
|
|
|
); |
|
|
|
z = ZSimplAlgo.computeAverage(zpos); |
|
|
|
// z = ZSimplAlgo.computeAverage(zpos); |
|
|
|
//计算d0x,所有 非0,5,10,15,20的点,到x0的距离/偏移差值,求平均 |
|
|
|
for (int i = 0; i < 6; i++) { |
|
|
|
int finalI = i; |
|
|
@ -201,29 +189,55 @@ public class HbotLittleBottleConsumableCalibration { |
|
|
|
} |
|
|
|
dy = ZSimplAlgo.computeAverage(dys); |
|
|
|
|
|
|
|
var oldposInfo = hbotConsumablePosMgr.getLittleBottleConsumablePosInfo(littleBottleConsumableType); |
|
|
|
|
|
|
|
littleBottleConsumablePosInfo = new LittleBottleConsumablePosInfo(); |
|
|
|
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.g0_000 = new Pos3d(x[0].intValue(), y[0].intValue(), oldposInfo.g0_000.z); |
|
|
|
littleBottleConsumablePosInfo.g1_000 = new Pos3d(x[1].intValue(), y[0].intValue(), oldposInfo.g1_000.z); |
|
|
|
littleBottleConsumablePosInfo.g2_000 = new Pos3d(x[2].intValue(), y[0].intValue(), oldposInfo.g2_000.z); |
|
|
|
littleBottleConsumablePosInfo.g3_000 = new Pos3d(x[0].intValue(), y[1].intValue(), oldposInfo.g3_000.z); |
|
|
|
littleBottleConsumablePosInfo.g4_000 = new Pos3d(x[1].intValue(), y[1].intValue(), oldposInfo.g4_000.z); |
|
|
|
littleBottleConsumablePosInfo.g5_000 = new Pos3d(x[2].intValue(), y[1].intValue(), oldposInfo.g5_000.z); |
|
|
|
littleBottleConsumablePosInfo.dx = dx; |
|
|
|
littleBottleConsumablePosInfo.dy = dy; |
|
|
|
return littleBottleConsumablePosInfo; |
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "保存计算结果", group = "标定小瓶坐标", order = 33) |
|
|
|
@ExtApiFn(name = "保存计算结果", group = "标定小瓶XY坐标", order = 33) |
|
|
|
public void saveLittleBottleConsumablePosInfo() throws AppException { |
|
|
|
hbotConsumablePosMgr.setLittleBottleConsumablePosInfo(littleBottleConsumableType, littleBottleConsumablePosInfo); |
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "读取所有参考点", group = "标定小瓶坐标", order = 33) |
|
|
|
@ExtApiFn(name = "读取所有参考点", group = "标定小瓶XY坐标", order = 33) |
|
|
|
public Object readAllRefPoint() throws AppException { |
|
|
|
return littleBottleConsumableRefPoint; |
|
|
|
} |
|
|
|
|
|
|
|
// |
|
|
|
// 标定Z轴 |
|
|
|
// |
|
|
|
|
|
|
|
|
|
|
|
@ExtApiFn(name = "校准.小瓶穿孔Z轴位置", group = "标定Z轴", order = 101) |
|
|
|
public void setLittleBSPierceZPos() throws AppException { |
|
|
|
pipetteCtrlModule.zMotorMeasureDistance(); |
|
|
|
hbotConsumablePosMgr.setParam(HbotConsumablePosParam.LittleBSPierceZPos, pipetteCtrlModule.zMotorReadMeasureDistanceResult()); |
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "校准.小瓶取样Z轴位置", group = "标定Z轴", order = 102) |
|
|
|
public void setLittleBSSampleZPos() throws AppException { |
|
|
|
pipetteCtrlModule.zMotorMeasureDistance(); |
|
|
|
hbotConsumablePosMgr.setParam(HbotConsumablePosParam.LittleBSSampleZPos, pipetteCtrlModule.zMotorReadMeasureDistanceResult()); |
|
|
|
} |
|
|
|
|
|
|
|
@ExtApiFn(name = "校准.探测物质取样Z轴位置", group = "标定Z轴", order = 103) |
|
|
|
public void setProbeSubstanceSampleZPos() throws AppException { |
|
|
|
pipetteCtrlModule.zMotorMeasureDistance(); |
|
|
|
hbotConsumablePosMgr.setParam(HbotConsumablePosParam.ProbeSubstanceSampleZPos, pipetteCtrlModule.zMotorReadMeasureDistanceResult()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// |
|
|
|
// 校验 |
|
|
|
// |
|
|
|
|
|
|
@ -232,19 +246,21 @@ public class HbotLittleBottleConsumableCalibration { |
|
|
|
resetStopFlag(); |
|
|
|
enableModule(); |
|
|
|
for (int i = 0; i < AppConstant.CONSUMABLE_NUM; i++) { |
|
|
|
hbotControler.moveToLittleBufferPos(group, i); |
|
|
|
hbotControler.moveToLittleBufferPiercePos(group, i); |
|
|
|
pipetteCtrlModule.zMotorMoveToZeroPointQuickBlock(); |
|
|
|
if (checkStopFlag()) |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//TODO:添加取样校验 |
|
|
|
|
|
|
|
@ExtApiFn(name = "校验探测物质坐标", group = "校验", order = 302) |
|
|
|
public void testMoveToProbeSubstancePos(ConsumableGroup group) throws AppException { |
|
|
|
resetStopFlag(); |
|
|
|
enableModule(); |
|
|
|
for (int i = 0; i < AppConstant.CONSUMABLE_NUM; i++) { |
|
|
|
hbotControler.moveToProbeSubstancePos(group, i); |
|
|
|
hbotControler.moveToProbeSubstanceSamplePos(group, i); |
|
|
|
pipetteCtrlModule.zMotorMoveToZeroPointQuickBlock(); |
|
|
|
if (checkStopFlag()) |
|
|
|
return; |
|
|
|