Browse Source

update

tags/v0
zhaohe 9 months ago
parent
commit
6332c90568
  1. 4
      src/main/java/a8k/service/app/devicectrl/ctrlservice/HbotCtrlService.java
  2. 94
      src/main/java/a8k/service/app/devicectrl/param/calibration/HbotLittleBSPosCalibration.java
  3. 149
      src/main/java/a8k/service/app/devicectrl/param/calibration/HbotTipPosCalibration.java
  4. 8
      src/main/java/a8k/service/app/devicectrl/param/param_mgr/HbotLittleBSPosMgr.java

4
src/main/java/a8k/service/app/devicectrl/ctrlservice/HbotCtrlService.java

@ -111,6 +111,10 @@ public class HbotCtrlService {
hbotBaseMoveExDriver.hbotMoveTo(hbotConsumableParamMgr.getLittleBufferPiercePos(group, off));
}
public void moveToLittleBufferSamplePosEnd(ConsumableGroup group, Integer off) throws AppException {
hbotBaseMoveExDriver.hbotMoveTo(hbotConsumableParamMgr.getLittleBufferSamplePosEnd(group, off));
}
public void moveToProbeSubstanceSamplePos(ConsumableGroup group, Integer off) throws AppException {
hbotBaseMoveExDriver.hbotMoveTo(hbotConsumableParamMgr.getProbeSubstanceSamplePos(group, off));
}

94
src/main/java/a8k/service/app/devicectrl/param/calibration/HbotLittleBSPosCalibration.java

@ -59,81 +59,82 @@ public class HbotLittleBSPosCalibration {
}
@ExtApiFn(name = "获取坐标", group = "基础", order = 1)
public Object getPoss() throws AppException {
return hbotLittleBSPosMgr.getParams();
}
// 测试工具
@ExtApiFn(name = "归零", group = "测试工具", order = 11)
@ExtApiFn(name = "归零", group = "测试工具", order = 1)
public void moveToZero() throws AppException {
enableModule();
pipetteCtrlDriver.zMotorMoveZeroBlock();
hbotDriver.moveToZeroBlock();
disableModule();
}
@ExtApiFn(name = "使能相关模块", group = "测试工具", order = 12)
@ExtApiFn(name = "获取坐标", group = "测试工具", order = 2)
public Object getPoss() throws AppException {
return hbotLittleBSPosMgr.getParams();
}
// @ExtApiFn(name = "使能相关模块", group = "测试工具", order = 12)
public void enableModule() throws AppException {
pipetteCtrlDriver.zMotorEnable(1);
hbotDriver.enable(1);
}
@ExtApiFn(name = "失能相关模块", group = "测试工具", order = 13)
// @ExtApiFn(name = "失能相关模块", group = "测试工具", order = 13)
public void disableModule() throws AppException {
pipetteCtrlDriver.zMotorEnable(0);
hbotDriver.enable(0);
}
@ExtApiFn(name = "开始标定", group = "标定小瓶XY坐标", order = 30)
public void startCalibrateLittleBottleGroup() throws AppException {
refPoint = new java.util.ArrayList<>();
moveToZero();
//
@ExtApiFn(name = "标定1号耗材坐标", group = "标定耗材0号坐标", order = 30)
public Pos2d calibrationPos00(ConsumableGroup group) throws AppException {
enableModule();
Pos2d xypos = hbotDriver.readPos();
disableModule();
hbotLittleBSPosMgr.setPos00(group, xypos);
return xypos;
}
@ExtApiFn(name = "添加参考点", group = "标定小瓶XY坐标", order = 31)
public Object addLittleBottleGroupRefPoint(ConsumableGroup group, Integer off0To24) throws AppException {
Pos2d pos01;
Pos2d pos25;
@ExtApiFn(name = "步骤1.测量1号坐标", group = "标定Dy和Dy", order = 31)
public Pos2d measurePos01() throws AppException {
enableModule();
Pos2d xypos = hbotDriver.readPos();
LittleBottleConsumableRefPoint littleBufferRefPoint = new LittleBottleConsumableRefPoint(group, off0To24, new Pos3d(xypos.x, xypos.y, 0));
this.refPoint.add(littleBufferRefPoint);
pos01 = hbotDriver.readPos();
disableModule();
ObjectNode node = ZJsonHelper.createObjectNode();
node.put("newPoint", ZJsonHelper.createObjectNode(littleBufferRefPoint));
node.put("computeResult", ZJsonHelper.createObjectNode(computeLittleBottlePosInfo()));
return node;
return pos01;
}
@ExtApiFn(name = "移除最后一个参考点", group = "标定小瓶XY坐标", order = 32)
public void removeTheLastLittleBottleGroupRefPoint() {
if (!refPoint.isEmpty()) {
refPoint.remove(refPoint.size() - 1);
}
@ExtApiFn(name = "步骤2.测量25号坐标", group = "标定Dy和Dy", order = 32)
public Pos2d measurePos25() throws AppException {
enableModule();
pos25 = hbotDriver.readPos();
disableModule();
return pos25;
}
@ExtApiFn(name = "读取坐标计算结果", group = "标定小瓶XY坐标", order = 33)
public LittleBottleConsumablePosInfo computeLittleBottlePosInfo() {
return HbotLittleBSCalibrationAlgo.compute(refPoint);
@ExtApiFn(name = "步骤3.计算Dx和Dy", group = "标定Dy和Dy", order = 33)
public Object computeDxAndDy() throws AppException {
ObjectNode node = ZJsonHelper.createObjectNode();
node.put("dx", (pos25.x - pos01.x) / 4);
node.put("dy", (pos25.y - pos01.y) / 4);
return node;
}
@ExtApiFn(name = "保存计算结果", group = "标定小瓶XY坐标", order = 34)
public void saveLittleBottleConsumablePosInfo() throws AppException {
hbotLittleBSPosMgr.setPosInfo(computeLittleBottlePosInfo());
@ExtApiFn(name = "步骤4.设置Dx和Dy", group = "标定Dy和Dy", order = 34)
public void setDxAndDy(Double dx, Double dy) throws AppException {
hbotLittleBSPosMgr.setParam(HbotLittleBSPos.LittleBufferGroupDX, dx);
hbotLittleBSPosMgr.setParam(HbotLittleBSPos.LittleBufferGroupDY, dy);
}
@ExtApiFn(name = "读取所有参考点", group = "标定小瓶XY坐标", order = 35)
public Object readAllRefPoint() throws AppException {
return refPoint;
}
//
// 标定Z轴
//
public void setZPos(HbotLittleBSPos posName, Integer offset) throws AppException {
public void calibrationZPos(HbotLittleBSPos posName, Integer offset) throws AppException {
enableModule();
pipetteCtrlDriver.zMotorMeasureDistance();
hbotLittleBSPosMgr.setParam(posName, pipetteCtrlDriver.zMotorReadMeasureDistanceResult() + offset);
@ -141,15 +142,16 @@ public class HbotLittleBSPosCalibration {
}
@ExtApiFn(name = "校准.小瓶穿孔Z轴位置", group = "标定Z轴", order = 101)
public void setPierceZPos() throws AppException {setZPos(HbotLittleBSPos.LittleBSPierceZPos, 0);}
public void calibrationPierceZPos() throws AppException {calibrationZPos(HbotLittleBSPos.LittleBSPierceZPos, 0);}
@ExtApiFn(name = "校准.小瓶取样Z轴位置", group = "标定Z轴", order = 102)
public void setSampleZPos() throws AppException {setZPos(HbotLittleBSPos.LittleBSSampleZPos, 0);}
public void calibrationSampleZPos() throws AppException {calibrationZPos(HbotLittleBSPos.LittleBSSampleZPos, 0);}
@ExtApiFn(name = "校准.小瓶缓冲液取样结束Z轴位置", group = "标定Z轴", order = 104)
public void setSampleEndZPos() throws AppException {
public void calibrationSampleEndZPos() throws AppException {
//结束位置比设定位置高1mm的余量
setZPos(HbotLittleBSPos.LittleBSSampleEndZPos, -20);}
calibrationZPos(HbotLittleBSPos.LittleBSSampleEndZPos, -20);
}
//
// 校验
@ -158,10 +160,10 @@ public class HbotLittleBSPosCalibration {
public void testMoveToLittleBufferPos(ConsumableGroup group) throws AppException {
resetStopFlag();
enableModule();
pipetteCtrlDriver.zMotorMoveZeroBlock();
pipetteCtrlDriver.zMotorMoveZeroBlock();
for (int i = 0; i < AppConstant.CONSUMABLE_NUM; i++) {
hbotCtrlService.moveToLittleBufferPiercePos(group, i);
hbotCtrlService.moveToLittleBufferSamplePosEnd(group, i);
pipetteCtrlDriver.zMotorMoveToZeroPointQuickBlock();
if (checkStopFlag())
return;

149
src/main/java/a8k/service/app/devicectrl/param/calibration/HbotTipPosCalibration.java

@ -15,6 +15,7 @@ import a8k.type.*;
import a8k.type.cfg.Pos2d;
import a8k.type.cfg.Pos3d;
import a8k.type.exception.AppException;
import a8k.type.pos.TipPos;
import a8k.type.type.TipGroup;
import a8k.utils.ZJsonHelper;
import a8k.utils.ZSimplAlgo;
@ -66,12 +67,6 @@ public class HbotTipPosCalibration {
}
@ExtApiFn(name = "获取所有坐标", group = "基础", order = 1)
public Object getPoss() throws AppException {
return hbotTipPosMgr.getParams();
}
// 测试工具
@ExtApiFn(name = "归零", group = "测试工具", order = 11)
public void moveToZero() throws AppException {
@ -92,139 +87,65 @@ public class HbotTipPosCalibration {
hbotDriver.enable(0);
}
@ExtApiFn(name = "设置上下文", group = "设置上下文", order = 20)
public void setContext(TipGroup tipGroup) throws AppException {
this.tipGroup = tipGroup;
@ExtApiFn(name = "获取所有坐标", group = "测试工具", order = 14)
public Object getPoss() throws AppException {
return hbotTipPosMgr.getParams();
}
//
// 标定
//
List<TipRefPoint> tipRefPosList;
Pos3d tip000;
Double tipdx;
Double tipdy;
@ExtApiFn(name = "清空参考点", group = "辅助标定", order = 20)
public void startCalibrateTipPos() throws AppException {
Assert.isTrue(tipGroup != null, "请先设置上下文");
tipRefPosList = new java.util.ArrayList<>();
tipdx = 0.0;
tipdy = 0.0;
tip000 = new Pos3d(0, 0, 0);
}
@ExtApiFn(name = "添加Tip参考点", group = "辅助标定", order = 21)
public Object addTipPosRefPoint(TipRowNum row, TipColumnNum columnNum) throws AppException {
@ExtApiFn(name = "测试Tip坐标", group = "测量Tip000坐标", order = 31)
public Pos3d measuringTipPos() throws AppException {
enableModule();
Pos2d xypos = hbotDriver.readPos();
pipetteCtrlDriver.zMotorMeasureDistance();
Integer z = pipetteCtrlDriver.zMotorReadMeasureDistanceResult();
pipetteCtrlDriver.putTipBlock();
TipRefPoint tipRefPoint = new TipRefPoint(row, columnNum, new Pos3d(xypos.x, xypos.y, z));
tipRefPosList.add(tipRefPoint);
var pos = new Pos3d(xypos.x, xypos.y, z);
disableModule();
Map<String, Object> ret = new java.util.HashMap<>();
ret.put("newPoint", tipRefPoint);
ret.put("computeResult", computeTipGroupPos());
return ret;
}
@ExtApiFn(name = "删除上一个Tip参考点", group = "辅助标定", 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;
return pos;
}
Pos3d tip000Pos;
Pos3d tip119Pos;
@ExtApiFn(name = "计算Tip坐标", group = "辅助标定", order = 23)
public ObjectNode computeTipGroupPos() throws AppException {
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);
}
//计算tip01_01_x,取所有第一列tip坐标x的平局值
Double tip01_01_x = ZSimplAlgo.computeAverage(
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.ROW00).
map(tipRefPoint -> Double.valueOf(tipRefPoint.pos.y)).toList()
);
//计算z,取所有tip坐标z的平局值
Double tip01_01_z = ZSimplAlgo.computeAverage(
tipRefPosList.stream().map(tipRefPoint -> Double.valueOf(tipRefPoint.pos.z)).toList()
);
//计算dx,所有点到tip01_01的距离除以行数 之后的平均值
Double dx = ZSimplAlgo.computeAverage(
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.ROW00)).
map(point -> Math.abs(point.pos.y - Double.valueOf(tip_ref_01_01.pos.y)) / point.row.ordinal()).toList()
);
tip01_01_z += 3;
tip000 = new Pos3d(tip01_01_x.intValue(), tip01_01_y.intValue(), tip01_01_z.intValue());
tipdx = dx;
tipdy = dy;
ObjectNode node = new ObjectMapper().createObjectNode();
node.put("tip000", ZJsonHelper.createObjectNode(tip000));
node.put("tipdx", tipdx);
node.put("tipdy", tipdy);
return node;
@ExtApiFn(name = "步骤1.测量Tip000坐标", group = "测量Tip间距", order = 40)
public void measuringTip000Pos() throws AppException {
tip000Pos = measuringTipPos();
}
@ExtApiFn(name = "步骤2.测量Tip119坐标", group = "测量Tip间距", order = 41)
public void measuringTip119Pos() throws AppException {
tip119Pos = measuringTipPos();
}
@ExtApiFn(name = "保存计算结果", group = "辅助标定", order = 24)
public void saveTipGroupPos() throws AppException {
TipPosConfig tipPosConfig = getTipPosConfig();
if (tipdx == null || tipdx.isNaN() || tipdx.isInfinite()) {
tipdx = tipPosConfig.spaceingX;
}
if (tipdy == null || tipdy.isNaN() || tipdy.isInfinite()) {
tipdy = tipPosConfig.spaceingY;
@ExtApiFn(name = "步骤3.计算Tip间距", group = "测量Tip间距", order = 42)
public Object computeDxAndDy() {
if (tip000Pos == null || tip119Pos == null) {
return "请先测量Tip000和Tip119坐标";
}
hbotTipPosMgr.setTipGroupParam(tipGroup, tip000, tipdx, tipdy);
double dx = (tip119Pos.x - tip000Pos.x) / 11.0;
double dy = (tip119Pos.y - tip000Pos.y) / 9.0;
return Map.of("dx", dx, "dy", dy);
}
@ExtApiFn(name = "获取当前Tip组的配置", group = "直接设置坐标", order = 31)
public TipPosConfig getTipPosConfig() {
@ExtApiFn(name = "获取配置", group = "设置", order = 100)
public TipPosConfig getTipPosConfig(TipGroup tipGroup) {
return hbotTipPosMgr.getTipPosCfg(tipGroup);
}
@ExtApiFn(name = "设置Tip000坐标", group = "直接设置坐标", order = 32)
public void setTipPos000(Integer x, Integer y, Integer z) {
tip000 = new Pos3d(x, y, z);
@ExtApiFn(name = "设置Tip000坐标", group = "设置", order = 101)
public void setTipPos000(TipGroup tipGroup, Integer x, Integer y, Integer z) {
var tip000 = new Pos3d(x, y, z);
TipPosConfig poscfg = hbotTipPosMgr.getTipPosCfg(tipGroup);
poscfg.tip000 = tip000;
hbotTipPosMgr.setTipPosCfg(tipGroup, poscfg);
}
@ExtApiFn(name = "设置Tip间距", group = "直接设置坐标", order = 33)
public void setSpacingXAndSpacingY(Double spacingX, Double spacingY) {
@ExtApiFn(name = "设置Tip间距", group = "设置", order = 102)
public void setSpacingXAndSpacingY(TipGroup tipGroup, Double spacingX, Double spacingY) {
TipPosConfig poscfg = hbotTipPosMgr.getTipPosCfg(tipGroup);
poscfg.spaceingX = spacingX;
poscfg.spaceingY = spacingY;
@ -242,10 +163,6 @@ public class HbotTipPosCalibration {
for (int i = 0; i < AppConstant.TIP_NUM; i++) {
hbotCtrlService.testTakeTip(tipGroup, i);
Pos3d tipPos = hbotConsumableParamMgr.getTipPos(tipGroup, i);
TipRefPoint tipRefPoint = new TipRefPoint(TipRowNum.values()[i / 12], TipColumnNum.values()[i % 12], tipPos);
if (tipRefPosList != null)
tipRefPosList.add(tipRefPoint);
if (checkStopFlag())
return;
}
@ -265,10 +182,6 @@ public class HbotTipPosCalibration {
for (Integer i : testPoint) {
hbotCtrlService.testTakeTip(tipGroup, i);
Pos3d tipPos = hbotConsumableParamMgr.getTipPos(tipGroup, i);
TipRefPoint tipRefPoint = new TipRefPoint(TipRowNum.values()[i / 12], TipColumnNum.values()[i % 12], tipPos);
if (tipRefPosList != null)
tipRefPosList.add(tipRefPoint);
if (checkStopFlag())
return;
}

8
src/main/java/a8k/service/app/devicectrl/param/param_mgr/HbotLittleBSPosMgr.java

@ -3,6 +3,7 @@ package a8k.service.app.devicectrl.param.param_mgr;
import a8k.service.app.devicectrl.param.param_mgr.base.ParamMgr;
import a8k.service.app.devicectrl.param.type.HbotLittleBSPos;
import a8k.type.*;
import a8k.type.cfg.Pos2d;
import a8k.type.cfg.Pos3d;
import jakarta.annotation.PostConstruct;
import org.slf4j.Logger;
@ -39,10 +40,15 @@ public class HbotLittleBSPosMgr extends ParamMgr {
setParam(HbotLittleBSPos.LittleBufferGroupDY, info.dy);
}
public void setPos00(ConsumableGroup group, Pos2d pos) {
HbotLittleBSPos param = HbotLittleBSPos.valueOf(HbotLittleBSPos.LittleBufferGroup0_000Pos.ordinal() + group.ordinal());
setParam(param, pos);
}
public Pos3d getPiercePos(ConsumableGroup group, Integer off) {
HbotLittleBSPos param = HbotLittleBSPos.valueOf(HbotLittleBSPos.LittleBufferGroup0_000Pos.ordinal() + group.ordinal());
Pos3d pos00 = getParam(param, Pos3d.class);
Pos2d pos00 = getParam(param, Pos2d.class);
Double dx = getParam(HbotLittleBSPos.LittleBufferGroupDX, Double.class);
Double dy = getParam(HbotLittleBSPos.LittleBufferGroupDY, Double.class);

Loading…
Cancel
Save