Browse Source

fix:因编码器问题获取xyz轴坐标为负数,取绝对值

tags/1.0
白凤吉 4 months ago
parent
commit
476aed0897
  1. 2
      src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayChangeParam.java
  2. 4
      src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayStart.java
  3. 1
      src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFill.java
  4. 1
      src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelineWash.java
  5. 1
      src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWash.java
  6. 2
      src/main/java/com/qyft/ms/app/front/cmd/debug/MotorXMove.java
  7. 2
      src/main/java/com/qyft/ms/app/front/cmd/debug/MotorYMove.java
  8. 2
      src/main/java/com/qyft/ms/app/front/cmd/debug/MotorZMove.java
  9. 1
      src/main/java/com/qyft/ms/system/core/listener/DeviceTcpMessageEventListener.java
  10. 4
      src/main/resources/application.yml

2
src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayChangeParam.java

@ -48,7 +48,7 @@ public class MatrixSprayChangeParam extends BaseCommandHandler {
Double highVoltageValue = form.getDoubleParam("highVoltageValue"); Double highVoltageValue = form.getDoubleParam("highVoltageValue");
Double movingSpeed = form.getDoubleParam("movingSpeed"); Double movingSpeed = form.getDoubleParam("movingSpeed");
if (highVoltageValue > 6000) {
if (highVoltageValue!= null && highVoltageValue > 6000) {
webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.DEVICE_ERROR, "电压不能大于6000V")); webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.DEVICE_ERROR, "电压不能大于6000V"));
throw new RuntimeException("电压不能大于6000V"); throw new RuntimeException("电压不能大于6000V");
} }

4
src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayStart.java

@ -134,7 +134,7 @@ public class MatrixSprayStart extends BaseCommandHandler {
List<Map<String, Object>> positionList = (List<Map<String, Object>>) form.getParams().get("position"); List<Map<String, Object>> positionList = (List<Map<String, Object>>) form.getParams().get("position");
nonNullCheck(matrixPathType, form.getCmdId(), form.getCmdCode(), motorZHeight, gasPressure, volume, highVoltage, spacing, movingSpeed, times, positionList); nonNullCheck(matrixPathType, form.getCmdId(), form.getCmdCode(), motorZHeight, gasPressure, volume, highVoltage, spacing, movingSpeed, times, positionList);
if (highVoltageValue > 6000) {
if (highVoltageValue != null && highVoltageValue > 6000) {
webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.DEVICE_ERROR, "电压不能大于6000V")); webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.DEVICE_ERROR, "电压不能大于6000V"));
throw new RuntimeException("电压不能大于6000V"); throw new RuntimeException("电压不能大于6000V");
} }
@ -341,7 +341,7 @@ public class MatrixSprayStart extends BaseCommandHandler {
CommandFuture[] commandFutureArray = futureList.toArray(new CommandFuture[0]); CommandFuture[] commandFutureArray = futureList.toArray(new CommandFuture[0]);
commandWait(commandFutureArray); commandWait(commandFutureArray);
DeviceCommand threeWayValveOpenSyringePipelineCommand = DeviceCommandGenerator.threeWayValveOpenSyringePipeline();//打开三通阀喷嘴管路
DeviceCommand threeWayValveOpenSyringePipelineCommand = DeviceCommandGenerator.threeWayValveOpenNozzlePipeline();//打开三通阀注射器管路
CommandFuture threeWayValveOpenSyringePipelineCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveOpenSyringePipelineCommand); CommandFuture threeWayValveOpenSyringePipelineCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveOpenSyringePipelineCommand);
commandWait(threeWayValveOpenSyringePipelineCommandFuture); commandWait(threeWayValveOpenSyringePipelineCommandFuture);

1
src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFill.java

@ -64,6 +64,7 @@ public class NozzlePipelinePreFill extends BaseCommandHandler {
webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.DEVICE_ERROR, "获得电机XYZ相对原点坐标失败")); webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.DEVICE_ERROR, "获得电机XYZ相对原点坐标失败"));
throw new RuntimeException("获得电机XYZ相对原点坐标失败"); throw new RuntimeException("获得电机XYZ相对原点坐标失败");
} }
zAxisPosition = Math.abs(zAxisPosition);
SysSettings safeZHeightSysSettings = sysSettingsService.getOne(new LambdaQueryWrapper<SysSettings>().eq(SysSettings::getCode, "safe_z_height")); SysSettings safeZHeightSysSettings = sysSettingsService.getOne(new LambdaQueryWrapper<SysSettings>().eq(SysSettings::getCode, "safe_z_height"));
double safeZHeight = Double.parseDouble(safeZHeightSysSettings.getValue()); double safeZHeight = Double.parseDouble(safeZHeightSysSettings.getValue());
if (zAxisPosition > safeZHeight) { //z轴超出安全距离抬升z轴 if (zAxisPosition > safeZHeight) { //z轴超出安全距离抬升z轴

1
src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelineWash.java

@ -56,6 +56,7 @@ public class NozzlePipelineWash extends BaseCommandHandler {
webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.DEVICE_ERROR, "获得电机XYZ相对原点坐标失败", motorXyzPositionGetCommandDeviceResult)); webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.DEVICE_ERROR, "获得电机XYZ相对原点坐标失败", motorXyzPositionGetCommandDeviceResult));
throw new RuntimeException("获得电机XYZ相对原点坐标失败"); throw new RuntimeException("获得电机XYZ相对原点坐标失败");
} }
zAxisPosition = Math.abs(zAxisPosition);
SysSettings safeZHeightSysSettings = sysSettingsService.getOne(new LambdaQueryWrapper<SysSettings>().eq(SysSettings::getCode, "safe_z_height")); SysSettings safeZHeightSysSettings = sysSettingsService.getOne(new LambdaQueryWrapper<SysSettings>().eq(SysSettings::getCode, "safe_z_height"));
double safeZHeight = Double.parseDouble(safeZHeightSysSettings.getValue()); double safeZHeight = Double.parseDouble(safeZHeightSysSettings.getValue());
if (zAxisPosition > safeZHeight) { //z轴超出安全距离抬升z轴 if (zAxisPosition > safeZHeight) { //z轴超出安全距离抬升z轴

1
src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWash.java

@ -65,6 +65,7 @@ public class SyringePipelineWash extends BaseCommandHandler {
webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.DEVICE_ERROR, "获得电机XYZ相对原点坐标失败", motorXyzPositionGetCommandDeviceResult)); webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.DEVICE_ERROR, "获得电机XYZ相对原点坐标失败", motorXyzPositionGetCommandDeviceResult));
throw new RuntimeException("获得电机XYZ相对原点坐标失败"); throw new RuntimeException("获得电机XYZ相对原点坐标失败");
} }
zAxisPosition = Math.abs(zAxisPosition);
SysSettings safeZHeightSysSettings = sysSettingsService.getOne(new LambdaQueryWrapper<SysSettings>().eq(SysSettings::getCode, "safe_z_height")); SysSettings safeZHeightSysSettings = sysSettingsService.getOne(new LambdaQueryWrapper<SysSettings>().eq(SysSettings::getCode, "safe_z_height"));
double safeZHeight = Double.parseDouble(safeZHeightSysSettings.getValue()); double safeZHeight = Double.parseDouble(safeZHeightSysSettings.getValue());
if (zAxisPosition > safeZHeight) { //z轴超出安全距离抬升z轴 if (zAxisPosition > safeZHeight) { //z轴超出安全距离抬升z轴

2
src/main/java/com/qyft/ms/app/front/cmd/debug/MotorXMove.java

@ -38,7 +38,7 @@ public class MotorXMove extends BaseCommandHandler {
JSONObject motorXyzPositionGetCommandResult = motorXyzPositionGetCommandFuture.getResponseResult(); JSONObject motorXyzPositionGetCommandResult = motorXyzPositionGetCommandFuture.getResponseResult();
Double xAxisPosition = motorXyzPositionGetCommandResult.getJSONObject("data").getDouble("xAxisPosition"); Double xAxisPosition = motorXyzPositionGetCommandResult.getJSONObject("data").getDouble("xAxisPosition");
xAxisPosition = Math.abs(xAxisPosition);
// 计算目标位置 // 计算目标位置
double finalPosition = 0.0; double finalPosition = 0.0;
if ("forward".equals(direction)) { if ("forward".equals(direction)) {

2
src/main/java/com/qyft/ms/app/front/cmd/debug/MotorYMove.java

@ -37,7 +37,7 @@ public class MotorYMove extends BaseCommandHandler {
commandWait(motorXyzPositionGetCommandFuture); commandWait(motorXyzPositionGetCommandFuture);
JSONObject motorXyzPositionGetCommandDeviceResult = motorXyzPositionGetCommandFuture.getResponseResult(); JSONObject motorXyzPositionGetCommandDeviceResult = motorXyzPositionGetCommandFuture.getResponseResult();
Double yAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("yAxisPosition"); Double yAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("yAxisPosition");
yAxisPosition = Math.abs(yAxisPosition);
// 计算目标位置 // 计算目标位置
double finalPosition = 0.0; double finalPosition = 0.0;
if ("forward".equals(direction)) { if ("forward".equals(direction)) {

2
src/main/java/com/qyft/ms/app/front/cmd/debug/MotorZMove.java

@ -38,7 +38,7 @@ public class MotorZMove extends BaseCommandHandler {
commandWait(motorXyzPositionGetCommandFuture); commandWait(motorXyzPositionGetCommandFuture);
JSONObject motorXyzPositionGetCommandDeviceResult = motorXyzPositionGetCommandFuture.getResponseResult(); JSONObject motorXyzPositionGetCommandDeviceResult = motorXyzPositionGetCommandFuture.getResponseResult();
Double zAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("zAxisPosition"); Double zAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("zAxisPosition");
zAxisPosition = Math.abs(zAxisPosition);
// 根据方向计算最终位置 // 根据方向计算最终位置
double finalPosition = 0.0; double finalPosition = 0.0;
if ("forward".equals(direction)) { if ("forward".equals(direction)) {

1
src/main/java/com/qyft/ms/system/core/listener/DeviceTcpMessageEventListener.java

@ -40,6 +40,7 @@ public class DeviceTcpMessageEventListener {
deviceStatus.setPaused(false); deviceStatus.setPaused(false);
deviceStatus.setSuspendable(false); deviceStatus.setSuspendable(false);
deviceStatus.setStopPressed(true); deviceStatus.setStopPressed(true);
deviceStatus.setSelfTestCompleted(false);
deviceCommandService.releaseAllCommandFutures(); deviceCommandService.releaseAllCommandFutures();
} else if ("system_e_stop_released".equals(eventType)) {//系统急停按钮被释放 } else if ("system_e_stop_released".equals(eventType)) {//系统急停按钮被释放
deviceStatus.setStopPressed(false); deviceStatus.setStopPressed(false);

4
src/main/resources/application.yml

@ -40,9 +40,9 @@ jwt:
tcp: tcp:
enable: true # 是否开启 TCP 连接 enable: true # 是否开启 TCP 连接
server-enable: true # 是否开启 TCP 连接 server-enable: true # 是否开启 TCP 连接
# host: 127.0.0.1
host: 127.0.0.1
# host: 192.168.1.106 # host: 192.168.1.106
host: 192.168.1.140
# host: 192.168.1.140
# host: 192.168.100.168 # host: 192.168.100.168
port: 9080 port: 9080
reconnect: 5000 # 断线重连间隔(单位:毫秒) reconnect: 5000 # 断线重连间隔(单位:毫秒)

Loading…
Cancel
Save