From 12262cd4de0c7ffd3c515fded07e26b7ef4250be Mon Sep 17 00:00:00 2001 From: zhaohe Date: Mon, 29 Jul 2024 10:22:41 +0800 Subject: [PATCH] update --- src/main/java/a8k/appbean/cfg/HbotLimitArea.java | 36 +++ src/main/java/a8k/appbean/cfg/Pos3d.java | 4 + .../java/a8k/appbean/cfg/TipPickUpPosInfo.java | 10 +- src/main/java/a8k/canbus/A8kCanBusService.java | 11 + .../java/a8k/canbus/A8kModParamInitializer.java | 21 +- src/main/java/a8k/canbus/protocol/A8kPacket.java | 6 +- .../a8k/service/hardware/HbotControlService.java | 250 +++++++++++++-------- 7 files changed, 229 insertions(+), 109 deletions(-) create mode 100644 src/main/java/a8k/appbean/cfg/HbotLimitArea.java diff --git a/src/main/java/a8k/appbean/cfg/HbotLimitArea.java b/src/main/java/a8k/appbean/cfg/HbotLimitArea.java new file mode 100644 index 0000000..0ace487 --- /dev/null +++ b/src/main/java/a8k/appbean/cfg/HbotLimitArea.java @@ -0,0 +1,36 @@ +package a8k.appbean.cfg; + +public class HbotLimitArea { + + + public Integer topLX; + public Integer topLY; + + public Integer bottoLX; + public Integer bottoLY; + + public HbotLimitArea(Integer topLX, Integer topLY, Integer bottoLX, Integer bottoLY) { + this.topLX = topLX; + this.topLY = topLY; + this.bottoLX = bottoLX; + this.bottoLY = bottoLY; + } + + public HbotLimitArea() { + this.topLX = 0; + this.topLY = 0; + this.bottoLX = 0; + this.bottoLY = 0; + } + + public Boolean checkIsInArea(Integer x, Integer y) { + if (x >= topLX && x <= bottoLX && y >= topLY && y <= bottoLY) { + return true; + } + return false; + } + + public Boolean checkIsInArea(Pos2d pos) { + return checkIsInArea(pos.x, pos.y); + } +} diff --git a/src/main/java/a8k/appbean/cfg/Pos3d.java b/src/main/java/a8k/appbean/cfg/Pos3d.java index af046c4..23c24a9 100644 --- a/src/main/java/a8k/appbean/cfg/Pos3d.java +++ b/src/main/java/a8k/appbean/cfg/Pos3d.java @@ -13,4 +13,8 @@ public class Pos3d { this.y = y; this.z = z; } + + public Pos2d getXYPos() { + return new Pos2d(x, y); + } } diff --git a/src/main/java/a8k/appbean/cfg/TipPickUpPosInfo.java b/src/main/java/a8k/appbean/cfg/TipPickUpPosInfo.java index 73593f4..1972613 100644 --- a/src/main/java/a8k/appbean/cfg/TipPickUpPosInfo.java +++ b/src/main/java/a8k/appbean/cfg/TipPickUpPosInfo.java @@ -6,8 +6,8 @@ public class TipPickUpPosInfo { public Pos2d g1tl; public Pos2d g2tl; - public Double xSpacing; //x间隔 - public Double ySpacing; //y间隔 + public Integer xSpacing; //x间隔 + public Integer ySpacing; //y间隔 public Integer pickUpZPos; //拾取高度 @@ -18,12 +18,12 @@ public class TipPickUpPosInfo { g0tl = new Pos2d(0, 0); g1tl = new Pos2d(0, 0); g2tl = new Pos2d(0, 0); - xSpacing = 0.0; - ySpacing = 0.0; + xSpacing = 0; + ySpacing = 0; pickUpZPos = 0; } - public TipPickUpPosInfo(Pos2d g0tl, Pos2d g1tl, Pos2d g2tl, Double xSpacing, Double ySpacing, Integer pickUpZPos) { + public TipPickUpPosInfo(Pos2d g0tl, Pos2d g1tl, Pos2d g2tl, Integer xSpacing, Integer ySpacing, Integer pickUpZPos) { this.g0tl = g0tl; this.g1tl = g1tl; this.g2tl = g2tl; diff --git a/src/main/java/a8k/canbus/A8kCanBusService.java b/src/main/java/a8k/canbus/A8kCanBusService.java index 90f6dcc..42b263c 100644 --- a/src/main/java/a8k/canbus/A8kCanBusService.java +++ b/src/main/java/a8k/canbus/A8kCanBusService.java @@ -193,10 +193,21 @@ public class A8kCanBusService { callcmd(id.toInt(), CmdId.pipette_ctrl_init_device.toInt()); } + public void pipetteCtrlInitDeviceBlock(MId id, Integer actionOvertime) throws HardwareException, InterruptedException { + pipetteCtrlInitDevice(id); + waitForMod(id, actionOvertime); + } + public void pipetteCtrlPutTip(MId id) throws HardwareException { callcmd(id.toInt(), CmdId.pipette_ctrl_put_tip.toInt()); } + public void pipetteCtrlPutTipBlock(MId id) throws HardwareException, InterruptedException { + pipetteCtrlPutTip(id); + waitForMod(id, 10000); + } + + public void pipetteCtrlPrepare(MId id) throws HardwareException { callcmd(id.toInt(), CmdId.pipette_lld_prepare.toInt()); } diff --git a/src/main/java/a8k/canbus/A8kModParamInitializer.java b/src/main/java/a8k/canbus/A8kModParamInitializer.java index c4e45d0..da71432 100644 --- a/src/main/java/a8k/canbus/A8kModParamInitializer.java +++ b/src/main/java/a8k/canbus/A8kModParamInitializer.java @@ -48,18 +48,18 @@ public class A8kModParamInitializer implements AppEventListener { */ canBus.moduleSetReg(MId.FeedingModXM, RegIndex.kret_step_motor_pos_devi_tolerance, 5); canBus.moduleSetReg(MId.ShakeModClampingM, RegIndex.kret_step_motor_pos_devi_tolerance, 5); - canBus.moduleSetReg(MId.ShakeModGripperZM, RegIndex.kret_step_motor_pos_devi_tolerance, 5); + canBus.moduleSetReg(MId.ShakeModGripperZM, RegIndex.kret_step_motor_pos_devi_tolerance, 20); canBus.moduleSetReg(MId.ShakeModShakeM, RegIndex.kret_step_motor_pos_devi_tolerance, 5); canBus.moduleSetReg(MId.PlatesBoxYM, RegIndex.kret_step_motor_pos_devi_tolerance, 5); canBus.moduleSetReg(MId.PlatesBoxPusherM, RegIndex.kret_step_motor_pos_devi_tolerance, 5); canBus.moduleSetReg(MId.OptModPullM, RegIndex.kret_step_motor_pos_devi_tolerance, 5); canBus.moduleSetReg(MId.OptModScannerM, RegIndex.kret_step_motor_pos_devi_tolerance, 5); - canBus.moduleSetReg(MId.PipetteModZM, RegIndex.kret_step_motor_pos_devi_tolerance, 5); + canBus.moduleSetReg(MId.PipetteModZM, RegIndex.kret_step_motor_pos_devi_tolerance, 20); canBus.moduleSetReg(MId.IncubatorRotateCtrlM, RegIndex.kret_step_motor_pos_devi_tolerance, 5); canBus.moduleSetReg(MId.FeedingModXM, RegIndex.kret_step_motor_io_trigger_append_distance, 10); canBus.moduleSetReg(MId.ShakeModClampingM, RegIndex.kret_step_motor_io_trigger_append_distance, 10); - canBus.moduleSetReg(MId.ShakeModGripperZM, RegIndex.kret_step_motor_io_trigger_append_distance, 10); + canBus.moduleSetReg(MId.ShakeModGripperZM, RegIndex.kret_step_motor_io_trigger_append_distance, 20); canBus.moduleSetReg(MId.ShakeModShakeM, RegIndex.kret_step_motor_io_trigger_append_distance, 10); canBus.moduleSetReg(MId.PlatesBoxYM, RegIndex.kret_step_motor_io_trigger_append_distance, 10); canBus.moduleSetReg(MId.PlatesBoxPusherM, RegIndex.kret_step_motor_io_trigger_append_distance, 3); @@ -86,20 +86,19 @@ public class A8kModParamInitializer implements AppEventListener { canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_min_x, -100); canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_min_y, -100); - canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_min_x, -100); - canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_min_y, -100); - - canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_vstart, 1); canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_a1, 5); - canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_amax, 10); - canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_v1, 300); - canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_dmax, 10); + canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_amax, 15); + canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_v1, 100); + canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_dmax, 15); canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_d1, 5); canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_vstop, 1); canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_tzerowait, 300); - canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_one_circle_pulse, 7215); + canBus.moduleSetReg(MId.PipetteModZM, RegIndex.kreg_step_motor_default_velocity, 1500); + +// canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_run_to_zero_speed, 300); +// canBus.moduleSetReg(MId.HbotM, RegIndex.kreg_xyrobot_one_circle_pulse, 7215); // canBus.moduleSetReg(MId.OptModPullM, RegIndex.kreg_step_motor_run_to_zero_speed, 500); } diff --git a/src/main/java/a8k/canbus/protocol/A8kPacket.java b/src/main/java/a8k/canbus/protocol/A8kPacket.java index 3fee79d..2b5bd84 100644 --- a/src/main/java/a8k/canbus/protocol/A8kPacket.java +++ b/src/main/java/a8k/canbus/protocol/A8kPacket.java @@ -133,8 +133,10 @@ public class A8kPacket { return false; } if (CmdId.module_get_reg.equals(cmdid) || CmdId.module_set_reg.equals(cmdid)) { - RegIndex regIndex = RegIndex.valueOf(getContentI32(0)); - return regIndex != null; + if (getPacketType() == PACKET_TYPE_CMD) { + RegIndex regIndex = RegIndex.valueOf(getContentI32(0)); + return regIndex != null; + } } return true; } diff --git a/src/main/java/a8k/service/hardware/HbotControlService.java b/src/main/java/a8k/service/hardware/HbotControlService.java index fd800f6..b8a670e 100644 --- a/src/main/java/a8k/service/hardware/HbotControlService.java +++ b/src/main/java/a8k/service/hardware/HbotControlService.java @@ -10,12 +10,16 @@ import a8k.canbus.protocol.MId; import a8k.canbus.protocol.RegIndex; import a8k.service.db.entity.HardwareServiceSetting; import a8k.utils.*; +import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.annotation.Resource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; +import java.util.HashMap; +import java.util.Map; + /** * Hbot控制服务 @@ -43,6 +47,11 @@ public class HbotControlService implements HardwareCtrlModule { return settingReader.getInteger("ActionOvertime", 10000); } + @HardwareServiceParam(name = "归零超时事件", group = "基础配置") + public Integer getRuntoZeroActionOvertime() { + return settingReader.getInteger("RuntoZeroActionOvertime", 20000); + } + @HardwareServiceParam(name = "扫码超时时间", group = "基础配置") public Integer getScancodeOvertime() { return settingReader.getInteger("ActionOvertime", 1000); @@ -61,21 +70,21 @@ public class HbotControlService implements HardwareCtrlModule { public TipPickUpPosInfo getTipPickUpPosInfo() { return settingReader.getObject("TipPickUpPosInfo", TipPickUpPosInfo.class, new TipPickUpPosInfo( - new Pos2d(903, -11), - new Pos2d(0, 0), - new Pos2d(0, 0), - 92.4, - 92.4, - 0)); + new Pos2d(887, -15), + new Pos2d(887, -15), + new Pos2d(887, -15), + 92, + 92, + 585)); } @HardwareServiceParam(name = "Tip丢弃位置", group = "简单位置坐标") public Pos3d getTipDropPos() { return new Pos3d( - 0, - 0, - 0 + 4873, + 2563, + 661 ); } @@ -139,14 +148,22 @@ public class HbotControlService implements HardwareCtrlModule { return settingReader.getInteger("CommonAreaYLimit", 0); } + + @HardwareServiceParam(name = "Hbot采样区", group = "限制值") + public HbotLimitArea getSampleCollectionArea() { + return settingReader.getObject("HbotPublicArea", HbotLimitArea.class, + new HbotLimitArea(0, 0, 601, 3151)); + } + public Integer getGripperZeroYPos() { //之所以这样写,是因为是为了放置两个类之间的循环依赖 return appCxt.getBean(SamplesPreProcessModuleCtrlService.class).getGripperZeroYPos(); } - /* - * 基础方法 - */ + + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // 基础控制 + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ private void checkPublicArea() throws HardwareException { if (canBus.miniServoReadPos(MId.ShakeModGripperYSV) > getGripperZeroYPos() + 20) { logger.error("ShakeModGripperYSV Pos:{} > {}", canBus.miniServoReadPos(MId.ShakeModGripperYSV), getGripperZeroYPos() + 20); @@ -154,24 +171,55 @@ public class HbotControlService implements HardwareCtrlModule { } } - private void checkBeforeHbotRun(Pos2d targetPos) throws HardwareException { + /** + * Hboot 移动 + * @param targetPos 目标位置 + * @throws HardwareException e + * @throws InterruptedException e + */ + private void hbotCheckAndMoveTo(Pos3d targetPos) throws HardwareException, InterruptedException { if (!canBus.getIOState(IOId.PlateBoxCoverClosurePPS)) { throw new HardwareException(A8kEcode.PlateBoxNotCover); } - if (targetPos.y > getCommonAreaYLimit()) { - checkPublicArea(); - } + //Z轴归零 + canBus.stepMotorEnable(MId.PipetteModZM, 1); + canBus.stepMotorEasyMoveToZeroPointQuickBlock(MId.PipetteModZM, getActionOvertime()); if (!getZPPS()) { throw new HardwareException(A8kEcode.ZMNotAtZPosWhenHbotTryMove); } + Pos2d nowHbotPos = canBus.hbotReadPos(MId.HbotM); + HbotLimitArea sampleArea = getSampleCollectionArea(); + + //检查采样区域是否有障碍 + if (sampleArea.checkIsInArea(nowHbotPos) || sampleArea.checkIsInArea(targetPos.getXYPos())) { + checkPublicArea(); + } + + //HBot移动 + canBus.hbotEnable(MId.HbotM, 1); + canBus.hbotMoveToBlock(MId.HbotM, targetPos.x, targetPos.y, getRuntoZeroActionOvertime()); + + //Z轴移动 + zMoveTo(targetPos.z); + } + + + private void zMoveTo(Integer z) throws HardwareException, InterruptedException { + if (z == 0) { + canBus.stepMotorEasyMoveToZeroPointQuickBlock(MId.PipetteModZM, getActionOvertime()); + } else { + canBus.stepMotorEasyMoveToBlock(MId.PipetteModZM, z, getActionOvertime()); + } + } + + + private void hbotCheckAndMoveTo(Pos2d targetPos) throws HardwareException, InterruptedException { + hbotCheckAndMoveTo(new Pos3d(targetPos.x, targetPos.y, 0)); } - /** - * 下面脚本中涉及到的动作,如果正常结束,Z轴均移动的0位置。 - */ @HardwareServiceAction(name = "模块使能", group = "基础控制") @Override public void modGroupEnable(Boolean enable) throws HardwareException, InterruptedException { if (enable) { @@ -188,30 +236,77 @@ public class HbotControlService implements HardwareCtrlModule { @HardwareServiceAction(name = "模块归零", group = "基础控制") @Override public void modGroupMoveToZero() throws HardwareException, InterruptedException { + if (!canBus.getIOState(IOId.PlateBoxCoverClosurePPS)) { + throw new HardwareException(A8kEcode.PlateBoxNotCover); + } + + //归零前检查 checkPublicArea(); canBus.stepMotorEnable(MId.PipetteModZM, 1); - canBus.hbotEnable(MId.HbotM, 1); + canBus.stepMotorEasyMoveToZeroBlock(MId.PipetteModZM, getRuntoZeroActionOvertime()); - canBus.stepMotorEasyMoveToZeroBlock(MId.PipetteModZM, getActionOvertime()); + //丢弃tip + Pos3d dropPos = getTipDropPos(); + hbotCheckAndMoveTo(dropPos); + canBus.pipetteCtrlInitDeviceBlock(MId.PipetteMod, getRuntoZeroActionOvertime()); - checkBeforeHbotRun(new Pos2d(0, 0)); - canBus.hbotMoveToZeroBlock(MId.HbotM, getActionOvertime()); + //快速归零 + modGroupMoveToZeroQuick(); } @HardwareServiceAction(name = "模块快速归零", group = "基础控制") @Override public void modGroupMoveToZeroQuick() throws HardwareException, InterruptedException { - checkPublicArea(); - canBus.stepMotorEnable(MId.PipetteModZM, 1); - canBus.hbotEnable(MId.HbotM, 1); + hbotCheckAndMoveTo(new Pos2d(0, 0)); + } + + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // 单步测试 + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + @HardwareServiceAction(name = "丢Tip", group = "单步测试") + public void dropTip() throws HardwareException, InterruptedException { + Pos3d pos = getTipDropPos(); + hbotMoveTo(pos.x, pos.y); + zMoveTo(pos.z); + canBus.pipetteCtrlPutTip(MId.PipetteMod); + + } + @HardwareServiceAction(name = "取Tip", group = "单步测试") + public AppRet takeTip(Integer groupId, Integer index) throws HardwareException, InterruptedException { + logger.info("takeTip groupId:{} index:{}", groupId, index); + if (groupId > 2 || groupId < 0) { + throw new HardwareException(A8kEcode.ParamOutOfRange); + } + + if (index > TipPickUpPosInfo.ROW_MAX * TipPickUpPosInfo.COL_MAX || index < 0) { + throw new HardwareException(A8kEcode.ParamOutOfRange); + } + + TipPickUpPosInfo tipPos = getTipPickUpPosInfo(); + Pos2d pos = tipPos.getTipPos(groupId, index); + hbotMoveTo(pos.x, pos.y); + + canBus.stepMotorEasyMoveToBlock(MId.PipetteModZM, tipPos.pickUpZPos, getActionOvertime()); canBus.stepMotorEasyMoveToZeroPointQuickBlock(MId.PipetteModZM, getActionOvertime()); - checkBeforeHbotRun(new Pos2d(0, 0)); - canBus.hbotMoveToBlock(MId.HbotM, 0, 0, getActionOvertime()); - canBus.hbotMoveToZeroBlock(MId.HbotM, getActionOvertime()); + Boolean isGetTip = canBus.moduleGetReg(MId.PipetteMod, RegIndex.kreg_pipette_tip_state) == 1; + if (!isGetTip) { + logger.error("takeTip fail"); + } + return AppRet.success(isGetTip); + } + + @HardwareServiceAction(name = "HBot移动到", group = "单步测试") + public void hbotMoveTo(Integer x, Integer y) throws HardwareException, InterruptedException { + hbotCheckAndMoveTo(new Pos2d(x, y)); } + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // 坐标获取工具 + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + @HardwareServiceAction(name = "Hbot使能", group = "坐标获取工具") public void hBotEnable() throws HardwareException, InterruptedException { canBus.hbotEnable(MId.HbotM, 1); @@ -232,74 +327,47 @@ public class HbotControlService implements HardwareCtrlModule { canBus.stepMotorEnable(MId.PipetteModZM, 0); } - @HardwareServiceAction(name = "读取Z轴坐标", group = "坐标获取工具") + @HardwareServiceAction(name = "归零读取Z轴坐标", group = "坐标获取工具") public AppRet readZAxisPosByMoveToZero() throws HardwareException, InterruptedException { return AppRet.success(canBus.stepMotorReadPosByMoveToZeroBlock(MId.PipetteModZM, getActionOvertime())); } - @HardwareServiceAction(name = "HBot移动到", group = "基础控制") - public void hbotMoveTo(Integer x, Integer y) throws HardwareException, InterruptedException { - checkPublicArea(); - checkBeforeHbotRun(new Pos2d(x, y)); - - canBus.hbotEnable(MId.HbotM, 1); - - canBus.hbotMoveToBlock(MId.HbotM, x - 20, y - 20, getActionOvertime()); - canBus.hbotMoveToBlock(MId.HbotM, x, y - 15, getActionOvertime()); - // Thread.sleep(200); - canBus.hbotMoveToBlock(MId.HbotM, x, y, getActionOvertime()); - } - - public void zMoveTo(Integer z) throws HardwareException, InterruptedException { - canBus.stepMotorEasyMoveToBlock(MId.PipetteModZM, z, getActionOvertime()); - } - - //取tip - @HardwareServiceAction(name = "取Tip", group = "单步操作") - public AppRet takeTip(Integer groupId, Integer index) throws HardwareException, InterruptedException { - logger.info("takeTip groupId:{} index:{}", groupId, index); - if (groupId > 2 || groupId < 0) { - throw new HardwareException(A8kEcode.ParamOutOfRange); - } - - if (index > TipPickUpPosInfo.ROW_MAX * TipPickUpPosInfo.COL_MAX || index < 0) { - throw new HardwareException(A8kEcode.ParamOutOfRange); - } - + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // 测试 + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Boolean testTakeTipFlag; + private AppRet takeTipTestStep(Integer groupId, Integer index) throws HardwareException, InterruptedException { + var ret = takeTip(groupId, index); TipPickUpPosInfo tipPos = getTipPickUpPosInfo(); - Pos2d pos = tipPos.getTipPos(groupId, index); - hbotMoveTo(pos.x, pos.y); - canBus.stepMotorEasyMoveToBlock(MId.PipetteModZM, tipPos.pickUpZPos, getActionOvertime()); + canBus.stepMotorEasyMoveToBlock(MId.PipetteModZM, tipPos.pickUpZPos - 100, getActionOvertime()); + canBus.pipetteCtrlPutTipBlock(MId.PipetteMod); canBus.stepMotorEasyMoveToZeroPointQuickBlock(MId.PipetteModZM, getActionOvertime()); + return ret; + } - Boolean isGetTip = canBus.moduleGetReg(MId.PipetteMod, RegIndex.kreg_pipette_tip_state) == 1; - if (!isGetTip) { - logger.error("takeTip fail"); + @HardwareServiceAction(name = "取全部Tip", group = "测试脚本") + public AppRet> testTakeAllTip(Integer group, Integer startFrom) throws HardwareException, InterruptedException { + // ObjectMapper mapper = new ObjectMapper(); + testTakeTipFlag = true; + Map result = new HashMap<>(); + for (int i = startFrom; i < TipPickUpPosInfo.COL_MAX * TipPickUpPosInfo.ROW_MAX; i++) { + var ret = takeTipTestStep(group, i); + result.put("Tip" + i, ret.getData() ? "suc" : "fail"); + logger.info("Take Tip {}-{} => {}", group, i, ret.getData()); + if (!testTakeTipFlag) { + break; + } } - return AppRet.success(isGetTip); + return AppRet.success(result); } - @HardwareServiceAction(name = "取Tip测试", group = "测试") - public AppRet takeTipTest(Integer groupId, Integer index) throws HardwareException, InterruptedException { - var ret = takeTip(groupId, index); - TipPickUpPosInfo tipPos = getTipPickUpPosInfo(); - - canBus.stepMotorEasyMoveToBlock(MId.PipetteModZM, tipPos.pickUpZPos, getActionOvertime()); - canBus.pipetteCtrlPutTip(MId.PipetteMod); - canBus.stepMotorEasyMoveToZeroPointQuickBlock(MId.PipetteModZM, getActionOvertime()); - return ret; + @HardwareServiceAction(name = "停止取全部Tip", group = "测试脚本") + public void testTakeAllTipStop() throws HardwareException, InterruptedException { + testTakeTipFlag = false; } - //丢tip - @HardwareServiceAction(name = "丢Tip", group = "单步操作") - public void dropTip() throws HardwareException, InterruptedException { - Pos3d pos = getTipDropPos(); - hbotMoveTo(pos.x, pos.y); - zMoveTo(pos.z); - canBus.pipetteCtrlPutTip(MId.PipetteMod); - } private AppRet hBotMoveToAndScan(Pos2d pos) throws HardwareException, InterruptedException { hbotMoveTo(pos.x, pos.y); @@ -353,27 +421,27 @@ public class HbotControlService implements HardwareCtrlModule { } - // @HardwareServiceStatus(name = "Z轴光电⬆") + @HardwareServiceStatus(name = "Z轴光电⬆") public Boolean getZPPS() throws HardwareException { return canBus.stepMotorReadIoState(MId.PipetteModZM, 0); } - // @HardwareServiceStatus(name = "X轴光电➡") + @HardwareServiceStatus(name = "X轴光电➡") public Boolean getXPPS() throws HardwareException { return canBus.hbotReadInio(MId.HbotM, 0); } - // @HardwareServiceStatus(name = "Y轴光电⬇") + @HardwareServiceStatus(name = "Y轴光电⬇") public Boolean getYPPS() throws HardwareException { return canBus.hbotReadInio(MId.HbotM, 1); } - // @HardwareServiceStatus(name = "TipState") - // public Boolean getTipPPS() throws HardwareException { - // return canBus.moduleGetReg(MId.PipetteMod, RegIndex.kreg_pipette_tip_state) == 1; - // } + // @HardwareServiceStatus(name = "TipState") + public Boolean getTipPPS() throws HardwareException { + return canBus.moduleGetReg(MId.PipetteMod, RegIndex.kreg_pipette_tip_state) == 1; + } -// @HardwareServiceStatus(name = "HbotPos") + @HardwareServiceStatus(name = "HbotPos") public String getPos() throws HardwareException { Pos2d pos = canBus.hbotReadPos(MId.HbotM); return pos.toString();