From 76e2082e1ac10eefce5f4ef434297bedf82efd00 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Fri, 26 Jul 2024 13:34:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=B8=BB=E8=BD=AC=E7=9B=98?= =?UTF-8?q?=E9=BD=BF=E8=BD=AE=E9=97=B4=E9=9A=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/a8k/canbus/A8kModParamInitializer.java | 6 ++---- src/main/java/a8k/canbus/protocol/CmdId.java | 2 +- .../hardware/ReactionPlatesTransmitCtrlService.java | 19 ++++++++++++++++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/main/java/a8k/canbus/A8kModParamInitializer.java b/src/main/java/a8k/canbus/A8kModParamInitializer.java index 4948ea6..fb589a6 100644 --- a/src/main/java/a8k/canbus/A8kModParamInitializer.java +++ b/src/main/java/a8k/canbus/A8kModParamInitializer.java @@ -71,14 +71,12 @@ public class A8kModParamInitializer implements AppEventListener { // canBus.moduleSetReg(MId.OptModPullM, RegIndex.kreg_step_motor_run_to_zero_speed, 500); canBus.moduleSetReg(MId.OptModPullM, RegIndex.kreg_step_motor_default_velocity, 2200); - // canBus.moduleSetReg(MId.OptModPullM, RegIndex.kreg_step_motor_a1, 50); - // canBus.moduleSetReg(MId.OptModPullM, RegIndex.kreg_step_motor_amax, 100); canBus.moduleSetReg(MId.OptModPullM, RegIndex.kreg_step_motor_irun, 31); - canBus.moduleSetReg(MId.PlatesBoxPusherM, RegIndex.kreg_step_motor_default_velocity, 1500); + canBus.moduleSetReg(MId.PlatesBoxPusherM, RegIndex.kreg_step_motor_default_velocity, 1800); canBus.moduleSetReg(MId.PlatesBoxPusherM, RegIndex.kreg_step_motor_irun, 31); - canBus.moduleSetReg(MId.PlatesBoxYM, RegIndex.kreg_step_motor_default_velocity, 1500); + canBus.moduleSetReg(MId.PlatesBoxYM, RegIndex.kreg_step_motor_default_velocity, 1800); canBus.moduleSetReg(MId.PlatesBoxYM, RegIndex.kreg_step_motor_irun, 25); // canBus.moduleSetReg(MId.OptModPullM, RegIndex.kreg_step_motor_run_to_zero_speed, 500); diff --git a/src/main/java/a8k/canbus/protocol/CmdId.java b/src/main/java/a8k/canbus/protocol/CmdId.java index 1964d5c..258b209 100644 --- a/src/main/java/a8k/canbus/protocol/CmdId.java +++ b/src/main/java/a8k/canbus/protocol/CmdId.java @@ -9,7 +9,7 @@ public enum CmdId { event_bus_reg_change_report(0x0064, "event_bus_reg_change_report"),// // module_ping(0x0100, "module_ping"),// - module_get_status(0x0104, "module_get_status", false),// + module_get_status(0x0104, "module_get_status", true),// module_stop(0x0101, "module_stop"),// module_set_reg(0x0105, "module_set_reg"),// module_get_reg(0x0106, "module_get_reg"),// diff --git a/src/main/java/a8k/service/hardware/ReactionPlatesTransmitCtrlService.java b/src/main/java/a8k/service/hardware/ReactionPlatesTransmitCtrlService.java index 5cf14ac..96fb549 100644 --- a/src/main/java/a8k/service/hardware/ReactionPlatesTransmitCtrlService.java +++ b/src/main/java/a8k/service/hardware/ReactionPlatesTransmitCtrlService.java @@ -216,7 +216,22 @@ public class ReactionPlatesTransmitCtrlService implements HardwareCtrlModule { //限制pos在 0--> 36000之间 pos = pos % 36000; if (pos < 0) {pos += 36000;} - canBus.stepMotorEasyMoveToBlock(MId.IncubatorRotateCtrlM, pos, getActionOvertime()); + + //先移动半个间距,用来检测是否发生卡板 + Integer nowPos = canBus.stepMotorReadPos(MId.IncubatorRotateCtrlM); + if (nowPos < pos) { + canBus.stepMotorEasyMoveByBlock(MId.IncubatorRotateCtrlM, getTurntablePosSpacing(), getActionOvertime()); + } else if (nowPos > pos) { + canBus.stepMotorEasyMoveByBlock(MId.IncubatorRotateCtrlM, -getTurntablePosSpacing(), getActionOvertime()); + } + + //解决齿轮间隙的问题 + if (nowPos < pos) { + canBus.stepMotorEasyMoveToBlock(MId.IncubatorRotateCtrlM, pos, getActionOvertime()); + } else { + canBus.stepMotorEasyMoveToBlock(MId.IncubatorRotateCtrlM, pos - 300/**/, getActionOvertime()); + canBus.stepMotorEasyMoveToBlock(MId.IncubatorRotateCtrlM, pos, getActionOvertime()); + } } @@ -289,9 +304,7 @@ public class ReactionPlatesTransmitCtrlService implements HardwareCtrlModule { continue; } pushPlateQuick(PBCh, index); - if (pushAllPlateAndDropBreakFlag) {break;} pullPlate(index); - if (pushAllPlateAndDropBreakFlag) {break;} dropPlate(); if (pushAllPlateAndDropBreakFlag) {break;} }