4 changed files with 215 additions and 155 deletions
-
17src/main/java/a8k/app/service/lowerctrl/TubeFeedingCtrlService.java
-
1src/main/java/a8k/extui/mgr/ExtApiPageGroupCfgMgr.java
-
153src/main/java/a8k/extui/page/pos_calibration/HbotSamplePosCalibration.java
-
199src/main/java/a8k/extui/page/pos_calibration_h/HbotSamplePosCalibration.java
@ -1,153 +0,0 @@ |
|||||
package a8k.extui.page.pos_calibration; |
|
||||
|
|
||||
|
|
||||
import a8k.extui.mgr.ExtApiPageMgr; |
|
||||
import a8k.app.service.lowerctrl.TubePreProcesModuleExCtrlService; |
|
||||
import a8k.app.service.lowerctrl.HbotMoveCtrlService; |
|
||||
import a8k.app.hardware.extdriver.MotorMoveZeroExDriver; |
|
||||
import a8k.app.a8ktype.param.HbotSamplePos; |
|
||||
import a8k.app.hardware.driver.HbotDriver; |
|
||||
import a8k.app.hardware.driver.PipetteCtrlDriver; |
|
||||
import a8k.app.service.lowerctrl.HbotMoveExCtrlService; |
|
||||
import a8k.app.hardware.driver.StepMotorCtrlDriver; |
|
||||
import a8k.app.hardware.driver.type.StepMotorMId; |
|
||||
import a8k.app.hardware.extdriver.MotorEnableExDriver; |
|
||||
import a8k.app.service.lowerctrl.TubePreProcesModuleCtrlService; |
|
||||
import a8k.app.service.param.HbotSamplePosParamMgr; |
|
||||
import a8k.app.a8ktype.device.Pos2d; |
|
||||
import a8k.app.a8ktype.device.Pos3d; |
|
||||
import a8k.app.a8ktype.exception.AppException; |
|
||||
import jakarta.annotation.PostConstruct; |
|
||||
import jakarta.annotation.Resource; |
|
||||
import lombok.extern.slf4j.Slf4j; |
|
||||
import org.slf4j.Logger; |
|
||||
import org.springframework.stereotype.Component; |
|
||||
|
|
||||
@Component |
|
||||
@Slf4j |
|
||||
public class HbotSamplePosCalibration { |
|
||||
static Logger logger = org.slf4j.LoggerFactory.getLogger(HbotSamplePosCalibration.class); |
|
||||
|
|
||||
@Resource |
|
||||
PipetteCtrlDriver pipetteCtrlDriver; |
|
||||
@Resource |
|
||||
MotorEnableExDriver motorEnableExDriver; |
|
||||
@Resource |
|
||||
HbotDriver hbotDriver; |
|
||||
@Resource |
|
||||
TubePreProcesModuleCtrlService tubePreProcesModuleCtrlService; |
|
||||
@Resource |
|
||||
HbotMoveCtrlService hbotMoveCtrlService; |
|
||||
@Resource |
|
||||
TubePreProcesModuleExCtrlService tubePreProcesCtrlService; |
|
||||
@Resource |
|
||||
MotorMoveZeroExDriver motorMoveZeroExDriver; |
|
||||
|
|
||||
|
|
||||
@Resource |
|
||||
HbotMoveExCtrlService hbotMoveExCtrlService; |
|
||||
@Resource |
|
||||
HbotSamplePosParamMgr hbotSamplePosParamMgr; |
|
||||
|
|
||||
|
|
||||
@Resource |
|
||||
StepMotorCtrlDriver stepMotorCtrlDriver; |
|
||||
|
|
||||
|
|
||||
public Object getPoss() throws AppException { |
|
||||
return hbotSamplePosParamMgr.getParams(); |
|
||||
} |
|
||||
|
|
||||
// 测试工具 |
|
||||
|
|
||||
public void moveToZero() throws AppException { |
|
||||
enableModule(); |
|
||||
|
|
||||
motorEnableExDriver.preProcessRelatedModuleEnable(true); |
|
||||
// motorEnableExDriver.tubeFeedRelatedModuleEnable(true); |
|
||||
|
|
||||
motorMoveZeroExDriver.preProcessModuleMoveToZero(); |
|
||||
pipetteCtrlDriver.zMotorMoveZeroBlock(); |
|
||||
hbotMoveCtrlService.moveToZero(); |
|
||||
// motorMoveZeroExDriver.tubeFeeddingModuleMoveToZero(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
public void enableModule() throws AppException { |
|
||||
pipetteCtrlDriver.zMotorEnable(1); |
|
||||
hbotMoveCtrlService.enable(1); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
public void disableModule() throws AppException { |
|
||||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ShakeModClampingM, 1); |
|
||||
stepMotorCtrlDriver.stepMotorEasyMoveByBlock(StepMotorMId.ShakeModClampingM, 10, 3000); |
|
||||
|
|
||||
pipetteCtrlDriver.zMotorEnable(0); |
|
||||
hbotMoveCtrlService.enable(0); |
|
||||
motorEnableExDriver.forceDisableAllMotor(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
public void takeTubeToShakePos(Boolean isHtube) throws AppException { |
|
||||
tubePreProcesCtrlService.takeTubeFromTubeholderToShakePos(isHtube); |
|
||||
tubePreProcesCtrlService.takeTubeCap(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
// |
|
||||
// 标定Z轴 |
|
||||
// |
|
||||
public Pos3d readPos() throws AppException { |
|
||||
enableModule(); |
|
||||
Pos2d xypos = hbotDriver.readPos(); |
|
||||
pipetteCtrlDriver.zMotorMeasureDistance(); |
|
||||
Integer z = pipetteCtrlDriver.zMotorReadMeasureDistanceResult(); |
|
||||
Pos3d var = new Pos3d(xypos.x, xypos.y, z); |
|
||||
disableModule(); |
|
||||
return var; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
public void calibrationSamplePos(HbotSamplePos posType) throws AppException { |
|
||||
Pos3d pos3d = readPos(); |
|
||||
hbotSamplePosParamMgr.setSamplePos(posType, pos3d); |
|
||||
} |
|
||||
|
|
||||
// |
|
||||
// 校验 |
|
||||
// |
|
||||
|
|
||||
public void testSamplePos(HbotSamplePos posType) throws AppException { |
|
||||
hbotMoveExCtrlService.moveToSamplePos(posType); |
|
||||
} |
|
||||
|
|
||||
@Resource |
|
||||
ExtApiPageMgr extApiPageMgr; |
|
||||
|
|
||||
@PostConstruct |
|
||||
public void init() { |
|
||||
var page = extApiPageMgr.newPage(this); |
|
||||
|
|
||||
page.newGroup("基础"); |
|
||||
page.addFunction("获取坐标", this::getPoss); |
|
||||
|
|
||||
page.newGroup("测试工具"); |
|
||||
page.addFunction("归零", this::moveToZero); |
|
||||
page.addFunction("使能相关模块", this::enableModule); |
|
||||
page.addFunction("失能相关模块", this::disableModule); |
|
||||
|
|
||||
page.newGroup("辅助工具"); |
|
||||
page.addFunction("取试管到试管摇匀位", this::takeTubeToShakePos); |
|
||||
|
|
||||
page.newGroup("标定"); |
|
||||
page.addFunction("校准.采样位置", this::calibrationSamplePos); |
|
||||
|
|
||||
page.newGroup("校验"); |
|
||||
page.addFunction("校验坐标", this::testSamplePos); |
|
||||
|
|
||||
extApiPageMgr.addPage(page); |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -0,0 +1,199 @@ |
|||||
|
package a8k.extui.page.pos_calibration_h; |
||||
|
|
||||
|
|
||||
|
import a8k.app.hardware.type.a8kcanprotocol.A8kEcode; |
||||
|
import a8k.app.service.lowerctrl.*; |
||||
|
import a8k.extui.mgr.ExtApiPageMgr; |
||||
|
import a8k.app.hardware.extdriver.MotorMoveZeroExDriver; |
||||
|
import a8k.app.a8ktype.param.HbotSamplePos; |
||||
|
import a8k.app.hardware.driver.HbotDriver; |
||||
|
import a8k.app.hardware.driver.PipetteCtrlDriver; |
||||
|
import a8k.app.hardware.driver.StepMotorCtrlDriver; |
||||
|
import a8k.app.hardware.driver.type.StepMotorMId; |
||||
|
import a8k.app.hardware.extdriver.MotorEnableExDriver; |
||||
|
import a8k.app.service.param.HbotSamplePosParamMgr; |
||||
|
import a8k.app.a8ktype.device.Pos2d; |
||||
|
import a8k.app.a8ktype.device.Pos3d; |
||||
|
import a8k.app.a8ktype.exception.AppException; |
||||
|
import jakarta.annotation.PostConstruct; |
||||
|
import jakarta.annotation.Resource; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
@Component |
||||
|
@Slf4j |
||||
|
public class HbotSamplePosCalibration { |
||||
|
|
||||
|
// @Resource |
||||
|
// PipetteCtrlDriver pipetteCtrlDriver; |
||||
|
// @Resource |
||||
|
// MotorEnableExDriver motorEnableExDriver; |
||||
|
// @Resource |
||||
|
// HbotDriver hbotDriver; |
||||
|
// @Resource |
||||
|
// TubePreProcesModuleCtrlService tubePreProcesModuleCtrlService; |
||||
|
// @Resource |
||||
|
// HbotMoveCtrlService hbotMoveCtrlService; |
||||
|
// @Resource |
||||
|
// TubePreProcesModuleExCtrlService tubePreProcesCtrlService; |
||||
|
// @Resource |
||||
|
// MotorMoveZeroExDriver motorMoveZeroExDriver; |
||||
|
// |
||||
|
// |
||||
|
// @Resource |
||||
|
// HbotMoveExCtrlService hbotMoveExCtrlService; |
||||
|
// @Resource |
||||
|
// HbotSamplePosParamMgr hbotSamplePosParamMgr; |
||||
|
// |
||||
|
// |
||||
|
// @Resource |
||||
|
// StepMotorCtrlDriver stepMotorCtrlDriver; |
||||
|
// |
||||
|
// |
||||
|
// public Object getPoss() throws AppException { |
||||
|
// return hbotSamplePosParamMgr.getParams(); |
||||
|
// } |
||||
|
// |
||||
|
// // 测试工具 |
||||
|
// |
||||
|
// public void moveToZero() throws AppException { |
||||
|
// enableModule(); |
||||
|
// |
||||
|
// motorEnableExDriver.preProcessRelatedModuleEnable(true); |
||||
|
// // motorEnableExDriver.tubeFeedRelatedModuleEnable(true); |
||||
|
// |
||||
|
// motorMoveZeroExDriver.preProcessModuleMoveToZero(); |
||||
|
// pipetteCtrlDriver.zMotorMoveZeroBlock(); |
||||
|
// hbotMoveCtrlService.moveToZero(); |
||||
|
// // motorMoveZeroExDriver.tubeFeeddingModuleMoveToZero(); |
||||
|
// } |
||||
|
// |
||||
|
// |
||||
|
// public void enableModule() throws AppException { |
||||
|
// pipetteCtrlDriver.zMotorEnable(1); |
||||
|
// hbotMoveCtrlService.enable(1); |
||||
|
// } |
||||
|
// |
||||
|
// |
||||
|
// public void disableModule() throws AppException { |
||||
|
// stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ShakeModClampingM, 1); |
||||
|
// stepMotorCtrlDriver.stepMotorEasyMoveByBlock(StepMotorMId.ShakeModClampingM, 10, 3000); |
||||
|
// |
||||
|
// pipetteCtrlDriver.zMotorEnable(0); |
||||
|
// hbotMoveCtrlService.enable(0); |
||||
|
// motorEnableExDriver.forceDisableAllMotor(); |
||||
|
// } |
||||
|
// |
||||
|
// |
||||
|
// |
||||
|
// public void takeTubeToShakePos(Boolean isHtube) throws AppException { |
||||
|
// tubePreProcesCtrlService.takeTubeFromTubeholderToShakePos(isHtube); |
||||
|
// tubePreProcesCtrlService.takeTubeCap(); |
||||
|
// } |
||||
|
// |
||||
|
// |
||||
|
// // |
||||
|
// // 标定Z轴 |
||||
|
// // |
||||
|
// public Pos3d readPos() throws AppException { |
||||
|
// enableModule(); |
||||
|
// Pos2d xypos = hbotDriver.readPos(); |
||||
|
// pipetteCtrlDriver.zMotorMeasureDistance(); |
||||
|
// Integer z = pipetteCtrlDriver.zMotorReadMeasureDistanceResult(); |
||||
|
// Pos3d var = new Pos3d(xypos.x, xypos.y, z); |
||||
|
// disableModule(); |
||||
|
// return var; |
||||
|
// } |
||||
|
// |
||||
|
// |
||||
|
// public void calibrationSamplePos(HbotSamplePos posType) throws AppException { |
||||
|
// Pos3d pos3d = readPos(); |
||||
|
// hbotSamplePosParamMgr.setSamplePos(posType, pos3d); |
||||
|
// } |
||||
|
// |
||||
|
// // |
||||
|
// // 校验 |
||||
|
// // |
||||
|
// |
||||
|
// public void testSamplePos(HbotSamplePos posType) throws AppException { |
||||
|
// hbotMoveExCtrlService.moveToSamplePos(posType); |
||||
|
// } |
||||
|
|
||||
|
@Resource |
||||
|
TubeFeedingCtrlService tubeFeedingCtrlService; |
||||
|
|
||||
|
@Resource |
||||
|
DeviceInitCtrlService deviceInitCtrlService; |
||||
|
|
||||
|
@Resource |
||||
|
HbotDriver hbotDriver; |
||||
|
|
||||
|
@Resource |
||||
|
PipetteCtrlDriver pipetteCtrlDriver; |
||||
|
|
||||
|
@Resource |
||||
|
HbotSamplePosParamMgr hbotSamplePosParamMgr; |
||||
|
|
||||
|
public void prepareMeasureEnv() throws AppException { |
||||
|
Boolean suc = tubeFeedingCtrlService.enterTubeHolder(); |
||||
|
if (suc) { |
||||
|
tubeFeedingCtrlService.moveTubeToPreProcessPos(0); |
||||
|
} else { |
||||
|
throw AppException.of(A8kEcode.CODEERROR, "未检测到试管架"); |
||||
|
} |
||||
|
hbotDriver.enable(0); |
||||
|
pipetteCtrlDriver.zMotorEnable(0); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public Pos3d measure() throws AppException { |
||||
|
Pos2d pos2d = hbotDriver.readPos(); |
||||
|
pipetteCtrlDriver.zMotorEnable(1); |
||||
|
pipetteCtrlDriver.zMotorMeasureDistance(); |
||||
|
Integer z = pipetteCtrlDriver.zMotorReadMeasureDistanceResult(); |
||||
|
pipetteCtrlDriver.zMotorEnable(0); |
||||
|
return new Pos3d(pos2d.x, pos2d.y, z); |
||||
|
} |
||||
|
|
||||
|
public void setPos(HbotSamplePos posType, Integer x, Integer y, Integer z) throws AppException { |
||||
|
Pos3d pos = new Pos3d(x, y, z); |
||||
|
hbotSamplePosParamMgr.setSamplePos(posType, pos); |
||||
|
} |
||||
|
|
||||
|
@Resource |
||||
|
ExtApiPageMgr extApiPageMgr; |
||||
|
|
||||
|
@PostConstruct |
||||
|
public void init() { |
||||
|
var page = extApiPageMgr.newPage(this); |
||||
|
|
||||
|
|
||||
|
// page.newGroup("基础"); |
||||
|
// page.addFunction("获取坐标", this::getPoss); |
||||
|
// |
||||
|
// page.newGroup("测试工具"); |
||||
|
// page.addFunction("归零", this::moveToZero); |
||||
|
// page.addFunction("使能相关模块", this::enableModule); |
||||
|
// page.addFunction("失能相关模块", this::disableModule); |
||||
|
// |
||||
|
// page.newGroup("辅助工具"); |
||||
|
// page.addFunction("取试管到试管摇匀位", this::takeTubeToShakePos); |
||||
|
// |
||||
|
// page.newGroup("标定"); |
||||
|
// page.addFunction("校准.采样位置", this::calibrationSamplePos); |
||||
|
// |
||||
|
// page.newGroup("校验"); |
||||
|
// page.addFunction("校验坐标", this::testSamplePos); |
||||
|
|
||||
|
page.newGroup("控制"); |
||||
|
page.addFunction("准备测量环境", this::prepareMeasureEnv); |
||||
|
page.addFunction("测量", this::measure); |
||||
|
|
||||
|
page.newGroup("参数"); |
||||
|
page.addFunction("设置位置", this::setPos); |
||||
|
|
||||
|
extApiPageMgr.addPage(page); |
||||
|
} |
||||
|
|
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue