Browse Source

update

tags/v0
zhaohe 9 months ago
parent
commit
29916fa790
  1. 6
      src/main/java/a8k/service/app/devicectrl/ctrlservice/HbotCtrlService.java
  2. 180
      src/main/java/a8k/service/app/devicectrl/param/calibration/HbotLargeBottleBSPosCalibration.java
  3. 9
      src/main/java/a8k/service/app/devicectrl/param/calibration/HbotLittleBSPosCalibration.java
  4. 5
      src/main/java/a8k/service/app/devicectrl/param/calibration/HbotProbeSubstancePosCalibration.java
  5. 25
      src/main/java/a8k/service/app/devicectrl/param/param_mgr/HbotLargeBottleBSPosMgr.java
  6. BIN
      src/main/resources/app.db

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

@ -128,6 +128,12 @@ public class HbotCtrlService {
hbotBaseMoveExDriver.hbotMoveTo(toPos);
}
public void moveToLargeBufferPosEnd(ConsumableGroup group) throws AppException {
Pos3d toPos = hbotConsumableParamMgr.getLargeBufferSamplePosEnd(group);
hbotBaseMoveExDriver.hbotMoveTo(toPos);
}
public void moveToSamplePos(HbotSamplePos pos) throws AppException {
hbotBaseMoveExDriver.hbotMoveTo(hbotSamplePosParamMgr.getSamplePos(pos));
}

180
src/main/java/a8k/service/app/devicectrl/param/calibration/HbotLargeBottleBSPosCalibration.java

@ -31,7 +31,7 @@ public class HbotLargeBottleBSPosCalibration {
static Logger logger = org.slf4j.LoggerFactory.getLogger(HbotLargeBottleBSPosCalibration.class);
@Resource
PipetteCtrlDriver pipetteCtrlDriver;
PipetteCtrlDriver pipetteCtrlDriver;
@Resource
HbotDriver hbotDriver;
@Resource
@ -88,96 +88,137 @@ public class HbotLargeBottleBSPosCalibration {
}
List<LargeBottleConsumableRefPoint> refpoints = new java.util.ArrayList<>();
@ExtApiFn(name = "开始标定大瓶坐标", group = "标定大瓶缓液XY坐标", order = 30)
public void startCalibrate() throws AppException {
refpoints = new java.util.ArrayList<>();
moveToZero();
disableModule();
}
@ExtApiFn(name = "添加大瓶参考点", group = "标定大瓶缓液XY坐标", order = 31)
public Object addRefPoint(ConsumableGroup group) throws AppException {
// List<LargeBottleConsumableRefPoint> refpoints = new java.util.ArrayList<>();
//
//
// @ExtApiFn(name = "开始标定大瓶坐标", group = "标定大瓶缓液XY坐标", order = 30)
// public void startCalibrate() throws AppException {
// refpoints = new java.util.ArrayList<>();
// moveToZero();
// disableModule();
// }
//
// @ExtApiFn(name = "添加大瓶参考点", group = "标定大瓶缓液XY坐标", order = 31)
// public Object addRefPoint(ConsumableGroup group) throws AppException {
// enableModule();
// Pos2d xypos = hbotDriver.readPos();
// // pipetteCtrlModule.zMotorMeasureDistance();
// // Integer z = pipetteCtrlModule.zMotorReadMeasureDistanceResult();
// LargeBottleConsumableRefPoint refPoints = new LargeBottleConsumableRefPoint(group, new Pos3d(xypos.x, xypos.y, 0));
// this.refpoints.add(refPoints);
// disableModule();
// ObjectNode node = ZJsonHelper.createObjectNode();
// node.put("newPoint", ZJsonHelper.createObjectNode(refPoints));
// node.put("computeResult", ZJsonHelper.createObjectNode(computeLittleBottlePosInfo()));
// return node;
// }
//
// @ExtApiFn(name = "移除最后一个参考点", group = "标定大瓶缓液XY坐标", order = 32)
// public void removeTheLastRefPoint() {
// if (!refpoints.isEmpty()) {
// refpoints.remove(refpoints.size() - 1);
// }
// }
//
//
// @ExtApiFn(name = "读取坐标计算结果", group = "标定大瓶缓液XY坐标", order = 33)
// public LargeBottoleConsumablePosInfo computeLittleBottlePosInfo() {
// //第一排x求平均
// // x[0] = ZSimplAlgo.computeAverage(
// // littleBottleConsumableRefPoint.stream().filter(point -> point.group.ordinal() % 3 == 0 && point.index % 5 == 0).
// // map(point -> point.pos.x).toList()
// // );
//
// var p00 = refpoints.stream().filter(point -> point.group == ConsumableGroup.GROUP0).findFirst().orElse(null);
// Double x, y, dx = null, dy = null;
//
// x = ZSimplAlgo.computeAverage(
// refpoints.stream().filter(point -> point.group.ordinal() / 3 == 0).
// map(point -> point.pos.x).toList());
// //第一列y求平均
// y = ZSimplAlgo.computeAverage(
// refpoints.stream().filter(point -> point.group.ordinal() % 3 == 0).
// map(point -> point.pos.y).toList());
// //除了第一列的所有点减少x,相加求平均
// if (p00 != null) {
// dx = ZSimplAlgo.computeAverage(
// refpoints.stream().filter(point -> point.getCol() != 0).
// map(point -> (point.pos.x - p00.pos.x) * 1.0 / point.getCol()).toList());
// //除了第一排的所有点减少y,相加求平均
// dy = ZSimplAlgo.computeAverage(
// refpoints.stream().filter(point -> point.getRow() != 0).
// map(point -> (point.pos.y - p00.pos.y) * 1.0 / point.getRow()).toList());
// }
//
// return new LargeBottoleConsumablePosInfo(new Pos3d(x.intValue(), y.intValue(), 0), dx, dy);
// }
//
// @ExtApiFn(name = "保存计算结果", group = "标定大瓶缓液XY坐标", order = 34)
// public void savePosInfo() throws AppException {
// posMgr.setLargeBufferGroupPosInfo(computeLittleBottlePosInfo());
// }
//
// @ExtApiFn(name = "读取所有参考点", group = "标定大瓶缓液XY坐标", order = 35)
// public Object readAllRefPoint() throws AppException {
// return refpoints;
// }
@ExtApiFn(name = "标定1号耗材坐标", group = "标定耗材1号坐标", order = 30)
public Pos2d calibrationPos1() throws AppException {
enableModule();
Pos2d xypos = hbotDriver.readPos();
// pipetteCtrlModule.zMotorMeasureDistance();
// Integer z = pipetteCtrlModule.zMotorReadMeasureDistanceResult();
LargeBottleConsumableRefPoint refPoints = new LargeBottleConsumableRefPoint(group, new Pos3d(xypos.x, xypos.y, 0));
this.refpoints.add(refPoints);
disableModule();
ObjectNode node = ZJsonHelper.createObjectNode();
node.put("newPoint", ZJsonHelper.createObjectNode(refPoints));
node.put("computeResult", ZJsonHelper.createObjectNode(computeLittleBottlePosInfo()));
return node;
posMgr.setPos0(xypos);
return xypos;
}
@ExtApiFn(name = "移除最后一个参考点", group = "标定大瓶缓液XY坐标", order = 32)
public void removeTheLastRefPoint() {
if (!refpoints.isEmpty()) {
refpoints.remove(refpoints.size() - 1);
}
}
Pos2d pos01;
Pos2d pos06;
@ExtApiFn(name = "读取坐标计算结果", group = "标定大瓶缓液XY坐标", order = 33)
public LargeBottoleConsumablePosInfo computeLittleBottlePosInfo() {
//第一排x求平均
// x[0] = ZSimplAlgo.computeAverage(
// littleBottleConsumableRefPoint.stream().filter(point -> point.group.ordinal() % 3 == 0 && point.index % 5 == 0).
// map(point -> point.pos.x).toList()
// );
var p00 = refpoints.stream().filter(point -> point.group == ConsumableGroup.GROUP0).findFirst().orElse(null);
Double x, y, dx = null, dy = null;
x = ZSimplAlgo.computeAverage(
refpoints.stream().filter(point -> point.group.ordinal() / 3 == 0).
map(point -> point.pos.x).toList());
//第一列y求平均
y = ZSimplAlgo.computeAverage(
refpoints.stream().filter(point -> point.group.ordinal() % 3 == 0).
map(point -> point.pos.y).toList());
//除了第一列的所有点减少x,相加求平均
if (p00 != null) {
dx = ZSimplAlgo.computeAverage(
refpoints.stream().filter(point -> point.getCol() != 0).
map(point -> (point.pos.x - p00.pos.x) * 1.0 / point.getCol()).toList());
//除了第一排的所有点减少y,相加求平均
dy = ZSimplAlgo.computeAverage(
refpoints.stream().filter(point -> point.getRow() != 0).
map(point -> (point.pos.y - p00.pos.y) * 1.0 / point.getRow()).toList());
}
@ExtApiFn(name = "步骤1.测量1号坐标", group = "标定Dy和Dy", order = 31)
public Pos2d measurePos01() throws AppException {
enableModule();
pos01 = hbotDriver.readPos();
disableModule();
return pos01;
}
return new LargeBottoleConsumablePosInfo(new Pos3d(x.intValue(), y.intValue(), 0), dx, dy);
@ExtApiFn(name = "步骤2.测量6号坐标", group = "标定Dy和Dy", order = 32)
public Pos2d measurePos25() throws AppException {
enableModule();
pos06 = hbotDriver.readPos();
disableModule();
return pos06;
}
@ExtApiFn(name = "保存计算结果", group = "标定大瓶缓液XY坐标", order = 34)
public void savePosInfo() throws AppException {
posMgr.setLargeBufferGroupPosInfo(computeLittleBottlePosInfo());
@ExtApiFn(name = "步骤3.计算Dx和Dy", group = "标定Dy和Dy", order = 33)
public Object computeDxAndDy() throws AppException {
ObjectNode node = ZJsonHelper.createObjectNode();
node.put("dx", (pos06.x - pos01.x) / 2.0);
node.put("dy", (pos06.y - pos01.y));
return node;
}
@ExtApiFn(name = "读取所有参考点", group = "标定大瓶缓液XY坐标", order = 35)
public Object readAllRefPoint() throws AppException {
return refpoints;
@ExtApiFn(name = "步骤4.设置Dx和Dy", group = "标定Dy和Dy", order = 34)
public void setDxAndDy(Double dx, Double dy) throws AppException {
posMgr.setDxAndDy(dx, dy);
}
//
// 标定Z轴
//
public void setZPos(HbotLargeBottleBSPos posName) throws AppException {
public void setZPos(HbotLargeBottleBSPos posName, Integer off) throws AppException {
enableModule();
pipetteCtrlDriver.zMotorMeasureDistance();
posMgr.setParam(posName, pipetteCtrlDriver.zMotorReadMeasureDistanceResult());
posMgr.setParam(posName, pipetteCtrlDriver.zMotorReadMeasureDistanceResult() + off);
disableModule();
}
@ExtApiFn(name = "校准.大瓶缓冲液Z轴位置", group = "标定Z轴", order = 104)
public void setLargeBSSSampleZPos() throws AppException {setZPos(HbotLargeBottleBSPos.LargeBSSSampleZPos);}
public void setLargeBSSSampleZPos() throws AppException {setZPos(HbotLargeBottleBSPos.LargeBSSSampleZPos, 0);}
@ExtApiFn(name = "校准.大瓶缓冲液Z轴结束位置", group = "标定Z轴", order = 105)
public void setLargeBSSSampleEndZPos() throws AppException {setZPos(HbotLargeBottleBSPos.LargeBSSSampleEndZPos);}
public void setLargeBSSSampleEndZPos() throws AppException {setZPos(HbotLargeBottleBSPos.LargeBSSSampleEndZPos, -20);}
//
// 校验
@ -187,11 +228,14 @@ public class HbotLargeBottleBSPosCalibration {
public void testMoveToLargeBufferPos() throws AppException {
resetStopFlag();
enableModule();
pipetteCtrlDriver.zMotorMoveZeroBlock();
for (ConsumableGroup group : ConsumableGroup.values()) {
hbotCtrlService.moveToLargeBufferPos(group);
hbotCtrlService.moveToLargeBufferPosEnd(group);
pipetteCtrlDriver.zMotorMoveToZeroPointQuickBlock();
if (checkStopFlag())
return;
break;
}
disableModule();
}
@ExtApiFn(name = "停止校验", group = "校验", order = 304)

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

@ -76,13 +76,13 @@ public class HbotLittleBSPosCalibration {
return hbotLittleBSPosMgr.getParams();
}
// @ExtApiFn(name = "使能相关模块", group = "测试工具", order = 12)
@ExtApiFn(name = "使能相关模块", group = "测试工具", order = 12)
public void enableModule() throws AppException {
pipetteCtrlDriver.zMotorEnable(1);
hbotBaseMoveExDriver.enable(1);
}
// @ExtApiFn(name = "失能相关模块", group = "测试工具", order = 13)
@ExtApiFn(name = "失能相关模块", group = "测试工具", order = 13)
public void disableModule() throws AppException {
pipetteCtrlDriver.zMotorEnable(0);
hbotBaseMoveExDriver.enable(0);
@ -122,8 +122,8 @@ public class HbotLittleBSPosCalibration {
@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);
node.put("dx", (pos25.x - pos01.x) / 4.0);
node.put("dy", (pos25.y - pos01.y) / 4.0);
return node;
}
@ -171,6 +171,7 @@ public class HbotLittleBSPosCalibration {
if (checkStopFlag())
break;
}
pipetteCtrlDriver.zMotorMoveToZeroPointQuickBlock();
disableModule();
}

5
src/main/java/a8k/service/app/devicectrl/param/calibration/HbotProbeSubstancePosCalibration.java

@ -125,8 +125,8 @@ public class HbotProbeSubstancePosCalibration {
@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);
node.put("dx", (pos25.x - pos01.x) / 4.0);
node.put("dy", (pos25.y - pos01.y) / 4.0);
return node;
}
@ -168,6 +168,7 @@ public class HbotProbeSubstancePosCalibration {
if (checkStopFlag())
break;
}
pipetteCtrlDriver.zMotorMoveToZeroPointQuickBlock();
disableModule();
}

25
src/main/java/a8k/service/app/devicectrl/param/param_mgr/HbotLargeBottleBSPosMgr.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.HbotLargeBottleBSPos;
import a8k.type.*;
import a8k.type.cfg.Pos2d;
import a8k.type.cfg.Pos3d;
import jakarta.annotation.PostConstruct;
import org.slf4j.Logger;
@ -27,23 +28,23 @@ public class HbotLargeBottleBSPosMgr extends ParamMgr {
setParam(param.name(), val);
}
public LargeBottoleConsumablePosInfo getLargeBufferGroupPosInfo() {
LargeBottoleConsumablePosInfo info = new LargeBottoleConsumablePosInfo();
info.pos00 = getParam(HbotLargeBottleBSPos.LargeBuffer_0Pos, Pos3d.class);
info.dx = getParam(HbotLargeBottleBSPos.LargeBuffer_DX, Double.class);
info.dy = getParam(HbotLargeBottleBSPos.LargeBuffer_DY, Double.class);
return info;
public void setPos0(Pos2d pos) {
setParam(HbotLargeBottleBSPos.LargeBuffer_0Pos, pos);
}
public void setLargeBufferGroupPosInfo(LargeBottoleConsumablePosInfo info) {
setParam(HbotLargeBottleBSPos.LargeBuffer_0Pos, info.pos00);
setParam(HbotLargeBottleBSPos.LargeBuffer_DX, info.dx);
setParam(HbotLargeBottleBSPos.LargeBuffer_DY, info.dy);
public void setDxAndDy(double dx, double dy) {
setParam(HbotLargeBottleBSPos.LargeBuffer_DX, dx);
setParam(HbotLargeBottleBSPos.LargeBuffer_DY, dy);
}
// public void setLargeBufferGroupPosInfo(LargeBottoleConsumablePosInfo info) {
// setParam(HbotLargeBottleBSPos.LargeBuffer_0Pos, info.pos00);
// setParam(HbotLargeBottleBSPos.LargeBuffer_DX, info.dx);
// setParam(HbotLargeBottleBSPos.LargeBuffer_DY, info.dy);
// }
public Pos3d getSamplePos(ConsumableGroup group) {
Pos3d pos00 = getParam(HbotLargeBottleBSPos.LargeBuffer_0Pos.name(), Pos3d.class);
Pos2d pos00 = getParam(HbotLargeBottleBSPos.LargeBuffer_0Pos.name(), Pos2d.class);
Double dx = getParam(HbotLargeBottleBSPos.LargeBuffer_DX, Double.class);
Double dy = getParam(HbotLargeBottleBSPos.LargeBuffer_DY, Double.class);

BIN
src/main/resources/app.db

Loading…
Cancel
Save