26 changed files with 450 additions and 161 deletions
-
8src/main/java/com/iflytop/gd/app/cmd/CapLiftingOriginCommand.java
-
37src/main/java/com/iflytop/gd/app/cmd/DoorOriginCommand.java
-
6src/main/java/com/iflytop/gd/app/cmd/DualRobotJointOriginCommand.java
-
5src/main/java/com/iflytop/gd/app/cmd/GantryZOriginCommand.java
-
10src/main/java/com/iflytop/gd/app/cmd/MoveToHeatAreaCommand.java
-
9src/main/java/com/iflytop/gd/app/cmd/MoveToSolutionAreaCommand.java
-
5src/main/java/com/iflytop/gd/app/cmd/debug/DebugCoverElevatorLiftDownCommand.java
-
5src/main/java/com/iflytop/gd/app/cmd/debug/DebugCoverElevatorLiftUpCommand.java
-
5src/main/java/com/iflytop/gd/app/cmd/debug/DebugCoverElevatorResetCommand.java
-
4src/main/java/com/iflytop/gd/app/cmd/debug/DebugCoverElevatorStopCommand.java
-
2src/main/java/com/iflytop/gd/app/cmd/debug/DebugLiquidArmResetCommand.java
-
5src/main/java/com/iflytop/gd/app/cmd/debug/DebugTransportationArmMoveCommand.java
-
5src/main/java/com/iflytop/gd/app/cmd/debug/DebugTransportationArmResetCommand.java
-
4src/main/java/com/iflytop/gd/app/cmd/debug/DebugTransportationArmStopCommand.java
-
54src/main/java/com/iflytop/gd/app/controller/StepCommandController.java
-
6src/main/java/com/iflytop/gd/app/controller/SystemController.java
-
3src/main/java/com/iflytop/gd/app/core/device/SelfTestState.java
-
29src/main/java/com/iflytop/gd/app/service/DeviceCommandUtilService.java
-
79src/main/java/com/iflytop/gd/app/service/DeviceInitService.java
-
3src/main/java/com/iflytop/gd/app/service/DeviceStateService.java
-
81src/main/java/com/iflytop/gd/app/service/StepCommandService.java
-
18src/main/java/com/iflytop/gd/hardware/constants/ActionOvertimeConstant.java
-
13src/main/java/com/iflytop/gd/hardware/drivers/LiquidDistributionArmDriver.java
-
4src/main/java/com/iflytop/gd/hardware/service/GDDeviceStatusService.java
-
31src/main/java/com/iflytop/gd/hardware/type/IO/InputIOMId.java
@ -0,0 +1,37 @@ |
|||
package com.iflytop.gd.app.cmd; |
|||
|
|||
import com.iflytop.gd.app.core.BaseCommandHandler; |
|||
import com.iflytop.gd.app.model.dto.CmdDTO; |
|||
import com.iflytop.gd.app.service.DeviceCommandUtilService; |
|||
import com.iflytop.gd.app.service.DevicePositionService; |
|||
import com.iflytop.gd.app.service.DeviceStateService; |
|||
import com.iflytop.gd.common.annotation.CommandMapping; |
|||
import com.iflytop.gd.common.enums.data.DevicePositionCode; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.concurrent.CompletableFuture; |
|||
|
|||
/** |
|||
* 门回原点 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
@RequiredArgsConstructor |
|||
@CommandMapping("door_origin")//业务指令注解 |
|||
public class DoorOriginCommand extends BaseCommandHandler { |
|||
private final DeviceCommandUtilService deviceCommandUtilService; |
|||
private final DeviceStateService deviceStateService; |
|||
|
|||
@Override |
|||
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
|||
return runAsync(() -> { |
|||
//门电机回原点 |
|||
deviceCommandUtilService.doorOrigin(cmdDTO.getCommandId(), cmdDTO.getCommand()); |
|||
//将门状态设置为false |
|||
deviceStateService.setDoorStatus(false); |
|||
}); |
|||
} |
|||
} |
|||
|
@ -0,0 +1,54 @@ |
|||
package com.iflytop.gd.app.controller; |
|||
|
|||
import com.iflytop.gd.app.model.bo.Point3D; |
|||
import com.iflytop.gd.app.service.StepCommandService; |
|||
import com.iflytop.gd.common.enums.HeatModuleCode; |
|||
import com.iflytop.gd.common.result.Result; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@Tag(name = "单步调试") |
|||
@RestController |
|||
@RequestMapping("/api/cmd/step") |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class StepCommandController { |
|||
private final StepCommandService stepCommandService; |
|||
|
|||
@Operation(summary = "获取当前龙门架机械臂坐标") |
|||
@GetMapping("/gantry-point") |
|||
public Result<String> getGantryPoint() throws Exception { |
|||
Point3D point3D = stepCommandService.getGantryPoint(); |
|||
return Result.success(point3D.getX() + "," + point3D.getY() + "," + point3D.getZ()); |
|||
} |
|||
|
|||
@Operation(summary = "失能所有电机") |
|||
@PostMapping("/disability-all") |
|||
public Result<?> disabilityAll() throws Exception { |
|||
stepCommandService.disabilityAll(); |
|||
return Result.success(); |
|||
} |
|||
|
|||
@Operation(summary = "使能所有电机") |
|||
@PostMapping("/enable-all") |
|||
public Result<?> enableAll() throws Exception { |
|||
stepCommandService.enableAll(); |
|||
return Result.success(); |
|||
} |
|||
|
|||
|
|||
@Operation(summary = "龙门架移至托盘夹取处") |
|||
@PostMapping("/gantry-tray") |
|||
public Result<?> gantryToTray(HeatModuleCode moduleCode) throws Exception { |
|||
stepCommandService.gantryToTray(moduleCode); |
|||
return Result.success(); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,81 @@ |
|||
package com.iflytop.gd.app.service; |
|||
|
|||
import com.iflytop.gd.app.model.bo.Point3D; |
|||
import com.iflytop.gd.common.enums.HeatModuleCode; |
|||
import com.iflytop.gd.hardware.drivers.LeisaiServoDriver; |
|||
import com.iflytop.gd.hardware.drivers.MiniServoDriver.MiniServoDriver; |
|||
import com.iflytop.gd.hardware.drivers.StepMotorDriver.StepMotorCtrlDriver; |
|||
import com.iflytop.gd.hardware.service.GDDeviceStatusService; |
|||
import com.iflytop.gd.hardware.drivers.LiquidDistributionArmDriver; |
|||
import com.iflytop.gd.hardware.type.Servo.LeisaiServoMId; |
|||
import com.iflytop.gd.hardware.type.Servo.LiquidArmMId; |
|||
import com.iflytop.gd.hardware.type.Servo.MiniServoMId; |
|||
import com.iflytop.gd.hardware.type.StepMotor.StepMotorMId; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* 单步运动调试服务 |
|||
*/ |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
public class StepCommandService { |
|||
private final DeviceCommandUtilService deviceCommandUtilService; |
|||
private final StepMotorCtrlDriver stepMotorCtrlDriver; |
|||
private final MiniServoDriver miniServoDriver; |
|||
private final LiquidDistributionArmDriver liquidDistributionArmDriver; |
|||
private final LeisaiServoDriver leisaiServoDriver; |
|||
private final GDDeviceStatusService gdDeviceStatusService; |
|||
|
|||
public void gantryToTray(HeatModuleCode moduleCode) throws Exception { |
|||
Point3D heatAreaTrayClawPoint3D = deviceCommandUtilService.getHeatAreaTrayClawPoint3D(moduleCode);//获取指定托盘上方点位 |
|||
deviceCommandUtilService.gantryMove(heatAreaTrayClawPoint3D); |
|||
} |
|||
|
|||
/** |
|||
* 获取当前龙门架机械臂所在点位 |
|||
*/ |
|||
public Point3D getGantryPoint() throws Exception { |
|||
double x = gdDeviceStatusService.getXYServoPosition(LeisaiServoMId.MainXSV); |
|||
double y = gdDeviceStatusService.getXYServoPosition(LeisaiServoMId.MainYSV); |
|||
double z = gdDeviceStatusService.getStepMotorPostion(StepMotorMId.HBOT_X_MOTOR_MID); |
|||
return new Point3D(x, y, z); |
|||
} |
|||
|
|||
public void enableAll() throws Exception { |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.DOOR_MOTOR_MID, 1); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.SHAKE_MOTOR_MID, 1); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.TRAY_MOTOR_MID, 1); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.HBOT_Z_MOTOR_MID, 1); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.HEATER_1_MOTOR_MID, 1); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.HEATER_2_MOTOR_MID, 1); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.HEATER_3_MOTOR_MID, 1); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.HEATER_4_MOTOR_MID, 1); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.HEATER_5_MOTOR_MID, 1); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.HEATER_6_MOTOR_MID, 1); |
|||
|
|||
liquidDistributionArmDriver.liquidDistributionArmEnable(LiquidArmMId.LiquidDistributionArm, 1); |
|||
miniServoDriver.miniServoForceEnable(MiniServoMId.CLAW_MID, 1); |
|||
leisaiServoDriver.enable(LeisaiServoMId.MainXSV, 1); |
|||
leisaiServoDriver.enable(LeisaiServoMId.MainYSV, 1); |
|||
} |
|||
|
|||
|
|||
public void disabilityAll() throws Exception { |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.DOOR_MOTOR_MID, 0); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.SHAKE_MOTOR_MID, 0); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.TRAY_MOTOR_MID, 0); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.HBOT_Z_MOTOR_MID, 0); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.HEATER_1_MOTOR_MID, 0); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.HEATER_2_MOTOR_MID, 0); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.HEATER_3_MOTOR_MID, 0); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.HEATER_4_MOTOR_MID, 0); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.HEATER_5_MOTOR_MID, 0); |
|||
stepMotorCtrlDriver.stepMotorEnable(StepMotorMId.HEATER_6_MOTOR_MID, 0); |
|||
|
|||
liquidDistributionArmDriver.liquidDistributionArmEnable(LiquidArmMId.LiquidDistributionArm, 1); |
|||
miniServoDriver.miniServoForceEnable(MiniServoMId.CLAW_MID, 1); |
|||
leisaiServoDriver.enable(LeisaiServoMId.MainXSV, 1); |
|||
leisaiServoDriver.enable(LeisaiServoMId.MainYSV, 1); |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue