@ -19,7 +19,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory ;
import org.springframework.stereotype.Component ;
/ * *
* Hbot控制服务
* /
@ -29,43 +28,43 @@ import org.springframework.stereotype.Component;
public class HbotControlService {
static Logger logger = LoggerFactory . getLogger ( HbotControlService . class ) ;
@Resource
A8kCanBusService canBus ;
A8kCanBusService canBus ;
@Resource
HardwareCommonCtrl hcc ;
@Resource
TimeParam timep ;
TimeParam timep ;
@Resource
PosParam pp ;
PosParam pp ;
@Resource
DebugParam dp ;
DebugParam dp ;
/ /
public Integer getGripperZeroYPos ( ) {
/ / 之所以这样写 , 是因为是为了放置两个类之间的循环依赖
/ / assert appCxt ! = null ;
/ / TODO
/ / return appCxt . getBean ( SamplesPreProcessModuleCtrlService . class ) . getGripperZeroYPos ( ) ;
/ / 之所以这样写 , 是因为是为了放置两个类之间的循环依赖
/ / assert appCxt ! = null ;
/ / TODO
/ / return
/ / appCxt . getBean ( SamplesPreProcessModuleCtrlService . class ) . getGripperZeroYPos ( ) ;
return 0 ;
}
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/ / 基础控制
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/ / 基础控制
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
private void checkPublicArea ( ) throws HardwareException {
if ( canBus . miniServoReadPos ( MId . ShakeModGripperYSV ) > getGripperZeroYPos ( ) + 20 ) {
logger . error ( "ShakeModGripperYSV Pos:{} > {}" , canBus . miniServoReadPos ( MId . ShakeModGripperYSV ) , getGripperZeroYPos ( ) + 20 ) ;
logger . error ( "ShakeModGripperYSV Pos:{} > {}" , canBus . miniServoReadPos ( MId . ShakeModGripperYSV ) ,
getGripperZeroYPos ( ) + 20 ) ;
throw new HardwareException ( A8kEcode . ShakeModGripperYSVInXYPublicArea ) ;
}
}
/ * *
* Hboot 移动
*
* @param targetPos 目标位置
* @throws HardwareException e
* @throws HardwareException e
* @throws InterruptedException e
* /
public void hbotCheckAndMoveTo ( Pos3d targetPos ) throws HardwareException , InterruptedException {
@ -74,7 +73,7 @@ public class HbotControlService {
throw new HardwareException ( A8kEcode . PlateBoxNotCover ) ;
}
boolean zEnable = true ;
boolean zEnable = true ;
boolean hbotEnable = canBus . moduleGetReg ( MId . HbotM , RegIndex . kreg_xyrobot_is_enable ) = = 1 ;
if ( canBus . moduleGetReg ( MId . PipetteModZM , RegIndex . kreg_step_motor_is_enable ) = = 0 ) {
canBus . stepMotorEnable ( MId . PipetteModZM , 1 ) ;
@ -82,31 +81,30 @@ public class HbotControlService {
zEnable = false ;
}
/ / Z轴归零
/ / Z轴归零
if ( ! getZPPS ( ) ) {
canBus . stepMotorEnable ( MId . PipetteModZM , 1 ) ;
canBus . stepMotorEasyMoveToZeroPointQuickBlock ( MId . PipetteModZM , timep . getActionOvertime ( ) ) ;
}
if ( ! getZPPS ( ) ) {
throw new HardwareException ( A8kEcode . ZMNotAtZPosWhenHbotTryMove ) ;
}
Pos2d nowHbotPos = canBus . hbotReadPos ( MId . HbotM ) ;
Pos2d nowHbotPos = canBus . hbotReadPos ( MId . HbotM ) ;
HbotLimitArea sampleArea = pp . getSampleCollectionArea ( ) ;
/ / 检查采样区域是否有障碍
/ / 检查采样区域是否有障碍
if ( sampleArea . checkIsInArea ( nowHbotPos ) | | sampleArea . checkIsInArea ( targetPos . getXYPos ( ) ) ) {
checkPublicArea ( ) ;
}
/ / HBot移动
/ / HBot移动
canBus . hbotEnable ( MId . HbotM , 1 ) ;
canBus . hbotMoveToBlock ( MId . HbotM , targetPos . x - 20 , targetPos . y - 20 , timep . getActionOvertime ( ) ) ;
canBus . hbotMoveToBlock ( MId . HbotM , targetPos . x , targetPos . y , timep . getActionOvertime ( ) ) ;
canBus . hbotMoveToBlock ( MId . HbotM , targetPos . x , targetPos . y , timep . getActionOvertime ( ) ) ;
/ / Z轴移动
/ / Z轴移动
if ( targetPos . z ! = 0 ) {
canBus . stepMotorEnable ( MId . PipetteModZM , 1 ) ;
canBus . stepMotorEasyMoveToZeroPointQuickBlock ( MId . PipetteModZM , timep . getActionOvertime ( ) ) ;
@ -116,7 +114,6 @@ public class HbotControlService {
canBus . hbotEnable ( MId . HbotM , hbotEnable ? 1 : 0 ) ;
}
public void zMoveTo ( Integer z ) throws HardwareException , InterruptedException {
if ( z = = 0 ) {
canBus . stepMotorEasyMoveToZeroPointQuickBlock ( MId . PipetteModZM , timep . getActionOvertime ( ) ) ;
@ -125,18 +122,16 @@ public class HbotControlService {
}
}
private void hbotCheckAndMoveTo ( Pos2d targetPos ) throws HardwareException , InterruptedException {
hbotCheckAndMoveTo ( new Pos3d ( targetPos . x , targetPos . y , 0 ) ) ;
}
private 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 ) ;
@ -144,12 +139,12 @@ public class HbotControlService {
canBus . stepMotorEasyMoveToZeroBlock ( MId . PipetteModZM , timep . getActionOvertime ( ) ) ;
canBus . hbotMoveToZeroBlock ( MId . HbotM , timep . getHbotRuntoZeroActionOvertime ( ) ) ;
/ / 丢弃tip
/ / 丢弃tip
Pos3d dropPos = pp . getTipDropPos ( ) ;
hbotCheckAndMoveTo ( dropPos ) ;
canBus . pipetteCtrlInitDeviceBlock ( MId . PipetteMod , timep . getActionOvertime ( ) ) ;
/ / 快速归零
/ / 快速归零
modGroupMoveToZeroQuick ( ) ;
}
@ -157,9 +152,9 @@ public class HbotControlService {
hbotCheckAndMoveTo ( new Pos2d ( 0 , 0 ) ) ;
}
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/ / 单步测试
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/ / 单步测试
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@EnginnerPageAction ( name = "丢Tip" , group = "单步测试" )
public void dropTip ( ) throws HardwareException , InterruptedException {
@ -182,7 +177,7 @@ public class HbotControlService {
}
TipPickUpPosInfo tipPos = pp . getTipPickUpPosInfo ( ) ;
Pos2d pos = tipPos . getTipPos ( groupId , index ) ;
Pos2d pos = tipPos . getTipPos ( groupId , index ) ;
hbotMoveTo ( pos . x , pos . y ) ;
Integer zCompensate = 0 ;
@ -190,8 +185,8 @@ public class HbotControlService {
zCompensate = 2 ;
}
canBus . stepMotorEasyMoveToBlock ( MId . PipetteModZM , tipPos . getPickUpZPos ( groupId ) + zCompensate , timep . getActionOvertime ( ) ) ;
canBus . stepMotorEasyMoveToBlock ( MId . PipetteModZM , tipPos . getPickUpZPos ( groupId ) + zCompensate ,
timep . getActionOvertime ( ) ) ;
canBus . stepMotorEasyMoveToZeroPointQuickBlock ( MId . PipetteModZM , timep . getActionOvertime ( ) ) ;
Boolean isGetTip = canBus . moduleGetReg ( MId . PipetteMod , RegIndex . kreg_pipette_tip_state ) = = 1 ;
@ -207,7 +202,8 @@ public class HbotControlService {
}
@EnginnerPageAction ( name = "HBot移动到小瓶缓冲液X孔" , group = "单步测试" )
public void hbotMoveToSmallBottleGroup ( ConsumableGroup group , Integer Xhole ) throws HardwareException , InterruptedException {
public void hbotMoveToSmallBottleGroup ( ConsumableGroup group , Integer Xhole )
throws HardwareException , InterruptedException {
BottleGroupsPosInfo posInfo = pp . getBottleBufferPosInfo ( ) ;
if ( Xhole < 0 | | Xhole > BottlesPosInfo . cgetMAX ( ) ) {
throw new HardwareException ( A8kEcode . ParamOutOfRange ) ;
@ -216,9 +212,9 @@ public class HbotControlService {
hbotCheckAndMoveTo ( pos ) ;
}
@EnginnerPageAction ( name = "HBot移动到探测物质X孔" , group = "单步测试" )
public void hbotMoveToDetectMaterialPos ( ConsumableGroup group , Integer Xhole ) throws HardwareException , InterruptedException {
public void hbotMoveToDetectMaterialPos ( ConsumableGroup group , Integer Xhole )
throws HardwareException , InterruptedException {
BottleGroupsPosInfo posInfo = pp . getBottleBufferPosInfo ( ) ;
if ( Xhole < 0 | | Xhole > BottlesPosInfo . cgetMAX ( ) ) {
throw new HardwareException ( A8kEcode . ParamOutOfRange ) ;
@ -230,7 +226,7 @@ public class HbotControlService {
@EnginnerPageAction ( name = "HBot移动到大瓶缓冲液X孔" , group = "单步测试" )
public void hbotMoveToLargeBottleGroup ( ConsumableGroup ch ) throws HardwareException , InterruptedException {
LargeBottleBufferPos posInfo = pp . getLargeBottleBufferPosInfo ( ) ;
Pos2d pos = posInfo . cgetBottlePos ( ch . off ) ;
Pos2d pos = posInfo . cgetBottlePos ( ch . off ) ;
hbotCheckAndMoveTo ( pos ) ;
}
@ -239,9 +235,9 @@ public class HbotControlService {
hbotCheckAndMoveTo ( pp . getEmergencyPos ( ) ) ;
}
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/ / 坐标获取工具
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/ / 坐标获取工具
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@EnginnerPageAction ( name = "Hbot使能" , group = "坐标获取工具" )
public void hBotEnable ( ) throws HardwareException , InterruptedException {
@ -285,9 +281,9 @@ public class HbotControlService {
hbotRefPos . y = y ;
}
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/ / hbot移动到并扫码
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/ / hbot移动到并扫码
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
private AppRet < String > hBotMoveToAndScan ( Pos2d pos ) throws HardwareException , InterruptedException {
hbotCheckAndMoveTo ( pos ) ;
@ -296,31 +292,31 @@ public class HbotControlService {
return AppRet . success ( result ) ;
}
/ / 扫描板夹仓二维码
/ / 扫描板夹仓二维码
@EnginnerPageAction ( name = "扫描板夹仓二维码" , group = "扫码" )
public AppRet < String > scanPlatesCode ( ConsumableGroup ch ) throws HardwareException , InterruptedException {
var posInfo = pp . getPlates2dCodeScanPosInfo ( ) ;
return hBotMoveToAndScan ( posInfo . cgetScanPos ( ch . off ) ) ;
}
/ / 扫描缓冲液二维码
/ / 扫描缓冲液二维码
@EnginnerPageAction ( name = "扫描缓冲液区二维码" , group = "扫码" )
public AppRet < String > scanBottleBuffersCode ( ConsumableGroup group ) throws HardwareException , InterruptedException {
BottleGroupsPosInfo posInfo = pp . getBottleBufferPosInfo ( ) ;
return hBotMoveToAndScan ( posInfo . cgetScanPos ( group . ordinal ( ) ) ) ;
}
/ / 扫描大缓冲液二维码
/ / 扫描大缓冲液二维码
@EnginnerPageAction ( name = "扫描大缓冲液二维码" , group = "扫码" )
public AppRet < String > scanBigBottleBufferCode ( ConsumableGroup group ) throws HardwareException , InterruptedException {
public AppRet < String > scanBigBottleBufferCode ( ConsumableGroup group )
throws HardwareException , InterruptedException {
LargeBottleBufferPos posInfo = pp . getLargeBottleBufferPosInfo ( ) ;
return hBotMoveToAndScan ( posInfo . cgetScanPos ( group . off ) ) ;
}
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/ / hbot取样品
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/ / hbot取样品
/ / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
public Boolean getZPPS ( ) throws HardwareException {
return canBus . stepMotorReadIoState ( MId . PipetteModZM , 0 ) ;