Browse Source

编辑工艺功能优化,工艺优化

master
白凤吉 2 months ago
parent
commit
89ac757e93
  1. 2
      src/main/java/com/iflytop/gd/app/command/control/MoveToHeatAreaCommand.java
  2. 10
      src/main/java/com/iflytop/gd/app/command/control/MoveToSolutionAreaCommand.java
  3. 7
      src/main/java/com/iflytop/gd/app/command/control/TrayUpCommand.java
  4. 8
      src/main/java/com/iflytop/gd/app/command/debug/step/DebugShowSmogCommand.java
  5. 8
      src/main/java/com/iflytop/gd/app/command/selftest/TrayOutCommand.java
  6. 57
      src/main/java/com/iflytop/gd/app/service/crafts/CraftsStepService.java
  7. 25
      src/main/java/com/iflytop/gd/app/service/device/DeviceCommandTempUtilService.java
  8. 9
      src/main/java/com/iflytop/gd/app/service/device/module/GantryModuleService.java

2
src/main/java/com/iflytop/gd/app/command/control/MoveToHeatAreaCommand.java

@ -121,7 +121,7 @@ public class MoveToHeatAreaCommand extends BaseCommandHandler {
gantryModuleService.gantryZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//抬升z轴
gantryModuleService.gantryMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatAreaCapClawPointPoint3D);//将携带拍子的机械臂移动至加热模块拍子上方
capModuleService.capUpBalanceNoWait(cmdDTO.getCommandId(), cmdDTO.getCommand()); //提升拍子存放区
deviceCommandTempUtilService.moveTrayHeatModuleAvoidUpNoWait(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode);Thread.sleep(4000);//TODO 结构有问题临时避让 完毕可以升起了顺带提升目标加热模块
deviceCommandTempUtilService.moveTrayHeatModuleAvoidUpNoWait(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode);Thread.sleep(2500);//TODO 结构有问题临时避让 完毕可以升起了顺带提升目标加热模块
gantryModuleService.gantryZMove(heatModuleCapMoveHeight);//下降z轴,使夹拍子落入加热模块
gantryModuleService.clawMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), clawCapPick);//将夹爪打开释放拍子
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setCapExist(true);//加热模块是否存在拍子

10
src/main/java/com/iflytop/gd/app/command/control/MoveToSolutionAreaCommand.java

@ -103,20 +103,14 @@ public class MoveToSolutionAreaCommand extends BaseCommandHandler {
capModuleService.capUpBalanceNoWait(cmdDTO.getCommandId(), cmdDTO.getCommand()); //提升拍子存放区至拍子夹取的高度
gantryModuleService.gantryMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatAreaCapClawPointPoint3D);//将机械臂移动至加热模块拍子上方
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(1);//将加热模块托盘状态改为抬起
double newTrayLift = trayLift; //TODO 临时调整位置
if(HeatModuleCode.heat_module_05.equals(heatModuleCode)){
newTrayLift = trayLift - 10;
}
heatModuleService.heaterMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, newTrayLift);//抬升指定加热位托盘
heatModuleService.heaterMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, trayLift);//抬升指定加热位托盘
gantryModuleService.clawMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), clawCapPick);//将夹爪打开准备夹取拍子
gantryModuleService.gantryZMove(heatModuleCapMoveHeight);//下降z轴,使夹爪落入加热模块拍子孔位
gantryModuleService.clawMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), clawCapGrip);//将夹爪收紧夹住拍子
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setCapExist(false);//加热模块是否存在拍子
capModuleService.capMotorMoveByNumNoWait(cmdDTO.getCommandId(), cmdDTO.getCommand(), -1);//拍子存放模块下降1个拍子位置
deviceCommandTempUtilService.moveTrayHeatModuleAvoidDownNoWait(cmdDTO.getCommandId(), cmdDTO.getCommand(), null);//TODO 结构有问题临时避让 开始移动托盘之前先降下所有加热模块
gantryModuleService.gantryZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0); Thread.sleep(4000);//抬升z轴
gantryModuleService.gantryZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0); Thread.sleep(2000);//抬升z轴
gantryModuleService.gantryMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), capStorageCapClawPoint3D);//将携带拍子的机械臂移动至存放区上方
deviceCommandTempUtilService.moveTrayHeatModuleAvoidUpNoWait(cmdDTO.getCommandId(), cmdDTO.getCommand(), null);//TODO 临时避 恢复抬起状态
gantryModuleService.gantryZMove(capModuleCapMoveHeight);//下降z轴,使夹拍子落入存放区

7
src/main/java/com/iflytop/gd/app/command/control/TrayUpCommand.java

@ -46,12 +46,7 @@ public class TrayUpCommand extends BaseCommandHandler {
double trayLift = devicePositionService.getPosition(DevicePositionCode.trayLift).getDistance();
return runAsync(() -> {
try {
//抬升加热位托盘
double newTrayLift = trayLift; //TODO 临时调整位置
if (HeatModuleCode.heat_module_05.equals(heatModuleCode)) {
newTrayLift = trayLift - 10;
}
heatModuleService.heaterMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, newTrayLift);
heatModuleService.heaterMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, trayLift);
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(1);
} catch (Exception e) {
log.error("抬起托盘失败", e);

8
src/main/java/com/iflytop/gd/app/command/debug/step/DebugShowSmogCommand.java

@ -48,13 +48,7 @@ public class DebugShowSmogCommand extends BaseCommandHandler {
Point3D heatAreaCapClawPointPoint3D = heatModuleService.getHeatAreaCapClawPointPoint3D(heatModuleCode);//获取指定加热模块拍子上方点位
return runAsync(() -> {
gantryModuleService.gantryMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatAreaCapClawPointPoint3D);//将机械臂移动至加热模块拍子上方
double newTrayLift = trayLift; //TODO 临时调整位置
if(HeatModuleCode.heat_module_05.equals(heatModuleCode)){
newTrayLift = trayLift - 10;
}
heatModuleService.heaterMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, newTrayLift);//抬升指定加热位托盘
heatModuleService.heaterMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, trayLift);//抬升指定加热位托盘
gantryModuleService.clawMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), clawCapPick);//将夹爪打开准备夹取拍子
gantryModuleService.gantryZMove(heatModuleCapMoveHeight);//下降z轴,使夹爪落入加热模块拍子孔位
gantryModuleService.clawMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), clawCapGrip);//将夹爪收紧夹住拍子

8
src/main/java/com/iflytop/gd/app/command/selftest/TrayOutCommand.java

@ -67,13 +67,7 @@ public class TrayOutCommand extends BaseCommandHandler {
solutionModuleService.requestSolutionModule();//申请使用加液区并等待
capModuleService.capUpBalance(cmdDTO.getCommandId(), cmdDTO.getCommand()); //提升拍子存放区至拍子夹取的高度
gantryModuleService.gantryMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatAreaCapClawPointPoint3D);//将机械臂移动至加热模块拍子上方
double newTrayLift = trayLift; //TODO 临时调整位置
if(HeatModuleCode.heat_module_05.equals(heatModuleCode)){
newTrayLift = trayLift - 10;
}
heatModuleService.heaterMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, newTrayLift);//抬升指定加热位托盘
heatModuleService.heaterMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, trayLift);//抬升指定加热位托盘
gantryModuleService.clawMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), clawCapPick);//将夹爪打开准备夹取拍子
gantryModuleService.gantryZMove(heatModuleCapMoveHeight);//下降z轴,使夹爪落入加热模块拍子孔位
gantryModuleService.clawMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), clawCapGrip);//将夹爪收紧夹住拍子

57
src/main/java/com/iflytop/gd/app/service/crafts/CraftsStepService.java

@ -29,6 +29,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@ -118,20 +119,26 @@ public class CraftsStepService {
&& deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTrayStatus() == 1) {
moveToSolutionModule(heatModuleCode);
}
JSONArray addLiquidList = params.getJSONArray("addLiquidList");
JSONArray addLiquidList = params.getJSONArray("list");
TrayState trayState = deviceStateService.getDeviceState().getTrayStateByHeatModuleCode(heatModuleCode);
TubeState[] tubeArray = trayState.getTubes();
for (TubeState tubeState : tubeArray) {
int tubeNum = tubeState.getTubeNum();
if (tubeNum > 0) {
log.info("工艺{},移动加液机械臂到指定试管", heatModuleCode);
for (int i = 0; i < addLiquidList.size(); i++) {
JSONObject addLiquidObject = addLiquidList.getJSONObject(i);
int tubeNum = addLiquidObject.getInt("tubeNum");
TubeState tubeState = tubeArray[tubeNum - 1];
if (tubeState.isNeedAddSolution()) {
log.info("工艺{},移动加液机械臂到指定试管({})", heatModuleCode, tubeNum);
solutionModuleService.dualRobotMovePoint(tubeNum);//移动加液机械臂到指定试管
List<CommandFuture> futuresList = new ArrayList<>();
for (int i = 0; i < addLiquidList.size(); i++) {
JSONObject addLiquid = addLiquidList.getJSONObject(i);
Long containerId = addLiquid.getLong("containerId");
for (int j = 0; j < addLiquidList.size(); j++) {
JSONObject addLiquid = addLiquidList.getJSONObject(j);
Long solutionId = addLiquid.getLong("solutionId");
Double volume = addLiquid.getDouble("volume");
Container container = containerService.getById(containerId);
Double offset = addLiquid.getDouble("offset");
if(offset != null){
volume += offset;
}
Container container = containerService.getContainerBySolutionId(solutionId);
if (container == null) {
throw new AppException(ResultCode.CONTAINER_NOT_FOUND);//未找到对应溶液容器
}
@ -172,10 +179,13 @@ public class CraftsStepService {
double trayLower = devicePositionService.getPosition(DevicePositionCode.trayLower).getDistance(); //获取托盘升降下降距离位置
moveToHeatModule(heatModuleCode);
Double inTemperature = params.getDouble("inTemperature");
Double targetTemperature = params.getDouble("temperature");
Integer second = params.getInt("second");
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTargetTime(second);
Integer coolingSecond = params.getInt("coolingSecond");
Double temperature = deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTemperature();
if (temperature > targetTemperature) {
log.info("工艺{},开启风扇降温中", heatModuleCode);
heatModuleService.fanStart(heatModuleCode);
@ -191,6 +201,15 @@ public class CraftsStepService {
heatModuleService.heatRodOpen(heatModuleCode, targetTemperature);
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.warm_up);
log.info("工艺{},等待升温", heatModuleCode);
if (inTemperature != null) {
while (deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTemperature() + 10 < inTemperature) {
delay(1);
}
log.info("工艺{},温度达到可以放入的温度,下降加热模块托盘", heatModuleCode);
heatModuleService.heaterMotorMove(heatModuleCode, trayLower);//下降加热模块托盘
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(0);//加热模块托盘升降状态
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setStartHeatTime(LocalDateTime.now());
}
while (deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTemperature() + 1 < targetTemperature) {
delay(1);
}
@ -201,10 +220,18 @@ public class CraftsStepService {
log.info("工艺{},温度合适,下降加热模块托盘", heatModuleCode);
heatModuleService.heaterMotorMove(heatModuleCode, trayLower);//下降加热模块托盘
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(0);//加热模块托盘升降状态
delay(second);
if (deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getStartHeatTime() == null) {
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setStartHeatTime(LocalDateTime.now());
}
LocalDateTime startHeatTime = deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getStartHeatTime();
LocalDateTime endHeatTime = startHeatTime.plusSeconds(second);
while (LocalDateTime.now().isBefore(endHeatTime)) {
delay(1);
}
log.info("工艺{},加热完成", heatModuleCode);
log.info("工艺{},抬升加热位托盘", heatModuleCode);
heatModuleService.heaterMotorMove(heatModuleCode, trayLift);//抬升加热位托盘
delay(coolingSecond);
return true;
}
@ -351,13 +378,7 @@ public class CraftsStepService {
gantryModuleService.gantryMove(heatAreaCapClawPointPoint3D);//将机械臂移动至加热模块拍子上方
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(1);//将加热模块托盘状态改为抬起
log.info("工艺{},抬升指定加热位托盘", heatModuleCode);
double newTrayLift = trayLift; //TODO 临时调整位置
if(HeatModuleCode.heat_module_05.equals(heatModuleCode)){
newTrayLift = trayLift - 10;
}
heatModuleService.heaterMotorMove(heatModuleCode, newTrayLift);//抬升指定加热位托盘
heatModuleService.heaterMotorMove(heatModuleCode, trayLift);//抬升指定加热位托盘
log.info("工艺{},将夹爪打开,准备夹取拍子", heatModuleCode);
gantryModuleService.clawMove(clawCapPick);//将夹爪打开准备夹取拍子
log.info("工艺{},下降z轴,使夹爪落入加热模块拍子孔位", heatModuleCode);

25
src/main/java/com/iflytop/gd/app/service/device/DeviceCommandTempUtilService.java

@ -58,21 +58,14 @@ public class DeviceCommandTempUtilService {
public void moveTrayHeatModuleAvoidUpNoWait(String cmdId, String cmdCode, HeatModuleCode targetHeatModuleCode, HeatModuleCode... exceptionHeatModuleCodes) throws Exception {
double trayLift = devicePositionService.getPosition(DevicePositionCode.trayLift).getDistance(); //托盘升降抬升距离
for (HeatModuleCode heatModuleCode : moveTrayHeatModuleAvoidUpStateList) {
double newTrayLift = trayLift; //TODO 临时调整位置
if(HeatModuleCode.heat_module_05.equals(heatModuleCode)){
newTrayLift = trayLift - 10;
}
if (!Arrays.stream(exceptionHeatModuleCodes).toList().contains(heatModuleCode)) {
DeviceCommandBundle deviceCommand = getHeaterMotorMoveDeviceCommand(heatModuleCode, newTrayLift);
DeviceCommandBundle deviceCommand = getHeaterMotorMoveDeviceCommand(heatModuleCode, trayLift);
deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand);
}
}
if (targetHeatModuleCode != null) {
double newTrayLift = trayLift; //TODO 临时调整位置
if(HeatModuleCode.heat_module_05.equals(targetHeatModuleCode)){
newTrayLift = trayLift - 10;
}
DeviceCommandBundle deviceCommand = getHeaterMotorMoveDeviceCommand(targetHeatModuleCode, newTrayLift);
DeviceCommandBundle deviceCommand = getHeaterMotorMoveDeviceCommand(targetHeatModuleCode, trayLift);
deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand);
}
for (HeatModuleCode heatModuleCode : moveTrayHeatModuleAvoidUpStateList) {
@ -89,22 +82,14 @@ public class DeviceCommandTempUtilService {
double trayLift = devicePositionService.getPosition(DevicePositionCode.trayLift).getDistance(); //托盘升降抬升距离
List<CommandFuture> futuresList = new ArrayList<>();
for (HeatModuleCode heatModuleCode : moveTrayHeatModuleAvoidUpStateList) {
double newTrayLift = trayLift; //TODO 临时调整位置
if(HeatModuleCode.heat_module_05.equals(heatModuleCode)){
newTrayLift = trayLift - 10;
}
if (!Arrays.stream(exceptionHeatModuleCodes).toList().contains(heatModuleCode)) {
DeviceCommandBundle deviceCommand = getHeaterMotorMoveDeviceCommand(heatModuleCode, newTrayLift);
DeviceCommandBundle deviceCommand = getHeaterMotorMoveDeviceCommand(heatModuleCode, trayLift);
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand);
futuresList.add(deviceCommandFuture);
}
}
if (targetHeatModuleCode != null) {
double newTrayLift = trayLift; //TODO 临时调整位置
if(HeatModuleCode.heat_module_05.equals(targetHeatModuleCode)){
newTrayLift = trayLift - 10;
}
DeviceCommandBundle deviceCommand = getHeaterMotorMoveDeviceCommand(targetHeatModuleCode, newTrayLift);
DeviceCommandBundle deviceCommand = getHeaterMotorMoveDeviceCommand(targetHeatModuleCode, trayLift);
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand);
futuresList.add(deviceCommandFuture);
}

9
src/main/java/com/iflytop/gd/app/service/device/module/GantryModuleService.java

@ -395,14 +395,7 @@ public class GantryModuleService {
List<CommandFuture> futuresList = new ArrayList<>();
for(HeatModuleCode heatModuleCode : HeatModuleCode.values()){
double newTrayLift = trayLift; //TODO 临时调整位置
if(HeatModuleCode.heat_module_05.equals(heatModuleCode)){
newTrayLift = trayLift - 10;
}
DeviceCommandBundle deviceCommand = getHeaterMotorMoveDeviceCommand(heatModuleCode, newTrayLift);
DeviceCommandBundle deviceCommand = getHeaterMotorMoveDeviceCommand(heatModuleCode, trayLift);
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand);
futuresList.add(deviceCommandFuture);
}

Loading…
Cancel
Save