Browse Source

update

tags/v0
zhaohe 9 months ago
parent
commit
4bebd7a7e2
  1. 1
      src/main/java/a8k/hardware/type/a8kcanprotocol/A8kEcode.java
  2. 14
      src/main/java/a8k/service/app/devicectrl/ctrlservice/TubePreProcesCtrlService.java
  3. 19
      src/main/java/a8k/service/app/devicectrl/driver/PipetteCtrlDriver.java
  4. 1
      src/main/java/a8k/service/app/devicectrl/param/calibration/HbotLittleBSPosCalibration.java
  5. 1
      src/main/java/a8k/service/app/devicectrl/param/calibration/HbotProbeSubstancePosCalibration.java
  6. 103
      src/main/java/a8k/service/app/devicectrl/param/calibration/PipetteGunLLDParamCalibration.java
  7. 16
      src/main/java/a8k/service/app/devicectrl/param/ext_param_mgr/PipetteGunParamExMgr.java
  8. 21
      src/main/java/a8k/service/app/devicectrl/param/param_mgr/PipetteGunLLDParamMgr.java
  9. 5
      src/main/java/a8k/service/app/devicectrl/param/type/PipetteGunLLDThresholdParam.java
  10. 11
      src/main/java/a8k/service/app/devicectrl/param/type/PipetteGunLLDTypeParam.java
  11. 1
      src/main/java/a8k/service/app/devicectrl/script/DeviceCtrlScripter.java
  12. 14
      src/main/java/a8k/type/ecode/AppCommonError.java
  13. 20
      src/main/java/a8k/type/exception/AppException.java
  14. BIN
      src/main/resources/app.db

1
src/main/java/a8k/hardware/type/a8kcanprotocol/A8kEcode.java

@ -4,6 +4,7 @@ public enum A8kEcode {
SUC(0),
MUTI_APPEXCEPTIONS(1),//内置无需关心
COMMON_ERROR(2),//通用错误只需显示携带错误信息
/*
* 代码错误代码没有BUG的情况下不应该出现的错误
*/

14
src/main/java/a8k/service/app/devicectrl/ctrlservice/TubePreProcesCtrlService.java

@ -55,23 +55,23 @@ public class TubePreProcesCtrlService {
//Z轴在原点
if (!stepMotorCtrlDriver.stepMotorReadIoState(StepMotorMId.ShakeModGripperZM, 0)) {
throw new AppException(A8kEcode.CODEERROR_MOTOR_NOT_IN_ZERO_POS, MId.ShakeModGripperZM);
throw AppException.of(A8kEcode.CODEERROR_MOTOR_NOT_IN_ZERO_POS, MId.ShakeModGripperZM);
}
//Y轴在零点附近
if (!ZEQ.IntEq(miniServoDriver.miniServoReadPos(MiniServoMId.ShakeModGripperYSV), MiniServoConstant.getZeroPos(MiniServoMId.ShakeModGripperYSV), 30)) {
throw new AppException(A8kEcode.CODEERROR_MOTOR_NOT_IN_ZERO_POS, MId.ShakeModGripperYSV);
throw AppException.of(A8kEcode.CODEERROR_MOTOR_NOT_IN_ZERO_POS, MId.ShakeModGripperYSV);
}
//夹爪没有零位置
if (!ZEQ.IntEq(miniServoDriver.miniServoReadPos(MiniServoMId.ShakeModGripperSV), MiniServoConstant.getZeroPos(MiniServoMId.ShakeModGripperSV), 30)) {
throw new AppException(A8kEcode.CODEERROR_MOTOR_NOT_IN_ZERO_POS, MId.ShakeModGripperSV);
throw AppException.of(A8kEcode.CODEERROR_MOTOR_NOT_IN_ZERO_POS, MId.ShakeModGripperSV);
}
// // 检查摇匀夹紧是否在零位
// if (!stepMotorCtrlDriver.stepMotorReadIoState(StepMotorMId.ShakeModClampingM, 0)) {
// throw new AppException(A8kEcode.CODEERROR_MOTOR_NOT_IN_ZERO_POS, MId.ShakeModClampingM);
// }
// // 检查摇匀夹紧是否在零位
// if (!stepMotorCtrlDriver.stepMotorReadIoState(StepMotorMId.ShakeModClampingM, 0)) {
// throw AppException.of(A8kEcode.CODEERROR_MOTOR_NOT_IN_ZERO_POS, MId.ShakeModClampingM);
// }
//
// Reset some motor

19
src/main/java/a8k/service/app/devicectrl/driver/PipetteCtrlDriver.java

@ -14,6 +14,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.util.List;
@ -34,6 +36,7 @@ import java.util.List;
@ExtApiTab(cfg = ExtApiTabConfig.A8kPipetteCtrlModule)
public class PipetteCtrlDriver {
private static final Logger log = LoggerFactory.getLogger(PipetteCtrlDriver.class);
@Resource
A8kCanBusService canBusService;
@ -147,46 +150,42 @@ public class PipetteCtrlDriver {
@ExtApiFn(name = "设置LLDAndLLF起始位置", order = FnOrder.setStartZ)
public void setStartZ(Integer startZ) throws AppException {
log.info("setStartZ:{}", startZ);
canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_set_startz.toInt(), startZ);
}
@ExtApiFn(name = "设置LLDAndLLF结束位置", order = FnOrder.setEndZ)
public void setEndZ(Integer endZ) throws AppException {
log.info("setEndZ:{}", endZ);
canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_set_endz.toInt(), endZ);
}
@ExtApiFn(name = "设置LLD类型", order = FnOrder.setLldType)
public void setLldType(LldType lldType) throws AppException {
log.info("setLldType:{}", lldType);
canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_set_lld_type.toInt(), lldType.getIndex());
}
@ExtApiFn(name = "设置LLD.C阈值", order = FnOrder.setLldCThreshold)
public void setLldCThreshold(Integer cThreshold) throws AppException {
log.info("setLldCThreshold:{}", cThreshold);
canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_set_lld_c_threshold.toInt(), cThreshold);
}
@ExtApiFn(name = "设置LLD.P阈值", order = FnOrder.setLldPThreshold)
public void setLldPThreshold(Integer pThreshold) throws AppException {
log.info("setLldPThreshold:{}", pThreshold);
canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_set_lld_p_threshold.toInt(), pThreshold);
}
@ExtApiFn(name = "LLD.准备", order = FnOrder.lldPrepareBlock)
public void lldPrepareBlock() throws AppException {
log.info("lldPrepareBlock");
canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_lld_prepare.toInt());
canBusService.waitForMod(MId.PipetteMod, overtime);
// zMotorMoveToBlock(startPos);
}
public void lldBlock(LldType type, Integer startz, Integer endz, Integer c_thres, Integer p_thres) throws AppException {
setStartZ(startz);
setEndZ(endz);
setLldType(type);
setLldCThreshold(c_thres);
setLldPThreshold(p_thres);
lldBlock();
}
@ExtApiFn(name = "LLD.Do", order = FnOrder.lldBlock)
public void lldBlock()
throws AppException {

1
src/main/java/a8k/service/app/devicectrl/param/calibration/HbotLittleBSPosCalibration.java

@ -68,7 +68,6 @@ public class HbotLittleBSPosCalibration {
enableModule();
pipetteCtrlDriver.zMotorMoveZeroBlock();
hbotBaseMoveExDriver.moveToZero();
disableModule();
}
@ExtApiFn(name = "获取坐标", group = "测试工具", order = 2)

1
src/main/java/a8k/service/app/devicectrl/param/calibration/HbotProbeSubstancePosCalibration.java

@ -71,7 +71,6 @@ public class HbotProbeSubstancePosCalibration {
enableModule();
pipetteCtrlDriver.zMotorMoveZeroBlock();
hbotBaseMoveExDriver.moveToZero();
disableModule();
}
@ExtApiFn(name = "获取坐标", group = "测试工具", order = 2)

103
src/main/java/a8k/service/app/devicectrl/param/calibration/PipetteGunLLDParamCalibration.java

@ -3,9 +3,13 @@ package a8k.service.app.devicectrl.param.calibration;
import a8k.extapi_controler.pagecontrol.ExtApiTabConfig;
import a8k.extapi_controler.utils.ExtApiFn;
import a8k.extapi_controler.utils.ExtApiTab;
import a8k.hardware.type.LldType;
import a8k.service.app.devicectrl.driver.PipetteCtrlDriver;
import a8k.service.app.devicectrl.exdriver.HbotBaseMoveExDriver;
import a8k.service.app.devicectrl.exdriver.MotorEnableExDriver;
import a8k.service.app.devicectrl.param.param_mgr.PipetteGunLLDParamMgr;
import a8k.service.app.devicectrl.param.type.PipetteGunLLDParam;
import a8k.service.app.devicectrl.param.type.PipetteGunLLFParam;
import a8k.service.app.devicectrl.param.type.PipetteGunLLDThresholdParam;
import a8k.service.app.devicectrl.param.type.PipetteGunLLDTypeParam;
import a8k.type.exception.AppException;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
@ -17,16 +21,103 @@ public class PipetteGunLLDParamCalibration {
@Resource
PipetteGunLLDParamMgr pipetteGunLLDParamMgr;
@ExtApiFn(name = "获取相关参数", group = "基础", order = 1)
@Resource
PipetteCtrlDriver pipetteCtrlDriver;
@Resource
HbotBaseMoveExDriver hbotBaseMoveExDriver;
@Resource
MotorEnableExDriver motorEnableExDriver;
// 测试工具
// @ExtApiFn(name = "归零", group = "基础", order = 1)
// public void moveToZero() throws AppException {
// enableModule();
// pipetteCtrlDriver.zMotorMoveZeroBlock();
// }
@ExtApiFn(name = "移液枪初始化(Tip会掉落)", group = "基础", order = 2)
public void pipetteInitDeviceBlock() throws AppException {
pipetteCtrlDriver.pipetteInitDeviceBlock();
}
@ExtApiFn(name = "使能相关模块", group = "基础", order = 3)
public void enableModule() throws AppException {
pipetteCtrlDriver.zMotorEnable(1);
}
@ExtApiFn(name = "失能相关模块", group = "基础", order = 4)
public void disableModule() throws AppException {
motorEnableExDriver.forceDisableAllMotor();
}
@ExtApiFn(name = "获取相关参数", group = "基础", order = 5)
public Object getParams() throws AppException {
return pipetteGunLLDParamMgr.getParams();
}
@ExtApiFn(name = "设置参数", group = "设置", order = 1)
public void setParam(PipetteGunLLFParam param, Integer val) throws AppException {
pipetteGunLLDParamMgr.setParam(param.chName, val);
Integer lldStartPos;
Integer lldEndPos;
@ExtApiFn(name = "设置LLD开始位置", group = "测试", order = 100)
public void setStartTestPos() throws AppException {
pipetteCtrlDriver.zMotorEnable(1);
pipetteCtrlDriver.zMotorMeasureDistance();
lldStartPos = pipetteCtrlDriver.zMotorReadMeasureDistanceResult();
pipetteCtrlDriver.zMotorEnable(0);
}
@ExtApiFn(name = "设置LLD结束位置", group = "测试", order = 101)
public void setEndTestPos() throws AppException {
pipetteCtrlDriver.zMotorEnable(1);
pipetteCtrlDriver.zMotorMeasureDistance();
lldEndPos = pipetteCtrlDriver.zMotorReadMeasureDistanceResult();
pipetteCtrlDriver.zMotorEnable(0);
}
@ExtApiFn(name = "LLD准备(每次LLD前都要调用一次,同时更换tip头)", group = "测试", order = 102)
public void lldPrepare() throws AppException {
pipetteCtrlDriver.zMotorEnable(1);
pipetteCtrlDriver.zMotorMoveZeroBlock();
pipetteCtrlDriver.lldPrepareBlock();
}
@ExtApiFn(name = "LDD测量液体属性", group = "测试", order = 103)
public Object lldCalibrate() throws AppException {
if (lldStartPos > lldEndPos) {
throw AppException.of("开始位置大于结束位置");
}
pipetteCtrlDriver.zMotorEnable(1);
pipetteCtrlDriver.zMotorMoveZeroBlock();
pipetteCtrlDriver.setStartZ(lldStartPos);
pipetteCtrlDriver.setEndZ(lldEndPos);
pipetteCtrlDriver.lldCalibrationBlock();
return pipetteCtrlDriver.getSensorSampleData();
}
@ExtApiFn(name = "LLD测试", group = "测试", order = 104)
public void lldTest(LldType type, Integer c_val, Integer p_val) throws AppException {
pipetteCtrlDriver.zMotorEnable(1);
pipetteCtrlDriver.zMotorMoveZeroBlock();
pipetteCtrlDriver.setStartZ(lldStartPos);
pipetteCtrlDriver.setEndZ(lldEndPos);
pipetteCtrlDriver.setLldType(type);
pipetteCtrlDriver.setLldCThreshold(c_val);
pipetteCtrlDriver.setLldPThreshold(p_val);
pipetteCtrlDriver.lldBlock();
}
@ExtApiFn(name = "设置参数", group = "设置", order = 200)
public void setDefaultCThread(PipetteGunLLDThresholdParam param, Integer val) throws AppException {
pipetteGunLLDParamMgr.setParam(param, val);
}
@ExtApiFn(name = "设置默认LLD方式", group = "设置", order = 201)
public void setLLDType(PipetteGunLLDTypeParam param, LldType type) throws AppException {
pipetteGunLLDParamMgr.setParam(param, type.name());
}
}

16
src/main/java/a8k/service/app/devicectrl/param/ext_param_mgr/PipetteGunParamExMgr.java

@ -10,8 +10,8 @@ import a8k.service.app.devicectrl.param.param_mgr.HbotSamplePosParamMgr;
import a8k.service.app.devicectrl.param.param_mgr.PipetteGunLLDParamMgr;
import a8k.service.app.devicectrl.param.param_mgr.PipetteGunLLFParamMgr;
import a8k.service.app.devicectrl.param.type.A8kSamplePos;
import a8k.service.app.devicectrl.param.type.PipetteGunLLDParam;
import a8k.service.app.devicectrl.param.type.PipetteGunLLFParam;
import a8k.service.app.devicectrl.param.type.PipetteGunLLDThresholdParam;
import a8k.service.app.devicectrl.param.type.PipetteGunLLDTypeParam;
import a8k.type.ConsumableGroup;
import a8k.type.cfg.Pos3d;
import a8k.type.type.A8kTubeHolderType;
@ -50,11 +50,11 @@ public class PipetteGunParamExMgr {
Pos3d sampleEndPos = hbotSamplePosParamMgr.getSampleEndPos(samplePos);
paramPack = new LLDParamPack();
paramPack.type = LldType.kplld;
paramPack.type = pipetteGunLLDParamMgr.getLLDType(PipetteGunLLDTypeParam.DEFAULT_LLD_TYPE);
paramPack.startZ = sampleStartPos.z;
paramPack.endZ = sampleEndPos.z;
paramPack.cThreshold = pipetteGunLLDParamMgr.getParam(PipetteGunLLDParam.DEFAULT_C_THRESHOLD);
paramPack.pThreshold = pipetteGunLLDParamMgr.getParam(PipetteGunLLDParam.DEFAULT_P_THRESHOLD);
paramPack.cThreshold = pipetteGunLLDParamMgr.getLLDThresholdParam(PipetteGunLLDThresholdParam.DEFAULT_C_THRESHOLD);
paramPack.pThreshold = pipetteGunLLDParamMgr.getLLDThresholdParam(PipetteGunLLDThresholdParam.DEFAULT_P_THRESHOLD);
}
case TAKE_LARGE_BUFFER_SOLUTION -> {
ConsumableGroup group = cxt.consumable.getGroup();
@ -62,11 +62,11 @@ public class PipetteGunParamExMgr {
var sEndPos = hbotLargeBottleBSPosMgr.getSamplePosEnd(group);
paramPack = new LLDParamPack();
paramPack.type = LldType.kmixlld;
paramPack.type = pipetteGunLLDParamMgr.getLLDType(PipetteGunLLDTypeParam.DEFAULT_LLD_TYPE);
paramPack.startZ = sStartPos.z;
paramPack.endZ = sEndPos.z;
paramPack.cThreshold = pipetteGunLLDParamMgr.getParam(PipetteGunLLDParam.DEFAULT_C_THRESHOLD);
paramPack.pThreshold = pipetteGunLLDParamMgr.getParam(PipetteGunLLDParam.DEFAULT_P_THRESHOLD);
paramPack.cThreshold = pipetteGunLLDParamMgr.getLLDThresholdParam(PipetteGunLLDThresholdParam.DEFAULT_C_THRESHOLD);
paramPack.pThreshold = pipetteGunLLDParamMgr.getLLDThresholdParam(PipetteGunLLDThresholdParam.DEFAULT_P_THRESHOLD);
}
}

21
src/main/java/a8k/service/app/devicectrl/param/param_mgr/PipetteGunLLDParamMgr.java

@ -1,16 +1,12 @@
package a8k.service.app.devicectrl.param.param_mgr;
import a8k.hardware.type.LldType;
import a8k.service.app.devicectrl.param.param_mgr.base.ParamMgr;
import a8k.service.app.devicectrl.param.type.HbotTipPosParam;
import a8k.service.app.devicectrl.param.type.PipetteGunLLDParam;
import a8k.type.cfg.Pos3d;
import a8k.type.type.TipGroup;
import a8k.service.app.devicectrl.param.type.PipetteGunLLDThresholdParam;
import a8k.service.app.devicectrl.param.type.PipetteGunLLDTypeParam;
import jakarta.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
/**
* HBOT二维码扫描坐标参数
@ -21,12 +17,19 @@ public class PipetteGunLLDParamMgr extends ParamMgr {
@PostConstruct
void initialize() {
for (PipetteGunLLDParam param : PipetteGunLLDParam.values()) {
for (PipetteGunLLDThresholdParam param : PipetteGunLLDThresholdParam.values()) {
setParamChName(param, param.chName);
}
for (PipetteGunLLDTypeParam param : PipetteGunLLDTypeParam.values()) {
setParamChName(param, param.chName);
}
}
public Integer getParam(PipetteGunLLDParam param) {
public Integer getLLDThresholdParam(PipetteGunLLDThresholdParam param) {
return getParam(param, Integer.class);
}
public LldType getLLDType(PipetteGunLLDTypeParam param) {
return getParam(param, LldType.class);
}
}

5
src/main/java/a8k/service/app/devicectrl/param/type/PipetteGunLLDParam.java → src/main/java/a8k/service/app/devicectrl/param/type/PipetteGunLLDThresholdParam.java

@ -1,13 +1,12 @@
package a8k.service.app.devicectrl.param.type;
public enum PipetteGunLLDParam {
public enum PipetteGunLLDThresholdParam {
DEFAULT_C_THRESHOLD("默认电容C阈值"),
DEFAULT_P_THRESHOLD("默认压力阈值"),
DEFAULT_LLD_TYPE("默认LLD类型"),
;
public final String chName;
PipetteGunLLDParam(String chName) {
PipetteGunLLDThresholdParam(String chName) {
this.chName = chName;
}
}

11
src/main/java/a8k/service/app/devicectrl/param/type/PipetteGunLLDTypeParam.java

@ -0,0 +1,11 @@
package a8k.service.app.devicectrl.param.type;
public enum PipetteGunLLDTypeParam {
DEFAULT_LLD_TYPE("默认LLD类型"),
;
public final String chName;
PipetteGunLLDTypeParam(String chName) {
this.chName = chName;
}
}

1
src/main/java/a8k/service/app/devicectrl/script/DeviceCtrlScripter.java

@ -97,6 +97,7 @@ public class DeviceCtrlScripter {
void lld(PipetteGunBindActionType actionType, ProjProcessContext ctx) throws AppException {
log.info("液面探测 {}", actionType);
LLDParamPack lldparm = pipetteGunParamExMgr.getLLDParam(actionType, ctx);
Pos3d sampleStartPos = null;
Pos3d sampleEndPos = null;

14
src/main/java/a8k/type/ecode/AppCommonError.java

@ -0,0 +1,14 @@
package a8k.type.ecode;
import a8k.hardware.type.a8kcanprotocol.A8kEcode;
public class AppCommonError extends AppError {
public String exmsg;
public AppCommonError(String exmsg) {
super(A8kEcode.COMMON_ERROR);
this.exmsg = exmsg;
}
}

20
src/main/java/a8k/type/exception/AppException.java

@ -3,6 +3,8 @@ package a8k.type.exception;
import a8k.hardware.type.a8kcanprotocol.A8kEcode;
import a8k.hardware.type.a8kcanprotocol.CmdId;
import a8k.hardware.type.a8kcanprotocol.MId;
import a8k.type.ecode.AppCodeError;
import a8k.type.ecode.AppCommonError;
import a8k.type.ecode.AppError;
import a8k.type.ecode.HardwareError;
import lombok.Getter;
@ -17,23 +19,21 @@ public class AppException extends Exception {
public AppException(A8kEcode ecodeType) {
super(String.format("Error code %s", ecodeType));
super(String.format("%s", ecodeType));
this.error = new AppError(ecodeType);
}
public AppException(AppError error) {
super(String.format("Error code %s", error.code));
super(String.format("%s", error.toString()));
this.error = error;
}
public AppException(A8kEcode errorCode, MId mid, CmdId cmdId) {
super(String.format("Error code %s", errorCode));
this.error = new HardwareError(errorCode, mid, cmdId);
public static AppException of(A8kEcode errorCode, MId mid, CmdId cmdId) {
return new AppException(new HardwareError(errorCode, mid, cmdId));
}
public AppException(A8kEcode errorCode, MId mid) {
super(String.format("Error code %s", errorCode));
this.error = new HardwareError(errorCode, mid, null);
public static AppException of(A8kEcode errorCode, MId mid) {
return new AppException(new HardwareError(errorCode, mid, null));
}
@ -41,6 +41,10 @@ public class AppException extends Exception {
return new AppException(hardwareError);
}
public static AppException of(String message) {
return new AppException(new AppCommonError(message));
}
public void print() {
log.error("Apperror: {}", error);

BIN
src/main/resources/app.db

Loading…
Cancel
Save