6 changed files with 206 additions and 11 deletions
-
34src/main/java/com/iflytop/gd/app/cmd/debug/DebugSualRobotMoveJoint.java
-
32src/main/java/com/iflytop/gd/app/cmd/debug/DebugSualRobotMovePoint.java
-
45src/main/java/com/iflytop/gd/app/cmd/debug/DebugSualRobotOrigin.java
-
45src/main/java/com/iflytop/gd/app/cmd/debug/DebugSualRobotSet.java
-
45src/main/java/com/iflytop/gd/app/cmd/debug/DebugSualRobotStop.java
-
16src/main/java/com/iflytop/gd/common/cmd/DeviceCommandGenerator.java
@ -0,0 +1,34 @@ |
|||
package com.iflytop.gd.app.cmd.debug; |
|||
|
|||
import com.iflytop.gd.app.core.BaseCommandHandler; |
|||
import com.iflytop.gd.app.model.dto.CmdDTO; |
|||
import com.iflytop.gd.app.service.DeviceCommandService; |
|||
import com.iflytop.gd.common.annotation.CommandMapping; |
|||
import com.iflytop.gd.common.cmd.CommandFuture; |
|||
import com.iflytop.gd.common.cmd.DeviceCommand; |
|||
import com.iflytop.gd.common.cmd.DeviceCommandGenerator; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 加液机械臂 轴移动到指定角度 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
@RequiredArgsConstructor |
|||
@CommandMapping("debug_sual_robot_move_joint") |
|||
public class DebugSualRobotMoveJoint extends BaseCommandHandler { |
|||
private final DeviceCommandService deviceCommandService; |
|||
|
|||
@Override |
|||
public void handle(CmdDTO cmdDTO) throws Exception { |
|||
Double joint1 = cmdDTO.getDoubleParam("joint1"); |
|||
Double joint2 = cmdDTO.getDoubleParam("joint2"); |
|||
DeviceCommand deviceCommandJoint1 = DeviceCommandGenerator.dualRobotJoint1Move(joint1); |
|||
CommandFuture deviceCommandJoint1Future = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommandJoint1); |
|||
DeviceCommand deviceCommandJoint2 = DeviceCommandGenerator.dualRobotJoint1Move(joint2); |
|||
CommandFuture deviceCommandJoint2Future = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommandJoint2); |
|||
commandWait(deviceCommandJoint1Future, deviceCommandJoint2Future); |
|||
} |
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.iflytop.gd.app.cmd.debug; |
|||
|
|||
import com.iflytop.gd.app.core.BaseCommandHandler; |
|||
import com.iflytop.gd.app.model.dto.CmdDTO; |
|||
import com.iflytop.gd.app.service.DeviceCommandService; |
|||
import com.iflytop.gd.common.annotation.CommandMapping; |
|||
import com.iflytop.gd.common.cmd.CommandFuture; |
|||
import com.iflytop.gd.common.cmd.DeviceCommand; |
|||
import com.iflytop.gd.common.cmd.DeviceCommandGenerator; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 加液机械臂 移动到指定坐标 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
@RequiredArgsConstructor |
|||
@CommandMapping("debug_sual_robot_move_point") |
|||
public class DebugSualRobotMovePoint extends BaseCommandHandler { |
|||
private final DeviceCommandService deviceCommandService; |
|||
|
|||
@Override |
|||
public void handle(CmdDTO cmdDTO) throws Exception { |
|||
Double x = cmdDTO.getDoubleParam("x"); |
|||
Double y = cmdDTO.getDoubleParam("y"); |
|||
DeviceCommand deviceCommand = DeviceCommandGenerator.dualRobotMovePoint(x, y); |
|||
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); |
|||
commandWait(deviceCommandFuture); |
|||
} |
|||
} |
@ -0,0 +1,45 @@ |
|||
package com.iflytop.gd.app.cmd.debug; |
|||
|
|||
import com.iflytop.gd.app.core.BaseCommandHandler; |
|||
import com.iflytop.gd.app.model.dto.CmdDTO; |
|||
import com.iflytop.gd.app.service.DeviceCommandService; |
|||
import com.iflytop.gd.common.annotation.CommandMapping; |
|||
import com.iflytop.gd.common.cmd.CommandFuture; |
|||
import com.iflytop.gd.common.cmd.DeviceCommand; |
|||
import com.iflytop.gd.common.cmd.DeviceCommandGenerator; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 加液机械臂 回原点 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
@RequiredArgsConstructor |
|||
@CommandMapping("debug_sual_robot_origin") |
|||
public class DebugSualRobotOrigin extends BaseCommandHandler { |
|||
private final DeviceCommandService deviceCommandService; |
|||
|
|||
@Override |
|||
public void handle(CmdDTO cmdDTO) throws Exception { |
|||
Boolean joint1 = cmdDTO.getBooleanParam("joint1"); |
|||
Boolean joint2 = cmdDTO.getBooleanParam("joint2"); |
|||
List<CommandFuture> futuresList = new ArrayList<>(); |
|||
if (joint1) { |
|||
DeviceCommand deviceCommand = DeviceCommandGenerator.dualRobotJoint1Origin(); |
|||
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); |
|||
futuresList.add(deviceCommandFuture); |
|||
} |
|||
if (joint2) { |
|||
DeviceCommand deviceCommand = DeviceCommandGenerator.dualRobotJoint2Origin(); |
|||
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); |
|||
futuresList.add(deviceCommandFuture); |
|||
} |
|||
|
|||
commandWait(futuresList.toArray(new CommandFuture[0])); |
|||
} |
|||
} |
@ -0,0 +1,45 @@ |
|||
package com.iflytop.gd.app.cmd.debug; |
|||
|
|||
import com.iflytop.gd.app.core.BaseCommandHandler; |
|||
import com.iflytop.gd.app.model.dto.CmdDTO; |
|||
import com.iflytop.gd.app.service.DeviceCommandService; |
|||
import com.iflytop.gd.common.annotation.CommandMapping; |
|||
import com.iflytop.gd.common.cmd.CommandFuture; |
|||
import com.iflytop.gd.common.cmd.DeviceCommand; |
|||
import com.iflytop.gd.common.cmd.DeviceCommandGenerator; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 加液机械臂 设置参数 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
@RequiredArgsConstructor |
|||
@CommandMapping("debug_sual_robot_set") |
|||
public class DebugSualRobotSet extends BaseCommandHandler { |
|||
private final DeviceCommandService deviceCommandService; |
|||
|
|||
@Override |
|||
public void handle(CmdDTO cmdDTO) throws Exception { |
|||
Double joint1Speed = cmdDTO.getDoubleParam("joint1Speed"); |
|||
Double joint2Speed = cmdDTO.getDoubleParam("joint2Speed"); |
|||
List<CommandFuture> futuresList = new ArrayList<>(); |
|||
if (joint1Speed != null) { |
|||
DeviceCommand deviceCommand = DeviceCommandGenerator.dualRobotJoint1Set(joint1Speed); |
|||
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); |
|||
futuresList.add(deviceCommandFuture); |
|||
} |
|||
if (joint2Speed != null) { |
|||
DeviceCommand deviceCommand = DeviceCommandGenerator.dualRobotJoint2Set(joint2Speed); |
|||
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); |
|||
futuresList.add(deviceCommandFuture); |
|||
} |
|||
|
|||
commandWait(futuresList.toArray(new CommandFuture[0])); |
|||
} |
|||
} |
@ -0,0 +1,45 @@ |
|||
package com.iflytop.gd.app.cmd.debug; |
|||
|
|||
import com.iflytop.gd.app.core.BaseCommandHandler; |
|||
import com.iflytop.gd.app.model.dto.CmdDTO; |
|||
import com.iflytop.gd.app.service.DeviceCommandService; |
|||
import com.iflytop.gd.common.annotation.CommandMapping; |
|||
import com.iflytop.gd.common.cmd.CommandFuture; |
|||
import com.iflytop.gd.common.cmd.DeviceCommand; |
|||
import com.iflytop.gd.common.cmd.DeviceCommandGenerator; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 加液机械臂 停止移动 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
@RequiredArgsConstructor |
|||
@CommandMapping("debug_sual_robot_stop") |
|||
public class DebugSualRobotStop extends BaseCommandHandler { |
|||
private final DeviceCommandService deviceCommandService; |
|||
|
|||
@Override |
|||
public void handle(CmdDTO cmdDTO) throws Exception { |
|||
Boolean joint1 = cmdDTO.getBooleanParam("joint1"); |
|||
Boolean joint2 = cmdDTO.getBooleanParam("joint2"); |
|||
List<CommandFuture> futuresList = new ArrayList<>(); |
|||
if (joint1) { |
|||
DeviceCommand deviceCommand = DeviceCommandGenerator.dualRobotJoint1Stop(); |
|||
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); |
|||
futuresList.add(deviceCommandFuture); |
|||
} |
|||
if (joint2) { |
|||
DeviceCommand deviceCommand = DeviceCommandGenerator.dualRobotJoint2Stop(); |
|||
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); |
|||
futuresList.add(deviceCommandFuture); |
|||
} |
|||
|
|||
commandWait(futuresList.toArray(new CommandFuture[0])); |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue