Browse Source

update

tags/v0
zhaohe 7 months ago
parent
commit
a75905d037
  1. 4
      src/main/java/a8k/extui/mgr/ExtApiPageGroupCfgMgr.java
  2. 68
      src/main/java/a8k/extui/page/measurement/HbotFreedomPosMeasurePage.java
  3. 108
      src/main/java/a8k/extui/page/measurement/HbotPosMeasurePage.java
  4. 96
      src/main/java/a8k/extui/page/measurement/HbotPosMeasurePageBak.java
  5. 2
      src/main/java/a8k/extui/type/ExtApiStatu.java
  6. 9
      src/main/resources/db/zapp_a8k_pos_parameter.csv

4
src/main/java/a8k/extui/mgr/ExtApiPageGroupCfgMgr.java

@ -162,11 +162,13 @@ public class ExtApiPageGroupCfgMgr {
pushMenu( pushMenu(
new Menu("测量", List.of( new Menu("测量", List.of(
new Menu(HbotPosMeasurePage.class, "HBOT测量"),
new Menu(HbotPosMeasurePage.class, "HBOT测量(电控)"),
new Menu(HbotFreedomPosMeasurePage.class, "HBO测量(自由模式)"),
new Menu(FeedingModMeasurePage.class, "入料模组"), new Menu(FeedingModMeasurePage.class, "入料模组"),
new Menu(ShakeModStepMotorMeasurePage.class, "摇匀模组"), new Menu(ShakeModStepMotorMeasurePage.class, "摇匀模组"),
new Menu(PlatesBoxMeasurePage.class, "板夹仓"), new Menu(PlatesBoxMeasurePage.class, "板夹仓"),
new Menu(IncubatorMeasurePage.class, "孵育盘"), new Menu(IncubatorMeasurePage.class, "孵育盘"),
new Menu(OptModMeasurePage.class, "光学模组") new Menu(OptModMeasurePage.class, "光学模组")
))); )));

68
src/main/java/a8k/extui/page/measurement/HbotFreedomPosMeasurePage.java

@ -0,0 +1,68 @@
package a8k.extui.page.measurement;
import a8k.app.a8ktype.device.Pos2d;
import a8k.app.a8ktype.device.Pos3d;
import a8k.app.a8ktype.exception.AppException;
import a8k.app.hardware.driver.HbotDriver;
import a8k.app.hardware.driver.PipetteCtrlDriver;
import a8k.app.service.lowerctrl.HbotMoveCtrlService;
import a8k.extui.mgr.ExtApiPageMgr;
import a8k.extui.type.ExtApiStatu;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
public class HbotFreedomPosMeasurePage {
@Resource
ExtApiPageMgr extApiPageMgr;
@Resource
HbotDriver hbotDriver;
@Resource
HbotMoveCtrlService hbotMoveCtrlService;
@Resource
PipetteCtrlDriver pipetteCtrlDriver;
public List<String> measurePosHistory = new ArrayList<>();
@ExtApiStatu(group = "测量位置历史记录")
public List<String> getMeasurePosHistory() {
return measurePosHistory;
}
public void measurementCurrentPos() throws AppException {
pipetteCtrlDriver.zMotorEnable(1);
pipetteCtrlDriver.zMotorMeasureDistance();
Pos3d pos = new Pos3d();
pos.z = pipetteCtrlDriver.zMotorReadMeasureDistanceResult();
pos.x = hbotDriver.readPos().x;
pos.y = hbotDriver.readPos().y;
pipetteCtrlDriver.zMotorEnable(0);
measurePosHistory.add(String.format("x: %3d, y: %3d, z: %3d", pos.x, pos.y, pos.z));
// return pos;
}
public void zmoveBy(Integer dpos) throws AppException {
pipetteCtrlDriver.zMotorEnable(1);
pipetteCtrlDriver.zMotorMoveByBlock(dpos);
pipetteCtrlDriver.zMotorEnable(0);
}
@PostConstruct
public void init() {
var page = extApiPageMgr.newPage(this);
page.addFunction("测量当前位置", this::measurementCurrentPos);
page.newGroup("Z轴控制");
page.addFunction("Z轴相对移动", this::zmoveBy);
extApiPageMgr.addPage(page);
}
}

108
src/main/java/a8k/extui/page/measurement/HbotPosMeasurePage.java

@ -5,6 +5,7 @@ import a8k.app.a8ktype.device.Pos3d;
import a8k.app.a8ktype.exception.AppException; import a8k.app.a8ktype.exception.AppException;
import a8k.app.hardware.driver.HbotDriver; import a8k.app.hardware.driver.HbotDriver;
import a8k.app.hardware.driver.PipetteCtrlDriver; import a8k.app.hardware.driver.PipetteCtrlDriver;
import a8k.app.hardware.driver.type.PipetteRegIndex;
import a8k.app.service.lowerctrl.HbotMoveCtrlService; import a8k.app.service.lowerctrl.HbotMoveCtrlService;
import a8k.extui.mgr.ExtApiPageMgr; import a8k.extui.mgr.ExtApiPageMgr;
import a8k.extui.type.ExtApiStatu; import a8k.extui.type.ExtApiStatu;
@ -26,16 +27,26 @@ public class HbotPosMeasurePage {
@Resource @Resource
PipetteCtrlDriver pipetteCtrlDriver; PipetteCtrlDriver pipetteCtrlDriver;
@ExtApiStatu(name = "Hbot当前坐标")
public Object readPos() throws AppException {
return hbotDriver.readPos();
@ExtApiStatu(group = "Hbot当前坐标")
public Pos3d readPos() throws AppException {
Pos3d pos = new Pos3d();
pos.x = hbotDriver.readPos().x;
pos.y = hbotDriver.readPos().y;
pos.z = pipetteCtrlDriver.getReg(PipetteRegIndex.kreg_pipette_zm_pos);
return pos;
} }
public void moveTo(Integer x, Integer y, Integer z) throws AppException {
hbotDriver.enable(1);
pipetteCtrlDriver.zMotorEnable(1);
pipetteCtrlDriver.zMotorMoveZeroBlock();
hbotMoveCtrlService.hbotMoveTo(x, y, z);
Integer moveByDistance = 100;
Integer zMotorMoveByDistance = 10;
@ExtApiStatu(group = "HBOT相对移动距离")
public Integer getMoveByDistance() {
return moveByDistance;
}
@ExtApiStatu(group = "Z轴相对移动距离")
public Integer getZMotorMoveByDistance() {
return zMotorMoveByDistance;
} }
public void moveBy(Integer dx, Integer dy) throws AppException { public void moveBy(Integer dx, Integer dy) throws AppException {
@ -47,6 +58,52 @@ public class HbotPosMeasurePage {
hbotDriver.moveToBlock(pos.x, pos.y); hbotDriver.moveToBlock(pos.x, pos.y);
} }
void zMotorMoveBy(Integer dz) throws AppException {
pipetteCtrlDriver.zMotorMoveByBlock(dz);
}
synchronized public void setMoveByDistance(Integer distance) {
moveByDistance = distance;
}
synchronized public void setzMotorMoveByDistance(Integer distance) {
zMotorMoveByDistance = distance;
}
synchronized public void enableMeasurment() throws AppException {
hbotDriver.enable(1);
pipetteCtrlDriver.zMotorEnable(1);
pipetteCtrlDriver.zMotorMoveZeroBlock();
hbotDriver.moveToZeroBlock();
}
public void moveUp() throws AppException {
moveBy(0, -moveByDistance);
}
public void moveDown() throws AppException {
moveBy(0, moveByDistance);
}
public void moveLeft() throws AppException {
moveBy(-moveByDistance, 0);
}
public void moveRight() throws AppException {
moveBy(moveByDistance, 0);
}
public void zmoveUp() throws AppException {
zMotorMoveBy(-zMotorMoveByDistance);
}
public void zmoveDown() throws AppException {
zMotorMoveBy(zMotorMoveByDistance);
}
public Pos3d measurementCurrentPos() throws AppException { public Pos3d measurementCurrentPos() throws AppException {
pipetteCtrlDriver.zMotorMeasureDistance(); pipetteCtrlDriver.zMotorMeasureDistance();
Pos3d pos = new Pos3d(); Pos3d pos = new Pos3d();
@ -57,28 +114,25 @@ public class HbotPosMeasurePage {
} }
public Integer readXPos() {
try {
return hbotDriver.readPos().x;
} catch (AppException e) {
return 0;
}
}
public Integer readYPos() {
try {
return hbotDriver.readPos().y;
} catch (AppException e) {
return 0;
}
}
@PostConstruct @PostConstruct
public void init() { public void init() {
var page = extApiPageMgr.newPage(this); var page = extApiPageMgr.newPage(this);
page.addFunction("移动到", this::moveTo).setParamVal("x", this::readXPos).setParamVal("y", this::readYPos);
page.addFunction("相对移动", this::moveBy).setParamVal("dx", 0).setParamVal("dy", 0);
page.addFunction("测量当前位置", this::measurementCurrentPos);
page.newGroup("基础");
page.addFunction("开始测量", this::enableMeasurment);
page.newGroup("Hbot");
page.addFunction("设置相对移动距离", this::setMoveByDistance).setParamVal("distance", () -> moveByDistance);
page.addFunction("上", this::moveUp);
page.addFunction("下", this::moveDown);
page.addFunction("左", this::moveLeft);
page.addFunction("右", this::moveRight);
page.newGroup("Z轴");
page.addFunction("设置Z轴相对移动距离", this::setzMotorMoveByDistance).setParamVal("distance", () -> zMotorMoveByDistance);
page.addFunction("上", this::zmoveUp);
page.addFunction("下", this::zmoveDown);
extApiPageMgr.addPage(page); extApiPageMgr.addPage(page);
} }
} }

96
src/main/java/a8k/extui/page/measurement/HbotPosMeasurePageBak.java

@ -1,96 +0,0 @@
package a8k.extui.page.measurement;
import a8k.app.a8ktype.device.Pos2d;
import a8k.app.a8ktype.device.Pos3d;
import a8k.app.a8ktype.exception.AppException;
import a8k.app.hardware.driver.HbotDriver;
import a8k.app.hardware.driver.PipetteCtrlDriver;
import a8k.app.service.lowerctrl.HbotMoveCtrlService;
import a8k.extui.mgr.ExtApiPageMgr;
import a8k.extui.type.ExtApiStatu;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
@Component
public class HbotPosMeasurePageBak {
@Resource
ExtApiPageMgr extApiPageMgr;
@Resource
HbotDriver hbotDriver;
@Resource
HbotMoveCtrlService hbotMoveCtrlService;
@Resource
PipetteCtrlDriver pipetteCtrlDriver;
@ExtApiStatu(name = "Hbot当前坐标")
public Object readPos() throws AppException {
return hbotDriver.readPos();
}
public void disableHbot() throws AppException {
hbotDriver.enable(0);
pipetteCtrlDriver.zMotorEnable(0);
}
public void enableHbot() throws AppException {
hbotDriver.enable(1);
pipetteCtrlDriver.zMotorEnable(1);
}
public void moveTo(Integer x, Integer y, Integer z) throws AppException {
hbotDriver.enable(1);
pipetteCtrlDriver.zMotorEnable(1);
pipetteCtrlDriver.zMotorMoveZeroBlock();
hbotMoveCtrlService.hbotMoveTo(x, y, z);
}
public void moveBy(Integer dx, Integer dy) throws AppException {
hbotDriver.enable(1);
pipetteCtrlDriver.zMotorEnable(1);
Pos2d pos = hbotDriver.readPos();
pos.x += dx;
pos.y += dy;
hbotDriver.moveToBlock(pos.x, pos.y);
}
public Pos3d measurementCurrentPos() throws AppException {
pipetteCtrlDriver.zMotorMeasureDistance();
Pos3d pos = new Pos3d();
pos.z = pipetteCtrlDriver.zMotorReadMeasureDistanceResult();
pos.x = hbotDriver.readPos().x;
pos.y = hbotDriver.readPos().y;
return pos;
}
public Integer readXPos() {
try {
return hbotDriver.readPos().x;
} catch (AppException e) {
return 0;
}
}
public Integer readYPos() {
try {
return hbotDriver.readPos().y;
} catch (AppException e) {
return 0;
}
}
@PostConstruct
public void init() {
var page = extApiPageMgr.newPage(this);
page.addFunction("使能HBOT", this::enableHbot);
page.addFunction("失能HBOT", this::disableHbot);
page.addFunction("移动到", this::moveTo).setParamVal("x", this::readXPos).setParamVal("y", this::readYPos);
page.addFunction("相对移动", this::moveBy).setParamVal("dx", 0).setParamVal("dy", 0);
page.addFunction("测量当前位置", this::measurementCurrentPos);
extApiPageMgr.addPage(page);
}
}

2
src/main/java/a8k/extui/type/ExtApiStatu.java

@ -7,7 +7,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD}) @Target({ElementType.METHOD})
public @interface ExtApiStatu { public @interface ExtApiStatu {
String name();
String name() default "";
String group() default ""; String group() default "";
String minWidth() default "20%"; String minWidth() default "20%";
int order() default 0; int order() default 0;

9
src/main/resources/db/zapp_a8k_pos_parameter.csv

@ -28,10 +28,10 @@ id,service,key,valType,val,chName
42,HbotSamplePosParamMgr,Bulltube0P5SampleEndPos,Pos3d,"{""x"":2331,""y"":3773,""z"":649}",<子弹头试管0.5mL>取样结束位置 42,HbotSamplePosParamMgr,Bulltube0P5SampleEndPos,Pos3d,"{""x"":2331,""y"":3773,""z"":649}",<子弹头试管0.5mL>取样结束位置
43,HbotSamplePosParamMgr,StoolTestTubeSamplePos,Pos3d,"{""x"":2331,""y"":3773,""z"":433}",<粪便试管>取样位置 43,HbotSamplePosParamMgr,StoolTestTubeSamplePos,Pos3d,"{""x"":2331,""y"":3773,""z"":433}",<粪便试管>取样位置
44,HbotSamplePosParamMgr,StoolTestTubeSampleEndPos,Pos3d,"{""x"":2331,""y"":3773,""z"":649}",<粪便试管>取样结束位置 44,HbotSamplePosParamMgr,StoolTestTubeSampleEndPos,Pos3d,"{""x"":2331,""y"":3773,""z"":649}",<粪便试管>取样结束位置
45,HbotLittleBSPosMgr,LittleBufferGroup0_000Pos,Pos2d,"{""x"":899,""y"":1101}",第1组小瓶缓冲液的第1个位置
45,HbotLittleBSPosMgr,LittleBufferGroup0_000Pos,Pos2d,"{""x"":901,""y"":1105}",第1组小瓶缓冲液的第1个位置
53,HbotLittleBSPosMgr,LittleBSPierceXYAppendDistance,Double,"{""value"":7.0}",小瓶缓冲液刺破XY附加距离 53,HbotLittleBSPosMgr,LittleBSPierceXYAppendDistance,Double,"{""value"":7.0}",小瓶缓冲液刺破XY附加距离
54,HbotLittleBSPosMgr,LittleBSPierceZPos,Integer,"{""value"":528}",小瓶缓冲液刺破Z坐标 54,HbotLittleBSPosMgr,LittleBSPierceZPos,Integer,"{""value"":528}",小瓶缓冲液刺破Z坐标
55,HbotLittleBSPosMgr,LittleBSSampleZPos,Integer,"{""value"":593}",小瓶缓冲液取样Z坐标
55,HbotLittleBSPosMgr,LittleBSSampleZPos,Integer,"{""value"":621}",小瓶缓冲液取样Z坐标
56,HbotLargeBottleBSPosMgr,LargeBuffer_0Pos,Pos2d,"{""x"":4576,""y"":1364}",大瓶缓冲液的第1个位置 56,HbotLargeBottleBSPosMgr,LargeBuffer_0Pos,Pos2d,"{""x"":4576,""y"":1364}",大瓶缓冲液的第1个位置
57,HbotLargeBottleBSPosMgr,LargeBuffer_DX,Double,"{""value"":281.0}",大瓶缓冲液的X间距 57,HbotLargeBottleBSPosMgr,LargeBuffer_DX,Double,"{""value"":281.0}",大瓶缓冲液的X间距
58,HbotLargeBottleBSPosMgr,LargeBuffer_DY,Double,"{""value"":274.0}",大瓶缓冲液的Y间距 58,HbotLargeBottleBSPosMgr,LargeBuffer_DY,Double,"{""value"":274.0}",大瓶缓冲液的Y间距
@ -49,9 +49,6 @@ id,service,key,valType,val,chName
83,TurntablePosParamMgr,PullPos0,Integer,"{""value"":19700}",出板位置 83,TurntablePosParamMgr,PullPos0,Integer,"{""value"":19700}",出板位置
84,TurntablePosParamMgr,DropLiquidPos0,Integer,"{""value"":10600}",滴液位置 84,TurntablePosParamMgr,DropLiquidPos0,Integer,"{""value"":10600}",滴液位置
85,TurntablePosParamMgr,PosSpacing,Integer,"{""value"":1800}",位置间隔 85,TurntablePosParamMgr,PosSpacing,Integer,"{""value"":1800}",位置间隔
86,PipetteGunLLDParamMgr,DEFAULT_C_THRESHOLD,Integer,"{""value"":15}",默认电容C阈值
87,PipetteGunLLDParamMgr,DEFAULT_P_THRESHOLD,Integer,"{""value"":50}",默认压力阈值
88,PipetteGunLLDParamMgr,DEFAULT_LLD_TYPE,LldType,"{""value"":""kplld""}",默认LLD类型
89,PipetteGunLLFParamMgr,EMERGENCY_TUBE_LLF_VEL,Integer,"{""value"":25}",<急诊试管>液面跟随速度 89,PipetteGunLLFParamMgr,EMERGENCY_TUBE_LLF_VEL,Integer,"{""value"":25}",<急诊试管>液面跟随速度
90,PipetteGunLLFParamMgr,BLOOD_TUBE_LLF_VEL,Integer,"{""value"":25}",<全血试管>液面跟随速度 90,PipetteGunLLFParamMgr,BLOOD_TUBE_LLF_VEL,Integer,"{""value"":25}",<全血试管>液面跟随速度
91,PipetteGunLLFParamMgr,MINI_TUBE_LLF_VEL,Integer,"{""value"":25}",<迷你试管>液面跟随速度 91,PipetteGunLLFParamMgr,MINI_TUBE_LLF_VEL,Integer,"{""value"":25}",<迷你试管>液面跟随速度
@ -102,3 +99,5 @@ id,service,key,valType,val,chName
139,HbotLittleBSPosMgr,ProbeSubstanceSampleZPos,Integer,"{""value"":475}",探测物质取样Z坐标 139,HbotLittleBSPosMgr,ProbeSubstanceSampleZPos,Integer,"{""value"":475}",探测物质取样Z坐标
140,HbotLargeBottleBSPosMgr,LargeBufferScanPos_DX,Double,"{""value"":280}",大瓶缓冲液的扫码位置dx 140,HbotLargeBottleBSPosMgr,LargeBufferScanPos_DX,Double,"{""value"":280}",大瓶缓冲液的扫码位置dx
141,HbotLargeBottleBSPosMgr,LargeBufferScanPos_DY,Double,"{""value"":580}",大瓶缓冲液的扫码位置dy 141,HbotLargeBottleBSPosMgr,LargeBufferScanPos_DY,Double,"{""value"":580}",大瓶缓冲液的扫码位置dy
142,RefPosMgr,HbotXYRefPoint,Pos2d,null,HBOT-XY参考点
143,RefPosMgr,HbotZRefPlane,Integer,null,HBOT-Z参考平面
Loading…
Cancel
Save