|
|
@ -44,44 +44,160 @@ public class CMDService { |
|
|
|
commandMap.put(Commands.MOVE_MACHINE_ARM, this::moveMachineArm); |
|
|
|
commandMap.put(Commands.MOVE_TUBE, this::moveTube); |
|
|
|
commandMap.put(Commands.MOVE_TO_HEAT_AREA, this::moveToHeatArea); |
|
|
|
commandMap.put(Commands.OPEN_CLAW, this::openClaw); |
|
|
|
commandMap.put(Commands.CLOSE_CLAW, this::closeClaw); |
|
|
|
} |
|
|
|
// 机械臂爪子开启 |
|
|
|
private List<Supplier<Boolean>> openClaw(Map<String, Object> params) { |
|
|
|
List<Supplier<Boolean>> cmdList = new ArrayList<>(); |
|
|
|
cmdList.add(() -> deviceService.openClaw()); |
|
|
|
return cmdList; |
|
|
|
} |
|
|
|
|
|
|
|
// 机械臂爪子闭合 |
|
|
|
private List<Supplier<Boolean>> closeClaw(Map<String, Object> params) { |
|
|
|
List<Supplier<Boolean>> cmdList = new ArrayList<>(); |
|
|
|
cmdList.add(() -> deviceService.closeClaw()); |
|
|
|
return cmdList; |
|
|
|
} |
|
|
|
// 移至加热 |
|
|
|
private List<Supplier<Boolean>> moveToHeatArea(Map<String, Object> params) { |
|
|
|
List<Supplier<Boolean>> cmdList = new ArrayList<>(); |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(1,2,3)); |
|
|
|
Map<String ,Object> map = baseDataService.getOffsetMap(); |
|
|
|
String heatAreaPosition = baseDataService.getHeatAreaPositionById((Integer) params.get("areaId")); |
|
|
|
String [] heatAreaPositionArr =heatAreaPosition.split(","); |
|
|
|
int x1 = Integer.parseInt(heatAreaPositionArr[0]); |
|
|
|
int y1 = Integer.parseInt(heatAreaPositionArr[1]); |
|
|
|
int z1 = Integer.parseInt(heatAreaPositionArr[2]); |
|
|
|
|
|
|
|
String solutionAreaPosition = baseDataService.getSolutionAreaPosition(); |
|
|
|
String [] solutionAreaPositionArr = solutionAreaPosition.split(","); |
|
|
|
int x2 = Integer.parseInt(solutionAreaPositionArr[0]); |
|
|
|
int y2 = Integer.parseInt(solutionAreaPositionArr[1]); |
|
|
|
int z2 = Integer.parseInt(solutionAreaPositionArr[2]); |
|
|
|
// 机械臂移动到加液位 |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x2,y2,z2)); |
|
|
|
// 打开钩子 |
|
|
|
cmdList.add(() -> deviceService.openClaw()); |
|
|
|
// 下降高度 |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x2,y2, z2 - (Integer) map.get("sys_offset_tube_rack_take_height"))); |
|
|
|
// 闭合钩子 |
|
|
|
cmdList.add(() -> deviceService.closeClaw()); |
|
|
|
// 机械臂抬起高度 |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x2,y2, z2 + (Integer) map.get("sys_offset_tube_rack_take_height") + (Integer) map.get("sys_offset_tube_height"))); |
|
|
|
// 机械臂移动到指定加热位 |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x1,y1, z2 + (Integer) map.get("sys_offset_tube_rack_take_height") + (Integer) map.get("sys_offset_tube_height"))); |
|
|
|
// 机械臂下降高度 |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x1,y1, z1)); |
|
|
|
// 机械臂打开钩子 |
|
|
|
cmdList.add(() -> deviceService.openClaw()); |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(4,5,6)); |
|
|
|
// 机械臂上升高度 |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x1,y1, z1 + (Integer) map.get("sys_offset_tube_rack_take_height"))); |
|
|
|
// 关闭钩子 |
|
|
|
cmdList.add(() -> deviceService.closeClaw()); |
|
|
|
|
|
|
|
return cmdList; |
|
|
|
} |
|
|
|
// 移动单个试管 |
|
|
|
private List<Supplier<Boolean> >moveTube(Map<String, Object> params) { |
|
|
|
List<Supplier<Boolean>> cmdList = new ArrayList<>(); |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(11,22,33)); |
|
|
|
|
|
|
|
return cmdList; |
|
|
|
} |
|
|
|
|
|
|
|
// 机械臂 |
|
|
|
private List<Supplier<Boolean>> moveMachineArm(Map<String, Object> params) { |
|
|
|
List<Supplier<Boolean>> cmdList = new ArrayList<>(); |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(11,22,33)); |
|
|
|
String position = (String) params.get("position"); |
|
|
|
String [] positionArr =position.split(","); |
|
|
|
int x = Integer.parseInt(positionArr[0]); |
|
|
|
int y = Integer.parseInt(positionArr[1]); |
|
|
|
int z = Integer.parseInt(positionArr[2]); |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x,y,z)); |
|
|
|
return cmdList; |
|
|
|
} |
|
|
|
// 装回盖子 |
|
|
|
private List<Supplier<Boolean>> putBackCap(Map<String, Object> params) { |
|
|
|
List<Supplier<Boolean>> cmdList = new ArrayList<>(); |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(11,22,33)); |
|
|
|
// 加热位机器代码 |
|
|
|
String heaterId = baseDataService.getHeatAreaHardwareIdById((Integer) params.get("areaId")); |
|
|
|
String lidPosition = baseDataService.getLidPosition(); |
|
|
|
String [] lidPositionArr = lidPosition.split(","); |
|
|
|
int x1 = Integer.parseInt(lidPositionArr[0]); |
|
|
|
int y1 = Integer.parseInt(lidPositionArr[1]); |
|
|
|
int z1 = Integer.parseInt(lidPositionArr[2]); |
|
|
|
|
|
|
|
String position = baseDataService.getHeatAreaLidPositionById((Integer) params.get("areaId")); |
|
|
|
Map<String ,Object> map = baseDataService.getOffsetMap(); |
|
|
|
String [] positionArr =position.split(","); |
|
|
|
int x2 = Integer.parseInt(positionArr[0]); |
|
|
|
int y2 = Integer.parseInt(positionArr[1]); |
|
|
|
int z2 = Integer.parseInt(positionArr[2]); |
|
|
|
//机械臂移动到拍子存放位坐标 |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x1,y1,z1)); |
|
|
|
// 打开钩子 |
|
|
|
cmdList.add(() -> deviceService.openClaw()); |
|
|
|
// 机械臂下移位置 |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x1,y1, z1 - (Integer) map.get("sys_offset_lid_take_height"))); |
|
|
|
// 闭合钩子 |
|
|
|
cmdList.add(() -> deviceService.closeClaw()); |
|
|
|
// 机械臂抬起指定高度 |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x1,y1,z1)); |
|
|
|
// 机械臂移至指定试管架 |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x2,y2,z2)); |
|
|
|
// 打开钩子 |
|
|
|
cmdList.add(() -> deviceService.openClaw()); |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(4,54,6)); |
|
|
|
// 机械臂上移指定位置 |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x1,y1,z1 + (Integer) map.get("sys_offset_lid_take_height"))); |
|
|
|
// 关闭钩子 |
|
|
|
cmdList.add(() -> deviceService.closeClaw()); |
|
|
|
// 密封 |
|
|
|
// 解除密封 |
|
|
|
cmdList.add(() -> deviceService.setSealLid(Integer.parseInt(heaterId), true)); |
|
|
|
// 机械臂复位 |
|
|
|
return cmdList; |
|
|
|
} |
|
|
|
// 取试管架盖 |
|
|
|
private List<Supplier<Boolean>> takeOffCap(Map<String, Object> params) { |
|
|
|
List<Supplier<Boolean>> cmdList = new ArrayList<>(); |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(13,42,53)); |
|
|
|
// 拍子坐标 |
|
|
|
String position = baseDataService.getHeatAreaLidPositionById((Integer) params.get("areaId")); |
|
|
|
// 加热位机器代码 |
|
|
|
String heaterId = baseDataService.getHeatAreaHardwareIdById((Integer) params.get("areaId")); |
|
|
|
|
|
|
|
Map<String ,Object> map = baseDataService.getOffsetMap(); |
|
|
|
String [] positionArr =position.split(","); |
|
|
|
int x1 = Integer.parseInt(positionArr[0]); |
|
|
|
int y1 = Integer.parseInt(positionArr[1]); |
|
|
|
int z1 = Integer.parseInt(positionArr[2]); |
|
|
|
|
|
|
|
String lidPosition = baseDataService.getLidPosition(); |
|
|
|
String [] lidPositionArr = lidPosition.split(","); |
|
|
|
int x2 = Integer.parseInt(lidPositionArr[0]); |
|
|
|
int y2 = Integer.parseInt(lidPositionArr[1]); |
|
|
|
int z2 = Integer.parseInt(lidPositionArr[2]); |
|
|
|
|
|
|
|
//机械臂移动到拍子坐标 |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x1,y1,z1)); |
|
|
|
// 解除密封 |
|
|
|
cmdList.add(() -> deviceService.setSealLid(Integer.parseInt(heaterId), false)); |
|
|
|
// 打开钩子 |
|
|
|
cmdList.add(() -> deviceService.openClaw()); |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(4,5,6)); |
|
|
|
// 机械臂下移位置 |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x1,y1, z1 - (Integer) map.get("sys_offset_lid_take_height"))); |
|
|
|
// 闭合钩子 |
|
|
|
cmdList.add(() -> deviceService.closeClaw()); |
|
|
|
// 机械臂抬起指定高度 |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x1,y1,z1)); |
|
|
|
// 机械臂移至拍子存放区 |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x2,y2,z2)); |
|
|
|
// 打开钩子 |
|
|
|
cmdList.add(() -> deviceService.openClaw()); |
|
|
|
// 机械臂上移指定位置 |
|
|
|
cmdList.add(() -> deviceService.moveRailArmToPoint(x2,y2,z2 + (Integer) map.get("sys_offset_lid_take_height"))); |
|
|
|
// 关闭钩子 |
|
|
|
cmdList.add(() -> deviceService.closeClaw()); |
|
|
|
// 机械臂复位 |
|
|
|
return cmdList; |
|
|
|
} |
|
|
|
// 拍照 |
|
|
|