diff --git a/src/main/java/a8k/appbean/cfg/LargeBottleBufferPos.java b/src/main/java/a8k/appbean/cfg/LargeBottleBufferPos.java index 68c945b..86a2311 100644 --- a/src/main/java/a8k/appbean/cfg/LargeBottleBufferPos.java +++ b/src/main/java/a8k/appbean/cfg/LargeBottleBufferPos.java @@ -8,12 +8,15 @@ import java.security.PublicKey; * 大瓶缓冲液位置信息 */ public class LargeBottleBufferPos { - public Pos2d topLelf; + public Pos2d topLelf = new Pos2d(0, 0); - public Integer xSpacing; //x间隔 - public Integer ySpacing; //y间隔 + public Pos2d hole0 = new Pos2d(0, 0); + public Integer holeXSpacing = 0; //x间隔 + public Integer holeYSpacing = 0; //y间隔 - public Integer scancodeRelaPos; //扫码相对每个大屏缓冲液的位置,第一排 -dy,第二排dy + public Pos2d scan0 = new Pos2d(0, 0); + public Integer scanPosXSpacing = 0; //扫码位置x间隔 + public Integer scanPosYSpacing = 0; //扫码位置y间隔 public Integer cgetCOL() { @@ -29,39 +32,36 @@ public class LargeBottleBufferPos { } public LargeBottleBufferPos() { - topLelf = new Pos2d(0, 0); - xSpacing = 0; - ySpacing = 0; - scancodeRelaPos = 0; } - public LargeBottleBufferPos(Pos2d topLelf, Integer xSpacing, Integer ySpacing, Integer scancodeRelaPos) { + public LargeBottleBufferPos(Pos2d topLelf, Pos2d hole0, Integer holeXSpacing, Integer holeYSpacing, Pos2d scan0, Integer scanPosXSpacing, Integer scanPosYSpacing) { this.topLelf = topLelf; - this.xSpacing = xSpacing; - this.ySpacing = ySpacing; - this.scancodeRelaPos = scancodeRelaPos; + this.holeXSpacing = holeXSpacing; + this.holeYSpacing = holeYSpacing; + this.scanPosXSpacing = scanPosXSpacing; + this.scanPosYSpacing = scanPosYSpacing; + this.hole0 = hole0; + this.scan0 = scan0; } public Pos2d cgetBottlePos(Integer bottleIndex) { Integer row = bottleIndex / cgetCOL(); Integer col = bottleIndex % cgetCOL(); - Integer x = topLelf.x + col * xSpacing; - Integer y = topLelf.y + row * ySpacing; + Integer x = topLelf.x + hole0.x + col * holeXSpacing; + Integer y = topLelf.y + hole0.y + row * holeYSpacing; return new Pos2d(x, y); } public Pos2d cgetScanPos(Integer bottleIndex) { - int row = bottleIndex / cgetCOL(); - Integer dy = 0; - if (row == 0) { - dy = -scancodeRelaPos; - } else if (row == 1) { - dy = scancodeRelaPos; - } - - Pos2d bottlePos = cgetBottlePos(bottleIndex); - return HbotScanerPosComputer.getScanPos(bottlePos); + Integer row = bottleIndex / cgetCOL(); + Integer col = bottleIndex % cgetCOL(); + + Integer x = topLelf.x + scan0.x + col * scanPosXSpacing; + Integer y = topLelf.y + scan0.y + row * scanPosYSpacing; + + return HbotScanerPosComputer.getScanPos(new Pos2d(x, y)); + } } diff --git a/src/main/java/a8k/service/hardware/HbotControlService.java b/src/main/java/a8k/service/hardware/HbotControlService.java index 9e2f85e..62acb91 100644 --- a/src/main/java/a8k/service/hardware/HbotControlService.java +++ b/src/main/java/a8k/service/hardware/HbotControlService.java @@ -138,10 +138,13 @@ public class HbotControlService implements HardwareCtrlModule { public LargeBottleBufferPos getLargeBottleBufferPosInfo() { return settingReader.getObject("LargeBottleBufferPosInfo", LargeBottleBufferPos.class, new LargeBottleBufferPos( - new Pos2d(4594, 1350), + new Pos2d(4474, 1172), + new Pos2d(109, 182), 280, 280, - 165 + new Pos2d(60, 30), + 280, + 580 )); } @@ -340,7 +343,6 @@ public class HbotControlService implements HardwareCtrlModule { } - @HardwareServiceAction(name = "HBot移动到探测物质X孔", group = "单步测试") public void hbotMoveToDetectMaterialPos(ConsumableGroup group, Integer Xhole) throws HardwareException, InterruptedException { BottleGroupsPosInfo posInfo = getBottleBufferPosInfo(); @@ -354,7 +356,7 @@ public class HbotControlService implements HardwareCtrlModule { @HardwareServiceAction(name = "HBot移动到大瓶缓冲液X孔", group = "单步测试") public void hbotMoveToLargeBottleGroup(ConsumableGroup ch) throws HardwareException, InterruptedException { LargeBottleBufferPos posInfo = getLargeBottleBufferPosInfo(); - Pos2d pos = posInfo.cgetBottlePos( ch.off); + Pos2d pos = posInfo.cgetBottlePos(ch.off); hbotCheckAndMoveTo(pos); } diff --git a/src/main/java/a8k/utils/HbotScanerPosComputer.java b/src/main/java/a8k/utils/HbotScanerPosComputer.java index 6fe9293..1b34a29 100644 --- a/src/main/java/a8k/utils/HbotScanerPosComputer.java +++ b/src/main/java/a8k/utils/HbotScanerPosComputer.java @@ -4,6 +4,6 @@ import a8k.appbean.cfg.Pos2d; public class HbotScanerPosComputer { static public Pos2d getScanPos(Pos2d tipPos) { - return new Pos2d(tipPos.x + 359, tipPos.y + 29); + return new Pos2d(tipPos.x + 333, tipPos.y + 29); } }