22 changed files with 461 additions and 214 deletions
-
4src/main/java/com/iflytop/gd/debug/services/cmds/DoorCloseCommandHandler.java
-
5src/main/java/com/iflytop/gd/debug/services/cmds/DoorOpenCommandHandler.java
-
32src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenDoor.java
-
21src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenLiquidFillingArm.java
-
23src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenTransportationArm.java
-
3src/main/java/com/iflytop/gd/infrastructure/devices/StandardStepMotor.java
-
35src/main/java/com/iflytop/gd/infrastructure/drivers/WebSocketCommandBusImpl.java
-
5src/main/java/com/iflytop/gd/system/constants/Dim.java
-
5src/main/java/com/iflytop/gd/system/constants/LiquidFillArmMotorIndex.java
-
11src/main/java/com/iflytop/gd/system/devices/BinaryDevice.java
-
47src/main/java/com/iflytop/gd/system/devices/ColdTray.java
-
7src/main/java/com/iflytop/gd/system/devices/Door.java
-
9src/main/java/com/iflytop/gd/system/devices/DoorStepMotor.java
-
14src/main/java/com/iflytop/gd/system/devices/Fan.java
-
13src/main/java/com/iflytop/gd/system/devices/Heater.java
-
43src/main/java/com/iflytop/gd/system/devices/LiquidFillingArm.java
-
12src/main/java/com/iflytop/gd/system/devices/Relay.java
-
4src/main/java/com/iflytop/gd/system/devices/Sensor.java
-
52src/main/java/com/iflytop/gd/system/devices/TransportationArm.java
-
23src/main/java/com/iflytop/gd/system/models/Point3D.java
-
3src/main/resources/application.yml
@ -0,0 +1,32 @@ |
|||
package com.iflytop.gd.infrastructure.devices; |
|||
|
|||
import com.iflytop.gd.infrastructure.drivers.ModuleId; |
|||
import com.iflytop.gd.system.devices.Door; |
|||
import com.iflytop.gd.system.devices.StepMotor; |
|||
import com.iflytop.gd.system.drivers.CommandBus; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 步进电机驱动的门实现 |
|||
*/ |
|||
@Component |
|||
public class MotorDrivenDoor implements Door { |
|||
|
|||
private final StepMotor doorMotor; |
|||
|
|||
public MotorDrivenDoor(CommandBus commandBus) { |
|||
this.doorMotor = new StandardStepMotor(ModuleId.DoorM, commandBus); |
|||
} |
|||
|
|||
@Override |
|||
public void open() { |
|||
|
|||
} |
|||
|
|||
|
|||
@Override |
|||
public void close() { |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.iflytop.gd.infrastructure.devices; |
|||
|
|||
|
|||
import com.iflytop.gd.infrastructure.drivers.ModuleId; |
|||
import com.iflytop.gd.system.devices.StepMotor; |
|||
import com.iflytop.gd.system.drivers.CommandBus; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 液体加注机械臂 |
|||
*/ |
|||
@Component |
|||
public class MotorDrivenLiquidFillingArm { |
|||
private final StepMotor largeArmMotor; |
|||
private final StepMotor smallArmMotor; |
|||
|
|||
public MotorDrivenLiquidFillingArm(CommandBus commandBus) { |
|||
this.largeArmMotor = new StandardStepMotor(ModuleId.DualRobotAxis1M, commandBus); |
|||
this.smallArmMotor = new StandardStepMotor(ModuleId.DualRobotAxis2M, commandBus); |
|||
} |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.iflytop.gd.infrastructure.devices; |
|||
|
|||
import com.iflytop.gd.infrastructure.drivers.ModuleId; |
|||
import com.iflytop.gd.system.devices.StepMotor; |
|||
import com.iflytop.gd.system.drivers.CommandBus; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 试管转移机械臂 |
|||
*/ |
|||
@Component |
|||
public class MotorDrivenTransportationArm { |
|||
|
|||
private StepMotor xDimMotor; |
|||
private StepMotor yDimMotor; |
|||
private StepMotor zDimMotor; |
|||
|
|||
public MotorDrivenTransportationArm(CommandBus commandBus) { |
|||
this.xDimMotor = new StandardStepMotor(ModuleId.HBotXM, commandBus); |
|||
this.yDimMotor = new StandardStepMotor(ModuleId.HBotYM, commandBus); |
|||
this.zDimMotor = new StandardStepMotor(ModuleId.HBotZM, commandBus); |
|||
} |
|||
} |
@ -1,9 +1,10 @@ |
|||
package com.iflytop.gd.system.devices; |
|||
package com.iflytop.gd.infrastructure.devices; |
|||
|
|||
import com.iflytop.gd.infrastructure.drivers.CmdId; |
|||
import com.iflytop.gd.infrastructure.drivers.ModuleId; |
|||
import com.iflytop.gd.system.constants.DistanceUnit; |
|||
import com.iflytop.gd.system.constants.RotationDirection; |
|||
import com.iflytop.gd.system.devices.StepMotor; |
|||
import com.iflytop.gd.system.drivers.CommandBus; |
|||
import com.iflytop.gd.system.exceptions.CommandExecTimeoutException; |
|||
import com.iflytop.gd.system.exceptions.HardwareErrorException; |
@ -0,0 +1,5 @@ |
|||
package com.iflytop.gd.system.constants; |
|||
|
|||
public enum Dim { |
|||
X, Y, Z |
|||
} |
@ -0,0 +1,5 @@ |
|||
package com.iflytop.gd.system.constants; |
|||
|
|||
public enum LiquidFillArmMotorIndex { |
|||
LargeArm, SmallArm |
|||
} |
@ -1,11 +0,0 @@ |
|||
package com.iflytop.gd.system.devices; |
|||
|
|||
/** |
|||
* 开关类型设备驱动定义 |
|||
*/ |
|||
public interface BinaryDevice { |
|||
void open(); |
|||
void close(); |
|||
boolean isOpen(); |
|||
boolean isClosed(); |
|||
} |
@ -0,0 +1,7 @@ |
|||
package com.iflytop.gd.system.devices; |
|||
|
|||
public interface Door { |
|||
void open(); |
|||
void close(); |
|||
|
|||
} |
@ -1,9 +0,0 @@ |
|||
package com.iflytop.gd.system.devices; |
|||
|
|||
/** |
|||
* 步进电机 |
|||
*/ |
|||
public class DoorStepMotor { |
|||
|
|||
|
|||
} |
@ -1,21 +1,38 @@ |
|||
package com.iflytop.gd.system.devices; |
|||
|
|||
import com.iflytop.gd.system.constants.LiquidFillArmMotorIndex; |
|||
import com.iflytop.gd.system.constants.RotationDirection; |
|||
import com.iflytop.gd.system.constants.SpeedUnit; |
|||
import com.iflytop.gd.system.models.Point3D; |
|||
|
|||
import com.iflytop.gd.infrastructure.drivers.ModuleId; |
|||
import com.iflytop.gd.system.drivers.CommandBus; |
|||
import jakarta.annotation.Resource; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 液体加注机械臂 |
|||
* 加液机械臂 |
|||
*/ |
|||
@Component |
|||
public class LiquidFillingArm { |
|||
private final StepMotor largeArmMotor; |
|||
private final StepMotor smallArmMotor; |
|||
public interface LiquidFillingArm { |
|||
|
|||
public LiquidFillingArm(CommandBus commandBus) { |
|||
this.largeArmMotor = new StandardStepMotor(ModuleId.DualRobotAxis1M, commandBus); |
|||
this.smallArmMotor = new StandardStepMotor(ModuleId.DualRobotAxis2M, commandBus); |
|||
} |
|||
/** |
|||
* 机械臂移动到指定点 |
|||
* @param point 点坐标 |
|||
* @return 是否移动完成 |
|||
*/ |
|||
boolean moveTo(Point3D point); |
|||
|
|||
/** |
|||
* 旋转到指定角度 |
|||
* @param liquidFillArmMotorIndex 机械臂电机索引 |
|||
* @param angle 角度 |
|||
* @param direction 旋转方向 |
|||
* @return 是否旋转完成 |
|||
*/ |
|||
boolean rotateTo(LiquidFillArmMotorIndex liquidFillArmMotorIndex, Integer angle, RotationDirection direction); |
|||
|
|||
|
|||
/** |
|||
* 设置旋转速率 |
|||
* @param speed 速率值 |
|||
* @param speedUnit 速率单位 |
|||
* @return 是否设置成功 |
|||
*/ |
|||
boolean setRotationSpeed(Integer speed, SpeedUnit speedUnit); |
|||
} |
@ -0,0 +1,4 @@ |
|||
package com.iflytop.gd.system.devices; |
|||
|
|||
public interface Sensor { |
|||
} |
@ -1,22 +1,42 @@ |
|||
package com.iflytop.gd.system.devices; |
|||
|
|||
import com.iflytop.gd.infrastructure.drivers.ModuleId; |
|||
import com.iflytop.gd.system.drivers.CommandBus; |
|||
import org.springframework.stereotype.Component; |
|||
import com.iflytop.gd.system.constants.Dim; |
|||
import com.iflytop.gd.system.constants.DistanceUnit; |
|||
import com.iflytop.gd.system.constants.SpeedUnit; |
|||
import com.iflytop.gd.system.models.Point3D; |
|||
|
|||
/** |
|||
* 试管转移机械臂 |
|||
*/ |
|||
@Component |
|||
public class TransportationArm { |
|||
public interface TransportationArm { |
|||
|
|||
private StepMotor xDimMotor; |
|||
private StepMotor yDimMotor; |
|||
private StepMotor zDimMotor; |
|||
/** |
|||
* 机械臂XYZ三个维度移动指定距离 |
|||
* @param dim 维度 |
|||
* @param distance 距离值 |
|||
* @param unit 距离单位 |
|||
* @return 是否移动完成 |
|||
*/ |
|||
boolean move(Dim dim, Integer distance, DistanceUnit unit); |
|||
|
|||
public TransportationArm(CommandBus commandBus) { |
|||
this.xDimMotor = new StandardStepMotor(ModuleId.HBotXM, commandBus); |
|||
this.yDimMotor = new StandardStepMotor(ModuleId.HBotYM, commandBus); |
|||
this.zDimMotor = new StandardStepMotor(ModuleId.HBotZM, commandBus); |
|||
} |
|||
/** |
|||
* 移动到指定点 |
|||
* @param point 点坐标 |
|||
* @param unit 距离单位 |
|||
* @return 是否移动完成 |
|||
*/ |
|||
boolean move(Point3D point, DistanceUnit unit); |
|||
|
|||
/** |
|||
* 独立停止XYZ三个维度移动 |
|||
* @param dim 维度 |
|||
* @return 是否执行完成 |
|||
*/ |
|||
boolean stop(Dim dim); |
|||
|
|||
/** |
|||
* 独立设置XYZ三个轴移动速率 |
|||
* @param dim 维度 |
|||
* @param speed 速率 |
|||
* @param unit 速率单位 |
|||
* @return 是否设置完成 |
|||
*/ |
|||
boolean setSpeed(Dim dim, Integer speed, SpeedUnit unit); |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.iflytop.gd.system.models; |
|||
|
|||
|
|||
import lombok.Getter; |
|||
|
|||
@Getter |
|||
public class Point3D { |
|||
private final Integer x; |
|||
private final Integer y; |
|||
private final Integer z; |
|||
|
|||
public Point3D(Integer x, Integer y, Integer z) { |
|||
this.x = x; |
|||
this.y = y; |
|||
this.z = z; |
|||
} |
|||
|
|||
public Point3D(Integer x, Integer y) { |
|||
this.x = x; |
|||
this.y = y; |
|||
this.z = 0; |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue