zhaohe 1 year ago
parent
commit
825016a4a9
  1. 7
      src/main/java/a8k/controller/HbotControlController.java
  2. 40
      src/main/java/a8k/service/hardware/MotorTubeRackMoveCtrlService.java

7
src/main/java/a8k/controller/HbotControlController.java

@ -0,0 +1,7 @@
package a8k.controller;
import com.iflytop.uf.controller.UfApiControllerBase;
import org.springframework.stereotype.Controller;
@Controller
public class HbotControlController extends UfApiControllerBase {
}

40
src/main/java/a8k/service/hardware/MotorTubeRackMoveCtrlService.java

@ -5,6 +5,7 @@ import a8k.appbean.HardwareException;
import a8k.base_hardware.A8kCanBusService;
import a8k.service.db.dao.A8kTubeInfoDao;
import a8k.service.db.dao.MotorTubeRackMoveCtrlServiceParameterDao;
import com.iflytop.uf.util.UfCommon;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -61,6 +62,16 @@ public class MotorTubeRackMoveCtrlService {
CmdId.step_motor_enable.toInt(),
enable ? 1 : 0
);
this.a8kCanBusService.callcmd(
MId.ShakeModTubeScanerClampingSV.toInt(),
CmdId.mini_servo_enable.toInt(),
enable ? 1 : 0
);
this.a8kCanBusService.callcmd(
MId.ShakeModTubeScanerRotateSV.toInt(),
CmdId.mini_servo_enable.toInt(),
enable ? 1 : 0
);
}
public void stop() throws HardwareException {
@ -79,6 +90,16 @@ public class MotorTubeRackMoveCtrlService {
CmdId.step_motor_stop.toInt(),
1
);
this.a8kCanBusService.callcmd(
MId.ShakeModTubeScanerClampingSV.toInt(),
CmdId.mini_servo_stop.toInt(),
1
);
this.a8kCanBusService.callcmd(
MId.ShakeModTubeScanerRotateSV.toInt(),
CmdId.mini_servo_stop.toInt(),
1
);
}
@ -93,6 +114,12 @@ public class MotorTubeRackMoveCtrlService {
CmdId.step_motor_easy_move_to_zero.toInt(),
params.getMoveToZeroOvertime()
);
this.a8kCanBusService.callblockcmd(
MId.ShakeModTubeScanerClampingSV.toInt(),
CmdId.mini_servo_move_to.toInt(),
params.getScanCodeReleasePos(),
params.getMoveToZeroOvertime()
);
}
@ -207,9 +234,16 @@ public class MotorTubeRackMoveCtrlService {
*/
public String moveTubeToScanPosAndScan(String tubeType, Integer tubeIndex) throws HardwareException, InterruptedException {
this.moveTubeToScanPos(tubeType, tubeIndex);
this.a8kCanBusService.callcmd(MId.FeedingModScannerMod.toInt(), CmdId.code_scaner_start_scan.toInt());
Thread.sleep(5000);
this.a8kCanBusService.callcmd(MId.ShakeModTubeScanerRotateSV.toInt(),CmdId.mini_servo_rotate_with_torque.toInt(), 200);
for ( int i=0; i<10; i++ ) {
var resIsReady = this.a8kCanBusService.callcmd(MId.FeedingModScannerMod.toInt(), CmdId.code_scaner_result_is_ready.toInt());
if ( 1 == resIsReady.getContentI32(0) ) {
break ;
}
UfCommon.delay(500);
}
this.a8kCanBusService.callcmd(MId.ShakeModTubeScanerRotateSV.toInt(), CmdId.mini_servo_stop.toInt(), 1);
var response = this.a8kCanBusService.callcmd(MId.FeedingModScannerMod.toInt(), CmdId.code_scaner_read_scaner_result.toInt());
this.a8kCanBusService.callcmd(MId.FeedingModScannerMod.toInt(), CmdId.code_scaner_stop_scan.toInt());
var contentBytes = response.getCmdContent();
@ -259,7 +293,7 @@ public class MotorTubeRackMoveCtrlService {
*/
public void moveTubeToExistJudgmentPos(String tubeType, Integer tubeIndex) throws HardwareException, InterruptedException {
var params = this.serviceParameterDao;
var pos = params.getTubeRackExitPos() + tubeIndex * params.getTubeSpacing();
var pos = params.getTubeExistJudgmentPos() + tubeIndex * params.getTubeSpacing();
this.a8kCanBusService.callblockcmd(MId.FeedingModXM.toInt(), CmdId.step_motor_easy_move_to.toInt(), new Integer[]{pos}, params.getActionOvertime());
}

Loading…
Cancel
Save