diff --git a/app.db b/app.db index f739c7f..e902213 100644 Binary files a/app.db and b/app.db differ diff --git a/src/main/java/a8k/hardware/type/a8kcanprotocol/A8kEcode.java b/src/main/java/a8k/hardware/type/a8kcanprotocol/A8kEcode.java index 5715348..0a494fc 100644 --- a/src/main/java/a8k/hardware/type/a8kcanprotocol/A8kEcode.java +++ b/src/main/java/a8k/hardware/type/a8kcanprotocol/A8kEcode.java @@ -62,6 +62,8 @@ public enum A8kEcode { APPE_CHECK_POINT_CHECK_FAIL(229), //检查点检查失败 + CALIBRATION_TIP_REF_POINT_NOT_ENOUGH(400),//校验TIP参考点不足 + /** * OS错误 */ @@ -74,6 +76,9 @@ public enum A8kEcode { TEST_SCRIP_ERROR_DEVICE_IS_BUSY(901), + //校验流程错误 + + // // LowBoard 底层错误,按照字面意思翻译即可,或者不翻译,直接打印错误英文 // diff --git a/src/main/java/a8k/service/app/devicedriver/basectrl/PipetteCtrlModule.java b/src/main/java/a8k/service/app/devicedriver/basectrl/PipetteCtrlModule.java index d7e0ef2..f432a35 100644 --- a/src/main/java/a8k/service/app/devicedriver/basectrl/PipetteCtrlModule.java +++ b/src/main/java/a8k/service/app/devicedriver/basectrl/PipetteCtrlModule.java @@ -137,8 +137,9 @@ public class PipetteCtrlModule { @ExtApiFn(name = "放置吸头", order = FnOrder.putTipBlock) public void putTipBlock() throws AppException { - canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_put_tip.toInt()); - canBusService.waitForMod(MId.PipetteMod, overtime); +// canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_put_tip.toInt()); +// canBusService.waitForMod(MId.PipetteMod, overtime); + pipetteInitDeviceBlock(); } @ExtApiFn(name = "LLD.准备", order = FnOrder.lldPrepareBlock) diff --git a/src/main/java/a8k/service/app/devicedriver/calibration/HbotConsumablePosCalibration.java b/src/main/java/a8k/service/app/devicedriver/calibration/HbotConsumablePosCalibration.java index 9893251..2d33226 100644 --- a/src/main/java/a8k/service/app/devicedriver/calibration/HbotConsumablePosCalibration.java +++ b/src/main/java/a8k/service/app/devicedriver/calibration/HbotConsumablePosCalibration.java @@ -15,13 +15,13 @@ import a8k.service.app.devicedriver.ctrl.HbotControler; import a8k.service.app.devicedriver.pos.Hbot2DCodeScanPos; import a8k.service.app.devicedriver.pos.HbotConsumablePosMgr; import a8k.service.app.devicedriver.pos.HbotSamplePosMgr; -import a8k.type.ConsumableGroup; -import a8k.type.ConsumableScanRawResult; -import a8k.type.HbotConsumablePos; +import a8k.type.*; import a8k.type.cfg.Pos2d; import a8k.type.cfg.Pos3d; import a8k.type.exception.AppException; import a8k.type.type.TipGroup; +import a8k.utils.ZJsonHelper; +import a8k.utils.ZSimplAlgo; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -32,7 +32,9 @@ import org.slf4j.Logger; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Component; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; @ExtApiTab(cfg = ExtApiTabConfig.HbotConsumablePosCalibration) @Component @@ -76,7 +78,6 @@ public class HbotConsumablePosCalibration { } - // 测试工具 @ExtApiFn(name = "归零", group = "测试工具", order = 11) public void deviceReset() throws AppException { @@ -101,16 +102,97 @@ public class HbotConsumablePosCalibration { // 标定 // - @ExtApiFn(name = "标定HBOT坐标", group = "标定", order = 21) - public void calibratePos(HbotConsumablePos hbotConsumablePos) throws AppException { + TipGroup tipGroup; + List tipRefPosList; + Pos3d tip000 = new Pos3d(0, 0, 0); + Double tipdx; + Double tipdy; + + // TipRefPoint findTipRefPoint(TipRowNum row, TipColumnNum col) { + // for (TipRefPoint tipRefPoint : tipRefPosList) { + // if (tipRefPoint.row == row && tipRefPoint.col == col) { + // return tipRefPoint; + // } + // } + // return null; + // } + + @ExtApiFn(name = "开始标定Tip坐标", group = "标定TIP坐标", order = 20) + public void startCalibrateTipPos(TipGroup tipGroup) { + this.tipGroup = tipGroup; + tipRefPosList = new java.util.ArrayList<>(); + } + + + @ExtApiFn(name = "添加Tip参考点", group = "标定TIP坐标", order = 21) + public void addTipPosRefPoint(TipRowNum row, TipColumnNum columnNum) throws AppException { enableModule(); Pos2d xypos = hbotModule.readPos(); pipetteCtrlModule.zMotorMeasureDistance(); Integer z = pipetteCtrlModule.zMotorReadMeasureDistanceResult(); - hbotConsumablePosMgr.setParam(hbotConsumablePos, new Pos3d(xypos.x, xypos.y, z)); - if (hbotConsumablePos.ordinal() <= HbotConsumablePos.Tip02_119Pos.ordinal()) { - pipetteCtrlModule.putTipBlock(); + pipetteCtrlModule.putTipBlock(); + tipRefPosList.add(new TipRefPoint(row, columnNum, new Pos3d(xypos.x, xypos.y, z))); + disableModule(); + } + + @ExtApiFn(name = "获取Tip参考点", group = "标定TIP坐标", order = 22) + public List getTipRefPosList() { + return tipRefPosList; + } + + @ExtApiFn(name = "计算Tip坐标", group = "标定TIP坐标", order = 23) + public ObjectNode computeTipGroupPos() throws AppException { + TipRefPoint tip_ref_01_01 = tipRefPosList.stream().filter(tipRefPoint -> tipRefPoint.eq(TipRowNum.ROW01, TipColumnNum.Colu01)).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.Colu01). + 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.ROW01). + 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.Colu01)). + 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.ROW01)). + 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 = "保存计算结果", group = "标定TIP坐标", order = 24) + public void saveTipGroupPos() throws AppException { + hbotConsumablePosMgr.setTipGroupParam(tipGroup, tip000, tipdx, tipdy); } @@ -118,17 +200,14 @@ public class HbotConsumablePosCalibration { // 校验 // @ExtApiFn(name = "校验Tip坐标", group = "校验", order = 30) - public void testTakeTip() throws AppException { + public void testTakeTip(TipGroup tipGroup) throws AppException { resetStopFlag(); enableModule(); - for (TipGroup tipGroup : TipGroup.values()) { - for (int i = 0; i < AppConstant.TIP_NUM; i++) { - hbotControler.testTakeTip(tipGroup, i); - if (checkStopFlag()) - return; - } + for (int i = 0; i < AppConstant.TIP_NUM; i++) { + hbotControler.testTakeTip(tipGroup, i); + if (checkStopFlag()) + return; } - } @ExtApiFn(name = "校验小瓶缓冲液坐标", group = "校验", order = 31) diff --git a/src/main/java/a8k/service/app/devicedriver/pos/HbotConsumablePosMgr.java b/src/main/java/a8k/service/app/devicedriver/pos/HbotConsumablePosMgr.java index fd2f161..a815baa 100644 --- a/src/main/java/a8k/service/app/devicedriver/pos/HbotConsumablePosMgr.java +++ b/src/main/java/a8k/service/app/devicedriver/pos/HbotConsumablePosMgr.java @@ -6,14 +6,10 @@ import a8k.extapi_controler.utils.ExtApiTab; import a8k.service.db.LowerDeviceParameterDBService; import a8k.service.db.utils.PosParameterReader; import a8k.type.ConsumableGroup; -import a8k.type.HbotConsumablePos; +import a8k.type.HbotConsumablePosParam; import a8k.type.cfg.Pos3d; import a8k.type.type.TipGroup; -import a8k.utils.PlaneUtils; import a8k.utils.ZJsonHelper; -import a8k.utils.ZSqliteJdbcHelper; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import jakarta.annotation.PostConstruct; import jakarta.annotation.Resource; @@ -22,7 +18,6 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import java.util.List; -import java.util.Map; /** * HBOT二维码扫描坐标参数 @@ -37,7 +32,7 @@ public class HbotConsumablePosMgr { LowerDeviceParameterDBService lowerDeviceParameterDBService; PosParameterReader posReader = null; - static Integer nowParaVersion = 2; + static Integer nowParaVersion = 3; @PostConstruct void initialize() { @@ -52,35 +47,24 @@ public class HbotConsumablePosMgr { logger.info("init param"); posReader.setVersion(nowParaVersion); - posReader.updatePos(HbotConsumablePos.Tip00_000Pos, new Pos3d()); - posReader.updatePos(HbotConsumablePos.Tip00_011Pos, new Pos3d()); - posReader.updatePos(HbotConsumablePos.Tip00_108Pos, new Pos3d()); - posReader.updatePos(HbotConsumablePos.Tip00_119Pos, new Pos3d()); - posReader.updatePos(HbotConsumablePos.Tip01_000Pos, new Pos3d()); - posReader.updatePos(HbotConsumablePos.Tip01_011Pos, new Pos3d()); - posReader.updatePos(HbotConsumablePos.Tip01_108Pos, new Pos3d()); - posReader.updatePos(HbotConsumablePos.Tip01_119Pos, new Pos3d()); - posReader.updatePos(HbotConsumablePos.Tip02_000Pos, new Pos3d()); - posReader.updatePos(HbotConsumablePos.Tip02_011Pos, new Pos3d()); - posReader.updatePos(HbotConsumablePos.Tip02_108Pos, new Pos3d()); - posReader.updatePos(HbotConsumablePos.Tip02_119Pos, new Pos3d()); - posReader.updatePos(HbotConsumablePos.LittleBufferPos00_00, new Pos3d()); - posReader.updatePos(HbotConsumablePos.LittleBufferPos00_24, new Pos3d()); - posReader.updatePos(HbotConsumablePos.LittleBufferPos05_00, new Pos3d()); - posReader.updatePos(HbotConsumablePos.LittleBufferPos05_24, new Pos3d()); - posReader.updatePos(HbotConsumablePos.ProbeSubstance00_00, new Pos3d()); - posReader.updatePos(HbotConsumablePos.ProbeSubstance00_24, new Pos3d()); - posReader.updatePos(HbotConsumablePos.ProbeSubstance05_00, new Pos3d()); - posReader.updatePos(HbotConsumablePos.ProbeSubstance05_24, new Pos3d()); - posReader.updatePos(HbotConsumablePos.LargeBufferPos00, new Pos3d()); - posReader.updatePos(HbotConsumablePos.LargeBufferPos05, new Pos3d()); + posReader.updatePos(HbotConsumablePosParam.TipGroup0_000Pos, new Pos3d()); + posReader.updatePos(HbotConsumablePosParam.TipGroup0_SpaceingX, 0.0); + posReader.updatePos(HbotConsumablePosParam.TipGroup0_SpaceingY, 0.0); + + posReader.updatePos(HbotConsumablePosParam.TipGroup1_000Pos, new Pos3d()); + posReader.updatePos(HbotConsumablePosParam.TipGroup1_SpaceingX, 0.0); + posReader.updatePos(HbotConsumablePosParam.TipGroup2_SpaceingY, 0.0); + + posReader.updatePos(HbotConsumablePosParam.TipGroup2_000Pos, new Pos3d()); + posReader.updatePos(HbotConsumablePosParam.TipGroup2_SpaceingX, 0.0); + posReader.updatePos(HbotConsumablePosParam.TipGroup2_SpaceingY, 0.0); } public List getParams() { List list = new java.util.ArrayList<>(); - for (HbotConsumablePos param : HbotConsumablePos.values()) { + for (HbotConsumablePosParam param : HbotConsumablePosParam.values()) { ObjectNode posNode = ZJsonHelper.createObjectNode(); posNode.put("pos", ZJsonHelper.createObjectNode(posReader.getPos(param.name(), Pos3d.class))); posNode.put("name", param.name()); @@ -91,50 +75,65 @@ public class HbotConsumablePosMgr { } - public void setParam(HbotConsumablePos param, Pos3d pos) { - posReader.updatePos(param.name(), pos); + public void setParam(HbotConsumablePosParam param, Object val) { + posReader.updatePos(param.name(), val); } + public void setTipGroupParam(TipGroup tipGroup, Pos3d tip000, Double dx, Double dy) { + HbotConsumablePosParam tip000Pos = null; + HbotConsumablePosParam tipDxPos = null; + HbotConsumablePosParam tipDyPos = null; + + if (tipGroup == TipGroup.GROUP0) { + tip000Pos = HbotConsumablePosParam.TipGroup0_000Pos; + tipDxPos = HbotConsumablePosParam.TipGroup0_SpaceingX; + tipDyPos = HbotConsumablePosParam.TipGroup0_SpaceingY; + } else if (tipGroup == TipGroup.GROUP1) { + tip000Pos = HbotConsumablePosParam.TipGroup1_000Pos; + tipDxPos = HbotConsumablePosParam.TipGroup1_SpaceingX; + tipDyPos = HbotConsumablePosParam.TipGroup2_SpaceingY; + } else if (tipGroup == TipGroup.GROUP2) { + tip000Pos = HbotConsumablePosParam.TipGroup2_000Pos; + tipDxPos = HbotConsumablePosParam.TipGroup2_SpaceingX; + tipDyPos = HbotConsumablePosParam.TipGroup2_SpaceingY; + } + + assert tip000Pos != null; + + posReader.updatePos(tip000Pos, tip000); + posReader.updatePos(tipDxPos, dx); + posReader.updatePos(tipDyPos, dy); + } public Pos3d getTipPos(TipGroup tipGroup, Integer tipoff) { - Pos3d tip000 = null; - Pos3d tip011 = null; - Pos3d tip108 = null; - Pos3d tip119 = null; + Pos3d tip000 = null; + Double dx = 0.0; + Double dy = 0.0; if (tipGroup == TipGroup.GROUP0) { - tip000 = posReader.getPos(HbotConsumablePos.Tip00_000Pos.name(), Pos3d.class); - tip011 = posReader.getPos(HbotConsumablePos.Tip00_011Pos.name(), Pos3d.class); - tip108 = posReader.getPos(HbotConsumablePos.Tip00_108Pos.name(), Pos3d.class); - tip119 = posReader.getPos(HbotConsumablePos.Tip00_119Pos.name(), Pos3d.class); + tip000 = posReader.getPos(HbotConsumablePosParam.TipGroup0_000Pos, Pos3d.class); + dx = posReader.getPos(HbotConsumablePosParam.TipGroup0_SpaceingX, Double.class); + dy = posReader.getPos(HbotConsumablePosParam.TipGroup0_SpaceingY, Double.class); } else if (tipGroup == TipGroup.GROUP1) { - tip000 = posReader.getPos(HbotConsumablePos.Tip01_000Pos.name(), Pos3d.class); - tip011 = posReader.getPos(HbotConsumablePos.Tip01_011Pos.name(), Pos3d.class); - tip108 = posReader.getPos(HbotConsumablePos.Tip01_108Pos.name(), Pos3d.class); - tip119 = posReader.getPos(HbotConsumablePos.Tip01_119Pos.name(), Pos3d.class); + tip000 = posReader.getPos(HbotConsumablePosParam.TipGroup1_000Pos, Pos3d.class); + dx = posReader.getPos(HbotConsumablePosParam.TipGroup1_SpaceingX, Double.class); + dy = posReader.getPos(HbotConsumablePosParam.TipGroup2_SpaceingY, Double.class); } else if (tipGroup == TipGroup.GROUP2) { - tip000 = posReader.getPos(HbotConsumablePos.Tip02_000Pos.name(), Pos3d.class); - tip011 = posReader.getPos(HbotConsumablePos.Tip02_011Pos.name(), Pos3d.class); - tip108 = posReader.getPos(HbotConsumablePos.Tip02_108Pos.name(), Pos3d.class); - tip119 = posReader.getPos(HbotConsumablePos.Tip02_119Pos.name(), Pos3d.class); + tip000 = posReader.getPos(HbotConsumablePosParam.TipGroup2_000Pos, Pos3d.class); + dx = posReader.getPos(HbotConsumablePosParam.TipGroup2_SpaceingX, Double.class); + dy = posReader.getPos(HbotConsumablePosParam.TipGroup2_SpaceingY, Double.class); } assert tip000 != null; - assert tip011 != null; - assert tip108 != null; - assert tip119 != null; - - //水平方向 - double dx = (tip119.x - tip000.x) / 11.0; - //前后方向 - double dy = (tip119.y - tip000.y) / 9.0; + assert dx != null; + assert dy != null; int xoff = tipoff % 12; int yoff = tipoff / 12; double x = tip000.x + xoff * dx; double y = tip000.y + yoff * dy; - double z = PlaneUtils.calculateZ(tip000, tip011, tip119, x, y); + double z = tip000.z; return new Pos3d((int) x, (int) y, (int) z); } @@ -183,24 +182,24 @@ public class HbotConsumablePosMgr { } public Pos3d getLittleBufferPos(ConsumableGroup group, Integer off) { - Pos3d pos00_00 = posReader.getPos(HbotConsumablePos.LittleBufferPos00_00.name(), Pos3d.class); - Pos3d pos00_24 = posReader.getPos(HbotConsumablePos.LittleBufferPos00_24.name(), Pos3d.class); - Pos3d pos05_00 = posReader.getPos(HbotConsumablePos.LittleBufferPos05_00.name(), Pos3d.class); - Pos3d pos05_24 = posReader.getPos(HbotConsumablePos.LittleBufferPos05_24.name(), Pos3d.class); + Pos3d pos00_00 = posReader.getPos(HbotConsumablePosParam.LittleBufferPos00_00.name(), Pos3d.class); + Pos3d pos00_24 = posReader.getPos(HbotConsumablePosParam.LittleBufferPos00_24.name(), Pos3d.class); + Pos3d pos05_00 = posReader.getPos(HbotConsumablePosParam.LittleBufferPos05_00.name(), Pos3d.class); + Pos3d pos05_24 = posReader.getPos(HbotConsumablePosParam.LittleBufferPos05_24.name(), Pos3d.class); return getLittleBufferOrProbeSubstancePos(pos00_00, pos00_24, pos05_00, pos05_24, group, off); } public Pos3d getProbeSubstancePos(ConsumableGroup group, Integer off) { - Pos3d pos00_00 = posReader.getPos(HbotConsumablePos.ProbeSubstance00_00.name(), Pos3d.class); - Pos3d pos00_24 = posReader.getPos(HbotConsumablePos.ProbeSubstance00_24.name(), Pos3d.class); - Pos3d pos05_00 = posReader.getPos(HbotConsumablePos.ProbeSubstance05_00.name(), Pos3d.class); - Pos3d pos05_24 = posReader.getPos(HbotConsumablePos.ProbeSubstance05_24.name(), Pos3d.class); + Pos3d pos00_00 = posReader.getPos(HbotConsumablePosParam.ProbeSubstance00_00.name(), Pos3d.class); + Pos3d pos00_24 = posReader.getPos(HbotConsumablePosParam.ProbeSubstance00_24.name(), Pos3d.class); + Pos3d pos05_00 = posReader.getPos(HbotConsumablePosParam.ProbeSubstance05_00.name(), Pos3d.class); + Pos3d pos05_24 = posReader.getPos(HbotConsumablePosParam.ProbeSubstance05_24.name(), Pos3d.class); return getLittleBufferOrProbeSubstancePos(pos00_00, pos00_24, pos05_00, pos05_24, group, off); } public Pos3d getLargeBufferPos(ConsumableGroup group) { - Pos3d pos00 = posReader.getPos(HbotConsumablePos.LargeBufferPos00.name(), Pos3d.class); - Pos3d pos05 = posReader.getPos(HbotConsumablePos.LargeBufferPos05.name(), Pos3d.class); + Pos3d pos00 = posReader.getPos(HbotConsumablePosParam.LargeBufferPos00.name(), Pos3d.class); + Pos3d pos05 = posReader.getPos(HbotConsumablePosParam.LargeBufferPos05.name(), Pos3d.class); int xoff = group.off % 3; int yoff = group.off / 3; diff --git a/src/main/java/a8k/type/HbotConsumablePos.java b/src/main/java/a8k/type/HbotConsumablePosParam.java similarity index 50% rename from src/main/java/a8k/type/HbotConsumablePos.java rename to src/main/java/a8k/type/HbotConsumablePosParam.java index 04a0602..226a2fa 100644 --- a/src/main/java/a8k/type/HbotConsumablePos.java +++ b/src/main/java/a8k/type/HbotConsumablePosParam.java @@ -1,21 +1,6 @@ package a8k.type; -public enum HbotConsumablePos { - Tip00_000Pos("第0组TIP的第0个位置"), - Tip00_011Pos("第0组TIP的第11个位置"), - Tip00_108Pos("第0组TIP的第108个位置"), - Tip00_119Pos("第0组TIP的第119个位置"), - - Tip01_000Pos("第1组TIP的第0个位置"), - Tip01_011Pos("第1组TIP的第11个位置"), - Tip01_108Pos("第1组TIP的第108个位置"), - Tip01_119Pos("第1组TIP的第119个位置"), - - Tip02_000Pos("第2组TIP的第0个位置"), - Tip02_011Pos("第2组TIP的第11个位置"), - Tip02_108Pos("第2组TIP的第108个位置"), - Tip02_119Pos("第2组TIP的第119个位置"), - +public enum HbotConsumablePosParam { LittleBufferPos00_00("第0组小瓶的第0个位置"), LittleBufferPos00_24("第0组小瓶的第24个位置"), LittleBufferPos05_00("第5组小瓶的第0个位置"), @@ -29,10 +14,22 @@ public enum HbotConsumablePos { LargeBufferPos00("左上角大瓶位置"), LargeBufferPos05("右下角大瓶位置"), + + TipGroup0_000Pos("第1组TIP的第1个位置"), + TipGroup0_SpaceingX("第1组TIP的X间距"), + TipGroup0_SpaceingY("第1组TIP的Y间距"), + + TipGroup1_000Pos("第2组TIP的第1个位置"), + TipGroup1_SpaceingX("第2组TIP的X间距"), + TipGroup1_SpaceingY("第2组TIP的Y间距"), + + TipGroup2_000Pos("第3组TIP的第1个位置"), + TipGroup2_SpaceingX("第3组TIP的X间距"), + TipGroup2_SpaceingY("第3组TIP的Y间距"), ; final public String chName; - HbotConsumablePos(String chName) { + HbotConsumablePosParam(String chName) { this.chName = chName; } } diff --git a/src/main/java/a8k/type/TipColumnNum.java b/src/main/java/a8k/type/TipColumnNum.java new file mode 100644 index 0000000..592b0e8 --- /dev/null +++ b/src/main/java/a8k/type/TipColumnNum.java @@ -0,0 +1,16 @@ +package a8k.type; + +public enum TipColumnNum { + Colu01, + Colu02, + Colu03, + Colu04, + Colu05, + Colu06, + Colu07, + Colu08, + Colu09, + Colu10, + Colu11, + Colu12, +} diff --git a/src/main/java/a8k/type/TipRefPoint.java b/src/main/java/a8k/type/TipRefPoint.java new file mode 100644 index 0000000..59ac0a4 --- /dev/null +++ b/src/main/java/a8k/type/TipRefPoint.java @@ -0,0 +1,23 @@ +package a8k.type; + +import a8k.type.cfg.Pos3d; + +public class TipRefPoint { + public TipRowNum row; // 行 + public TipColumnNum col; // 列 + public Pos3d pos; + + public TipRefPoint(TipRowNum rowNum, TipColumnNum colNum, Pos3d pos) { + this.row = rowNum; + this.col = colNum; + this.pos = pos; + } + + public Boolean eq(TipRowNum row, TipColumnNum col) { + return this.row == row && this.col == col; + } + + public Boolean neq(TipRowNum row, TipColumnNum col) { + return this.row != row || this.col != col; + } +} diff --git a/src/main/java/a8k/type/TipRowNum.java b/src/main/java/a8k/type/TipRowNum.java new file mode 100644 index 0000000..6f1efea --- /dev/null +++ b/src/main/java/a8k/type/TipRowNum.java @@ -0,0 +1,14 @@ +package a8k.type; + +public enum TipRowNum { + ROW01, + ROW02, + ROW03, + ROW04, + ROW05, + ROW06, + ROW07, + ROW08, + ROW09, + ROW10, +} diff --git a/src/main/java/a8k/utils/ZSimplAlgo.java b/src/main/java/a8k/utils/ZSimplAlgo.java new file mode 100644 index 0000000..8843e1e --- /dev/null +++ b/src/main/java/a8k/utils/ZSimplAlgo.java @@ -0,0 +1,21 @@ +package a8k.utils; + +import java.util.List; + +public class ZSimplAlgo { + public static Double computeAverage(List data) { + Double sum = 0.0; + for (Double datum : data) { + sum += datum; + } + return sum / data.size(); + } + + public static Double computeAverage(Double[] data) { + Double sum = 0.0; + for (Double datum : data) { + sum += datum; + } + return sum / data.length; + } +}