|
|
@ -10,11 +10,13 @@ import com.iflytop.gd.common.enums.AcidPumpDeviceCode; |
|
|
|
import com.iflytop.gd.common.enums.HeatModuleCode; |
|
|
|
import com.iflytop.gd.common.enums.cmd.CmdAxis; |
|
|
|
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.service.GDDeviceStatusService; |
|
|
|
import com.iflytop.gd.hardware.type.IO.InputIOMId; |
|
|
|
import com.iflytop.gd.hardware.type.LiquidDistributionArmDriver; |
|
|
|
import com.iflytop.gd.hardware.type.Servo.LiquidArmMId; |
|
|
|
import com.iflytop.gd.hardware.type.StepMotor.StepMotorMId; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
@ -29,7 +31,7 @@ public class DeviceCommandUtilService { |
|
|
|
private final DevicePositionService devicePositionService; |
|
|
|
private final LiquidDistributionArmDriver liquidDistributionArmDriver; |
|
|
|
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 { |
|
|
|
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 gantryZMoveDeviceCommand = DeviceCommandGenerator.gantryZMove(point.getZ()); |
|
|
|
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 { |
|
|
|
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); |
|
|
|
commandWait(deviceCommandFutureArr); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 龙门架机械臂Y轴回原点 |
|
|
|
*/ |
|
|
@ -109,10 +150,28 @@ public class DeviceCommandUtilService { |
|
|
|
*/ |
|
|
|
public void gantryYMoveOrigin(String cmdId, String cmdCode) throws Exception { |
|
|
|
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); |
|
|
|
commandWait(deviceCommandFutureArr); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 龙门架机械臂Z轴回原点 |
|
|
|
*/ |
|
|
@ -125,6 +184,23 @@ public class DeviceCommandUtilService { |
|
|
|
*/ |
|
|
|
public void gantryZMoveOrigin(String cmdId, String cmdCode) throws Exception { |
|
|
|
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); |
|
|
|
commandWait(deviceCommandFutureArr); |
|
|
|
} |
|
|
@ -141,6 +217,22 @@ public class DeviceCommandUtilService { |
|
|
|
*/ |
|
|
|
public void gantryXMove(String cmdId, String cmdCode, double position) throws Exception { |
|
|
|
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); |
|
|
|
commandWait(deviceCommandFutureArr); |
|
|
|
} |
|
|
@ -157,6 +249,22 @@ public class DeviceCommandUtilService { |
|
|
|
*/ |
|
|
|
public void gantryYMove(String cmdId, String cmdCode, double position) throws Exception { |
|
|
|
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); |
|
|
|
commandWait(deviceCommandFutureArr); |
|
|
|
} |
|
|
@ -173,6 +281,22 @@ public class DeviceCommandUtilService { |
|
|
|
*/ |
|
|
|
public void gantryZMove(String cmdId, String cmdCode, double position) throws Exception { |
|
|
|
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); |
|
|
|
commandWait(deviceCommandFutureArr); |
|
|
|
} |
|
|
@ -189,6 +313,22 @@ public class DeviceCommandUtilService { |
|
|
|
*/ |
|
|
|
public void gantryXMoveBy(String cmdId, String cmdCode, double position) throws Exception { |
|
|
|
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); |
|
|
|
commandWait(deviceCommandFutureArr); |
|
|
|
} |
|
|
@ -205,6 +345,22 @@ public class DeviceCommandUtilService { |
|
|
|
*/ |
|
|
|
public void gantryYMoveBy(String cmdId, String cmdCode, double position) throws Exception { |
|
|
|
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); |
|
|
|
commandWait(deviceCommandFutureArr); |
|
|
|
} |
|
|
@ -221,6 +377,22 @@ public class DeviceCommandUtilService { |
|
|
|
*/ |
|
|
|
public void gantryZMoveBy(String cmdId, String cmdCode, double position) throws Exception { |
|
|
|
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); |
|
|
|
commandWait(deviceCommandFutureArr); |
|
|
|
} |
|
|
@ -401,18 +573,55 @@ public class DeviceCommandUtilService { |
|
|
|
* 添加溶液 |
|
|
|
*/ |
|
|
|
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); |
|
|
|
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 未找到"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|