Browse Source

feat:设备实现

tags/freeze
黄翔 3 months ago
parent
commit
dc585b5956
  1. 5
      src/main/java/com/iflytop/gd/debug/controller/CmdDebugController.java
  2. 4
      src/main/java/com/iflytop/gd/debug/services/cmds/DoorStopCommandHandler.java
  3. 42
      src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenDoor.java
  4. 24
      src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenLiquidFillingArm.java
  5. 38
      src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenTransportationArm.java
  6. 2
      src/main/java/com/iflytop/gd/infrastructure/devices/StandardStepMotor.java
  7. 28
      src/main/java/com/iflytop/gd/infrastructure/devices/VirtualLiquidFillingArm.java
  8. 28
      src/main/java/com/iflytop/gd/infrastructure/devices/VirtualStepMotor.java
  9. 92
      src/main/java/com/iflytop/gd/infrastructure/devices/VirtualTransportationArm.java
  10. 9
      src/main/java/com/iflytop/gd/system/constants/SpeedUnit.java
  11. 2
      src/main/java/com/iflytop/gd/system/devices/Door.java
  12. 6
      src/main/java/com/iflytop/gd/system/devices/LiquidFillingArm.java
  13. 12
      src/main/java/com/iflytop/gd/system/devices/ServoMotor.java
  14. 2
      src/main/java/com/iflytop/gd/system/devices/StepMotor.java
  15. 10
      src/main/java/com/iflytop/gd/system/devices/TransportationArm.java
  16. 35
      src/main/resources/application-dev.yml
  17. 35
      src/main/resources/application-test.yml
  18. 36
      src/main/resources/application.yml
  19. 2
      src/main/resources/logback.xml

5
src/main/java/com/iflytop/gd/debug/controller/CmdDebugController.java

@ -29,10 +29,11 @@ public class CmdDebugController {
String commandName = cmdDTO.getCommand(); String commandName = cmdDTO.getCommand();
try { try {
CommandHandler commandHandler = registry.getCommandHandler(commandName); CommandHandler commandHandler = registry.getCommandHandler(commandName);
log.info("调试指令开始执行");
log.info("调试指令{}开始执行", commandName);
commandHandler.handle(cmdDTO); commandHandler.handle(cmdDTO);
log.info("调试指令{}执行结束", commandName);
} catch (UnSupportCommandException exception) { } catch (UnSupportCommandException exception) {
log.error("未找到对应的调试指令");
log.error("未找到对应的调试指令{}", commandName);
String errorMsg = "未找到对应的调试指令, commandName=" + commandName; String errorMsg = "未找到对应的调试指令, commandName=" + commandName;
return Result.failed(errorMsg); return Result.failed(errorMsg);
} catch (Exception e) { } catch (Exception e) {

4
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.app.model.dto.CmdDTO;
import com.iflytop.gd.common.annotation.CommandMapping; import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.cmd.CommandHandler; import com.iflytop.gd.common.cmd.CommandHandler;
import com.iflytop.gd.system.devices.Door;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -15,8 +16,9 @@ import org.springframework.stereotype.Component;
@RequiredArgsConstructor @RequiredArgsConstructor
@CommandMapping("debug_door_stop") @CommandMapping("debug_door_stop")
public class DoorStopCommandHandler implements CommandHandler { public class DoorStopCommandHandler implements CommandHandler {
private final Door door;
@Override @Override
public void handle(CmdDTO cmdDTO) { public void handle(CmdDTO cmdDTO) {
this.door.stop();
} }
} }

42
src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenDoor.java

@ -1,32 +1,70 @@
package com.iflytop.gd.infrastructure.devices; 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.infrastructure.drivers.ModuleId;
import com.iflytop.gd.system.constants.DistanceUnit;
import com.iflytop.gd.system.devices.Door; import com.iflytop.gd.system.devices.Door;
import com.iflytop.gd.system.devices.StepMotor; import com.iflytop.gd.system.devices.StepMotor;
import com.iflytop.gd.system.drivers.CommandBus; 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 org.springframework.stereotype.Component;
import java.io.IOException;
/** /**
* 步进电机驱动的门实现 * 步进电机驱动的门实现
*/ */
@Profile("test")
@Component @Component
public class MotorDrivenDoor implements Door { public class MotorDrivenDoor implements Door {
private final StepMotor doorMotor; private final StepMotor doorMotor;
public MotorDrivenDoor(CommandBus commandBus) { public MotorDrivenDoor(CommandBus commandBus) {
this.doorMotor = new StandardStepMotor(ModuleId.DoorM, commandBus);
this.doorMotor = new VirtualStepMotor(ModuleId.DoorM);
} }
@Override @Override
public void open() { 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 @Override
public void close() { 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);
}
} }
} }

24
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.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.devices.StepMotor;
import com.iflytop.gd.system.drivers.CommandBus; 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; import org.springframework.stereotype.Component;
/** /**
* 液体加注机械臂 * 液体加注机械臂
*/ */
@Profile("test")
@Component @Component
public class MotorDrivenLiquidFillingArm {
public class MotorDrivenLiquidFillingArm implements LiquidFillingArm {
private final StepMotor largeArmMotor; private final StepMotor largeArmMotor;
private final StepMotor smallArmMotor; private final StepMotor smallArmMotor;
@ -18,4 +25,19 @@ public class MotorDrivenLiquidFillingArm {
this.largeArmMotor = new StandardStepMotor(ModuleId.DualRobotAxis1M, commandBus); this.largeArmMotor = new StandardStepMotor(ModuleId.DualRobotAxis1M, commandBus);
this.smallArmMotor = new StandardStepMotor(ModuleId.DualRobotAxis2M, 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) {
}
} }

38
src/main/java/com/iflytop/gd/infrastructure/devices/MotorDrivenTransportationArm.java

@ -1,23 +1,51 @@
package com.iflytop.gd.infrastructure.devices; package com.iflytop.gd.infrastructure.devices;
import com.iflytop.gd.infrastructure.drivers.ModuleId; 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.StepMotor;
import com.iflytop.gd.system.devices.TransportationArm;
import com.iflytop.gd.system.drivers.CommandBus; 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; import org.springframework.stereotype.Component;
/** /**
* 试管转移机械臂
* 电机驱动转移机械臂
*/ */
@Profile("test")
@Component @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) { public MotorDrivenTransportationArm(CommandBus commandBus) {
this.xDimMotor = new StandardStepMotor(ModuleId.HBotXM, commandBus); this.xDimMotor = new StandardStepMotor(ModuleId.HBotXM, commandBus);
this.yDimMotor = new StandardStepMotor(ModuleId.HBotYM, commandBus); this.yDimMotor = new StandardStepMotor(ModuleId.HBotYM, commandBus);
this.zDimMotor = new StandardStepMotor(ModuleId.HBotZM, 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) {
}
} }

2
src/main/java/com/iflytop/gd/infrastructure/devices/StandardStepMotor.java

@ -84,7 +84,7 @@ public class StandardStepMotor implements StepMotor {
@Override @Override
public void stop() {
public void stop() throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException {
} }

28
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) {
}
}

28
src/main/java/com/iflytop/gd/infrastructure/devices/VirtualStepMotor.java

@ -1,5 +1,7 @@
package com.iflytop.gd.infrastructure.devices; 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.infrastructure.drivers.RegIndex;
import com.iflytop.gd.system.constants.DistanceUnit; import com.iflytop.gd.system.constants.DistanceUnit;
import com.iflytop.gd.system.constants.RotationDirection; 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.CommandExecTimeoutException;
import com.iflytop.gd.system.exceptions.HardwareErrorException; import com.iflytop.gd.system.exceptions.HardwareErrorException;
import com.iflytop.gd.system.models.MotorStatus; import com.iflytop.gd.system.models.MotorStatus;
import lombok.extern.slf4j.Slf4j;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/**
* 虚拟步进电机
*/
@Slf4j
public class VirtualStepMotor implements StepMotor { public class VirtualStepMotor implements StepMotor {
private MotorStatus motorStatus;
private MotorStatus motorStatus = new MotorStatus();
private Map<RegIndex, Integer> registers = new HashMap<RegIndex, Integer>(); private Map<RegIndex, Integer> registers = new HashMap<RegIndex, Integer>();
private final ModuleId moduleId;
public VirtualStepMotor(ModuleId moduleId) {
this.moduleId = moduleId;
}
@Override @Override
public void easyMoveBy(Integer value, DistanceUnit unit) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { public void easyMoveBy(Integer value, DistanceUnit unit) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException {
@ -25,33 +37,43 @@ public class VirtualStepMotor implements StepMotor {
@Override @Override
public void easyMoveTo(Integer value, DistanceUnit unit) throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { 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.setCurrentPosition(unit.toMM(value));
this.motorStatus.setZeroPosition(this.motorStatus.getCurrentPosition() == 0); this.motorStatus.setZeroPosition(this.motorStatus.getCurrentPosition() == 0);
this.motorStatus.setStopped(true); this.motorStatus.setStopped(true);
log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.motorStatus));
} }
@Override @Override
public void easyMoveToZero() throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException { public void easyMoveToZero() throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException {
log.debug("Easy move to zero.");
this.motorStatus.setCurrentPosition(0); this.motorStatus.setCurrentPosition(0);
this.motorStatus.setZeroPosition(this.motorStatus.getCurrentPosition() == 0); this.motorStatus.setZeroPosition(this.motorStatus.getCurrentPosition() == 0);
this.motorStatus.setStopped(true); this.motorStatus.setStopped(true);
log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.motorStatus));
} }
@Override @Override
public void easyMoveToZeroPointQuick() { public void easyMoveToZeroPointQuick() {
log.debug("Easy move to zero quick.");
this.motorStatus.setCurrentPosition(0); this.motorStatus.setCurrentPosition(0);
this.motorStatus.setZeroPosition(this.motorStatus.getCurrentPosition() == 0); this.motorStatus.setZeroPosition(this.motorStatus.getCurrentPosition() == 0);
this.motorStatus.setStopped(true); this.motorStatus.setStopped(true);
log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.motorStatus));
} }
@Override @Override
public void enable() { public void enable() {
log.debug("Enable step motor.");
this.motorStatus.setEnabled(true); this.motorStatus.setEnabled(true);
log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.motorStatus));
} }
@Override @Override
public void disable() { public void disable() {
log.debug("Disable step motor.");
this.motorStatus.setEnabled(false); this.motorStatus.setEnabled(false);
log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.motorStatus));
} }
@Override @Override
@ -65,8 +87,10 @@ public class VirtualStepMotor implements StepMotor {
} }
@Override @Override
public void stop() {
public void stop() throws HardwareErrorException, CommandExecTimeoutException, IOException, InterruptedException {
log.debug("Stop step motor.");
this.motorStatus.setStopped(true); this.motorStatus.setStopped(true);
log.debug("MotorStatus {}", JSONUtil.toJsonStr(this.motorStatus));
} }
@Override @Override

92
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<Dim, StepMotor> stepMotors = new HashMap<Dim, StepMotor>();
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);
}
}
}

9
src/main/java/com/iflytop/gd/system/constants/SpeedUnit.java

@ -4,5 +4,12 @@ package com.iflytop.gd.system.constants;
* 移动速度单位 * 移动速度单位
*/ */
public enum SpeedUnit { 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;
}
} }

2
src/main/java/com/iflytop/gd/system/devices/Door.java

@ -3,5 +3,5 @@ package com.iflytop.gd.system.devices;
public interface Door { public interface Door {
void open(); void open();
void close(); void close();
void stop();
} }

6
src/main/java/com/iflytop/gd/system/devices/LiquidFillingArm.java

@ -16,7 +16,7 @@ public interface LiquidFillingArm {
* @param point 点坐标 * @param point 点坐标
* @return 是否移动完成 * @return 是否移动完成
*/ */
boolean moveTo(Point3D point);
void moveTo(Point3D point);
/** /**
* 旋转到指定角度 * 旋转到指定角度
@ -25,7 +25,7 @@ public interface LiquidFillingArm {
* @param direction 旋转方向 * @param direction 旋转方向
* @return 是否旋转完成 * @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 速率单位 * @param speedUnit 速率单位
* @return 是否设置成功 * @return 是否设置成功
*/ */
boolean setRotationSpeed(Integer speed, SpeedUnit speedUnit);
void setRotationSpeed(Integer speed, SpeedUnit speedUnit);
} }

12
src/main/java/com/iflytop/gd/system/devices/ServoMotor.java

@ -5,4 +5,16 @@ package com.iflytop.gd.system.devices;
* 伺服电机 * 伺服电机
*/ */
public interface ServoMotor { public interface ServoMotor {
void enable();
void disable();
void stop();
Integer getCurrentPosition();
void moveToZero();
void moveTo(Integer position);
} }

2
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;
/** /**
* 正向旋转 * 正向旋转

10
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.Dim;
import com.iflytop.gd.system.constants.DistanceUnit; import com.iflytop.gd.system.constants.DistanceUnit;
import com.iflytop.gd.system.constants.SpeedUnit; import com.iflytop.gd.system.constants.SpeedUnit;
import com.iflytop.gd.system.models.Point3D;
public interface TransportationArm { public interface TransportationArm {
@ -14,22 +13,21 @@ public interface TransportationArm {
* @param unit 距离单位 * @param unit 距离单位
* @return 是否移动完成 * @return 是否移动完成
*/ */
boolean move(Dim dim, Integer distance, DistanceUnit unit);
void moveTo(Dim dim, Integer distance, DistanceUnit unit);
/** /**
* 移动到指定点 * 移动到指定点
* @param point 点坐标
* @param unit 距离单位 * @param unit 距离单位
* @return 是否移动完成 * @return 是否移动完成
*/ */
boolean move(Point3D point, DistanceUnit unit);
void relativelyMove(Dim dim, Integer distance, DistanceUnit unit);
/** /**
* 独立停止XYZ三个维度移动 * 独立停止XYZ三个维度移动
* @param dim 维度 * @param dim 维度
* @return 是否执行完成 * @return 是否执行完成
*/ */
boolean stop(Dim dim);
void stop(Dim dim);
/** /**
* 独立设置XYZ三个轴移动速率 * 独立设置XYZ三个轴移动速率
@ -38,5 +36,5 @@ public interface TransportationArm {
* @param unit 速率单位 * @param unit 速率单位
* @return 是否设置完成 * @return 是否设置完成
*/ */
boolean setSpeed(Dim dim, Integer speed, SpeedUnit unit);
void setSpeed(Dim dim, Integer speed, SpeedUnit unit);
} }

35
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

35
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

36
src/main/resources/application.yml

@ -1,35 +1,3 @@
server:
servlet:
context-path: /
port: 8080
spring: 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

2
src/main/resources/logback.xml

@ -46,7 +46,7 @@
</appender> </appender>
<!-- 包级别日志 --> <!-- 包级别日志 -->
<logger name="com.iflytop" level="INFO"/>
<logger name="com.iflytop" level="DEBUG"/>
<logger name="org.springframework" level="WARN"/> <logger name="org.springframework" level="WARN"/>
<root level="INFO"> <root level="INFO">

Loading…
Cancel
Save