7 changed files with 159 additions and 132 deletions
-
2src/main/java/a8k/app/a8ktype/ui/ZAppPromopt.java
-
4src/main/java/a8k/extui/mgr/ExtApiPageGroupCfgMgr.java
-
68src/main/java/a8k/extui/page/measurement/HbotFreedomPosMeasurePage.java
-
108src/main/java/a8k/extui/page/measurement/HbotPosMeasurePage.java
-
96src/main/java/a8k/extui/page/measurement/HbotPosMeasurePageBak.java
-
2src/main/java/a8k/extui/type/ExtApiStatu.java
-
11src/main/resources/db/zapp_a8k_pos_parameter.csv
@ -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); |
||||
|
} |
||||
|
} |
@ -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); |
|
||||
} |
|
||||
} |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue