15 changed files with 650 additions and 369 deletions
-
BINapp.db
-
2src/main/java/a8k/constant/AppConstant.java
-
3src/main/java/a8k/extapi_controler/pagecontrol/ExtApiTabConfig.java
-
237src/main/java/a8k/service/app/devicedriver/calibration/HbotLittleBottleConsumableCalibration.java
-
63src/main/java/a8k/service/app/devicedriver/calibration/HbotTipPosCalibration.java
-
46src/main/java/a8k/service/app/devicedriver/calibration/ReactionPlatesTransmitControlerCalibration.java
-
116src/main/java/a8k/service/app/devicedriver/pos/HbotConsumablePosMgr.java
-
12src/main/java/a8k/service/debug/AppDebugHelperService.java
-
2src/main/java/a8k/type/ConsumableGroup.java
-
41src/main/java/a8k/type/HbotConsumablePosParam.java
-
15src/main/java/a8k/type/LittleBottleConsumablePosInfo.java
-
25src/main/java/a8k/type/LittleBottleConsumableRefPoint.java
-
6src/main/java/a8k/type/LittleBottleConsumableType.java
-
19src/main/java/a8k/utils/ZSimplAlgo.java
@ -0,0 +1,237 @@ |
|||
package a8k.service.app.devicedriver.calibration; |
|||
|
|||
|
|||
import a8k.constant.AppConstant; |
|||
import a8k.extapi_controler.pagecontrol.ExtApiTabConfig; |
|||
import a8k.extapi_controler.utils.ExtApiFn; |
|||
import a8k.extapi_controler.utils.ExtApiTab; |
|||
import a8k.service.app.devicedriver.basectrl.HbotModule; |
|||
import a8k.service.app.devicedriver.basectrl.PipetteCtrlModule; |
|||
import a8k.service.app.devicedriver.ctrl.HbotControler; |
|||
import a8k.service.app.devicedriver.pos.HbotConsumablePosMgr; |
|||
import a8k.type.*; |
|||
import a8k.type.cfg.Pos2d; |
|||
import a8k.type.cfg.Pos3d; |
|||
import a8k.type.exception.AppException; |
|||
import a8k.utils.ZSimplAlgo; |
|||
import jakarta.annotation.Resource; |
|||
import org.aspectj.lang.annotation.Aspect; |
|||
import org.slf4j.Logger; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
|
|||
@ExtApiTab(cfg = ExtApiTabConfig.HbotLittleBottleConsumableCalibration) |
|||
@Component |
|||
@Aspect |
|||
public class HbotLittleBottleConsumableCalibration { |
|||
static Logger logger = org.slf4j.LoggerFactory.getLogger(HbotLittleBottleConsumableCalibration.class); |
|||
|
|||
@Resource |
|||
PipetteCtrlModule pipetteCtrlModule; |
|||
@Resource |
|||
HbotModule hbotModule; |
|||
|
|||
|
|||
@Resource |
|||
HbotControler hbotControler; |
|||
@Resource |
|||
HbotConsumablePosMgr hbotConsumablePosMgr; |
|||
|
|||
Boolean stopFlag = false; |
|||
|
|||
Boolean checkStopFlag() { |
|||
if (stopFlag) { |
|||
stopFlag = false; |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
void resetStopFlag() { |
|||
stopFlag = false; |
|||
} |
|||
|
|||
void setStopFlag() { |
|||
stopFlag = true; |
|||
} |
|||
|
|||
|
|||
@ExtApiFn(name = "获取所有坐标", group = "基础", order = 1) |
|||
public Object getPoss() throws AppException { |
|||
return hbotConsumablePosMgr.getParams(); |
|||
} |
|||
|
|||
|
|||
// 测试工具 |
|||
@ExtApiFn(name = "归零", group = "测试工具", order = 11) |
|||
public void moveToZero() throws AppException { |
|||
enableModule(); |
|||
pipetteCtrlModule.zMotorMoveZeroBlock(); |
|||
hbotModule.moveToZeroBlock(); |
|||
} |
|||
|
|||
@ExtApiFn(name = "使能相关模块", group = "测试工具", order = 12) |
|||
public void enableModule() throws AppException { |
|||
pipetteCtrlModule.zMotorEnable(1); |
|||
hbotModule.enable(1); |
|||
} |
|||
|
|||
@ExtApiFn(name = "失能相关模块", group = "测试工具", order = 13) |
|||
public void disableModule() throws AppException { |
|||
pipetteCtrlModule.zMotorEnable(0); |
|||
hbotModule.enable(0); |
|||
} |
|||
|
|||
|
|||
LittleBottleConsumableType littleBottleConsumableType = LittleBottleConsumableType.BufferSolution; |
|||
List<LittleBottleConsumableRefPoint> littleBottleConsumableRefPoint; |
|||
LittleBottleConsumablePosInfo littleBottleConsumablePosInfo; |
|||
|
|||
|
|||
@ExtApiFn(name = "开始标定小瓶坐标", group = "标定小瓶坐标", order = 30) |
|||
public void startCalibrateLittleBottleGroup(LittleBottleConsumableType type) throws AppException { |
|||
littleBottleConsumablePosInfo = null; |
|||
littleBottleConsumableRefPoint = new java.util.ArrayList<>(); |
|||
littleBottleConsumableType = type; |
|||
moveToZero(); |
|||
disableModule(); |
|||
} |
|||
|
|||
@ExtApiFn(name = "添加小瓶参考点", group = "标定小瓶坐标", order = 31) |
|||
public Object addLittleBottleGroupRefPoint(ConsumableGroup group, Integer off0To24) throws AppException { |
|||
enableModule(); |
|||
Pos2d xypos = hbotModule.readPos(); |
|||
pipetteCtrlModule.zMotorMeasureDistance(); |
|||
Integer z = pipetteCtrlModule.zMotorReadMeasureDistanceResult(); |
|||
LittleBottleConsumableRefPoint littleBufferRefPoint = new LittleBottleConsumableRefPoint(group, off0To24, new Pos3d(xypos.x, xypos.y, z)); |
|||
this.littleBottleConsumableRefPoint.add(littleBufferRefPoint); |
|||
disableModule(); |
|||
return computeLittleBottlePosInfo(); |
|||
} |
|||
|
|||
@ExtApiFn(name = "删除上一个小瓶参考点", group = "标定小瓶坐标", order = 32) |
|||
public LittleBottleConsumablePosInfo computeLittleBottlePosInfo() { |
|||
//计算y0,所有group==0,1,2,同时0<=off<5的点,求平均 |
|||
Double[] y = new Double[2]; |
|||
Double[] x = new Double[3]; |
|||
Double[] dxs = new Double[6]; |
|||
Double[] dys = new Double[6]; |
|||
Double dx; |
|||
Double dy; |
|||
Double z; |
|||
|
|||
y[0] = ZSimplAlgo.computeAverage( |
|||
littleBottleConsumableRefPoint.stream().filter(point -> point.group.ordinal() < 3 && point.index < 5). |
|||
map(point -> point.pos.y).toList() |
|||
); |
|||
//计算y1,所有group==3,4,5,同时0<=off<5的点,求平均 |
|||
y[1] = ZSimplAlgo.computeAverage( |
|||
littleBottleConsumableRefPoint.stream().filter(point -> point.group.ordinal() >= 3 && point.index < 5). |
|||
map(point -> point.pos.y).toList() |
|||
); |
|||
|
|||
//计算y0,所有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() |
|||
); |
|||
//计算y1,所有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() |
|||
); |
|||
//计算y2 |
|||
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() |
|||
); |
|||
//计算d0x,所有 非0,5,10,15,20的点,到x0的距离/偏移差值,求平均 |
|||
for (int i = 0; i < 6; i++) { |
|||
int finalI = i; |
|||
dxs[i] = ZSimplAlgo.computeAverage( |
|||
littleBottleConsumableRefPoint.stream().filter(point -> point.group.ordinal() == finalI && point.getColOff() != 0). |
|||
map(point -> point.pos.x - x[finalI % 3] / (point.getColOff())).toList() |
|||
); |
|||
} |
|||
dx = ZSimplAlgo.computeAverage(dxs); |
|||
//计算dy, |
|||
for (int i = 0; i < 6; i++) { |
|||
int finalI = i; |
|||
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() |
|||
); |
|||
} |
|||
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.dx = dx; |
|||
littleBottleConsumablePosInfo.dy = dy; |
|||
return littleBottleConsumablePosInfo; |
|||
} |
|||
|
|||
@ExtApiFn(name = "保存小瓶坐标", group = "标定小瓶坐标", order = 33) |
|||
public void saveLittleBottleConsumablePosInfo() throws AppException { |
|||
hbotConsumablePosMgr.setLittleBottleConsumablePosInfo(littleBottleConsumableType, littleBottleConsumablePosInfo); |
|||
} |
|||
|
|||
// |
|||
// 校验 |
|||
// |
|||
|
|||
@ExtApiFn(name = "校验小瓶缓冲液坐标", group = "校验", order = 301) |
|||
public void testMoveToLittleBufferPos() 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; |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
@ExtApiFn(name = "校验探测物质坐标", group = "校验", order = 302) |
|||
public void testMoveToProbeSubstancePos() 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; |
|||
} |
|||
} |
|||
} |
|||
|
|||
// @ExtApiFn(name = "校验大瓶缓冲液坐标", group = "校验", order = 303) |
|||
// public void testMoveToLargeBufferPos() throws AppException { |
|||
// resetStopFlag(); |
|||
// enableModule(); |
|||
// for (ConsumableGroup group : ConsumableGroup.values()) { |
|||
// hbotControler.moveToLargeBufferPos(group); |
|||
// if (checkStopFlag()) |
|||
// return; |
|||
// } |
|||
// } |
|||
|
|||
@ExtApiFn(name = "停止校验", group = "校验", order = 304) |
|||
public void stopTest() throws AppException { |
|||
setStopFlag(); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package a8k.type; |
|||
|
|||
import a8k.type.cfg.Pos3d; |
|||
|
|||
public class LittleBottleConsumablePosInfo { |
|||
public Pos3d g0_000; |
|||
public Pos3d g1_000; |
|||
public Pos3d g2_000; |
|||
public Pos3d g3_000; |
|||
public Pos3d g4_000; |
|||
public Pos3d g5_000; |
|||
public Double dx; |
|||
public Double dy; |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package a8k.type; |
|||
|
|||
import a8k.constant.AppConstant; |
|||
import a8k.type.cfg.Pos3d; |
|||
|
|||
public class LittleBottleConsumableRefPoint { |
|||
public ConsumableGroup group; |
|||
public Integer index;//from zero |
|||
|
|||
public Pos3d pos; |
|||
|
|||
public LittleBottleConsumableRefPoint(ConsumableGroup group, Integer index, Pos3d pos) { |
|||
this.group = group; |
|||
this.index = index; |
|||
this.pos = pos; |
|||
} |
|||
|
|||
public Integer getRowOff() { |
|||
return index / AppConstant.CONSUMABLE_COL_NUM; |
|||
} |
|||
|
|||
public Integer getColOff() { |
|||
return index % AppConstant.CONSUMABLE_COL_NUM; |
|||
} |
|||
} |
@ -0,0 +1,6 @@ |
|||
package a8k.type; |
|||
|
|||
public enum LittleBottleConsumableType { |
|||
BufferSolution, //缓冲液 |
|||
ProbeSubstance, //探测物质 |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue