From dc585b5956614a6cc7d56e6e6fd4e59d10644d3d Mon Sep 17 00:00:00 2001 From: huangxiang <155373492@qq.com> Date: Tue, 29 Apr 2025 16:04:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E8=AE=BE=E5=A4=87=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gd/debug/controller/CmdDebugController.java | 5 +- .../services/cmds/DoorStopCommandHandler.java | 4 +- .../gd/infrastructure/devices/MotorDrivenDoor.java | 42 +++++++++- .../devices/MotorDrivenLiquidFillingArm.java | 24 +++++- .../devices/MotorDrivenTransportationArm.java | 38 +++++++-- .../infrastructure/devices/StandardStepMotor.java | 2 +- .../devices/VirtualLiquidFillingArm.java | 28 +++++++ .../infrastructure/devices/VirtualStepMotor.java | 28 ++++++- .../devices/VirtualTransportationArm.java | 92 ++++++++++++++++++++++ .../com/iflytop/gd/system/constants/SpeedUnit.java | 9 ++- .../java/com/iflytop/gd/system/devices/Door.java | 2 +- .../gd/system/devices/LiquidFillingArm.java | 6 +- .../com/iflytop/gd/system/devices/ServoMotor.java | 12 +++ .../com/iflytop/gd/system/devices/StepMotor.java | 2 +- .../gd/system/devices/TransportationArm.java | 10 +-- src/main/resources/application-dev.yml | 35 ++++++++ src/main/resources/application-test.yml | 35 ++++++++ src/main/resources/application.yml | 36 +-------- src/main/resources/logback.xml | 2 +- 19 files changed, 351 insertions(+), 61 deletions(-) create mode 100644 src/main/java/com/iflytop/gd/infrastructure/devices/VirtualLiquidFillingArm.java create mode 100644 src/main/java/com/iflytop/gd/infrastructure/devices/VirtualTransportationArm.java create mode 100644 src/main/resources/application-dev.yml create mode 100644 src/main/resources/application-test.yml diff --git a/src/main/java/com/iflytop/gd/debug/controller/CmdDebugController.java b/src/main/java/com/iflytop/gd/debug/controller/CmdDebugController.java index 325980d..708d71b 100644 --- a/src/main/java/com/iflytop/gd/debug/controller/CmdDebugController.java +++ b/src/main/java/com/iflytop/gd/debug/controller/CmdDebugController.java @@ -29,10 +29,11 @@ public class CmdDebugController { String commandName = cmdDTO.getCommand(); try { CommandHandler commandHandler = registry.getCommandHandler(commandName); - log.info("调试指令开始执行"); + log.info("调试指令{}开始执行", commandName); commandHandler.handle(cmdDTO); + log.info("调试指令{}执行结束", commandName); } catch (UnSupportCommandException exception) { - log.error("未找到对应的调试指令"); + log.error("未找到对应的调试指令{}", commandName); String errorMsg = "未找到对应的调试指令, commandName=" + commandName; return Result.failed(errorMsg); } catch (Exception e) { diff --git a/src/main/java/com/iflytop/gd/debug/services/cmds/DoorStopCommandHandler.java b/src/main/java/com/iflytop/gd/debug/services/cmds/DoorStopCommandHandler.java index 6c598a9..8519164 100644 --- a/src/main/java/com/iflytop/gd/debug/services/cmds/DoorStopCommandHandler.java +++ b/src/main/java/com/iflytop/gd/debug/services/cmds/DoorStopCommandHandler.java @@ -3,6 +3,7 @@ package com.iflytop.gd.debug.services.cmds; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.common.annotation.CommandMapping; import com.iflytop.gd.common.cmd.CommandHandler; +import com.iflytop.gd.system.devices.Door; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -15,8 +16,9 @@ import org.springframework.stereotype.Component; @RequiredArgsConstructor @CommandMapping("debug_door_stop") public class DoorStopCommandHandler implements CommandHandler { + private final Door door; @Override public void handle(CmdDTO cmdDTO) { - + this.door.stop(); } } diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenDoor.java b/src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenDoor.java index d8f30c3..257f13d 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenDoor.java +++ b/src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenDoor.java @@ -1,32 +1,70 @@ package com.iflytop.gd.infrastructure.devices; +import com.iflytop.gd.common.exception.AppException; +import com.iflytop.gd.common.result.ResultCode; import com.iflytop.gd.infrastructure.drivers.ModuleId; +import com.iflytop.gd.system.constants.DistanceUnit; import com.iflytop.gd.system.devices.Door; 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; +import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; +import java.io.IOException; + /** * 步进电机驱动的门实现 */ +@Profile("test") @Component public class MotorDrivenDoor implements Door { private final StepMotor doorMotor; public MotorDrivenDoor(CommandBus commandBus) { - this.doorMotor = new StandardStepMotor(ModuleId.DoorM, commandBus); + this.doorMotor = new VirtualStepMotor(ModuleId.DoorM); } @Override public void open() { - + try { + doorMotor.easyMoveTo(100, DistanceUnit.MM); + } catch (HardwareErrorException e) { + throw new AppException(ResultCode.HARDWARE_ERROR); + } catch (CommandExecTimeoutException e) { + throw new AppException(ResultCode.COMMAND_EXEC_TIMEOUT); + } catch (IOException | InterruptedException e) { + throw new AppException(ResultCode.SYSTEM_ERROR); + } } @Override public void close() { + try { + doorMotor.easyMoveToZero(); + } catch (HardwareErrorException e) { + throw new AppException(ResultCode.HARDWARE_ERROR); + } catch (CommandExecTimeoutException e) { + throw new AppException(ResultCode.COMMAND_EXEC_TIMEOUT); + } catch (IOException | InterruptedException e) { + throw new AppException(ResultCode.SYSTEM_ERROR); + } + } + @Override + public void stop() { + try { + doorMotor.stop(); + } catch (HardwareErrorException e) { + throw new AppException(ResultCode.HARDWARE_ERROR); + } catch (CommandExecTimeoutException e) { + throw new AppException(ResultCode.COMMAND_EXEC_TIMEOUT); + } catch (IOException | InterruptedException e) { + throw new AppException(ResultCode.SYSTEM_ERROR); + } } } diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenLiquidFillingArm.java b/src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenLiquidFillingArm.java index d72ea54..dbb961c 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenLiquidFillingArm.java +++ b/src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenLiquidFillingArm.java @@ -2,15 +2,22 @@ package com.iflytop.gd.infrastructure.devices; import com.iflytop.gd.infrastructure.drivers.ModuleId; +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.devices.LiquidFillingArm; import com.iflytop.gd.system.devices.StepMotor; import com.iflytop.gd.system.drivers.CommandBus; +import com.iflytop.gd.system.models.Point3D; +import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; /** * 液体加注机械臂 */ +@Profile("test") @Component -public class MotorDrivenLiquidFillingArm { +public class MotorDrivenLiquidFillingArm implements LiquidFillingArm { private final StepMotor largeArmMotor; private final StepMotor smallArmMotor; @@ -18,4 +25,19 @@ public class MotorDrivenLiquidFillingArm { this.largeArmMotor = new StandardStepMotor(ModuleId.DualRobotAxis1M, commandBus); this.smallArmMotor = new StandardStepMotor(ModuleId.DualRobotAxis2M, commandBus); } + + @Override + public void moveTo(Point3D point) { + + } + + @Override + public void rotateTo(LiquidFillArmMotorIndex liquidFillArmMotorIndex, Integer angle, RotationDirection direction) { + + } + + @Override + public void setRotationSpeed(Integer speed, SpeedUnit speedUnit) { + + } } diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenTransportationArm.java b/src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenTransportationArm.java index 97cbc1a..f86e6c9 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenTransportationArm.java +++ b/src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenTransportationArm.java @@ -1,23 +1,51 @@ package com.iflytop.gd.infrastructure.devices; import com.iflytop.gd.infrastructure.drivers.ModuleId; +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.devices.StepMotor; +import com.iflytop.gd.system.devices.TransportationArm; import com.iflytop.gd.system.drivers.CommandBus; +import com.iflytop.gd.system.models.Point3D; +import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; /** - * 试管转移机械臂 + * 电机驱动转移机械臂 */ +@Profile("test") @Component -public class MotorDrivenTransportationArm { +public class MotorDrivenTransportationArm implements TransportationArm { - private StepMotor xDimMotor; - private StepMotor yDimMotor; - private StepMotor zDimMotor; + private final StepMotor xDimMotor; + private final StepMotor yDimMotor; + private final 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); } + + @Override + public void moveTo(Dim dim, Integer distance, DistanceUnit unit) { + + } + + @Override + public void relativelyMove(Dim dim, Integer distance, DistanceUnit unit) { + + } + + + @Override + public void stop(Dim dim) { + + } + + @Override + public void setSpeed(Dim dim, Integer speed, SpeedUnit unit) { + + } } diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/StandardStepMotor.java b/src/main/java/com/iflytop/gd/infrastructure/devices/StandardStepMotor.java index 90f2337..02f682e 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/StandardStepMotor.java +++ b/src/main/java/com/iflytop/gd/infrastructure/devices/StandardStepMotor.java @@ -84,7 +84,7 @@ public class StandardStepMotor implements StepMotor { @Override - public void stop() { + public void stop() throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { } diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/VirtualLiquidFillingArm.java b/src/main/java/com/iflytop/gd/infrastructure/devices/VirtualLiquidFillingArm.java new file mode 100644 index 0000000..9ac2c04 --- /dev/null +++ b/src/main/java/com/iflytop/gd/infrastructure/devices/VirtualLiquidFillingArm.java @@ -0,0 +1,28 @@ +package com.iflytop.gd.infrastructure.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.devices.LiquidFillingArm; +import com.iflytop.gd.system.models.Point3D; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Component; + +/** + * 虚拟加液机械臂 + */ +@Profile("dev") +@Component +public class VirtualLiquidFillingArm implements LiquidFillingArm { + @Override + public void moveTo(Point3D point) { + } + + @Override + public void rotateTo(LiquidFillArmMotorIndex liquidFillArmMotorIndex, Integer angle, RotationDirection direction) { + } + + @Override + public void setRotationSpeed(Integer speed, SpeedUnit speedUnit) { + } +} diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/VirtualStepMotor.java b/src/main/java/com/iflytop/gd/infrastructure/devices/VirtualStepMotor.java index d008fd5..035f378 100644 --- a/src/main/java/com/iflytop/gd/infrastructure/devices/VirtualStepMotor.java +++ b/src/main/java/com/iflytop/gd/infrastructure/devices/VirtualStepMotor.java @@ -1,5 +1,7 @@ package com.iflytop.gd.infrastructure.devices; +import cn.hutool.json.JSONUtil; +import com.iflytop.gd.infrastructure.drivers.ModuleId; import com.iflytop.gd.infrastructure.drivers.RegIndex; import com.iflytop.gd.system.constants.DistanceUnit; import com.iflytop.gd.system.constants.RotationDirection; @@ -7,14 +9,24 @@ import com.iflytop.gd.system.devices.StepMotor; import com.iflytop.gd.system.exceptions.CommandExecTimeoutException; import com.iflytop.gd.system.exceptions.HardwareErrorException; import com.iflytop.gd.system.models.MotorStatus; +import lombok.extern.slf4j.Slf4j; import java.io.IOException; import java.util.HashMap; import java.util.Map; +/** + * 虚拟步进电机 + */ +@Slf4j public class VirtualStepMotor implements StepMotor { - private MotorStatus motorStatus; + private MotorStatus motorStatus = new MotorStatus(); private Map registers = new HashMap(); + private final ModuleId moduleId; + + public VirtualStepMotor(ModuleId moduleId) { + this.moduleId = moduleId; + } @Override public void easyMoveBy(Integer value, DistanceUnit unit) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { @@ -25,33 +37,43 @@ public class VirtualStepMotor implements StepMotor { @Override public void easyMoveTo(Integer value, DistanceUnit unit) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { + log.debug("Moving to {}", value); this.motorStatus.setCurrentPosition(unit.toMM(value)); this.motorStatus.setZeroPosition(this.motorStatus.getCurrentPosition() == 0); this.motorStatus.setStopped(true); + log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.motorStatus)); } @Override public void easyMoveToZero() throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { + log.debug("Easy move to zero."); this.motorStatus.setCurrentPosition(0); this.motorStatus.setZeroPosition(this.motorStatus.getCurrentPosition() == 0); this.motorStatus.setStopped(true); + log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.motorStatus)); } @Override public void easyMoveToZeroPointQuick() { + log.debug("Easy move to zero quick."); this.motorStatus.setCurrentPosition(0); this.motorStatus.setZeroPosition(this.motorStatus.getCurrentPosition() == 0); this.motorStatus.setStopped(true); + log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.motorStatus)); } @Override public void enable() { + log.debug("Enable step motor."); this.motorStatus.setEnabled(true); + log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.motorStatus)); } @Override public void disable() { + log.debug("Disable step motor."); this.motorStatus.setEnabled(false); + log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.motorStatus)); } @Override @@ -65,8 +87,10 @@ public class VirtualStepMotor implements StepMotor { } @Override - public void stop() { + public void stop() throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { + log.debug("Stop step motor."); this.motorStatus.setStopped(true); + log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.motorStatus)); } @Override diff --git a/src/main/java/com/iflytop/gd/infrastructure/devices/VirtualTransportationArm.java b/src/main/java/com/iflytop/gd/infrastructure/devices/VirtualTransportationArm.java new file mode 100644 index 0000000..bcd5b3b --- /dev/null +++ b/src/main/java/com/iflytop/gd/infrastructure/devices/VirtualTransportationArm.java @@ -0,0 +1,92 @@ +package com.iflytop.gd.infrastructure.devices; + +import com.iflytop.gd.common.exception.AppException; +import com.iflytop.gd.common.result.ResultCode; +import com.iflytop.gd.infrastructure.drivers.ModuleId; +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.devices.StepMotor; +import com.iflytop.gd.system.devices.TransportationArm; +import com.iflytop.gd.system.exceptions.CommandExecTimeoutException; +import com.iflytop.gd.system.exceptions.HardwareErrorException; +import com.iflytop.gd.system.models.Point3D; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** + * 虚拟转移机械臂 + */ +@Component +@Profile("dev") +public class VirtualTransportationArm implements TransportationArm { + private final StepMotor xDimMotor; + private final StepMotor yDimMotor; + private final StepMotor zDimMotor; + private final Map stepMotors = new HashMap(); + + public VirtualTransportationArm() { + this.xDimMotor = new VirtualStepMotor(ModuleId.HBotXM); + this.yDimMotor = new VirtualStepMotor(ModuleId.HBotYM); + this.zDimMotor = new VirtualStepMotor(ModuleId.HBotZM); + stepMotors.put(Dim.X, xDimMotor); + stepMotors.put(Dim.Y, yDimMotor); + stepMotors.put(Dim.Z, zDimMotor); + } + + @Override + public void moveTo(Dim dim, Integer distance, DistanceUnit unit) { + try { + stepMotors.get(dim).easyMoveTo(distance, unit); + } catch (HardwareErrorException e) { + throw new AppException(ResultCode.HARDWARE_ERROR); + } catch (CommandExecTimeoutException e) { + throw new AppException(ResultCode.COMMAND_EXEC_TIMEOUT); + } catch (IOException | InterruptedException e) { + throw new AppException(ResultCode.SYSTEM_ERROR); + } + } + + @Override + public void relativelyMove(Dim dim, Integer distance, DistanceUnit unit) { + try { + stepMotors.get(dim).easyMoveBy(distance, unit); + } catch (HardwareErrorException e) { + throw new AppException(ResultCode.HARDWARE_ERROR); + } catch (CommandExecTimeoutException e) { + throw new AppException(ResultCode.COMMAND_EXEC_TIMEOUT); + } catch (IOException | InterruptedException e) { + throw new AppException(ResultCode.SYSTEM_ERROR); + } + } + + @Override + public void stop(Dim dim) { + try { + stepMotors.get(dim).stop(); + } catch (HardwareErrorException e) { + throw new AppException(ResultCode.HARDWARE_ERROR); + } catch (CommandExecTimeoutException e) { + throw new AppException(ResultCode.COMMAND_EXEC_TIMEOUT); + } catch (IOException | InterruptedException e) { + throw new AppException(ResultCode.SYSTEM_ERROR); + } + } + + @Override + public void setSpeed(Dim dim, Integer speed, SpeedUnit unit) { + try { + stepMotors.get(dim).setDefaultVelocity(unit.toMM_PER_SEC(speed)); + } catch (HardwareErrorException e) { + throw new AppException(ResultCode.HARDWARE_ERROR); + } catch (CommandExecTimeoutException e) { + throw new AppException(ResultCode.COMMAND_EXEC_TIMEOUT); + } catch (IOException | InterruptedException e) { + throw new AppException(ResultCode.SYSTEM_ERROR); + } + } +} diff --git a/src/main/java/com/iflytop/gd/system/constants/SpeedUnit.java b/src/main/java/com/iflytop/gd/system/constants/SpeedUnit.java index 72a5865..f87d879 100644 --- a/src/main/java/com/iflytop/gd/system/constants/SpeedUnit.java +++ b/src/main/java/com/iflytop/gd/system/constants/SpeedUnit.java @@ -4,5 +4,12 @@ package com.iflytop.gd.system.constants; * 移动速度单位 */ public enum SpeedUnit { - MM_PER_SEC, CM_PER_SEC + MM_PER_SEC, CM_PER_SEC; + + public Integer toMM_PER_SEC(Integer value) { + if (this == SpeedUnit.CM_PER_SEC) { + return value * 10; + } + return value; + } } diff --git a/src/main/java/com/iflytop/gd/system/devices/Door.java b/src/main/java/com/iflytop/gd/system/devices/Door.java index 6ca8977..0fc417a 100644 --- a/src/main/java/com/iflytop/gd/system/devices/Door.java +++ b/src/main/java/com/iflytop/gd/system/devices/Door.java @@ -3,5 +3,5 @@ package com.iflytop.gd.system.devices; public interface Door { void open(); void close(); - + void stop(); } diff --git a/src/main/java/com/iflytop/gd/system/devices/LiquidFillingArm.java b/src/main/java/com/iflytop/gd/system/devices/LiquidFillingArm.java index 587e468..9cae460 100644 --- a/src/main/java/com/iflytop/gd/system/devices/LiquidFillingArm.java +++ b/src/main/java/com/iflytop/gd/system/devices/LiquidFillingArm.java @@ -16,7 +16,7 @@ public interface LiquidFillingArm { * @param point 点坐标 * @return 是否移动完成 */ - boolean moveTo(Point3D point); + void moveTo(Point3D point); /** * 旋转到指定角度 @@ -25,7 +25,7 @@ public interface LiquidFillingArm { * @param direction 旋转方向 * @return 是否旋转完成 */ - boolean rotateTo(LiquidFillArmMotorIndex liquidFillArmMotorIndex, Integer angle, RotationDirection direction); + void rotateTo(LiquidFillArmMotorIndex liquidFillArmMotorIndex, Integer angle, RotationDirection direction); /** @@ -34,5 +34,5 @@ public interface LiquidFillingArm { * @param speedUnit 速率单位 * @return 是否设置成功 */ - boolean setRotationSpeed(Integer speed, SpeedUnit speedUnit); + void setRotationSpeed(Integer speed, SpeedUnit speedUnit); } diff --git a/src/main/java/com/iflytop/gd/system/devices/ServoMotor.java b/src/main/java/com/iflytop/gd/system/devices/ServoMotor.java index 4eb075f..a262005 100644 --- a/src/main/java/com/iflytop/gd/system/devices/ServoMotor.java +++ b/src/main/java/com/iflytop/gd/system/devices/ServoMotor.java @@ -5,4 +5,16 @@ package com.iflytop.gd.system.devices; * 伺服电机 */ public interface ServoMotor { + + void enable(); + + void disable(); + + void stop(); + + Integer getCurrentPosition(); + + void moveToZero(); + + void moveTo(Integer position); } diff --git a/src/main/java/com/iflytop/gd/system/devices/StepMotor.java b/src/main/java/com/iflytop/gd/system/devices/StepMotor.java index eba216c..c1e68ad 100644 --- a/src/main/java/com/iflytop/gd/system/devices/StepMotor.java +++ b/src/main/java/com/iflytop/gd/system/devices/StepMotor.java @@ -87,7 +87,7 @@ public interface StepMotor { /** * 停止电机 */ - void stop(); + void stop() throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException; /** * 正向旋转 diff --git a/src/main/java/com/iflytop/gd/system/devices/TransportationArm.java b/src/main/java/com/iflytop/gd/system/devices/TransportationArm.java index 92452e5..2e4c613 100644 --- a/src/main/java/com/iflytop/gd/system/devices/TransportationArm.java +++ b/src/main/java/com/iflytop/gd/system/devices/TransportationArm.java @@ -3,7 +3,6 @@ package com.iflytop.gd.system.devices; 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; public interface TransportationArm { @@ -14,22 +13,21 @@ public interface TransportationArm { * @param unit 距离单位 * @return 是否移动完成 */ - boolean move(Dim dim, Integer distance, DistanceUnit unit); + void moveTo(Dim dim, Integer distance, DistanceUnit unit); /** * 移动到指定点 - * @param point 点坐标 * @param unit 距离单位 * @return 是否移动完成 */ - boolean move(Point3D point, DistanceUnit unit); + void relativelyMove(Dim dim, Integer distance, DistanceUnit unit); /** * 独立停止XYZ三个维度移动 * @param dim 维度 * @return 是否执行完成 */ - boolean stop(Dim dim); + void stop(Dim dim); /** * 独立设置XYZ三个轴移动速率 @@ -38,5 +36,5 @@ public interface TransportationArm { * @param unit 速率单位 * @return 是否设置完成 */ - boolean setSpeed(Dim dim, Integer speed, SpeedUnit unit); + void setSpeed(Dim dim, Integer speed, SpeedUnit unit); } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml new file mode 100644 index 0000000..8781a47 --- /dev/null +++ b/src/main/resources/application-dev.yml @@ -0,0 +1,35 @@ +server: + servlet: + context-path: / + port: 8080 + +spring: + application: + name: graphite_digestion_service + datasource: + url: jdbc:sqlite:db/app.db + driver-class-name: org.sqlite.JDBC + sql: + init: + #always embedded never + mode: always + schema-locations: classpath:/sql/init.sql + +mybatis-plus: + configuration: + # 开启 SQL 日志输出(可选) + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + # 如果需要加载 XML 文件(自定义 SQL),可配置 mapper-locations: + mapper-locations: classpath*:mapper/*.xml + +#开启 SQL 打印,调试时方便查看 +logging: + level: + root: INFO + org.mybatis: DEBUG + +springdoc: + default-flat-param-object: true + +command_bus: + websocket_server_url: ws://127.0.0.1 diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml new file mode 100644 index 0000000..8781a47 --- /dev/null +++ b/src/main/resources/application-test.yml @@ -0,0 +1,35 @@ +server: + servlet: + context-path: / + port: 8080 + +spring: + application: + name: graphite_digestion_service + datasource: + url: jdbc:sqlite:db/app.db + driver-class-name: org.sqlite.JDBC + sql: + init: + #always embedded never + mode: always + schema-locations: classpath:/sql/init.sql + +mybatis-plus: + configuration: + # 开启 SQL 日志输出(可选) + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + # 如果需要加载 XML 文件(自定义 SQL),可配置 mapper-locations: + mapper-locations: classpath*:mapper/*.xml + +#开启 SQL 打印,调试时方便查看 +logging: + level: + root: INFO + org.mybatis: DEBUG + +springdoc: + default-flat-param-object: true + +command_bus: + websocket_server_url: ws://127.0.0.1 diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 8781a47..caf4dfc 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,35 +1,3 @@ -server: - servlet: - context-path: / - port: 8080 - spring: - application: - name: graphite_digestion_service - datasource: - url: jdbc:sqlite:db/app.db - driver-class-name: org.sqlite.JDBC - sql: - init: - #always embedded never - mode: always - schema-locations: classpath:/sql/init.sql - -mybatis-plus: - configuration: - # 开启 SQL 日志输出(可选) - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl - # 如果需要加载 XML 文件(自定义 SQL),可配置 mapper-locations: - mapper-locations: classpath*:mapper/*.xml - -#开启 SQL 打印,调试时方便查看 -logging: - level: - root: INFO - org.mybatis: DEBUG - -springdoc: - default-flat-param-object: true - -command_bus: - websocket_server_url: ws://127.0.0.1 + profiles: + active: dev \ No newline at end of file diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index f18b14b..0e6c853 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -46,7 +46,7 @@ - +