From b380259677bc14f18ae1af0f8a35e8f9ca3fc83a Mon Sep 17 00:00:00 2001 From: zhaohe Date: Thu, 17 Oct 2024 11:43:19 +0800 Subject: [PATCH] update --- app.db | Bin 225280 -> 225280 bytes .../calibration/HbotConsumablePosCalibration.java | 50 ++++++++++++--------- .../app/devicedriver/ctrl/HbotControler.java | 6 +-- src/main/java/a8k/type/TipColumnNum.java | 2 +- src/main/java/a8k/type/TipRowNum.java | 2 +- 5 files changed, 35 insertions(+), 25 deletions(-) diff --git a/app.db b/app.db index e902213856a617f247fcb993ee6ca625f8bd9bab..6f968439ca20dc72e3d2fbc9444645f882755e13 100644 GIT binary patch delta 383 zcmZp8z}xVEcY?IwE(Qh$b09VYVig7kPP2(R#;m&-^vb$6rtCe>YrrmUY|PjaTauWR zlRDY)g79X?3-*kR`kNas$}lnNZJu}eHzT9&=2=%CGBWCHuDO1UozbA#`F^|eea7w1 z_nGzuurZ%w&}UjZo!x*rl#A&zcRbTt7IWs0n*{~jnV4M4r#l!kD^1TcVHT9MG}N;& zFfy<(h5^q~HU?8&amVR~*35F#+pU=eM2$=gO?8wim8^7)40M#Ll&nn6Eo-OS88c5{ zVPDOlJbk@6vpkbaCEQdlg$S4YQlQg8hMOQkW6uhN;WE>;OqhkFjV(>gQ4O~+taT~? zshhsglv#ZHd=utQHfAfcvgsEO%Apwz)F&;? VKi$xpS!6o*LMFcL=dGCyO#s4cQUm}1 diff --git a/src/main/java/a8k/service/app/devicedriver/calibration/HbotConsumablePosCalibration.java b/src/main/java/a8k/service/app/devicedriver/calibration/HbotConsumablePosCalibration.java index 2d33226..5102197 100644 --- a/src/main/java/a8k/service/app/devicedriver/calibration/HbotConsumablePosCalibration.java +++ b/src/main/java/a8k/service/app/devicedriver/calibration/HbotConsumablePosCalibration.java @@ -104,45 +104,54 @@ public class HbotConsumablePosCalibration { TipGroup tipGroup; List tipRefPosList; - Pos3d tip000 = new Pos3d(0, 0, 0); + Pos3d tip000; Double tipdx; Double tipdy; - // TipRefPoint findTipRefPoint(TipRowNum row, TipColumnNum col) { - // for (TipRefPoint tipRefPoint : tipRefPosList) { - // if (tipRefPoint.row == row && tipRefPoint.col == col) { - // return tipRefPoint; - // } - // } - // return null; - // } @ExtApiFn(name = "开始标定Tip坐标", group = "标定TIP坐标", order = 20) - public void startCalibrateTipPos(TipGroup tipGroup) { + public void startCalibrateTipPos(TipGroup tipGroup) throws AppException { this.tipGroup = tipGroup; tipRefPosList = new java.util.ArrayList<>(); + deviceReset(); + disableModule(); + tipdx = 0.0; + tipdy = 0.0; + tip000 = new Pos3d(0, 0, 0); } @ExtApiFn(name = "添加Tip参考点", group = "标定TIP坐标", order = 21) - public void addTipPosRefPoint(TipRowNum row, TipColumnNum columnNum) throws AppException { + public Object addTipPosRefPoint(TipRowNum row, TipColumnNum columnNum) throws AppException { enableModule(); Pos2d xypos = hbotModule.readPos(); pipetteCtrlModule.zMotorMeasureDistance(); Integer z = pipetteCtrlModule.zMotorReadMeasureDistanceResult(); pipetteCtrlModule.putTipBlock(); - tipRefPosList.add(new TipRefPoint(row, columnNum, new Pos3d(xypos.x, xypos.y, z))); + TipRefPoint tipRefPoint = new TipRefPoint(row, columnNum, new Pos3d(xypos.x, xypos.y, z)); + tipRefPosList.add(tipRefPoint); disableModule(); + + Map ret = new java.util.HashMap<>(); + ret.put("newPoint", tipRefPoint); + ret.put("computeResult", computeTipGroupPos()); + return ret; } - @ExtApiFn(name = "获取Tip参考点", group = "标定TIP坐标", order = 22) - public List getTipRefPosList() { - return tipRefPosList; + @ExtApiFn(name = "删除上一个Tip参考点", group = "标定TIP坐标", order = 22) + public Object removeTipPosRefPoint() throws AppException { + if (!tipRefPosList.isEmpty()) { + tipRefPosList.remove(tipRefPosList.size() - 1); + } + Map ret = new java.util.HashMap<>(); + ret.put("computeResult", computeTipGroupPos()); + return ret; } + @ExtApiFn(name = "计算Tip坐标", group = "标定TIP坐标", order = 23) public ObjectNode computeTipGroupPos() throws AppException { - TipRefPoint tip_ref_01_01 = tipRefPosList.stream().filter(tipRefPoint -> tipRefPoint.eq(TipRowNum.ROW01, TipColumnNum.Colu01)).findFirst().orElse(null); + TipRefPoint tip_ref_01_01 = tipRefPosList.stream().filter(tipRefPoint -> tipRefPoint.eq(TipRowNum.ROW00, TipColumnNum.Colu00)).findFirst().orElse(null); if (tip_ref_01_01 == null) { throw new AppException(A8kEcode.CALIBRATION_TIP_REF_POINT_NOT_ENOUGH); @@ -151,13 +160,13 @@ public class HbotConsumablePosCalibration { //计算tip01_01_x,取所有第一列tip坐标x的平局值 Double tip01_01_x = ZSimplAlgo.computeAverage( - tipRefPosList.stream().filter(tipRefPoint -> tipRefPoint.col == TipColumnNum.Colu01). + tipRefPosList.stream().filter(tipRefPoint -> tipRefPoint.col == TipColumnNum.Colu00). map(tipRefPoint -> Double.valueOf(tipRefPoint.pos.x)).toList() ); //计算tip01_01_y,取所有第1行tip坐标y的平局值 Double tip01_01_y = ZSimplAlgo.computeAverage( - tipRefPosList.stream().filter(tipRefPoint -> tipRefPoint.row == TipRowNum.ROW01). + tipRefPosList.stream().filter(tipRefPoint -> tipRefPoint.row == TipRowNum.ROW00). map(tipRefPoint -> Double.valueOf(tipRefPoint.pos.y)).toList() ); @@ -167,12 +176,12 @@ public class HbotConsumablePosCalibration { ); //计算dx,所有点到tip01_01的距离除以行数 之后的平均值 Double dx = ZSimplAlgo.computeAverage( - tipRefPosList.stream().filter(point -> !point.col.equals(TipColumnNum.Colu01)). + tipRefPosList.stream().filter(point -> !point.col.equals(TipColumnNum.Colu00)). map(point -> Math.abs(point.pos.x - Double.valueOf(tip_ref_01_01.pos.x)) / point.col.ordinal()).toList() ); //计算dy,所有点到tip01_01的距离除以列数 之后的平均值 Double dy = ZSimplAlgo.computeAverage( - tipRefPosList.stream().filter(point -> !point.row.equals(TipRowNum.ROW01)). + tipRefPosList.stream().filter(point -> !point.row.equals(TipRowNum.ROW00)). map(point -> Math.abs(point.pos.y - Double.valueOf(tip_ref_01_01.pos.y)) / point.row.ordinal()).toList() ); @@ -190,6 +199,7 @@ public class HbotConsumablePosCalibration { return node; } + @ExtApiFn(name = "保存计算结果", group = "标定TIP坐标", order = 24) public void saveTipGroupPos() throws AppException { hbotConsumablePosMgr.setTipGroupParam(tipGroup, tip000, tipdx, tipdy); diff --git a/src/main/java/a8k/service/app/devicedriver/ctrl/HbotControler.java b/src/main/java/a8k/service/app/devicedriver/ctrl/HbotControler.java index 63300b9..5f65209 100644 --- a/src/main/java/a8k/service/app/devicedriver/ctrl/HbotControler.java +++ b/src/main/java/a8k/service/app/devicedriver/ctrl/HbotControler.java @@ -60,9 +60,9 @@ public class HbotControler { //取tip pipetteCtrlModule.zMotorMoveToBlock(tipPos.z - 100); -// if (!pipetteCtrlModule.isHasTip()) { -// throw new AppException(A8kEcode.APPE_TAKE_TIP_FAIL); -// } + if (!pipetteCtrlModule.isHasTip()) { + throw new AppException(A8kEcode.APPE_TAKE_TIP_FAIL); + } //丢tip pipetteCtrlModule.putTipBlock(); diff --git a/src/main/java/a8k/type/TipColumnNum.java b/src/main/java/a8k/type/TipColumnNum.java index 592b0e8..2a80b0b 100644 --- a/src/main/java/a8k/type/TipColumnNum.java +++ b/src/main/java/a8k/type/TipColumnNum.java @@ -1,6 +1,7 @@ package a8k.type; public enum TipColumnNum { + Colu00, Colu01, Colu02, Colu03, @@ -12,5 +13,4 @@ public enum TipColumnNum { Colu09, Colu10, Colu11, - Colu12, } diff --git a/src/main/java/a8k/type/TipRowNum.java b/src/main/java/a8k/type/TipRowNum.java index 6f1efea..3e250e0 100644 --- a/src/main/java/a8k/type/TipRowNum.java +++ b/src/main/java/a8k/type/TipRowNum.java @@ -1,6 +1,7 @@ package a8k.type; public enum TipRowNum { + ROW00, ROW01, ROW02, ROW03, @@ -10,5 +11,4 @@ public enum TipRowNum { ROW07, ROW08, ROW09, - ROW10, }