|
@ -6,6 +6,7 @@ import a8k.canbus.protocol.IOId; |
|
|
import a8k.canbus.protocol.MId; |
|
|
import a8k.canbus.protocol.MId; |
|
|
import a8k.appbean.ecode.AppRet; |
|
|
import a8k.appbean.ecode.AppRet; |
|
|
import a8k.canbus.A8kCanBusService; |
|
|
import a8k.canbus.A8kCanBusService; |
|
|
|
|
|
import a8k.opt_algo.A8kOptAlgo; |
|
|
import a8k.utils.*; |
|
|
import a8k.utils.*; |
|
|
import jakarta.annotation.Resource; |
|
|
import jakarta.annotation.Resource; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.Logger; |
|
@ -28,7 +29,12 @@ public class ReactionPlatesTransmitCtrlService implements HardwareCtrlModule { |
|
|
|
|
|
|
|
|
@HardwareServiceParam(name = "动作超时时间", group = "基础参数") |
|
|
@HardwareServiceParam(name = "动作超时时间", group = "基础参数") |
|
|
public Integer getActionOvertime() { |
|
|
public Integer getActionOvertime() { |
|
|
return hpReader.getInteger("actionOvertime", 10000); |
|
|
|
|
|
|
|
|
return hpReader.getInteger("actionOvertime", 7000); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@HardwareServiceParam(name = "光学扫描超时时间", group = "基础参数") |
|
|
|
|
|
public Integer getOptScanOvertime() { |
|
|
|
|
|
return hpReader.getInteger("optScanOvertime", 10000); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@HardwareServiceParam(name = "板夹仓通道0位置", group = "板夹仓参数") |
|
|
@HardwareServiceParam(name = "板夹仓通道0位置", group = "板夹仓参数") |
|
@ -62,7 +68,7 @@ public class ReactionPlatesTransmitCtrlService implements HardwareCtrlModule { |
|
|
|
|
|
|
|
|
@HardwareServiceParam(name = "仓位0出板位置", group = "转盘参数") |
|
|
@HardwareServiceParam(name = "仓位0出板位置", group = "转盘参数") |
|
|
public Integer getTurntablePullPos0() { |
|
|
public Integer getTurntablePullPos0() { |
|
|
return hpReader.getInteger("TurntablePullPos0", 1650 + 18000); |
|
|
|
|
|
|
|
|
return hpReader.getInteger("TurntablePullPos0", 19700); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@HardwareServiceParam(name = "仓位0点滴位", group = "转盘参数") |
|
|
@HardwareServiceParam(name = "仓位0点滴位", group = "转盘参数") |
|
@ -89,9 +95,30 @@ public class ReactionPlatesTransmitCtrlService implements HardwareCtrlModule { |
|
|
|
|
|
|
|
|
@HardwareServiceParam(name = "扫描待机位", group = "光学模组参数") |
|
|
@HardwareServiceParam(name = "扫描待机位", group = "光学模组参数") |
|
|
public Integer getOptScanScandbyPos() { |
|
|
public Integer getOptScanScandbyPos() { |
|
|
return hpReader.getInteger("OptScanScandbyPos", 580); |
|
|
|
|
|
|
|
|
return hpReader.getInteger("OptScanScandbyPos", 305); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@HardwareServiceParam(name = "T光学扫描起始坐标", group = "光学模组参数") |
|
|
|
|
|
public Integer getTOptPosOffset() { |
|
|
|
|
|
return hpReader.getInteger("TOptPosOffset", 3723); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@HardwareServiceParam(name = "F光学扫描起始坐标", group = "光学模组参数") |
|
|
|
|
|
public Integer getFOptPosOffset() { |
|
|
|
|
|
return hpReader.getInteger("FOptPosOffset", 2559); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@HardwareServiceParam(name = "T光学发光增益", group = "光学模组参数") |
|
|
|
|
|
public Integer getOptTLasterGain() { |
|
|
|
|
|
return hpReader.getInteger("OptTLasterGain", 0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@HardwareServiceParam(name = "F光学发光增益", group = "光学模组参数") |
|
|
|
|
|
public Integer getOptFLasterGain() { |
|
|
|
|
|
return hpReader.getInteger("OptFLasterGain", 0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* ZERO_DPOS |
|
|
* ZERO_DPOS |
|
|
*/ |
|
|
*/ |
|
@ -216,7 +243,22 @@ public class ReactionPlatesTransmitCtrlService implements HardwareCtrlModule { |
|
|
//限制pos在 0--> 36000之间 |
|
|
//限制pos在 0--> 36000之间 |
|
|
pos = pos % 36000; |
|
|
pos = pos % 36000; |
|
|
if (pos < 0) {pos += 36000;} |
|
|
if (pos < 0) {pos += 36000;} |
|
|
canBus.stepMotorEasyMoveToBlock(MId.IncubatorRotateCtrlM, pos, getActionOvertime()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//先移动半个间距,用来检测是否发生卡板 |
|
|
|
|
|
Integer nowPos = canBus.stepMotorReadPos(MId.IncubatorRotateCtrlM); |
|
|
|
|
|
if (nowPos < pos) { |
|
|
|
|
|
canBus.stepMotorEasyMoveByBlock(MId.IncubatorRotateCtrlM, getTurntablePosSpacing(), getActionOvertime()); |
|
|
|
|
|
} else if (nowPos > pos) { |
|
|
|
|
|
canBus.stepMotorEasyMoveByBlock(MId.IncubatorRotateCtrlM, -getTurntablePosSpacing(), getActionOvertime()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//解决齿轮间隙的问题 |
|
|
|
|
|
if (nowPos < pos) { |
|
|
|
|
|
canBus.stepMotorEasyMoveToBlock(MId.IncubatorRotateCtrlM, pos, getActionOvertime()); |
|
|
|
|
|
} else { |
|
|
|
|
|
canBus.stepMotorEasyMoveToBlock(MId.IncubatorRotateCtrlM, pos - 300/**/, getActionOvertime()); |
|
|
|
|
|
canBus.stepMotorEasyMoveToBlock(MId.IncubatorRotateCtrlM, pos, getActionOvertime()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -247,12 +289,24 @@ public class ReactionPlatesTransmitCtrlService implements HardwareCtrlModule { |
|
|
return AppRet.success(canBus.plateCodeScannerReadCode(MId.PlatesBoxScanner)); |
|
|
return AppRet.success(canBus.plateCodeScannerReadCode(MId.PlatesBoxScanner)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void pushPlateQuick(PlateBoxCh PBCh, IncubatorPos turntablePosIndex) throws HardwareException, InterruptedException { |
|
|
|
|
|
trunableMoveToPushPos(turntablePosIndex); |
|
|
|
|
|
canBus.stepMotorEasyMoveToBlock(MId.PlatesBoxYM, getPBCh0Pos() + PBCh.off * getPBChSpacing(), getActionOvertime()); |
|
|
|
|
|
canBus.stepMotorEasyMoveToBlock(MId.PlatesBoxPusherM, getPusherEndPos(), getActionOvertime()); |
|
|
|
|
|
canBus.stepMotorEasyMoveToZeroPointQuickBlock(MId.PlatesBoxPusherM, getActionOvertime()); |
|
|
|
|
|
canBus.stepMotorEasyMoveToZeroPointQuickBlock(MId.PlatesBoxYM, getActionOvertime()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@HardwareServiceAction(name = "拉板", group = "单步操作") |
|
|
@HardwareServiceAction(name = "拉板", group = "单步操作") |
|
|
public void pullPlate(IncubatorPos turntablePosIndex) throws HardwareException, InterruptedException { |
|
|
public void pullPlate(IncubatorPos turntablePosIndex) throws HardwareException, InterruptedException { |
|
|
trunableMoveToPullPos(turntablePosIndex); |
|
|
trunableMoveToPullPos(turntablePosIndex); |
|
|
canBus.stepMotorEasyMoveToBlock(MId.OptModScannerM, getOptScanScandbyPos(), getActionOvertime()); |
|
|
canBus.stepMotorEasyMoveToBlock(MId.OptModScannerM, getOptScanScandbyPos(), getActionOvertime()); |
|
|
canBus.stepMotorEasyMoveToBlock(MId.OptModPullM, getPullerTargetPos(), getActionOvertime()); |
|
|
canBus.stepMotorEasyMoveToBlock(MId.OptModPullM, getPullerTargetPos(), getActionOvertime()); |
|
|
|
|
|
if (!canBus.getIOState(IOId.PullerMEndPPS)) { |
|
|
|
|
|
logger.error("pull plate fail"); |
|
|
|
|
|
throw new HardwareException(A8kEcode.PullPlateFail); |
|
|
|
|
|
} |
|
|
canBus.stepMotorEasyMoveToZeroPointQuickBlock(MId.OptModPullM, getActionOvertime()); |
|
|
canBus.stepMotorEasyMoveToZeroPointQuickBlock(MId.OptModPullM, getActionOvertime()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -263,29 +317,31 @@ public class ReactionPlatesTransmitCtrlService implements HardwareCtrlModule { |
|
|
canBus.stepMotorEasyMoveToBlock(MId.OptModScannerM, getOptScanScandbyPos(), getActionOvertime()); |
|
|
canBus.stepMotorEasyMoveToBlock(MId.OptModScannerM, getOptScanScandbyPos(), getActionOvertime()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private Boolean breakDropAllPlateFlag = false; |
|
|
|
|
|
|
|
|
Boolean pushAllPlateAndDropBreakFlag = false; |
|
|
|
|
|
|
|
|
@HardwareServiceAction(name = "丢弃全部板", group = "测试") |
|
|
|
|
|
public void dropAllPlate() throws HardwareException, InterruptedException { |
|
|
|
|
|
breakDropAllPlateFlag = false; |
|
|
|
|
|
|
|
|
@HardwareServiceAction(name = "推全部板同时丢弃", group = "位置测试") |
|
|
|
|
|
public void pushAllPlateAndDrop(PlateBoxCh PBCh, IncubatorPos startPos) throws HardwareException, InterruptedException { |
|
|
|
|
|
pushAllPlateAndDropBreakFlag = false; |
|
|
checkBeforeMoveTrunable(); |
|
|
checkBeforeMoveTrunable(); |
|
|
checkBeforeMovePlateBox(); |
|
|
checkBeforeMovePlateBox(); |
|
|
modGroupMoveToZeroQuick(); |
|
|
modGroupMoveToZeroQuick(); |
|
|
|
|
|
dropPlate(); |
|
|
for (IncubatorPos index : IncubatorPos.values()) { |
|
|
for (IncubatorPos index : IncubatorPos.values()) { |
|
|
|
|
|
if (index.compareTo(startPos) < 0) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
pushPlateQuick(PBCh, index); |
|
|
pullPlate(index); |
|
|
pullPlate(index); |
|
|
dropPlate(); |
|
|
dropPlate(); |
|
|
if (breakDropAllPlateFlag) { |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (pushAllPlateAndDropBreakFlag) {break;} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@HardwareServiceAction(name = "打断-丢弃全部板", group = "测试") |
|
|
|
|
|
public void breakDropAllPlate() throws HardwareException, InterruptedException { |
|
|
|
|
|
breakDropAllPlateFlag = true; |
|
|
|
|
|
|
|
|
@HardwareServiceAction(name = "推全部板同时丢弃中断", group = "位置测试") |
|
|
|
|
|
public void pushAllPlateAndDropBreak() { |
|
|
|
|
|
pushAllPlateAndDropBreakFlag = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@HardwareServiceAction(name = "显示板夹扫码原始曲线", group = "辅助调试") |
|
|
@HardwareServiceAction(name = "显示板夹扫码原始曲线", group = "辅助调试") |
|
|
public AppRet<A8kScanCurve> readPlateScanCurve() throws HardwareException, InterruptedException { |
|
|
public AppRet<A8kScanCurve> readPlateScanCurve() throws HardwareException, InterruptedException { |
|
|
List<Integer> scanDataCurve = canBus.plateCodeScanerReadRawResult(MId.PlatesBoxScanner); |
|
|
List<Integer> scanDataCurve = canBus.plateCodeScanerReadRawResult(MId.PlatesBoxScanner); |
|
@ -296,6 +352,32 @@ public class ReactionPlatesTransmitCtrlService implements HardwareCtrlModule { |
|
|
return AppRet.success(new A8kScanCurve(scanDataCurve, refLine)); |
|
|
return AppRet.success(new A8kScanCurve(scanDataCurve, refLine)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private AppRet<A8kScanCurve> packetOptDisplayScanCurve(List<Integer> scanDataCurve) { |
|
|
|
|
|
A8kScanCurve scanCurve = new A8kScanCurve(); |
|
|
|
|
|
scanCurve.scanDataCurve = A8kOptAlgo.preProcessOptData(scanDataCurve); |
|
|
|
|
|
scanCurve.refCurve = A8kOptAlgo.preProcessOptData(scanDataCurve); |
|
|
|
|
|
scanCurve.refLine = new ArrayList<>(); |
|
|
|
|
|
for (int i = 1; i < 6; i++) { |
|
|
|
|
|
scanCurve.refLine.add(40 * i); |
|
|
|
|
|
} |
|
|
|
|
|
return AppRet.success(scanCurve); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@HardwareServiceAction(name = "T光学扫码", group = "光学调试") |
|
|
|
|
|
public AppRet<A8kScanCurve> optTScan(OptScanDirection direction, Integer scanerGain) throws HardwareException, InterruptedException { |
|
|
|
|
|
canBus.optTStartScanBlock(MId.OptMod, direction, getOptTLasterGain(), scanerGain, getOptScanOvertime()); |
|
|
|
|
|
return packetOptDisplayScanCurve(canBus.optReadRaw(MId.OptMod)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@HardwareServiceAction(name = "F光学扫码", group = "光学调试") |
|
|
|
|
|
public AppRet<A8kScanCurve> optFScan(OptScanDirection direction, Integer scanerGain) throws HardwareException, InterruptedException { |
|
|
|
|
|
canBus.optFStartScanBlock(MId.OptMod, direction, getOptTLasterGain(), scanerGain, getOptScanOvertime()); |
|
|
|
|
|
return packetOptDisplayScanCurve(canBus.optReadRaw(MId.OptMod)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// |
|
|
|
|
|
// 状态 |
|
|
|
|
|
// |
|
|
|
|
|
|
|
|
@HardwareServiceAction(name = "读取<转盘>位置", group = "位置测量") |
|
|
@HardwareServiceAction(name = "读取<转盘>位置", group = "位置测量") |
|
|
public AppRet<Integer> readTrunablePos() throws HardwareException, InterruptedException { |
|
|
public AppRet<Integer> readTrunablePos() throws HardwareException, InterruptedException { |
|
|