Browse Source

update

tags/v0
zhaohe 1 year ago
parent
commit
0ea87c2df7
  1. 4
      src/main/java/a8k/appbean/cfg/BottleGroupsPosInfo.java
  2. 12
      src/main/java/a8k/appbean/cfg/BottlesPosInfo.java
  3. 12
      src/main/java/a8k/appbean/cfg/LargeBottleBufferPos.java
  4. 2
      src/main/java/a8k/appbean/cfg/Plates2dCodeScanPos.java
  5. 115
      src/main/java/a8k/appbean/cfg/SmallBottleBufferPos.java
  6. 2
      src/main/java/a8k/canbus/protocol/A8kPacket.java
  7. 41
      src/main/java/a8k/service/hardware/HbotControlService.java
  8. 9
      src/main/java/a8k/utils/HbotScanerPosComputer.java

4
src/main/java/a8k/appbean/cfg/BottleGroupsPosInfo.java

@ -1,5 +1,7 @@
package a8k.appbean.cfg; package a8k.appbean.cfg;
import a8k.utils.HbotScanerPosComputer;
public class BottleGroupsPosInfo { public class BottleGroupsPosInfo {
static public Integer cgetMAX_GROUP_COL() {return 2;} static public Integer cgetMAX_GROUP_COL() {return 2;}
@ -57,7 +59,7 @@ public class BottleGroupsPosInfo {
if (topLelf == null) { if (topLelf == null) {
return 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) { Pos2d cgetSamllBottlePos(Integer group, Integer bottleIndex) {

12
src/main/java/a8k/appbean/cfg/BottlesPosInfo.java

@ -8,21 +8,21 @@ public class BottlesPosInfo {
static public Integer cgetMAX() {return cgetMAX_COL() * cgetMAX_ROW();} static public Integer cgetMAX() {return cgetMAX_COL() * cgetMAX_ROW();}
public Pos2d topLelf;
public Pos2d relaTopLelf;
public Integer xSpacing; public Integer xSpacing;
public Integer ySpacing; public Integer ySpacing;
public Integer piercedPosZ; public Integer piercedPosZ;
public BottlesPosInfo() { public BottlesPosInfo() {
topLelf = new Pos2d(0, 0);
relaTopLelf = new Pos2d(0, 0);
xSpacing = 0; xSpacing = 0;
ySpacing = 0; ySpacing = 0;
piercedPosZ = 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.xSpacing = xSpacing;
this.ySpacing = ySpacing; this.ySpacing = ySpacing;
this.piercedPosZ = piercedPosZ; this.piercedPosZ = piercedPosZ;
@ -32,8 +32,8 @@ public class BottlesPosInfo {
Integer row = index / cgetMAX_COL(); Integer row = index / cgetMAX_COL();
Integer col = 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); return new Pos2d(x + groupPos.x, y + groupPos.y);

12
src/main/java/a8k/appbean/cfg/LargeBottleBufferPos.java

@ -1,5 +1,7 @@
package a8k.appbean.cfg; package a8k.appbean.cfg;
import a8k.utils.HbotScanerPosComputer;
import java.security.PublicKey; import java.security.PublicKey;
/** /**
@ -36,11 +38,11 @@ public class LargeBottleBufferPos {
sampleZDepth = 0; 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.topLelf = topLelf;
this.xSpacing = xSpacing; this.xSpacing = xSpacing;
this.ySpacing = ySpacing; this.ySpacing = ySpacing;
this.scancodeRelaPos = scancodeRelaPos;
this.scancodeRelaPos = 0;
this.sampleZPos = sampleZPos; this.sampleZPos = sampleZPos;
this.sampleZDepth = sampleZDepth; this.sampleZDepth = sampleZDepth;
} }
@ -56,8 +58,8 @@ public class LargeBottleBufferPos {
} }
public Pos2d cgetScanPos(Integer bottleIndex) { public Pos2d cgetScanPos(Integer bottleIndex) {
Integer row = bottleIndex / cgetCOL();
Integer dy = 0;
int row = bottleIndex / cgetCOL();
Integer dy = 0;
if (row == 0) { if (row == 0) {
dy = -scancodeRelaPos; dy = -scancodeRelaPos;
} else if (row == 1) { } else if (row == 1) {
@ -65,6 +67,6 @@ public class LargeBottleBufferPos {
} }
Pos2d bottlePos = cgetBottlePos(bottleIndex); Pos2d bottlePos = cgetBottlePos(bottleIndex);
return new Pos2d(bottlePos.x, bottlePos.y + dy);
return HbotScanerPosComputer.getScanPos(bottlePos);
} }
} }

2
src/main/java/a8k/appbean/cfg/Plates2dCodeScanPos.java

@ -1,5 +1,7 @@
package a8k.appbean.cfg; package a8k.appbean.cfg;
import a8k.utils.HbotScanerPosComputer;
/** /**
* 板夹仓扫码信息 * 板夹仓扫码信息
*/ */

115
src/main/java/a8k/appbean/cfg/SmallBottleBufferPos.java

@ -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);
// }
//
}

2
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)) { if (cmdId.equals(CmdId.module_get_reg) || cmdId.equals(CmdId.module_set_reg)) {
RegIndex regIndex = RegIndex.valueOf(getContentI32(0)); RegIndex regIndex = RegIndex.valueOf(getContentI32(0));
if (regIndex != null) { 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 { } else {
ret = String.format("[CMD ] index:[%d] %s unkown_index(%d) %d", getPacketIndex(), cmdId, getContentI32(0), getContentI32(1)); ret = String.format("[CMD ] index:[%d] %s unkown_index(%d) %d", getPacketIndex(), cmdId, getContentI32(0), getContentI32(1));
} }

41
src/main/java/a8k/service/hardware/HbotControlService.java

@ -100,25 +100,24 @@ public class HbotControlService implements HardwareCtrlModule {
)); ));
} }
@HardwareServiceParam(name = "缓冲液位置", group = "位置坐标集合") @HardwareServiceParam(name = "缓冲液位置", group = "位置坐标集合")
public BottleGroupsPosInfo getBottleBufferPosInfo() { public BottleGroupsPosInfo getBottleBufferPosInfo() {
return settingReader.getObject("BottleBufferPosInfo", BottleGroupsPosInfo.class, return settingReader.getObject("BottleBufferPosInfo", BottleGroupsPosInfo.class,
new BottleGroupsPosInfo( 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 0
), ),
new BottlesPosInfo(
new Pos2d(0, 0),
0,
0,
new BottlesPosInfo/*小孔*/(
new Pos2d(220, 220),
187,
187,
0 0
) )
)); ));
@ -138,27 +137,23 @@ public class HbotControlService implements HardwareCtrlModule {
public LargeBottleBufferPos getLargeBottleBufferPosInfo() { public LargeBottleBufferPos getLargeBottleBufferPosInfo() {
return settingReader.getObject("LargeBottleBufferPosInfo", LargeBottleBufferPos.class, return settingReader.getObject("LargeBottleBufferPosInfo", LargeBottleBufferPos.class,
new LargeBottleBufferPos( new LargeBottleBufferPos(
new Pos2d(0, 0),
0,
0,
new Pos2d(4583, 1363),
280,
280,
0, 0,
0, 0,
0 0
)); ));
} }
@HardwareServiceParam(name = "公共区Y轴限制值", group = "限制值")
public Integer getCommonAreaYLimit() {
return settingReader.getInteger("CommonAreaYLimit", 0);
}
@HardwareServiceParam(name = "Hbot采样区", group = "限制值") @HardwareServiceParam(name = "Hbot采样区", group = "限制值")
public HbotLimitArea getSampleCollectionArea() { public HbotLimitArea getSampleCollectionArea() {
return settingReader.getObject("HbotPublicArea", HbotLimitArea.class, return settingReader.getObject("HbotPublicArea", HbotLimitArea.class,
new HbotLimitArea(0, 0, 601, 3151));
new HbotLimitArea(0, 3643, 5060, 4074));
} }
//
public Integer getGripperZeroYPos() { public Integer getGripperZeroYPos() {
//之所以这样写是因为是为了放置两个类之间的循环依赖 //之所以这样写是因为是为了放置两个类之间的循环依赖
return appCxt.getBean(SamplesPreProcessModuleCtrlService.class).getGripperZeroYPos(); return appCxt.getBean(SamplesPreProcessModuleCtrlService.class).getGripperZeroYPos();

9
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);
}
}
Loading…
Cancel
Save