From c6e4a476aabc66651d4aa574502594c2e13f2f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=A2=A6=E8=BF=9C?= <1063331231@qq.com> Date: Thu, 29 May 2025 09:54:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sgs/app/cmd/control/LiquidAddCommand.java | 12 ++-- .../app/cmd/control/LiquidPreFillStartCommand.java | 9 ++- .../sgs/app/cmd/control/LiquidReduceCommand.java | 11 ++- .../app/cmd/control/MoveToAnnealAreaCommand.java | 78 ++++++++++++++++++++++ .../sgs/app/cmd/control/MoveToFeedAreaCommand.java | 3 + .../sgs/app/cmd/control/MoveToHeatAreaCommand.java | 3 + .../app/cmd/control/MoveToLiquidAreaCommand.java | 3 + .../app/cmd/selftest/TransferOriginCommand.java | 13 ++-- .../sgs/app/service/device/DeviceInitService.java | 1 - .../app/service/device/DeviceSensorService.java | 1 - .../device/module/SolutionModuleService.java | 9 ++- .../com/iflytop/sgs/common/result/ResultCode.java | 3 +- .../sgs/hardware/config/LeiSaiServoConfig.java | 2 +- .../sgs/hardware/config/StepMotorConfig.java | 4 +- 14 files changed, 121 insertions(+), 31 deletions(-) create mode 100644 src/main/java/com/iflytop/sgs/app/cmd/control/MoveToAnnealAreaCommand.java diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidAddCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidAddCommand.java index 788dd73..ecbf907 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidAddCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidAddCommand.java @@ -54,13 +54,13 @@ public class LiquidAddCommand extends BaseCommandHandler { Solutions solutions = solutionsService.getById(solutionId);//获取溶液 ValveStateCode valveStateCode = ValveStateCode.valueOf(solutions.getName());//根据溶液获取电磁阀code Assert.isTrue(!jsonArray.isEmpty(), () -> new AppException(ResultCode.INVALID_PARAMETER));//确定选中了列 - boolean liquidTrayExist = deviceSensorService.getSensorStatus(DeviceSensorCode.LIQUID_TRAY_EXIST);//获取传感器状态 - Assert.isTrue(liquidTrayExist, () -> new AppException(ResultCode.OPERATION_NOT_ALLOWED));//判断机械臂是否有托盘 Point3D liquidAreaTrayPoint = devicePositionService.getPosition(DevicePositionCode.liquidAreaTrayPoint).getPoint3D(); //获取加液区上方托盘点位 Double solutionModuleMotorDownInTubeAddPositon = devicePositionService.getPosition(DevicePositionCode.solutionModuleMotorDownInTubeAddPositon).getPositon(); //加液模块电机下降进入试管加液位置 Double trayTubeHorizontalSpacingDistance = devicePositionService.getPosition(DevicePositionCode.trayTubeHorizontalSpacingDistance).getDistance(); //托盘试管水平间距 solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//加液机械臂上升 transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置 + boolean liquidTrayExist = deviceSensorService.getSensorStatus(DeviceSensorCode.LIQUID_TRAY_EXIST);//获取传感器状态 + Assert.isTrue(liquidTrayExist, () -> new AppException(ResultCode.SOLUTION_MODULE_NO_TRAY));//判断机械臂是否有托盘 Integer currentChannel = deviceSensorService.readLiquidValvePosition();//获取当前阀门的状态 ValveStateCode oldValveState = ValveStateCode.thick.getByChannel(currentChannel);//获取当前电磁阀的值 @@ -102,14 +102,14 @@ public class LiquidAddCommand extends BaseCommandHandler { for (int i = 0; i < jsonArray.size(); i++) { int column = jsonArray.getInt(i); if (column > 0 && column < 6) { - double distance = (column - 1) * trayTubeHorizontalSpacingDistance;//机械臂左移距离 - transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), -distance);//机械臂左移 + double distance = (column - 1) * trayTubeHorizontalSpacingDistance;//机械臂右移距离 + transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint.getX()+distance);//机械臂移动到试管位置 solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), solutionModuleMotorDownInTubeAddPositon);//加液机械臂下降 solutionModuleService.liquidPumpMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), position);//加液 - solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//加液机械臂上升 + solutionModuleService.solutionMotorMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//加液机械臂上升 } } - solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//加液机械臂上升 + solutionModuleService.solutionMotorMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//加液机械臂上升 transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置 deviceStateService.getDeviceState().getSolutionModule().setIdle(false);//设置占用解除 deviceStateService.getDeviceState().getSolutionModule().setPumping(false);//设置加液结束 diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidPreFillStartCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidPreFillStartCommand.java index 3786a8b..a210817 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidPreFillStartCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidPreFillStartCommand.java @@ -35,7 +35,6 @@ public class LiquidPreFillStartCommand extends BaseCommandHandler { private final DeviceStateService deviceStateService; private final DevicePositionService devicePositionService; private final TransferModuleService transferModuleService; - private final DeviceSensorService deviceSensorService; private final SolutionsService solutionsService; @Override @@ -46,15 +45,15 @@ public class LiquidPreFillStartCommand extends BaseCommandHandler { Assert.notNull(solutions, () -> new AppException(ResultCode.OPERATION_NOT_ALLOWED));//检验参数 ValveStateCode valveStateCode = ValveStateCode.valueOf(solutions.getCode());//获取对应的电磁阀通道 Point3D liquidAreaTrayPoint = devicePositionService.getPosition(DevicePositionCode.liquidAreaTrayPoint).getPoint3D(); //获取加液区上方点位 - double position=devicePositionService.getPosition(DevicePositionCode.solutionPreFillDistance).getDistance();//溶液首次预充距离 + double position = devicePositionService.getPosition(DevicePositionCode.solutionPreFillDistance).getDistance();//溶液首次预充距离 + double motorDownInTubeExtPositon = devicePositionService.getPosition(DevicePositionCode.solutionModuleMotorDownInTubeExtPositon).getPositon();//加液臂抽液位 return runAsync(() -> { - boolean liquidTrayExist = deviceSensorService.getSensorStatus(DeviceSensorCode.LIQUID_TRAY_EXIST);//获取传感器状态 - Assert.isTrue(liquidTrayExist, () -> new AppException(ResultCode.OPERATION_NOT_ALLOWED));//判断机械臂是否有托盘 deviceStateService.getDeviceState().getSolutionModule().setIdle(true);//设置占用 deviceStateService.getDeviceState().getSolutionModule().setPumping(true);//设置正在加液 solutionModuleService.liquidValveSwitch(cmdDTO.getCommandId(), cmdDTO.getCommand(), valveStateCode);//电磁阀对应的酸液通道打开 - solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//加液机械臂上升 + solutionModuleService.solutionMotorMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//加液机械臂上升 transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置 + solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), motorDownInTubeExtPositon);//加液机械臂下降至加液位 solutionModuleService.liquidPumpMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), position);//预充开始 deviceStateService.getDeviceState().getSolutionModule().setIdle(false);//设置占用 deviceStateService.getDeviceState().getSolutionModule().setPumping(false);//设置正在加液 diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidReduceCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidReduceCommand.java index 9767ac3..2710362 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidReduceCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidReduceCommand.java @@ -49,22 +49,21 @@ public class LiquidReduceCommand extends BaseCommandHandler { Double solutionModuleMotorDownInTubeExtPositon = devicePositionService.getPosition(DevicePositionCode.solutionModuleMotorDownInTubeExtPositon).getPositon();//加液模块电机下降进入试管抽取位置 double reduceNumber= Double.parseDouble(systemConfigService.getSystemConfigValueByCode(SystemConfigCode.number_reduce));//抽液volume配置 return runAsync(() -> { + solutionModuleService.solutionMotorMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//加液模块上升 transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint3D);//将X轴移动至加液时托盘位置点 boolean liquidTrayExist = deviceSensorService.getSensorStatus(DeviceSensorCode.LIQUID_TRAY_EXIST);//获取传感器状态 - Assert.isTrue(liquidTrayExist, () -> new AppException(ResultCode.OPERATION_NOT_ALLOWED));//判断机械臂是否有托盘 + Assert.isTrue(liquidTrayExist, () -> new AppException(ResultCode.SOLUTION_MODULE_NO_TRAY));//判断机械臂是否有托盘 deviceStateService.getDeviceState().getSolutionModule().setIdle(true);//设置占用 deviceStateService.getDeviceState().getSolutionModule().setPumping(true);//设置正在加液 - solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0.0);//加液模块上升 solutionModuleService.liquidValveSwitch(cmdDTO.getCommandId(), cmdDTO.getCommand(), ValveStateCode.waste);//电磁阀对应通道打开 for (int i = 0; i < jsonArray.size(); i++) { int column = jsonArray.getInt(i); if (column > 0 && column < 6) { + double distance = (jsonArray.getInt(i) - 1) * trayTubeHorizontalSpacingDistance; + transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint3D.getX()+distance);//机械臂移动到试管位置 solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), solutionModuleMotorDownInTubeExtPositon);//加液模块下降进入试管 solutionModuleService.liquidPumpMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), -reduceNumber);//抽液 - double distance = (jsonArray.getInt(i) - 1) * trayTubeHorizontalSpacingDistance; - solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0.0);//加液模块上升 - transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint3D);//移动至加液时托盘位置点 - transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), -distance);//X轴依次按照试管间距移动 + solutionModuleService.solutionMotorMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//加液模块上升 } } solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//加液模块上升至最高,移出试管 diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToAnnealAreaCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToAnnealAreaCommand.java new file mode 100644 index 0000000..511977e --- /dev/null +++ b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToAnnealAreaCommand.java @@ -0,0 +1,78 @@ +package com.iflytop.sgs.app.cmd.control; + +import cn.hutool.core.lang.Assert; +import com.iflytop.sgs.app.core.BaseCommandHandler; +import com.iflytop.sgs.app.model.bo.Point3D; +import com.iflytop.sgs.app.model.dto.CmdDTO; +import com.iflytop.sgs.app.service.api.DevicePositionService; +import com.iflytop.sgs.app.service.device.DeviceSensorService; +import com.iflytop.sgs.app.service.device.DeviceStateService; +import com.iflytop.sgs.app.service.device.module.HeatModuleService; +import com.iflytop.sgs.app.service.device.module.SolutionModuleService; +import com.iflytop.sgs.app.service.device.module.TransferModuleService; +import com.iflytop.sgs.common.annotation.CommandMapping; +import com.iflytop.sgs.common.enums.DeviceSensorCode; +import com.iflytop.sgs.common.enums.HeatModuleCode; +import com.iflytop.sgs.common.enums.data.DevicePositionCode; +import com.iflytop.sgs.common.exception.AppException; +import com.iflytop.sgs.common.result.ResultCode; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.concurrent.CompletableFuture; + +/** + * 转移至退火区 + */ +@Slf4j +@Component +@RequiredArgsConstructor +@CommandMapping("move_to_anneal_area")//业务指令注解 +public class MoveToAnnealAreaCommand extends BaseCommandHandler { + private final HeatModuleService heatModuleService; + private final TransferModuleService transferModuleService; + + private final DevicePositionService devicePositionService; + private final DeviceStateService deviceStateService; + private final DeviceSensorService deviceSensorService; + private final SolutionModuleService solutionModuleService; + + @Override + public CompletableFuture handle(CmdDTO cmdDTO) throws Exception { + String heatModuleCodeStr = cmdDTO.getStringParam("heatModuleCode"); + HeatModuleCode heatModuleCode; + HeatModuleCode targetHeatModuleCode = HeatModuleCode.heat_module_04; + if (heatModuleCodeStr != null) {//目标加热模块非必填,如果没有传递目标加热模块则尝试获取上料区是否有托盘 + heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr);//目标加热模块 + Assert.isTrue(heatModuleCode.equals(targetHeatModuleCode), () -> new AppException(ResultCode.HAVE_IN_ANNEAL_MODULE)); + } else { + heatModuleCode = null; + } + Point3D heatModuleTrayClawPoint3D = heatModuleService.getHeatModuleTrayClawPoint3D(heatModuleCode);//获取加热模块托盘夹取点 + Point3D targetHeatModuleTrayClawPoint3D = heatModuleService.getHeatModuleTrayClawPoint3D(targetHeatModuleCode);//获取目标加热模块托盘夹取点 + Double transferModuleXPickTrayMoveDistance = devicePositionService.getPosition(DevicePositionCode.transferModuleXPickTrayMoveDistance).getDistance();//获取转运模块X轴拿取托盘进出卡槽移动距离 + Double transferModuleZPickTrayDownPositon = devicePositionService.getPosition(DevicePositionCode.transferModuleZPickTrayDownPositon).getPositon();//获取转运模块Z轴拿取托盘时下降的高度位置 + Point3D liquidAreaTrayPoint = devicePositionService.getPosition(DevicePositionCode.liquidAreaTrayPoint).getPoint3D(); //获取加液区上方点位 + return runAsync(() -> { + boolean annealTrayExist = deviceSensorService.getSensorStatus(DeviceSensorCode.HEATER_TRAY_4_EXIST);//获取传感器状态 + Assert.isTrue(annealTrayExist, () -> new AppException(ResultCode.ANNEAL_MODULE_EXIST_TRAY));//加热位是否有托盘 + if (heatModuleCode != null) { + solutionModuleService.solutionMotorMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//加液机械臂上升 + transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置 + boolean liquidTrayExist = deviceSensorService.getSensorStatus(DeviceSensorCode.LIQUID_TRAY_EXIST);//获取传感器状态 + Assert.isTrue(liquidTrayExist, () -> new AppException(ResultCode.OPERATION_NOT_ALLOWED));//判断机械臂是否有托盘 + transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleTrayClawPoint3D.getX() + transferModuleXPickTrayMoveDistance);//将X轴移动至加热区托盘夹取点 + 进出卡槽移动距离 + transferModuleService.transferZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), transferModuleZPickTrayDownPositon);//Z轴下降至夹取点,使托盘落入石墨加热盘 + transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), -transferModuleXPickTrayMoveDistance);//X轴进入卡槽 + } + transferModuleService.transferZMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//Z轴抬升至最高 + transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), targetHeatModuleTrayClawPoint3D.getX());//将X轴移动至目标加热模块托盘夹取点 + transferModuleService.transferZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), transferModuleZPickTrayDownPositon);//Z轴下降至夹取点,使托盘落入石墨加热盘 + transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), transferModuleXPickTrayMoveDistance);//X轴移出卡槽 + transferModuleService.transferZMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//Z轴抬升至最高 + deviceStateService.getDeviceState().getHeatModuleByCode(targetHeatModuleCode).setTrayStatus(true);//设置目标加热区有托盘 + }); + } +} + diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToFeedAreaCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToFeedAreaCommand.java index f00a7fa..eab00d0 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToFeedAreaCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToFeedAreaCommand.java @@ -8,6 +8,7 @@ import com.iflytop.sgs.app.service.api.DevicePositionService; import com.iflytop.sgs.app.service.device.DeviceSensorService; import com.iflytop.sgs.app.service.device.DeviceStateService; import com.iflytop.sgs.app.service.device.module.HeatModuleService; +import com.iflytop.sgs.app.service.device.module.SolutionModuleService; import com.iflytop.sgs.app.service.device.module.TransferModuleService; import com.iflytop.sgs.common.annotation.CommandMapping; import com.iflytop.sgs.common.enums.DeviceSensorCode; @@ -35,6 +36,7 @@ public class MoveToFeedAreaCommand extends BaseCommandHandler { private final DevicePositionService devicePositionService; private final DeviceStateService deviceStateService; private final DeviceSensorService deviceSensorService; + private final SolutionModuleService solutionModuleService; @Override public CompletableFuture handle(CmdDTO cmdDTO) throws Exception { @@ -54,6 +56,7 @@ public class MoveToFeedAreaCommand extends BaseCommandHandler { Point3D feedAreaTrayPoint3D = devicePositionService.getPosition(DevicePositionCode.feedAreaTrayPoint).getPoint3D();//获取上料区托盘夹爪位置点 return runAsync(() -> { + solutionModuleService.solutionMotorMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//加液机械臂上升 if (targetHeatModuleCode == null) { //获取加液位托盘 deviceStateService.getDeviceState().getTrayByHeatModuleCode(targetHeatModuleCode).setInSolutionPositon(false);//设定托盘不在加液位中 diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToHeatAreaCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToHeatAreaCommand.java index cf767f6..a99a86b 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToHeatAreaCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToHeatAreaCommand.java @@ -7,6 +7,7 @@ import com.iflytop.sgs.app.service.api.DevicePositionService; import com.iflytop.sgs.app.service.device.DeviceSensorService; import com.iflytop.sgs.app.service.device.DeviceStateService; import com.iflytop.sgs.app.service.device.module.HeatModuleService; +import com.iflytop.sgs.app.service.device.module.SolutionModuleService; import com.iflytop.sgs.app.service.device.module.TransferModuleService; import com.iflytop.sgs.common.annotation.CommandMapping; import com.iflytop.sgs.common.enums.DeviceSensorCode; @@ -32,6 +33,7 @@ public class MoveToHeatAreaCommand extends BaseCommandHandler { private final DevicePositionService devicePositionService; private final DeviceStateService deviceStateService; private final DeviceSensorService deviceSensorService; + private final SolutionModuleService solutionModuleService; @Override public CompletableFuture handle(CmdDTO cmdDTO) throws Exception { @@ -43,6 +45,7 @@ public class MoveToHeatAreaCommand extends BaseCommandHandler { Point3D feedAreaTrayPoint3D = devicePositionService.getPosition(DevicePositionCode.feedAreaTrayPoint).getPoint3D();//获取上料区托盘夹爪位置点 return runAsync(() -> { + solutionModuleService.solutionMotorMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//加液机械臂上升 boolean liquidTrayExist = deviceSensorService.getSensorStatus(DeviceSensorCode.LIQUID_TRAY_EXIST);//获取传感器状态 if (!liquidTrayExist) { //判断机械臂上是否有托盘 //机械臂上无托盘,取上料区托盘 diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToLiquidAreaCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToLiquidAreaCommand.java index d7b5362..8602dc4 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToLiquidAreaCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToLiquidAreaCommand.java @@ -7,6 +7,7 @@ import com.iflytop.sgs.app.model.dto.CmdDTO; import com.iflytop.sgs.app.service.api.DevicePositionService; import com.iflytop.sgs.app.service.device.DeviceStateService; import com.iflytop.sgs.app.service.device.module.HeatModuleService; +import com.iflytop.sgs.app.service.device.module.SolutionModuleService; import com.iflytop.sgs.app.service.device.module.TransferModuleService; import com.iflytop.sgs.common.annotation.CommandMapping; import com.iflytop.sgs.common.enums.HeatModuleCode; @@ -32,6 +33,7 @@ public class MoveToLiquidAreaCommand extends BaseCommandHandler { private final DevicePositionService devicePositionService; private final DeviceStateService deviceStateService; + private final SolutionModuleService solutionModuleService; @Override public CompletableFuture handle(CmdDTO cmdDTO) throws Exception { @@ -52,6 +54,7 @@ public class MoveToLiquidAreaCommand extends BaseCommandHandler { Point3D liquidAreaTrayPoint3D = devicePositionService.getPosition(DevicePositionCode.liquidAreaTrayPoint).getPoint3D();//获取加液时托盘位置点 return runAsync(() -> { + solutionModuleService.solutionMotorMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//加液机械臂上升 if (targetHeatModuleCode == null) { //获取上料区托盘 transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), feedAreaTrayPoint3D.getX() + transferModuleXPickTrayMoveDistance);//将X轴移动至上料区托盘夹取点 + 进出卡槽移动距离 diff --git a/src/main/java/com/iflytop/sgs/app/cmd/selftest/TransferOriginCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/selftest/TransferOriginCommand.java index 627e787..3297982 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/selftest/TransferOriginCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/selftest/TransferOriginCommand.java @@ -3,6 +3,7 @@ package com.iflytop.sgs.app.cmd.selftest; import com.iflytop.sgs.app.core.BaseCommandHandler; import com.iflytop.sgs.app.model.dto.CmdDTO; import com.iflytop.sgs.app.service.device.SelfTestService; +import com.iflytop.sgs.app.service.device.module.SolutionModuleService; import com.iflytop.sgs.app.service.device.module.TransferModuleService; import com.iflytop.sgs.common.annotation.CommandMapping; import lombok.RequiredArgsConstructor; @@ -12,23 +13,21 @@ import org.springframework.stereotype.Component; import java.util.concurrent.CompletableFuture; /** - * 转运机械臂回原点 + * 加液机械臂回原点 */ @Slf4j @Component @RequiredArgsConstructor -@CommandMapping("transfer_origin")//业务指令注解 +@CommandMapping("dual_robot_origin")//业务指令注解 public class TransferOriginCommand extends BaseCommandHandler { - private final TransferModuleService transferModuleService; + private final SolutionModuleService solutionModuleService; private final SelfTestService selfTestService; @Override public CompletableFuture handle(CmdDTO cmdDTO) { return runAsync(() -> { - transferModuleService.transferZMoveOrigin(cmdDTO.getCommandId(), cmdDTO.getCommand()); - selfTestService.getSelfTestState().setTransferZOrigin(true);//设置z是否在原点状态 - transferModuleService.transferXMoveOrigin(cmdDTO.getCommandId(), cmdDTO.getCommand()); - selfTestService.getSelfTestState().setTransferXOrigin(true);//设置x是否在原点状态 + solutionModuleService.solutionMotorMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand()); + selfTestService.getSelfTestState().setDualRobotOrigin(true); }); } } diff --git a/src/main/java/com/iflytop/sgs/app/service/device/DeviceInitService.java b/src/main/java/com/iflytop/sgs/app/service/device/DeviceInitService.java index ec090cb..3ab9bab 100644 --- a/src/main/java/com/iflytop/sgs/app/service/device/DeviceInitService.java +++ b/src/main/java/com/iflytop/sgs/app/service/device/DeviceInitService.java @@ -15,7 +15,6 @@ import com.iflytop.sgs.common.enums.ContainerType; import com.iflytop.sgs.common.enums.HeatModuleCode; import com.iflytop.sgs.common.enums.cmd.CmdColor; import com.iflytop.sgs.common.service.CanBusService; -import com.iflytop.sgs.hardware.exception.HardwareException; import jakarta.annotation.PostConstruct; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/com/iflytop/sgs/app/service/device/DeviceSensorService.java b/src/main/java/com/iflytop/sgs/app/service/device/DeviceSensorService.java index 6924433..7c4e057 100644 --- a/src/main/java/com/iflytop/sgs/app/service/device/DeviceSensorService.java +++ b/src/main/java/com/iflytop/sgs/app/service/device/DeviceSensorService.java @@ -11,7 +11,6 @@ import com.iflytop.sgs.common.service.GDDeviceStatusService; import com.iflytop.sgs.hardware.exception.HardwareException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; @Slf4j diff --git a/src/main/java/com/iflytop/sgs/app/service/device/module/SolutionModuleService.java b/src/main/java/com/iflytop/sgs/app/service/device/module/SolutionModuleService.java index 6faa6c1..9c66974 100644 --- a/src/main/java/com/iflytop/sgs/app/service/device/module/SolutionModuleService.java +++ b/src/main/java/com/iflytop/sgs/app/service/device/module/SolutionModuleService.java @@ -102,7 +102,14 @@ public class SolutionModuleService { CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand); CommandUtil.wait(deviceCommandFuture); } - + /** + * 加液机械臂移动到0 + */ + public void solutionMotorMoveZero(String cmdId, String cmdCode) throws Exception { + DeviceCommandBundle deviceCommand = DeviceCommandGenerator.solutionMotorMove(0.0); + CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand); + CommandUtil.wait(deviceCommandFuture); + } /** * 加液泵加液 */ diff --git a/src/main/java/com/iflytop/sgs/common/result/ResultCode.java b/src/main/java/com/iflytop/sgs/common/result/ResultCode.java index 021c1d6..1042cde 100644 --- a/src/main/java/com/iflytop/sgs/common/result/ResultCode.java +++ b/src/main/java/com/iflytop/sgs/common/result/ResultCode.java @@ -60,7 +60,8 @@ public enum ResultCode implements IResultCode, Serializable { SOLUTION_MODULE_NO_TRAY("6027", "加液模块无托盘"), FEED_AREA_NO_TRAY("6028", "上料区无托盘"), SOLUTION_MODULE_IS_BUSY("6029", "加液模块正忙"), - ; + ANNEAL_MODULE_EXIST_TRAY("6030", "退火模块存在托盘"), + HAVE_IN_ANNEAL_MODULE("6031", "已经在退热模块"); /** 状态码 */ private final String code; /** 提示信息 */ diff --git a/src/main/java/com/iflytop/sgs/hardware/config/LeiSaiServoConfig.java b/src/main/java/com/iflytop/sgs/hardware/config/LeiSaiServoConfig.java index 95f06b3..a6c392b 100644 --- a/src/main/java/com/iflytop/sgs/hardware/config/LeiSaiServoConfig.java +++ b/src/main/java/com/iflytop/sgs/hardware/config/LeiSaiServoConfig.java @@ -11,7 +11,7 @@ import java.util.Map; public class LeiSaiServoConfig { static final double DEFAULT_MAX_LIMIT = 0.0; // mm final static Map stepMotorMaxLimitMap = Map.ofEntries( - Map.entry(LeisaiServoMId.XSV, 1000.0) + Map.entry(LeisaiServoMId.XSV, 1500.0) ); /* ******************** ******************** ******************** */ diff --git a/src/main/java/com/iflytop/sgs/hardware/config/StepMotorConfig.java b/src/main/java/com/iflytop/sgs/hardware/config/StepMotorConfig.java index 280d749..3e59749 100644 --- a/src/main/java/com/iflytop/sgs/hardware/config/StepMotorConfig.java +++ b/src/main/java/com/iflytop/sgs/hardware/config/StepMotorConfig.java @@ -34,8 +34,8 @@ public class StepMotorConfig { static final double DEFAULT_MAX_LIMIT = 0.0; // mm final static Map stepMotorMaxLimitMap = Map.ofEntries( Map.entry(StepMotorMId.DoorM, 200.0), - Map.entry(StepMotorMId.LiquidM, 150.0), - Map.entry(StepMotorMId.ZM, 100.0) + Map.entry(StepMotorMId.LiquidM, 160.0), + Map.entry(StepMotorMId.ZM, 110.0) ); // 是否安装编码器