9 changed files with 598 additions and 134 deletions
-
63src/main/java/com/iflytop/gd/app/command/control/MoveToHeatAreaCommand.java
-
69src/main/java/com/iflytop/gd/app/command/control/MoveToSolutionAreaCommand.java
-
3src/main/java/com/iflytop/gd/app/model/bo/status/device/HeatModuleState.java
-
28src/main/java/com/iflytop/gd/app/service/api/TestService.java
-
174src/main/java/com/iflytop/gd/app/service/device/ActionCommandService.java
-
335src/main/java/com/iflytop/gd/app/service/device/DeviceCommandTempUtilService.java
-
25src/main/java/com/iflytop/gd/app/service/device/module/GantryModuleService.java
-
22src/main/java/com/iflytop/gd/app/service/device/module/HeatModuleService.java
-
13src/main/java/com/iflytop/gd/common/enums/ClawItemType.java
@ -0,0 +1,174 @@ |
|||||
|
package com.iflytop.gd.app.service.device; |
||||
|
|
||||
|
import com.iflytop.gd.app.model.bo.Point3D; |
||||
|
import com.iflytop.gd.app.model.bo.status.device.TrayState; |
||||
|
import com.iflytop.gd.app.service.api.DevicePositionService; |
||||
|
import com.iflytop.gd.app.service.device.module.CapModuleService; |
||||
|
import com.iflytop.gd.app.service.device.module.GantryModuleService; |
||||
|
import com.iflytop.gd.app.service.device.module.HeatModuleService; |
||||
|
import com.iflytop.gd.common.enums.ClawItemType; |
||||
|
import com.iflytop.gd.common.enums.HeatModuleCode; |
||||
|
import com.iflytop.gd.common.enums.data.DevicePositionCode; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* 动作指令 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class ActionCommandService { |
||||
|
private final DeviceCommandService deviceCommandService; |
||||
|
private final DevicePositionService devicePositionService; |
||||
|
private final DeviceStateService deviceStateService; |
||||
|
private final HeatModuleService heatModuleService; |
||||
|
private final CapModuleService capModuleService; |
||||
|
private final GantryModuleService gantryModuleService; |
||||
|
private final DeviceCommandTempUtilService deviceCommandTempUtilService; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 指定加热模块移除托盘 |
||||
|
*/ |
||||
|
public void heatModuleRemoveTray(String commandId, String command, HeatModuleCode heatModuleCode) throws Exception { |
||||
|
double clawTrayPick = devicePositionService.getPosition(DevicePositionCode.clawTrayPick).getDistance();//获取夹爪托盘夹取距离 |
||||
|
double clawTrayGrip = devicePositionService.getPosition(DevicePositionCode.clawTrayGrip).getDistance();//获取夹爪托盘夹紧距离 |
||||
|
double trayLower = devicePositionService.getPosition(DevicePositionCode.trayLower).getDistance(); //获取加热位下降托盘位置 |
||||
|
double heatModuleTrayMoveHeight = devicePositionService.getPosition(DevicePositionCode.heatModuleTrayMoveHeight).getDistance();//加热模块托盘z轴移动高度 |
||||
|
double solutionModuleTrayMoveHeight = devicePositionService.getPosition(DevicePositionCode.solutionModuleTrayMoveHeight).getDistance();//加液模块托盘z轴移动高度 |
||||
|
Point3D liquidAreaTrayPoint3D = devicePositionService.getPosition(DevicePositionCode.liquidAreaTrayPoint).getPoint3D();//获取加液模块上方点位 |
||||
|
Point3D heatAreaTrayClawPoint3D = heatModuleService.getHeatAreaTrayClawPoint3D(heatModuleCode);//获取指定加热模块上方点位 |
||||
|
|
||||
|
TrayState trayState = deviceStateService.getDeviceState().getTrayStateByHeatModuleCode(heatModuleCode); |
||||
|
|
||||
|
heatModuleService.heaterMotorMoveNoWait(commandId, command, heatModuleCode, trayLower);//确保目标加热模块是抬升状态 |
||||
|
gantryModuleService.gantryXYMove(commandId, command, heatAreaTrayClawPoint3D);//将机械臂移动至加热模块上方 |
||||
|
gantryModuleService.clawMove(commandId, command, clawTrayPick);//将夹爪打开,准备夹取托盘 |
||||
|
gantryModuleService.gantryZMove(heatModuleTrayMoveHeight);//下降z轴,使夹爪落入托盘孔位 |
||||
|
gantryModuleService.clawMove(commandId, command, clawTrayGrip);//将夹爪收紧,夹住托盘 |
||||
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayStatus(0);//加热模块是否存在托盘 |
||||
|
if (trayState != null) { |
||||
|
trayState.setInHeatModule(false); |
||||
|
} |
||||
|
heatModuleService.heaterMotorMoveNoWait(commandId, command, heatModuleCode, trayLower);//下降加热模块 |
||||
|
gantryModuleService.gantryZMove(commandId, command, 0);//抬升z轴 |
||||
|
Thread.sleep(2500); |
||||
|
deviceCommandTempUtilService.carryMoveXYToSolutionManyPoints(commandId, command, heatModuleCode, ClawItemType.tray);//携带托盘移动至加液模块 |
||||
|
gantryModuleService.gantryXYMove(commandId, command, liquidAreaTrayPoint3D); //将携带托盘的机械臂移动至加液模块上方 |
||||
|
deviceCommandTempUtilService.moveTrayHeatModuleAvoidUpNoWait(commandId, command, heatModuleCode);//移动完毕恢复抬升状态 |
||||
|
gantryModuleService.gantryZMove(solutionModuleTrayMoveHeight);//下降z轴,使托盘落入加液模块 |
||||
|
deviceStateService.getDeviceState().getSolutionModule().setTrayStatus(1);//加液模块是否存在托盘 |
||||
|
if (trayState != null) { |
||||
|
trayState.setInSolutionModule(true); |
||||
|
} |
||||
|
gantryModuleService.clawMove(commandId, command, clawTrayPick);//将夹爪打开,释放托盘 |
||||
|
gantryModuleService.gantryZMove(commandId, command, 0);//抬升z轴 |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 指定加热模块移除拍子 |
||||
|
*/ |
||||
|
public void heatModuleRemoveCap(String commandId, String command, HeatModuleCode heatModuleCode) throws Exception { |
||||
|
double clawCapPick = devicePositionService.getPosition(DevicePositionCode.clawCapPick).getDistance(); //获取拍子夹取距离 |
||||
|
double clawCapGrip = devicePositionService.getPosition(DevicePositionCode.clawCapGrip).getDistance(); //获取拍子夹紧距离 |
||||
|
double trayLower = devicePositionService.getPosition(DevicePositionCode.trayLower).getDistance(); //获取加热位下降托盘位置 |
||||
|
double heatModuleCapMoveHeight = devicePositionService.getPosition(DevicePositionCode.heatModuleCapMoveHeight).getDistance();//加热模块拍子移动高度 |
||||
|
double capModuleCapMoveHeight = devicePositionService.getPosition(DevicePositionCode.capModuleCapMoveHeight).getDistance();//拍子升降模块拍子z轴移动高度 |
||||
|
|
||||
|
Point3D heatAreaCapClawPointPoint3D = heatModuleService.getHeatAreaCapClawPointPoint3D(heatModuleCode);//获取指定加热模块拍子上方点位 |
||||
|
|
||||
|
heatModuleService.heaterMotorMoveNoWait(commandId, command, heatModuleCode, trayLower);//确保目标加热模块是抬升状态 |
||||
|
|
||||
|
gantryModuleService.gantryXYMove(commandId, command, heatAreaCapClawPointPoint3D);//将机械臂移动至加热模块拍子上方 |
||||
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(1);//将加热模块托盘状态改为抬起 |
||||
|
gantryModuleService.clawMove(commandId, command, clawCapPick);//将夹爪打开,准备夹取拍子 |
||||
|
gantryModuleService.gantryZMove(heatModuleCapMoveHeight);//下降z轴,使夹爪落入加热模块拍子孔位 |
||||
|
gantryModuleService.clawMove(commandId, command, clawCapGrip);//将夹爪收紧,夹住拍子 |
||||
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setCapExist(false);//加热模块是否存在拍子 |
||||
|
capModuleService.capMotorMoveByNumNoWait(commandId, command, -1);//拍子存放模块下降1个拍子位置 |
||||
|
gantryModuleService.gantryZMove(commandId, command, 0);//抬升z轴 |
||||
|
heatModuleService.heaterMotorMoveNoWait(commandId, command, heatModuleCode, trayLower);//下降加热模块 |
||||
|
Thread.sleep(2500); |
||||
|
deviceCommandTempUtilService.carryMoveXYToSolutionManyPoints(commandId, command, heatModuleCode, ClawItemType.cap);//携带拍子移动至存放区 |
||||
|
deviceCommandTempUtilService.moveTrayHeatModuleAvoidUpNoWait(commandId, command, heatModuleCode);//移动完毕恢复抬升状态 |
||||
|
gantryModuleService.gantryZMove(capModuleCapMoveHeight);//下降z轴,使夹拍子落入存放区 |
||||
|
gantryModuleService.clawMove(commandId, command, clawCapPick);//将夹爪打开,释放夹取的拍子 |
||||
|
gantryModuleService.gantryZMove(commandId, command, 0);//抬升z轴 |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 指定加热模块安装拍子 |
||||
|
*/ |
||||
|
public void heatModuleInstallCap(String commandId, String command, HeatModuleCode heatModuleCode) throws Exception { |
||||
|
double clawCapPick = devicePositionService.getPosition(DevicePositionCode.clawCapPick).getDistance(); //获取拍子夹取距离 |
||||
|
double clawCapGrip = devicePositionService.getPosition(DevicePositionCode.clawCapGrip).getDistance(); //获取拍子夹紧距离 |
||||
|
double trayLower = devicePositionService.getPosition(DevicePositionCode.trayLower).getDistance(); //获取加热位下降托盘位置 |
||||
|
double heatModuleCapMoveHeight = devicePositionService.getPosition(DevicePositionCode.heatModuleCapMoveHeight).getDistance();//加热模块拍子移动高度 |
||||
|
double capModuleCapMoveHeight = devicePositionService.getPosition(DevicePositionCode.capModuleCapMoveHeight).getDistance();//拍子升降模块拍子z轴移动高度 |
||||
|
Point3D capStorageCapClawPoint3D = devicePositionService.getPosition(DevicePositionCode.capStorageCapClawPoint).getPoint3D();//获取拍子存放区上方点位; |
||||
|
|
||||
|
heatModuleService.heaterMotorMoveNoWait(commandId, command, heatModuleCode, trayLower);//确保目标加热模块是下降状态 |
||||
|
|
||||
|
gantryModuleService.gantryXYMove(commandId, command, capStorageCapClawPoint3D);//移动机械臂至拍子存放区上方 |
||||
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(0);//将加热模块托盘状态改为下降 |
||||
|
gantryModuleService.clawMove(commandId, command, clawCapPick);//将夹爪打开,准备夹取拍子 |
||||
|
gantryModuleService.gantryZMove(capModuleCapMoveHeight);//下降z轴,使夹爪落入拍子升降模块拍子孔位 |
||||
|
gantryModuleService.clawMove(commandId, command, clawCapGrip);//将夹爪收紧,夹住拍子 |
||||
|
gantryModuleService.gantryZMoveZero(commandId, command);//抬升z轴 |
||||
|
deviceCommandTempUtilService.carryMoveXYToHeatManyPoints(commandId, command, heatModuleCode, ClawItemType.cap);//将拍子移动至目标加热模块上方 |
||||
|
capModuleService.capUpBalanceNoWait(commandId, command); //提升拍子存放区 |
||||
|
|
||||
|
deviceCommandTempUtilService.moveTrayHeatModuleAvoidUpNoWait(commandId, command, heatModuleCode); |
||||
|
Thread.sleep(4500); |
||||
|
|
||||
|
gantryModuleService.gantryZMove(heatModuleCapMoveHeight);//下降z轴,使夹拍子落入加热模块 |
||||
|
gantryModuleService.clawMove(commandId, command, clawCapPick);//将夹爪打开,释放拍子 |
||||
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setCapExist(true);//加热模块是否存在拍子 |
||||
|
gantryModuleService.gantryZMoveZero(commandId, command);//抬升z轴 |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 从加液模块移动托盘至指定加热模块 |
||||
|
*/ |
||||
|
public void moveTrayToHeatModule(String commandId, String command, HeatModuleCode heatModuleCode) throws Exception { |
||||
|
double clawTrayPick = devicePositionService.getPosition(DevicePositionCode.clawTrayPick).getDistance();//获取夹爪托盘夹取距离 |
||||
|
double clawTrayGrip = devicePositionService.getPosition(DevicePositionCode.clawTrayGrip).getDistance();//获取夹爪托盘夹紧距离 |
||||
|
double trayLower = devicePositionService.getPosition(DevicePositionCode.trayLower).getDistance(); //获取加热位下降托盘位置 |
||||
|
double heatModuleTrayMoveHeight = devicePositionService.getPosition(DevicePositionCode.heatModuleTrayMoveHeight).getDistance();//加热模块托盘z轴移动高度 |
||||
|
double solutionModuleTrayMoveHeight = devicePositionService.getPosition(DevicePositionCode.solutionModuleTrayMoveHeight).getDistance();//加液模块托盘z轴移动高度 |
||||
|
Point3D liquidAreaTrayPoint3D = devicePositionService.getPosition(DevicePositionCode.liquidAreaTrayPoint).getPoint3D();//获取加液模块上方点位 |
||||
|
|
||||
|
TrayState trayState = deviceStateService.getDeviceState().getTrayInSolutionModule(); |
||||
|
if (trayState != null) { |
||||
|
trayState.setHeatModuleId(heatModuleCode); |
||||
|
} |
||||
|
|
||||
|
heatModuleService.heaterMotorMoveNoWait(commandId, command, heatModuleCode, trayLower);//确保目标加热模块是下降状态 |
||||
|
|
||||
|
gantryModuleService.gantryXYMove(commandId, command, liquidAreaTrayPoint3D); //将机械臂移动至加液模块上方 |
||||
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(0);//将加热模块托盘状态改为下降 |
||||
|
gantryModuleService.clawMove(commandId, command, clawTrayPick);//将夹爪打开,准备夹取托盘 |
||||
|
gantryModuleService.gantryZMove(solutionModuleTrayMoveHeight);//下降z轴,使夹爪落入托盘孔位 |
||||
|
gantryModuleService.clawMove(commandId, command, clawTrayGrip);//将夹爪收紧,夹住托盘 |
||||
|
gantryModuleService.gantryZMoveZero(commandId, command);//抬升z轴 |
||||
|
if (trayState != null) { |
||||
|
trayState.setInSolutionModule(false); |
||||
|
} |
||||
|
deviceStateService.getDeviceState().getSolutionModule().setTrayStatus(0);//加液模块是否有托盘 |
||||
|
deviceCommandTempUtilService.carryMoveXYToHeatManyPoints(commandId, command, heatModuleCode, ClawItemType.tray);//将托盘移动至目标加热模块上方 |
||||
|
|
||||
|
deviceCommandTempUtilService.moveTrayHeatModuleAvoidUpNoWait(commandId, command, heatModuleCode);//抬升避让的加热模块 |
||||
|
Thread.sleep(3200); |
||||
|
|
||||
|
gantryModuleService.gantryZMove(heatModuleTrayMoveHeight);//下降z轴,使托盘落入加热模块 |
||||
|
gantryModuleService.clawMove(commandId, command, clawTrayPick);//将夹爪打开,释放托盘 |
||||
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayStatus(1);//加热模块是否存在托盘 |
||||
|
if (trayState != null) { |
||||
|
trayState.setInHeatModule(true); |
||||
|
} |
||||
|
gantryModuleService.gantryZMove(commandId, command, 0);//抬升z轴 |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
package com.iflytop.gd.common.enums; |
||||
|
|
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 夹爪夹取的物品类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
public enum ClawItemType { |
||||
|
tray, |
||||
|
cap, |
||||
|
tube |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue