5 changed files with 162 additions and 76 deletions
-
2src/main/java/com/qyft/gd/device/service/DeviceService.java
-
143src/main/java/com/qyft/gd/device/service/DeviceStepService.java
-
16src/main/java/com/qyft/gd/model/bo/AddLiquid.java
-
2src/main/java/com/qyft/gd/service/CMDService.java
-
75src/main/java/com/qyft/gd/service/CraftsStepService.java
@ -0,0 +1,143 @@ |
|||||
|
package com.qyft.gd.device.service; |
||||
|
|
||||
|
import com.qyft.gd.model.bo.AddLiquid; |
||||
|
import com.qyft.gd.service.BaseDataService; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.function.BooleanSupplier; |
||||
|
|
||||
|
/** |
||||
|
* 设备步骤操作 |
||||
|
*/ |
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class DeviceStepService { |
||||
|
|
||||
|
DeviceService deviceService; |
||||
|
BaseDataService baseDataService; |
||||
|
|
||||
|
/** |
||||
|
* 抬起托盘 |
||||
|
* |
||||
|
* @param heaterId 加热区id |
||||
|
*/ |
||||
|
public void upTray(String heaterId) { |
||||
|
deviceService.raiseTray(heaterId); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 降下托盘 |
||||
|
* |
||||
|
* @param heaterId 加热区id |
||||
|
*/ |
||||
|
public void downTray(String heaterId) { |
||||
|
deviceService.lowerTray(heaterId); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 添加溶液 |
||||
|
* |
||||
|
* @param tubeCoordinateList 需要添加溶液的试管坐标list: x,y,z 字符 |
||||
|
* @param addLiquidList 需要添加的溶液 |
||||
|
*/ |
||||
|
public boolean addLiquid(List<String> tubeCoordinateList, List<AddLiquid> addLiquidList) { |
||||
|
List<Boolean> results = new ArrayList<>(); |
||||
|
for (String tubeCoordinate : tubeCoordinateList) { |
||||
|
String[] tubeCoordinateArray = tubeCoordinate.split(","); |
||||
|
int x = Integer.parseInt(tubeCoordinateArray[0]); |
||||
|
int y = Integer.parseInt(tubeCoordinateArray[1]); |
||||
|
int z = Integer.parseInt(tubeCoordinateArray[2]); |
||||
|
results.add(deviceService.moveLiquidArmToPoint(x, y, z));//加液孔对准试管 |
||||
|
for (AddLiquid addLiquid : addLiquidList) {//依次添加溶液 |
||||
|
results.add(deviceService.addLiquid(addLiquid.getPumpId(), addLiquid.getVolume())); |
||||
|
} |
||||
|
} |
||||
|
return results.stream().allMatch(Boolean::booleanValue); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 将指定加热区的托盘移至加液区 |
||||
|
* |
||||
|
* @param heaterId 加热区id |
||||
|
*/ |
||||
|
public boolean moveToSol(String heaterId) { |
||||
|
//从内存中获取加热区拍子点位 |
||||
|
//机械臂移动到拍子上方 |
||||
|
//张开夹爪 |
||||
|
//向下移动机械臂,确保夹爪闭合可以夹住拍子 |
||||
|
//闭合夹爪 |
||||
|
//解除拍子密封 |
||||
|
//向上移动机械臂,确保不会发生碰撞的高度 |
||||
|
//拍子存放区高度 -1 |
||||
|
//从内存中获取拍子存放区点位 |
||||
|
//移动机械臂至拍子存放区点位 |
||||
|
//向下移动机械臂,使拍子落入拍子存放区 |
||||
|
//张开夹爪,放下拍子 |
||||
|
//向上移动机械臂,脱离拍子存放区 |
||||
|
//移动机械臂至加热区 |
||||
|
//张开夹爪 |
||||
|
//向下移动机械臂,确保夹爪闭合可以夹住托盘 |
||||
|
//闭合夹爪 |
||||
|
//向上移动机械臂,确保不会发生碰撞的高度 |
||||
|
//从内存中获取加液区点位 |
||||
|
//移动机械臂至加液区点位 |
||||
|
//向下移动机械臂,放下托盘 |
||||
|
//张开夹爪 |
||||
|
//向上移动机械臂,脱离托盘 |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
//移至加热 |
||||
|
public boolean moveToHeater(int heaterId) { |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
//摇匀 |
||||
|
public boolean shaking() { |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
//开始加热 |
||||
|
public boolean startHeating(int heaterId) { |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
//停止加热 |
||||
|
public boolean stopHeating(int heaterId) { |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
//拍照 |
||||
|
public boolean takePhoto() { |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
//移至异常 |
||||
|
public boolean moveToExc() { |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
//移除异常 |
||||
|
public boolean moveOutToExc() { |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 等待 |
||||
|
* |
||||
|
* @param millis 毫秒 |
||||
|
*/ |
||||
|
private boolean delay(int millis) { |
||||
|
try { |
||||
|
Thread.sleep(millis); |
||||
|
return true; |
||||
|
} catch (InterruptedException e) { |
||||
|
Thread.currentThread().interrupt(); |
||||
|
} |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package com.qyft.gd.model.bo; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* 添加溶液 |
||||
|
*/ |
||||
|
@Schema(description = "添加溶液") |
||||
|
@Data |
||||
|
public class AddLiquid { |
||||
|
@Schema(description = "泵id") |
||||
|
private Long pumpId; |
||||
|
@Schema(description = "加液量") |
||||
|
private Integer volume; |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue