From 0ea87c2df7e9f42d186556c0b31f8ef03ac925cb Mon Sep 17 00:00:00 2001 From: zhaohe Date: Mon, 29 Jul 2024 16:48:11 +0800 Subject: [PATCH] update --- .../java/a8k/appbean/cfg/BottleGroupsPosInfo.java | 4 +- src/main/java/a8k/appbean/cfg/BottlesPosInfo.java | 12 +-- .../java/a8k/appbean/cfg/LargeBottleBufferPos.java | 12 ++- .../java/a8k/appbean/cfg/Plates2dCodeScanPos.java | 2 + .../java/a8k/appbean/cfg/SmallBottleBufferPos.java | 115 --------------------- src/main/java/a8k/canbus/protocol/A8kPacket.java | 2 +- .../a8k/service/hardware/HbotControlService.java | 41 ++++---- src/main/java/a8k/utils/HbotScanerPosComputer.java | 9 ++ 8 files changed, 46 insertions(+), 151 deletions(-) delete mode 100644 src/main/java/a8k/appbean/cfg/SmallBottleBufferPos.java create mode 100644 src/main/java/a8k/utils/HbotScanerPosComputer.java diff --git a/src/main/java/a8k/appbean/cfg/BottleGroupsPosInfo.java b/src/main/java/a8k/appbean/cfg/BottleGroupsPosInfo.java index 709afd7..0d928b3 100644 --- a/src/main/java/a8k/appbean/cfg/BottleGroupsPosInfo.java +++ b/src/main/java/a8k/appbean/cfg/BottleGroupsPosInfo.java @@ -1,5 +1,7 @@ package a8k.appbean.cfg; +import a8k.utils.HbotScanerPosComputer; + public class BottleGroupsPosInfo { static public Integer cgetMAX_GROUP_COL() {return 2;} @@ -57,7 +59,7 @@ public class BottleGroupsPosInfo { if (topLelf == null) { return null; } - return new Pos2d(topLelf.x + scanCodeRelaPos.x, topLelf.y + scanCodeRelaPos.y); + return HbotScanerPosComputer.getScanPos(new Pos2d(topLelf.x + scanCodeRelaPos.x, topLelf.y + scanCodeRelaPos.y)); } Pos2d cgetSamllBottlePos(Integer group, Integer bottleIndex) { diff --git a/src/main/java/a8k/appbean/cfg/BottlesPosInfo.java b/src/main/java/a8k/appbean/cfg/BottlesPosInfo.java index d966ef4..a81b481 100644 --- a/src/main/java/a8k/appbean/cfg/BottlesPosInfo.java +++ b/src/main/java/a8k/appbean/cfg/BottlesPosInfo.java @@ -8,21 +8,21 @@ public class BottlesPosInfo { static public Integer cgetMAX() {return cgetMAX_COL() * cgetMAX_ROW();} - public Pos2d topLelf; + public Pos2d relaTopLelf; public Integer xSpacing; public Integer ySpacing; public Integer piercedPosZ; public BottlesPosInfo() { - topLelf = new Pos2d(0, 0); + relaTopLelf = new Pos2d(0, 0); xSpacing = 0; ySpacing = 0; piercedPosZ = 0; } - public BottlesPosInfo(Pos2d topLelf, Integer xSpacing, Integer ySpacing, Integer piercedPosZ) { - this.topLelf = topLelf; + public BottlesPosInfo(Pos2d relaTopLelf, Integer xSpacing, Integer ySpacing, Integer piercedPosZ) { + this.relaTopLelf = relaTopLelf; this.xSpacing = xSpacing; this.ySpacing = ySpacing; this.piercedPosZ = piercedPosZ; @@ -32,8 +32,8 @@ public class BottlesPosInfo { Integer row = index / cgetMAX_COL(); Integer col = index % cgetMAX_COL(); - Integer x = topLelf.x + col * xSpacing; - Integer y = topLelf.y + row * ySpacing; + Integer x = relaTopLelf.x + col * xSpacing; + Integer y = relaTopLelf.y + row * ySpacing; return new Pos2d(x + groupPos.x, y + groupPos.y); diff --git a/src/main/java/a8k/appbean/cfg/LargeBottleBufferPos.java b/src/main/java/a8k/appbean/cfg/LargeBottleBufferPos.java index bad79cb..5f84810 100644 --- a/src/main/java/a8k/appbean/cfg/LargeBottleBufferPos.java +++ b/src/main/java/a8k/appbean/cfg/LargeBottleBufferPos.java @@ -1,5 +1,7 @@ package a8k.appbean.cfg; +import a8k.utils.HbotScanerPosComputer; + import java.security.PublicKey; /** @@ -36,11 +38,11 @@ public class LargeBottleBufferPos { sampleZDepth = 0; } - public LargeBottleBufferPos(Pos2d topLelf, Integer xSpacing, Integer ySpacing, Integer scancodeRelaPos, Integer sampleZPos, Integer sampleZDepth) { + public LargeBottleBufferPos(Pos2d topLelf, Integer xSpacing, Integer ySpacing, Integer relaPos, Integer sampleZPos, Integer sampleZDepth) { this.topLelf = topLelf; this.xSpacing = xSpacing; this.ySpacing = ySpacing; - this.scancodeRelaPos = scancodeRelaPos; + this.scancodeRelaPos = 0; this.sampleZPos = sampleZPos; this.sampleZDepth = sampleZDepth; } @@ -56,8 +58,8 @@ public class LargeBottleBufferPos { } public Pos2d cgetScanPos(Integer bottleIndex) { - Integer row = bottleIndex / cgetCOL(); - Integer dy = 0; + int row = bottleIndex / cgetCOL(); + Integer dy = 0; if (row == 0) { dy = -scancodeRelaPos; } else if (row == 1) { @@ -65,6 +67,6 @@ public class LargeBottleBufferPos { } Pos2d bottlePos = cgetBottlePos(bottleIndex); - return new Pos2d(bottlePos.x, bottlePos.y + dy); + return HbotScanerPosComputer.getScanPos(bottlePos); } } diff --git a/src/main/java/a8k/appbean/cfg/Plates2dCodeScanPos.java b/src/main/java/a8k/appbean/cfg/Plates2dCodeScanPos.java index 473db9c..43dfbe5 100644 --- a/src/main/java/a8k/appbean/cfg/Plates2dCodeScanPos.java +++ b/src/main/java/a8k/appbean/cfg/Plates2dCodeScanPos.java @@ -1,5 +1,7 @@ package a8k.appbean.cfg; +import a8k.utils.HbotScanerPosComputer; + /** * 板夹仓扫码信息 */ diff --git a/src/main/java/a8k/appbean/cfg/SmallBottleBufferPos.java b/src/main/java/a8k/appbean/cfg/SmallBottleBufferPos.java deleted file mode 100644 index 7050d16..0000000 --- a/src/main/java/a8k/appbean/cfg/SmallBottleBufferPos.java +++ /dev/null @@ -1,115 +0,0 @@ -package a8k.appbean.cfg; - -public class SmallBottleBufferPos { - - public Pos2d topLelf0;//小孔topf - public Pos2d topLelf1;//大孔topf - - public Integer xSpacing0; //小孔,x间隔 - public Integer ySpacing0; //小孔,y间隔 - - public Integer xSpacing1; //大孔,x间隔 - public Integer ySpacing1; //大孔,y间隔 - - public Integer groupXSpacing; //x间隔 - public Integer groupYSpacing; //y间隔 - - public Integer sampleZPos; //取样开始位置 - public Integer sampleZDepth; //取样深度 - - public Pos2d scanRelaPos;//扫码相对配置 - - public Integer piercedZPos; //刺破高度 - public Integer smallBottleBufDistributeZPos; //小瓶缓冲液吐液高度 - public Integer detectMaterialDistributeZpos; //探测物质吐液高度 - - public Integer cgetMAX_COL() {return 5;} - - public Integer cgetMAX_ROW() {return 5;} - - public Integer cgetBottomNum() {return 5 * 5;} - -// -// public SmallBottleBufferPos() { -// g0TopLelf = new Pos2d(0, 0); -// g1TopLelf = new Pos2d(0, 0); -// g2TopLelf = new Pos2d(0, 0); -// g3TopLelf = new Pos2d(0, 0); -// g4TopLelf = new Pos2d(0, 0); -// g5TopLelf = new Pos2d(0, 0); -// xSpacing = 0; -// ySpacing = 0; -// sampleZPos = 0; -// sampleZDepth = 0; -// scanRelaPos = new Pos2d(0, 0); -// piercedZPos = 0; -// smallBottleBufDistributeZPos = 0; -// detectMaterialDistributeZpos = 0; -// } -// -// public SmallBottleBufferPos(Pos2d g0TopLelf, -// Pos2d g1TopLelf, -// Pos2d g2TopLelf, -// Pos2d g3TopLelf, -// Pos2d g4TopLelf, -// Pos2d g5TopLelf, -// Integer xSpacing, -// Integer ySpacing, -// Integer sampleZPos, -// Integer sampleZDepth, -// Pos2d scanRelaPos, -// Integer piercedZPos, -// Integer smallBottleBufDistributeZPos, -// Integer detectMaterialDistributeZpos) { -// -// this.g0TopLelf = g0TopLelf; -// this.g1TopLelf = g1TopLelf; -// this.g2TopLelf = g2TopLelf; -// this.g3TopLelf = g3TopLelf; -// this.g4TopLelf = g4TopLelf; -// this.g5TopLelf = g5TopLelf; -// this.xSpacing = xSpacing; -// this.ySpacing = ySpacing; -// this.sampleZPos = sampleZPos; -// this.sampleZDepth = sampleZDepth; -// this.scanRelaPos = scanRelaPos; -// this.piercedZPos = piercedZPos; -// this.smallBottleBufDistributeZPos = smallBottleBufDistributeZPos; -// this.detectMaterialDistributeZpos = detectMaterialDistributeZpos; -// } -// -// Pos2d cgetTopLelf(Integer group) { -// return switch (group) { -// case 0 -> g0TopLelf; -// case 1 -> g1TopLelf; -// case 2 -> g2TopLelf; -// case 3 -> g3TopLelf; -// case 4 -> g4TopLelf; -// case 5 -> g5TopLelf; -// default -> null; -// }; -// } -// -// public Pos2d cgetScanPos(Integer group) { -// Pos2d topLelf = cgetTopLelf(group); -// if (topLelf == null) { -// return null; -// } -// return new Pos2d(topLelf.x + scanRelaPos.x, topLelf.y + scanRelaPos.y); -// } -// -// Pos2d cgetBottlePos(Integer group, Integer bottleIndex) { -// Pos2d topLelf = cgetTopLelf(group); -// assert topLelf != null; -// int col = bottleIndex % 5; -// int row = bottleIndex / 5; -// return new Pos2d(topLelf.x + col * xSpacing, topLelf.y + row * ySpacing); -// } -// -// Pos3d cgetBottlePiercedPos(Integer group, Integer bottleIndex) { -// Pos2d bottlePos = cgetBottlePos(group, bottleIndex); -// return new Pos3d(bottlePos.x, bottlePos.y, piercedZPos); -// } -// - -} diff --git a/src/main/java/a8k/canbus/protocol/A8kPacket.java b/src/main/java/a8k/canbus/protocol/A8kPacket.java index 2b5bd84..6c043c9 100644 --- a/src/main/java/a8k/canbus/protocol/A8kPacket.java +++ b/src/main/java/a8k/canbus/protocol/A8kPacket.java @@ -88,7 +88,7 @@ public class A8kPacket { if (cmdId.equals(CmdId.module_get_reg) || cmdId.equals(CmdId.module_set_reg)) { RegIndex regIndex = RegIndex.valueOf(getContentI32(0)); if (regIndex != null) { - ret = String.format("[CMD ] index:[%d] %s %s(%d) %d", getPacketIndex(), cmdId, regIndex, regIndex.index, getContentI32(1)); + ret = String.format("[CMD ] index:[%d] %s %s %s(%d) %d", getPacketIndex(), cmdId, MId.valueOf(getModuleId()),regIndex, regIndex.index, getContentI32(1)); } else { ret = String.format("[CMD ] index:[%d] %s unkown_index(%d) %d", getPacketIndex(), cmdId, getContentI32(0), getContentI32(1)); } diff --git a/src/main/java/a8k/service/hardware/HbotControlService.java b/src/main/java/a8k/service/hardware/HbotControlService.java index 846dae7..6f1a9a7 100644 --- a/src/main/java/a8k/service/hardware/HbotControlService.java +++ b/src/main/java/a8k/service/hardware/HbotControlService.java @@ -100,25 +100,24 @@ public class HbotControlService implements HardwareCtrlModule { )); } - @HardwareServiceParam(name = "缓冲液位置", group = "位置坐标集合") public BottleGroupsPosInfo getBottleBufferPosInfo() { return settingReader.getObject("BottleBufferPosInfo", BottleGroupsPosInfo.class, new BottleGroupsPosInfo( - new Pos2d(0, 0), - 0, - 0, - new Pos2d(0, 0), - new BottlesPosInfo( - new Pos2d(0, 0), - 0, - 0, + new Pos2d(741, 937), + 1230, + 1250, + new Pos2d(577, 1097), + new BottlesPosInfo/*大孔*/( + new Pos2d(175, 175), + 210, + 210, 0 ), - new BottlesPosInfo( - new Pos2d(0, 0), - 0, - 0, + new BottlesPosInfo/*小孔*/( + new Pos2d(220, 220), + 187, + 187, 0 ) )); @@ -138,27 +137,23 @@ public class HbotControlService implements HardwareCtrlModule { public LargeBottleBufferPos getLargeBottleBufferPosInfo() { return settingReader.getObject("LargeBottleBufferPosInfo", LargeBottleBufferPos.class, new LargeBottleBufferPos( - new Pos2d(0, 0), - 0, - 0, + new Pos2d(4583, 1363), + 280, + 280, 0, 0, 0 )); } - @HardwareServiceParam(name = "公共区Y轴限制值", group = "限制值") - public Integer getCommonAreaYLimit() { - return settingReader.getInteger("CommonAreaYLimit", 0); - } - - @HardwareServiceParam(name = "Hbot采样区", group = "限制值") public HbotLimitArea getSampleCollectionArea() { return settingReader.getObject("HbotPublicArea", HbotLimitArea.class, - new HbotLimitArea(0, 0, 601, 3151)); + new HbotLimitArea(0, 3643, 5060, 4074)); } + + // public Integer getGripperZeroYPos() { //之所以这样写,是因为是为了放置两个类之间的循环依赖 return appCxt.getBean(SamplesPreProcessModuleCtrlService.class).getGripperZeroYPos(); diff --git a/src/main/java/a8k/utils/HbotScanerPosComputer.java b/src/main/java/a8k/utils/HbotScanerPosComputer.java new file mode 100644 index 0000000..6fe9293 --- /dev/null +++ b/src/main/java/a8k/utils/HbotScanerPosComputer.java @@ -0,0 +1,9 @@ +package a8k.utils; + +import a8k.appbean.cfg.Pos2d; + +public class HbotScanerPosComputer { + static public Pos2d getScanPos(Pos2d tipPos) { + return new Pos2d(tipPos.x + 359, tipPos.y + 29); + } +}