Browse Source

现场代码同步

master
白凤吉 3 months ago
parent
commit
e67f4631b7
  1. 16
      src/main/java/com/iflytop/gd/app/cmd/DualRobotJointOriginCommand.java
  2. 5
      src/main/java/com/iflytop/gd/app/cmd/MoveToHeatAreaCommand.java
  3. 5
      src/main/java/com/iflytop/gd/app/cmd/MoveToSolutionAreaCommand.java
  4. 5
      src/main/java/com/iflytop/gd/app/cmd/SolutionAddCommand.java
  5. 54
      src/main/java/com/iflytop/gd/app/cmd/debug/DebugLiquidPumpStartCommand.java
  6. 14
      src/main/java/com/iflytop/gd/app/cmd/debug/DebugLiquidPumpStopCommand.java
  7. 7
      src/main/java/com/iflytop/gd/app/core/device/SelfTestState.java
  8. 231
      src/main/java/com/iflytop/gd/app/service/DeviceCommandUtilService.java

16
src/main/java/com/iflytop/gd/app/cmd/DualRobotJointOriginCommand.java

@ -3,6 +3,7 @@ package com.iflytop.gd.app.cmd;
import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.core.BaseCommandHandler;
import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.app.model.dto.CmdDTO;
import com.iflytop.gd.app.service.DeviceCommandUtilService; import com.iflytop.gd.app.service.DeviceCommandUtilService;
import com.iflytop.gd.app.service.DeviceStateService;
import com.iflytop.gd.app.service.SelfTestService; import com.iflytop.gd.app.service.SelfTestService;
import com.iflytop.gd.common.annotation.CommandMapping; import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.enums.cmd.CmdAxis; import com.iflytop.gd.common.enums.cmd.CmdAxis;
@ -20,17 +21,22 @@ import java.util.concurrent.CompletableFuture;
@Slf4j @Slf4j
@Component @Component
@RequiredArgsConstructor @RequiredArgsConstructor
@CommandMapping("dual_robot_joint_origin")//业务指令注解
@CommandMapping("dual_robot_origin")//业务指令注解
public class DualRobotJointOriginCommand extends BaseCommandHandler { public class DualRobotJointOriginCommand extends BaseCommandHandler {
private final LiquidDistributionArmDriver liquidDistributionArmDriver; private final LiquidDistributionArmDriver liquidDistributionArmDriver;
private final DeviceStateService deviceStateService;
private final SelfTestService selfTestService;
@Override @Override
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
return runAsync(() -> { return runAsync(() -> {
//加液臂电机使能 TODO将来干掉
liquidDistributionArmDriver.liquidDistributionArmEnable(LiquidArmMId.LiquidDistributionArm, 1);
//将加液臂移动至0位
liquidDistributionArmDriver.liquidDistributionArmMoveTo(LiquidArmMId.LiquidDistributionArm, 0);
if (!deviceStateService.getDeviceState().isVirtual()) {//虚拟模式不执行
//加液臂电机使能 TODO将来干掉
liquidDistributionArmDriver.liquidDistributionArmEnable(LiquidArmMId.LiquidDistributionArm, 1);
//将加液臂移动至0位
liquidDistributionArmDriver.liquidDistributionArmMoveTo(LiquidArmMId.LiquidDistributionArm, 0);
}
selfTestService.getSelfTestState().setDualRobotOrigin(true);//设置是否在原点状态
}); });
} }
} }

5
src/main/java/com/iflytop/gd/app/cmd/MoveToHeatAreaCommand.java

@ -15,6 +15,7 @@ import com.iflytop.gd.common.exception.AppException;
import com.iflytop.gd.common.result.ResultCode; import com.iflytop.gd.common.result.ResultCode;
import com.iflytop.gd.hardware.service.GDDeviceStatusService; import com.iflytop.gd.hardware.service.GDDeviceStatusService;
import com.iflytop.gd.hardware.type.IO.InputIOMId; import com.iflytop.gd.hardware.type.IO.InputIOMId;
import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -34,11 +35,13 @@ public class MoveToHeatAreaCommand extends BaseCommandHandler {
private final DevicePositionService devicePositionService; private final DevicePositionService devicePositionService;
private final GantryArmService gantryArmService; private final GantryArmService gantryArmService;
private final DeviceStateService deviceStateService; private final DeviceStateService deviceStateService;
private final MoveToSolutionAreaCommand moveToSolutionAreaCommand;
@Getter
private final AtomicBoolean isExecuting = new AtomicBoolean(false); private final AtomicBoolean isExecuting = new AtomicBoolean(false);
@Override @Override
public CompletableFuture<Void> handle(CmdDTO cmdDTO) throws Exception { public CompletableFuture<Void> handle(CmdDTO cmdDTO) throws Exception {
if (isExecuting.get()) {
if (isExecuting.get() || moveToSolutionAreaCommand.getIsExecuting().get()) {
throw new AppException(ResultCode.COMMAND_ALREADY_EXECUTING); throw new AppException(ResultCode.COMMAND_ALREADY_EXECUTING);
} }
isExecuting.set(true); isExecuting.set(true);

5
src/main/java/com/iflytop/gd/app/cmd/MoveToSolutionAreaCommand.java

@ -14,6 +14,7 @@ import com.iflytop.gd.common.enums.data.DevicePositionCode;
import com.iflytop.gd.common.exception.AppException; import com.iflytop.gd.common.exception.AppException;
import com.iflytop.gd.common.result.ResultCode; import com.iflytop.gd.common.result.ResultCode;
import com.iflytop.gd.hardware.exception.HardwareException; import com.iflytop.gd.hardware.exception.HardwareException;
import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -33,11 +34,13 @@ public class MoveToSolutionAreaCommand extends BaseCommandHandler {
private final DevicePositionService devicePositionService; private final DevicePositionService devicePositionService;
private final GantryArmService gantryArmService; private final GantryArmService gantryArmService;
private final DeviceStateService deviceStateService; private final DeviceStateService deviceStateService;
private final MoveToHeatAreaCommand moveToHeatAreaCommand;
@Getter
private final AtomicBoolean isExecuting = new AtomicBoolean(false); private final AtomicBoolean isExecuting = new AtomicBoolean(false);
@Override @Override
public CompletableFuture<Void> handle(CmdDTO cmdDTO) throws Exception { public CompletableFuture<Void> handle(CmdDTO cmdDTO) throws Exception {
if (isExecuting.get()) {
if (isExecuting.get() || moveToHeatAreaCommand.getIsExecuting().get()) {
throw new AppException(ResultCode.COMMAND_ALREADY_EXECUTING); throw new AppException(ResultCode.COMMAND_ALREADY_EXECUTING);
} }
isExecuting.set(true); isExecuting.set(true);

5
src/main/java/com/iflytop/gd/app/cmd/SolutionAddCommand.java

@ -2,6 +2,7 @@ package com.iflytop.gd.app.cmd;
import cn.hutool.json.JSONArray; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.core.BaseCommandHandler;
import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.app.model.dto.CmdDTO;
import com.iflytop.gd.app.service.ContainerService; import com.iflytop.gd.app.service.ContainerService;
@ -35,7 +36,7 @@ public class SolutionAddCommand extends BaseCommandHandler {
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
deviceStateService.setSolutionModuleStatePumping(true); deviceStateService.setSolutionModuleStatePumping(true);
return runAsync(() -> { return runAsync(() -> {
JSONArray dataList = (JSONArray) cmdDTO.getParams().get("dataList");
JSONArray dataList = JSONUtil.parseArray(cmdDTO.getParams().get("dataList"));
for (int i = 0; i < dataList.size(); i++) {//遍历前端传入的加液配置 for (int i = 0; i < dataList.size(); i++) {//遍历前端传入的加液配置
JSONObject tubeSol = dataList.getJSONObject(i); JSONObject tubeSol = dataList.getJSONObject(i);
String tubeNum = tubeSol.getStr("tubeNum");//获取试管编号 String tubeNum = tubeSol.getStr("tubeNum");//获取试管编号
@ -50,7 +51,7 @@ public class SolutionAddCommand extends BaseCommandHandler {
Double volume = addSolution.getDouble("volume"); Double volume = addSolution.getDouble("volume");
AcidPumpDeviceCode acidPumpDevice = containerService.getPumpBySolutionId(solId);//获取溶液对应的泵 AcidPumpDeviceCode acidPumpDevice = containerService.getPumpBySolutionId(solId);//获取溶液对应的泵
if (acidPumpDevice == null) { if (acidPumpDevice == null) {
throw new AppException(ResultCode.CRAFT_CONTAINER_NOT_FOUND);//工艺未找到对应溶液容器
throw new AppException(ResultCode.CRAFT_CONTAINER_NOT_FOUND);//未找到对应溶液容器
} }
deviceCommandUtilService.dualRobotMovePoint(num);//移动加液机械臂到指定试管点位 deviceCommandUtilService.dualRobotMovePoint(num);//移动加液机械臂到指定试管点位
deviceCommandUtilService.acidPumpMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), acidPumpDevice, volume);//添加溶液 deviceCommandUtilService.acidPumpMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), acidPumpDevice, volume);//添加溶液

54
src/main/java/com/iflytop/gd/app/cmd/debug/DebugLiquidPumpStartCommand.java

@ -8,6 +8,8 @@ import com.iflytop.gd.common.cmd.CommandFuture;
import com.iflytop.gd.common.cmd.DeviceCommandBundle; import com.iflytop.gd.common.cmd.DeviceCommandBundle;
import com.iflytop.gd.common.cmd.DeviceCommandGenerator; import com.iflytop.gd.common.cmd.DeviceCommandGenerator;
import com.iflytop.gd.common.enums.AcidPumpDeviceCode; import com.iflytop.gd.common.enums.AcidPumpDeviceCode;
import com.iflytop.gd.hardware.drivers.StepMotorDriver.StepMotorCtrlDriver;
import com.iflytop.gd.hardware.type.StepMotor.StepMotorMId;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -23,6 +25,7 @@ import java.util.concurrent.CompletableFuture;
@CommandMapping("debug_liquid_pump_start") @CommandMapping("debug_liquid_pump_start")
public class DebugLiquidPumpStartCommand extends BaseCommandHandler { public class DebugLiquidPumpStartCommand extends BaseCommandHandler {
private final DeviceCommandService deviceCommandService; private final DeviceCommandService deviceCommandService;
private final StepMotorCtrlDriver stepMotorCtrlDriver;
@Override @Override
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
@ -50,18 +53,53 @@ public class DebugLiquidPumpStartCommand extends BaseCommandHandler {
} }
switch (acidPumpDevice) { switch (acidPumpDevice) {
case acid_pump_01 -> deviceCommand = DeviceCommandGenerator.acidPump1MoveBy(volume);
case acid_pump_02 -> deviceCommand = DeviceCommandGenerator.acidPump2MoveBy(volume);
case acid_pump_03 -> deviceCommand = DeviceCommandGenerator.acidPump3MoveBy(volume);
case acid_pump_04 -> deviceCommand = DeviceCommandGenerator.acidPump4MoveBy(volume);
case acid_pump_05 -> deviceCommand = DeviceCommandGenerator.acidPump5MoveBy(volume);
case acid_pump_06 -> deviceCommand = DeviceCommandGenerator.acidPump6MoveBy(volume);
case acid_pump_07 -> deviceCommand = DeviceCommandGenerator.acidPump7MoveBy(volume);
case acid_pump_08 -> deviceCommand = DeviceCommandGenerator.acidPump8MoveBy(volume);
case acid_pump_01 -> {
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_1_MOTOR_MID, 1);
deviceCommand = DeviceCommandGenerator.acidPump1MoveBy(volume);
}
case acid_pump_02 -> {
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_2_MOTOR_MID, 1);
deviceCommand = DeviceCommandGenerator.acidPump2MoveBy(volume);
}
case acid_pump_03 -> {
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_3_MOTOR_MID, 1);
deviceCommand = DeviceCommandGenerator.acidPump3MoveBy(volume);
}
case acid_pump_04 -> {
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_4_MOTOR_MID, 1);
deviceCommand = DeviceCommandGenerator.acidPump4MoveBy(volume);
}
case acid_pump_05 -> {
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_5_MOTOR_MID, 1);
deviceCommand = DeviceCommandGenerator.acidPump5MoveBy(volume);
}
case acid_pump_06 -> {
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_6_MOTOR_MID, 1);
deviceCommand = DeviceCommandGenerator.acidPump6MoveBy(volume);
}
case acid_pump_07 -> {
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_7_MOTOR_MID, 1);
deviceCommand = DeviceCommandGenerator.acidPump7MoveBy(volume);
}
case acid_pump_08 -> {
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_8_MOTOR_MID, 1);
deviceCommand = DeviceCommandGenerator.acidPump8MoveBy(volume);
}
default -> throw new RuntimeException("index 未找到"); default -> throw new RuntimeException("index 未找到");
} }
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand);
commandWait(deviceCommandFuture); commandWait(deviceCommandFuture);
switch (acidPumpDevice) {
case acid_pump_01 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_1_MOTOR_MID, 0);
case acid_pump_02 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_2_MOTOR_MID, 0);
case acid_pump_03 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_3_MOTOR_MID, 0);
case acid_pump_04 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_4_MOTOR_MID, 0);
case acid_pump_05 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_5_MOTOR_MID, 0);
case acid_pump_06 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_6_MOTOR_MID, 0);
case acid_pump_07 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_7_MOTOR_MID, 0);
case acid_pump_08 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_8_MOTOR_MID, 0);
default -> throw new RuntimeException("index 未找到");
}
}); });
} }
} }

14
src/main/java/com/iflytop/gd/app/cmd/debug/DebugLiquidPumpStopCommand.java

@ -8,6 +8,8 @@ import com.iflytop.gd.common.cmd.CommandFuture;
import com.iflytop.gd.common.cmd.DeviceCommandBundle; import com.iflytop.gd.common.cmd.DeviceCommandBundle;
import com.iflytop.gd.common.cmd.DeviceCommandGenerator; import com.iflytop.gd.common.cmd.DeviceCommandGenerator;
import com.iflytop.gd.common.enums.AcidPumpDeviceCode; import com.iflytop.gd.common.enums.AcidPumpDeviceCode;
import com.iflytop.gd.hardware.drivers.StepMotorDriver.StepMotorCtrlDriver;
import com.iflytop.gd.hardware.type.StepMotor.StepMotorMId;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -23,6 +25,7 @@ import java.util.concurrent.CompletableFuture;
@CommandMapping("debug_liquid_pump_stop") @CommandMapping("debug_liquid_pump_stop")
public class DebugLiquidPumpStopCommand extends BaseCommandHandler { public class DebugLiquidPumpStopCommand extends BaseCommandHandler {
private final DeviceCommandService deviceCommandService; private final DeviceCommandService deviceCommandService;
private final StepMotorCtrlDriver stepMotorCtrlDriver;
@Override @Override
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
@ -43,6 +46,17 @@ public class DebugLiquidPumpStopCommand extends BaseCommandHandler {
} }
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand);
commandWait(deviceCommandFuture); commandWait(deviceCommandFuture);
switch (acidPumpDevice) {
case acid_pump_01 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_1_MOTOR_MID, 0);
case acid_pump_02 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_2_MOTOR_MID, 0);
case acid_pump_03 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_3_MOTOR_MID, 0);
case acid_pump_04 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_4_MOTOR_MID, 0);
case acid_pump_05 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_5_MOTOR_MID, 0);
case acid_pump_06 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_6_MOTOR_MID, 0);
case acid_pump_07 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_7_MOTOR_MID, 0);
case acid_pump_08 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_8_MOTOR_MID, 0);
default -> throw new RuntimeException("index 未找到");
}
}); });
} }
} }

7
src/main/java/com/iflytop/gd/app/core/device/SelfTestState.java

@ -15,11 +15,8 @@ public class SelfTestState {
@Schema(description = "龙门架机械臂z轴是否在原点") @Schema(description = "龙门架机械臂z轴是否在原点")
private boolean gantryZOrigin = false; private boolean gantryZOrigin = false;
@Schema(description = "加液机械臂01是否在原点")
private boolean dualRobotJoint1Origin = false;
@Schema(description = "加液机械臂02是否在原点")
private boolean dualRobotJoint2Origin = false;
@Schema(description = "加液机械臂是否在原点")
private boolean dualRobotOrigin = false;
@Schema(description = "拍子升降是否在原点") @Schema(description = "拍子升降是否在原点")
private boolean capLiftingOrigin = false; private boolean capLiftingOrigin = false;

231
src/main/java/com/iflytop/gd/app/service/DeviceCommandUtilService.java

@ -10,11 +10,13 @@ import com.iflytop.gd.common.enums.AcidPumpDeviceCode;
import com.iflytop.gd.common.enums.HeatModuleCode; import com.iflytop.gd.common.enums.HeatModuleCode;
import com.iflytop.gd.common.enums.cmd.CmdAxis; import com.iflytop.gd.common.enums.cmd.CmdAxis;
import com.iflytop.gd.common.enums.data.DevicePositionCode; import com.iflytop.gd.common.enums.data.DevicePositionCode;
import com.iflytop.gd.hardware.drivers.StepMotorDriver.StepMotorCtrlDriver;
import com.iflytop.gd.hardware.exception.HardwareException; import com.iflytop.gd.hardware.exception.HardwareException;
import com.iflytop.gd.hardware.service.GDDeviceStatusService; import com.iflytop.gd.hardware.service.GDDeviceStatusService;
import com.iflytop.gd.hardware.type.IO.InputIOMId; import com.iflytop.gd.hardware.type.IO.InputIOMId;
import com.iflytop.gd.hardware.type.LiquidDistributionArmDriver; import com.iflytop.gd.hardware.type.LiquidDistributionArmDriver;
import com.iflytop.gd.hardware.type.Servo.LiquidArmMId; import com.iflytop.gd.hardware.type.Servo.LiquidArmMId;
import com.iflytop.gd.hardware.type.StepMotor.StepMotorMId;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -29,7 +31,7 @@ public class DeviceCommandUtilService {
private final DevicePositionService devicePositionService; private final DevicePositionService devicePositionService;
private final LiquidDistributionArmDriver liquidDistributionArmDriver; private final LiquidDistributionArmDriver liquidDistributionArmDriver;
private final GDDeviceStatusService gdDeviceStatusService; private final GDDeviceStatusService gdDeviceStatusService;
private final StepMotorCtrlDriver stepMotorCtrlDriver;
/** /**
* 门电机回原点 * 门电机回原点
*/ */
@ -74,6 +76,28 @@ public class DeviceCommandUtilService {
*/ */
public void gantryMove(String cmdId, String cmdCode, Point3D point) throws Exception { public void gantryMove(String cmdId, String cmdCode, Point3D point) throws Exception {
DeviceCommandBundle gantryXMoveDeviceCommand = DeviceCommandGenerator.gantryXMove(point.getX()); DeviceCommandBundle gantryXMoveDeviceCommand = DeviceCommandGenerator.gantryXMove(point.getX());
CommandFuture gantryXMoveDeviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, gantryXMoveDeviceCommand);
DeviceCommandBundle gantryYMoveDeviceCommand = DeviceCommandGenerator.gantryYMove(point.getY());
CommandFuture gantryYMoveDeviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, gantryYMoveDeviceCommand);
DeviceCommandBundle gantryZMoveDeviceCommand = DeviceCommandGenerator.gantryZMove(point.getZ());
CommandFuture gantryZMoveDeviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, gantryZMoveDeviceCommand);
commandWait(gantryXMoveDeviceCommandFuture, gantryYMoveDeviceCommandFuture, gantryZMoveDeviceCommandFuture);
}
/**
* 龙门架机械臂移动到指定点
*/
public void gantryMoveQueue(Point3D point) throws Exception {
gantryMoveQueue(null, null, point);
}
/**
* 龙门架机械臂移动到指定点
*/
public void gantryMoveQueue(String cmdId, String cmdCode, Point3D point) throws Exception {
DeviceCommandBundle gantryXMoveDeviceCommand = DeviceCommandGenerator.gantryXMove(point.getX());
DeviceCommandBundle gantryYMoveDeviceCommand = DeviceCommandGenerator.gantryYMove(point.getY()); DeviceCommandBundle gantryYMoveDeviceCommand = DeviceCommandGenerator.gantryYMove(point.getY());
DeviceCommandBundle gantryZMoveDeviceCommand = DeviceCommandGenerator.gantryZMove(point.getZ()); DeviceCommandBundle gantryZMoveDeviceCommand = DeviceCommandGenerator.gantryZMove(point.getZ());
CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, gantryXMoveDeviceCommand, gantryYMoveDeviceCommand, gantryZMoveDeviceCommand); CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, gantryXMoveDeviceCommand, gantryYMoveDeviceCommand, gantryZMoveDeviceCommand);
@ -93,10 +117,27 @@ public class DeviceCommandUtilService {
*/ */
public void gantryXMoveOrigin(String cmdId, String cmdCode) throws Exception { public void gantryXMoveOrigin(String cmdId, String cmdCode) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryXOrigin(); DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryXOrigin();
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFuture);
}
/**
* 龙门架机械臂X轴回原点
*/
public void gantryXMoveOriginQueue() throws Exception {
gantryXMoveOriginQueue(null, null);
}
/**
* 龙门架机械臂X轴回原点
*/
public void gantryXMoveOriginQueue(String cmdId, String cmdCode) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryXOrigin();
CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand); CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFutureArr); commandWait(deviceCommandFutureArr);
} }
/** /**
* 龙门架机械臂Y轴回原点 * 龙门架机械臂Y轴回原点
*/ */
@ -109,10 +150,28 @@ public class DeviceCommandUtilService {
*/ */
public void gantryYMoveOrigin(String cmdId, String cmdCode) throws Exception { public void gantryYMoveOrigin(String cmdId, String cmdCode) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryYOrigin(); DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryYOrigin();
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFuture);
}
/**
* 龙门架机械臂Y轴回原点
*/
public void gantryYMoveOriginQueue() throws Exception {
gantryYMoveOriginQueue(null, null);
}
/**
* 龙门架机械臂Y轴回原点
*/
public void gantryYMoveOriginQueue(String cmdId, String cmdCode) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryYOrigin();
CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand); CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFutureArr); commandWait(deviceCommandFutureArr);
} }
/** /**
* 龙门架机械臂Z轴回原点 * 龙门架机械臂Z轴回原点
*/ */
@ -125,6 +184,23 @@ public class DeviceCommandUtilService {
*/ */
public void gantryZMoveOrigin(String cmdId, String cmdCode) throws Exception { public void gantryZMoveOrigin(String cmdId, String cmdCode) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryZOrigin(); DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryZOrigin();
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFuture);
}
/**
* 龙门架机械臂Z轴回原点
*/
public void gantryZMoveOriginQueue() throws Exception {
gantryZMoveOriginQueue(null, null);
}
/**
* 龙门架机械臂Z轴回原点
*/
public void gantryZMoveOriginQueue(String cmdId, String cmdCode) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryZOrigin();
CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand); CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFutureArr); commandWait(deviceCommandFutureArr);
} }
@ -141,6 +217,22 @@ public class DeviceCommandUtilService {
*/ */
public void gantryXMove(String cmdId, String cmdCode, double position) throws Exception { public void gantryXMove(String cmdId, String cmdCode, double position) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryXMove(position); DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryXMove(position);
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFuture);
}
/**
* 龙门架机械臂X轴移动到指定点
*/
public void gantryXMoveQueue(double position) throws Exception {
gantryXMoveQueue(null, null, position);
}
/**
* 龙门架机械臂X轴移动到指定点
*/
public void gantryXMoveQueue(String cmdId, String cmdCode, double position) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryXMove(position);
CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand); CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFutureArr); commandWait(deviceCommandFutureArr);
} }
@ -157,6 +249,22 @@ public class DeviceCommandUtilService {
*/ */
public void gantryYMove(String cmdId, String cmdCode, double position) throws Exception { public void gantryYMove(String cmdId, String cmdCode, double position) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryYMove(position); DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryYMove(position);
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFuture);
}
/**
* 龙门架机械臂Y轴移动到指定点
*/
public void gantryYMoveQueue(double position) throws Exception {
gantryYMoveQueue(null, null, position);
}
/**
* 龙门架机械臂Y轴移动到指定点
*/
public void gantryYMoveQueue(String cmdId, String cmdCode, double position) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryYMove(position);
CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand); CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFutureArr); commandWait(deviceCommandFutureArr);
} }
@ -173,6 +281,22 @@ public class DeviceCommandUtilService {
*/ */
public void gantryZMove(String cmdId, String cmdCode, double position) throws Exception { public void gantryZMove(String cmdId, String cmdCode, double position) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryZMove(position); DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryZMove(position);
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFuture);
}
/**
* 龙门架机械臂Z轴移动到指定点
*/
public void gantryZMoveQueue(double position) throws Exception {
gantryZMoveQueue(null, null, position);
}
/**
* 龙门架机械臂Z轴移动到指定点
*/
public void gantryZMoveQueue(String cmdId, String cmdCode, double position) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryZMove(position);
CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand); CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFutureArr); commandWait(deviceCommandFutureArr);
} }
@ -189,6 +313,22 @@ public class DeviceCommandUtilService {
*/ */
public void gantryXMoveBy(String cmdId, String cmdCode, double position) throws Exception { public void gantryXMoveBy(String cmdId, String cmdCode, double position) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryXMoveBy(position); DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryXMoveBy(position);
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFuture);
}
/**
* 龙门架机械臂X轴相对移动到指定点
*/
public void gantryXMoveByQueue(double position) throws Exception {
gantryXMoveByQueue(null, null, position);
}
/**
* 龙门架机械臂X轴相对移动到指定点
*/
public void gantryXMoveByQueue(String cmdId, String cmdCode, double position) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryXMoveBy(position);
CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand); CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFutureArr); commandWait(deviceCommandFutureArr);
} }
@ -205,6 +345,22 @@ public class DeviceCommandUtilService {
*/ */
public void gantryYMoveBy(String cmdId, String cmdCode, double position) throws Exception { public void gantryYMoveBy(String cmdId, String cmdCode, double position) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryYMoveBy(position); DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryYMoveBy(position);
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFuture);
}
/**
* 龙门架机械臂Y轴相对移动到指定点
*/
public void gantryYMoveByQueue(double position) throws Exception {
gantryYMoveByQueue(null, null, position);
}
/**
* 龙门架机械臂Y轴相对移动到指定点
*/
public void gantryYMoveByQueue(String cmdId, String cmdCode, double position) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryYMoveBy(position);
CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand); CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFutureArr); commandWait(deviceCommandFutureArr);
} }
@ -221,6 +377,22 @@ public class DeviceCommandUtilService {
*/ */
public void gantryZMoveBy(String cmdId, String cmdCode, double position) throws Exception { public void gantryZMoveBy(String cmdId, String cmdCode, double position) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryZMoveBy(position); DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryZMoveBy(position);
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFuture);
}
/**
* 龙门架机械臂Z轴相对移动到指定点
*/
public void gantryZMoveByQueue(double position) throws Exception {
gantryZMoveByQueue(null, null, position);
}
/**
* 龙门架机械臂Z轴相对移动到指定点
*/
public void gantryZMoveByQueue(String cmdId, String cmdCode, double position) throws Exception {
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.gantryZMoveBy(position);
CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand); CommandFuture[] deviceCommandFutureArr = deviceCommandService.sendCommandGantryQueue(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFutureArr); commandWait(deviceCommandFutureArr);
} }
@ -401,18 +573,55 @@ public class DeviceCommandUtilService {
* 添加溶液 * 添加溶液
*/ */
public void acidPumpMoveBy(String cmdId, String cmdCode, AcidPumpDeviceCode acidPumpDevice, double position) throws Exception { public void acidPumpMoveBy(String cmdId, String cmdCode, AcidPumpDeviceCode acidPumpDevice, double position) throws Exception {
DeviceCommandBundle deviceCommand = switch (acidPumpDevice) {
case acid_pump_01 -> DeviceCommandGenerator.acidPump1MoveBy(position);
case acid_pump_02 -> DeviceCommandGenerator.acidPump2MoveBy(position);
case acid_pump_03 -> DeviceCommandGenerator.acidPump3MoveBy(position);
case acid_pump_04 -> DeviceCommandGenerator.acidPump4MoveBy(position);
case acid_pump_05 -> DeviceCommandGenerator.acidPump5MoveBy(position);
case acid_pump_06 -> DeviceCommandGenerator.acidPump6MoveBy(position);
case acid_pump_07 -> DeviceCommandGenerator.acidPump7MoveBy(position);
case acid_pump_08 -> DeviceCommandGenerator.acidPump8MoveBy(position);
};
DeviceCommandBundle deviceCommand;
switch (acidPumpDevice) {
case acid_pump_01 -> {
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_1_MOTOR_MID, 1);
deviceCommand = DeviceCommandGenerator.acidPump1MoveBy(position);
}
case acid_pump_02 -> {
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_2_MOTOR_MID, 1);
deviceCommand = DeviceCommandGenerator.acidPump2MoveBy(position);
}
case acid_pump_03 -> {
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_3_MOTOR_MID, 1);
deviceCommand = DeviceCommandGenerator.acidPump3MoveBy(position);
}
case acid_pump_04 -> {
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_4_MOTOR_MID, 1);
deviceCommand = DeviceCommandGenerator.acidPump4MoveBy(position);
}
case acid_pump_05 -> {
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_5_MOTOR_MID, 1);
deviceCommand = DeviceCommandGenerator.acidPump5MoveBy(position);
}
case acid_pump_06 -> {
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_6_MOTOR_MID, 1);
deviceCommand = DeviceCommandGenerator.acidPump6MoveBy(position);
}
case acid_pump_07 -> {
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_7_MOTOR_MID, 1);
deviceCommand = DeviceCommandGenerator.acidPump7MoveBy(position);
}
case acid_pump_08 -> {
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_8_MOTOR_MID, 1);
deviceCommand = DeviceCommandGenerator.acidPump8MoveBy(position);
}
default -> throw new RuntimeException("index 未找到");
}
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand); CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand);
commandWait(deviceCommandFuture); commandWait(deviceCommandFuture);
switch (acidPumpDevice) {
case acid_pump_01 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_1_MOTOR_MID, 0);
case acid_pump_02 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_2_MOTOR_MID, 0);
case acid_pump_03 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_3_MOTOR_MID, 0);
case acid_pump_04 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_4_MOTOR_MID, 0);
case acid_pump_05 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_5_MOTOR_MID, 0);
case acid_pump_06 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_6_MOTOR_MID, 0);
case acid_pump_07 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_7_MOTOR_MID, 0);
case acid_pump_08 -> stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.ACID_PUMP_8_MOTOR_MID, 0);
default -> throw new RuntimeException("index 未找到");
}
} }
/** /**

Loading…
Cancel
Save