From 61790ea85730ae73fa7848b7adeaadfb592fa858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=87=A4=E5=90=89?= Date: Wed, 30 Apr 2025 16:34:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=B0=81=E8=A3=85=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gd/common/cmd/DeviceCommandGenerator.java | 1131 +++++++++++++++++++- .../iflytop/gd/common/cmd/DeviceCommandParams.java | 6 + .../com/iflytop/gd/common/enums/cmd/CmdAction.java | 3 +- .../com/iflytop/gd/common/enums/cmd/CmdColor.java | 5 + .../com/iflytop/gd/common/enums/cmd/CmdDevice.java | 7 +- 5 files changed, 1147 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/iflytop/gd/common/enums/cmd/CmdColor.java diff --git a/src/main/java/com/iflytop/gd/common/cmd/DeviceCommandGenerator.java b/src/main/java/com/iflytop/gd/common/cmd/DeviceCommandGenerator.java index 45ebc0a..20bd96d 100644 --- a/src/main/java/com/iflytop/gd/common/cmd/DeviceCommandGenerator.java +++ b/src/main/java/com/iflytop/gd/common/cmd/DeviceCommandGenerator.java @@ -1,7 +1,7 @@ package com.iflytop.gd.common.cmd; -import java.util.Map; +import com.iflytop.gd.common.enums.cmd.*; /** * 生成给设备发送的指令 @@ -9,9 +9,1135 @@ import java.util.Map; public class DeviceCommandGenerator { /** + * 门 打开 + */ + public static DeviceCommand doorOpen() { + return controlMotorCmd(CmdDevice.door, CmdAction.open, null, "打开设备门"); + } + + /** + * 门 关闭 + */ + public static DeviceCommand doorClose() { + return controlMotorCmd(CmdDevice.door, CmdAction.close, null, "关闭设备门"); + } + + /** + * 门 停止动作 + */ + public static DeviceCommand doorStop() { + return controlMotorCmd(CmdDevice.door, CmdAction.stop, null, "停止门动作"); + } + + /** + * 摇匀电机 设置参数 + */ + public static DeviceCommand shakeMotorSet(Double current, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setSpeed(speed); + return setInfoCmd(CmdDevice.shake_motor, CmdAction.set, params, "摇匀电机设置参数"); + } + + /** + * 摇匀电机 开始摇匀 + */ + public static DeviceCommand shakeMotorStart() { + return controlMotorCmd(CmdDevice.shake_motor, CmdAction.start, null, "开始摇匀"); + } + + /** + * 摇匀电机 结束摇匀 + */ + public static DeviceCommand shakeMotorStop() { + return controlMotorCmd(CmdDevice.shake_motor, CmdAction.stop, null, "结束摇匀"); + } + + /** + * 托盘电机 设置参数 + */ + public static DeviceCommand trayMotorSet(Double current, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setSpeed(speed); + return setInfoCmd(CmdDevice.tray_motor, CmdAction.set, params, "托盘电机设置参数"); + } + + /** + * 托盘电机 回原点 + */ + public static DeviceCommand trayMotorOrigin() { + return controlMotorCmd(CmdDevice.tray_motor, CmdAction.origin, null, "托盘电机回原点"); + } + + /** + * 托盘电机 移动 + */ + public static DeviceCommand trayMotorMove(Double position) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setPosition(position); + return controlMotorCmd(CmdDevice.tray_motor, CmdAction.move, params, "托盘电机移动"); + } + + /** + * 托盘电机 停止移动 + */ + public static DeviceCommand trayMotorStop() { + return controlMotorCmd(CmdDevice.tray_motor, CmdAction.stop, null, "托盘电机停止移动"); + } + + + /** + * 双轴械臂 设置参数 + */ + public static DeviceCommand dualRobotSet(CmdAxis axis, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setAxis(axis); + params.setSpeed(speed); + return setInfoCmd(CmdDevice.dual_robot, CmdAction.set, params, "双轴械臂设置参数"); + } + + /** + * 双轴械臂 回原点 + */ + public static DeviceCommand dualRobotOrigin(CmdAxis axis) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setAxis(axis); + return controlCmd(CmdDevice.dual_robot, CmdAction.origin, params, "双轴械臂回原点"); + } + + /** + * 双轴械臂 移动关节 + */ + public static DeviceCommand dualRobotMoveJoint(CmdAxis axis, CmdDirection direction, Double angle, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setAxis(axis); + params.setDirection(direction); + params.setAngle(angle); + params.setSpeed(speed); + return controlCmd(CmdDevice.dual_robot, CmdAction.move_x_joint, params, "双轴械臂移动关节"); + } + + /** + * 双轴械臂 x移动位置 + */ + public static DeviceCommand dualRobotXMovePos(CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return controlCmd(CmdDevice.dual_robot, CmdAction.move_x_joint, params, "双轴械臂移动x"); + } + + /** + * 双轴械臂 y移动位置 + */ + public static DeviceCommand dualRobotYMovePos(CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return controlCmd(CmdDevice.dual_robot, CmdAction.move_y_joint, params, "双轴械臂移动y"); + } + + + /** + * 双轴械臂 停止移动 + */ + public static DeviceCommand dualRobotStop(CmdAxis axis) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setAxis(axis); + return controlCmd(CmdDevice.dual_robot, CmdAction.stop, params, "双轴械臂停止移动"); + } + + /** + * 龙门架 x轴设置参数 + */ + public static DeviceCommand hBotXSet(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return setInfoCmd(CmdDevice.hbot_x, CmdAction.set, params, "龙门架x轴设置参数"); + } + + /** + * 龙门架 y轴设置参数 + */ + public static DeviceCommand hBotYSet(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return setInfoCmd(CmdDevice.hbot_y, CmdAction.set, params, "龙门架y轴设置参数"); + } + + /** + * 龙门架 z轴设置参数 + */ + public static DeviceCommand hBotZSet(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return setInfoCmd(CmdDevice.hbot_z, CmdAction.set, params, "龙门架z轴设置参数"); + } + + + /** + * 龙门架 x轴回原点 + */ + public static DeviceCommand hBotXOrigin() { + return controlMotorCmd(CmdDevice.hbot_x, CmdAction.origin, null, "龙门架x轴回原点"); + } + + /** + * 龙门架 y轴回原点 + */ + public static DeviceCommand hBotYOrigin() { + return controlMotorCmd(CmdDevice.hbot_y, CmdAction.origin, null, "龙门架y轴回原点"); + } + + /** + * 龙门架 z轴回原点 + */ + public static DeviceCommand hBotZOrigin() { + return controlMotorCmd(CmdDevice.hbot_z, CmdAction.origin, null, "龙门架z轴回原点"); + } + + /** + * 龙门架 x轴移动 + */ + public static DeviceCommand hBotXMove(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return controlMotorCmd(CmdDevice.hbot_z, CmdAction.move, params, "龙门架x轴移动"); + } + + /** + * 龙门架 y轴移动 + */ + public static DeviceCommand hBotYMove(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return controlMotorCmd(CmdDevice.hbot_y, CmdAction.move, params, "龙门架y轴移动"); + } + + /** + * 龙门架 z轴移动 + */ + public static DeviceCommand hBotZMove(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return controlMotorCmd(CmdDevice.hbot_z, CmdAction.move, params, "龙门架z轴移动"); + } + + /** + * 龙门架 x轴停止 + */ + public static DeviceCommand hBotXStop() { + return controlMotorCmd(CmdDevice.hbot_x, CmdAction.stop, null, "龙门架x轴停止"); + } + + /** + * 龙门架 y轴停止 + */ + public static DeviceCommand hBotYStop() { + return controlMotorCmd(CmdDevice.hbot_y, CmdAction.stop, null, "龙门架y轴停止"); + } + + /** + * 龙门架 z轴停止 + */ + public static DeviceCommand hBotZStop() { + return controlMotorCmd(CmdDevice.hbot_z, CmdAction.stop, null, "龙门架z轴停止"); + } + + + /** + * 加热区顶升电机 加热位1设置参数 + */ + public static DeviceCommand heaterMotor1Set(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return setInfoCmd(CmdDevice.heater_motor_1, CmdAction.set, params, "加热区顶升电机加热位1设置参数"); + } + + /** + * 加热区顶升电机 加热位2设置参数 + */ + public static DeviceCommand heaterMotor2Set(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return setInfoCmd(CmdDevice.heater_motor_2, CmdAction.set, params, "加热区顶升电机加热位2设置参数"); + } + + /** + * 加热区顶升电机 加热位3设置参数 + */ + public static DeviceCommand heaterMotor3Set(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return setInfoCmd(CmdDevice.heater_motor_3, CmdAction.set, params, "加热区顶升电机加热位3设置参数"); + } + + /** + * 加热区顶升电机 加热位4设置参数 + */ + public static DeviceCommand heaterMotor4Set(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return setInfoCmd(CmdDevice.heater_motor_4, CmdAction.set, params, "加热区顶升电机加热位4设置参数"); + } + + /** + * 加热区顶升电机 加热位5设置参数 + */ + public static DeviceCommand heaterMotor5Set(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return setInfoCmd(CmdDevice.heater_motor_5, CmdAction.set, params, "加热区顶升电机加热位5设置参数"); + } + + /** + * 加热区顶升电机 加热位6设置参数 + */ + public static DeviceCommand heaterMotor6Set(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return setInfoCmd(CmdDevice.heater_motor_6, CmdAction.set, params, "加热区顶升电机加热位6设置参数"); + } + + /** + * 加热区顶升电机 加热位1回原点 + */ + public static DeviceCommand heaterMotor1Origin() { + return controlMotorCmd(CmdDevice.heater_motor_1, CmdAction.origin, null, "加热区顶升电机加热位1回原点"); + } + + /** + * 加热区顶升电机 加热位2回原点 + */ + public static DeviceCommand heaterMotor2Origin() { + return controlMotorCmd(CmdDevice.heater_motor_2, CmdAction.origin, null, "加热区顶升电机加热位2回原点"); + } + + /** + * 加热区顶升电机 加热位3回原点 + */ + public static DeviceCommand heaterMotor3Origin() { + return controlMotorCmd(CmdDevice.heater_motor_3, CmdAction.origin, null, "加热区顶升电机加热位3回原点"); + } + + /** + * 加热区顶升电机 加热位4回原点 + */ + public static DeviceCommand heaterMotor4Origin() { + return controlMotorCmd(CmdDevice.heater_motor_4, CmdAction.origin, null, "加热区顶升电机加热位4回原点"); + } + + /** + * 加热区顶升电机 加热位5回原点 + */ + public static DeviceCommand heaterMotor5Origin() { + return controlMotorCmd(CmdDevice.heater_motor_5, CmdAction.origin, null, "加热区顶升电机加热位5回原点"); + } + + /** + * 加热区顶升电机 加热位6回原点 + */ + public static DeviceCommand heaterMotor6Origin() { + return controlMotorCmd(CmdDevice.heater_motor_6, CmdAction.origin, null, "加热区顶升电机加热位6回原点"); + } + + /** + * 加热区顶升电机 加热位1移动 + */ + public static DeviceCommand heaterMotor1Move(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return controlMotorCmd(CmdDevice.heater_motor_1, CmdAction.move, params, "加热区顶升电机加热位1移动"); + } + + /** + * 加热区顶升电机 加热位2移动 + */ + public static DeviceCommand heaterMotor2Move(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return controlMotorCmd(CmdDevice.heater_motor_2, CmdAction.move, params, "加热区顶升电机加热位2移动"); + } + + /** + * 加热区顶升电机 加热位3移动 + */ + public static DeviceCommand heaterMotor3Move(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return controlMotorCmd(CmdDevice.heater_motor_3, CmdAction.move, params, "加热区顶升电机加热位3移动"); + } + + /** + * 加热区顶升电机 加热位4移动 + */ + public static DeviceCommand heaterMotor4Move(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return controlMotorCmd(CmdDevice.heater_motor_4, CmdAction.move, params, "加热区顶升电机加热位4移动"); + } + + /** + * 加热区顶升电机 加热位5移动 + */ + public static DeviceCommand heaterMotor5Move(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return controlMotorCmd(CmdDevice.heater_motor_5, CmdAction.move, params, "加热区顶升电机加热位5移动"); + } + + /** + * 加热区顶升电机 加热位6移动 + */ + public static DeviceCommand heaterMotor6Move(Double current, CmdDirection direction, Double position, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setCurrent(current); + params.setDirection(direction); + params.setPosition(position); + params.setSpeed(speed); + return controlMotorCmd(CmdDevice.heater_motor_6, CmdAction.move, params, "加热区顶升电机加热位6移动"); + } + + + /** + * 加热区顶升电机 加热位1停止 + */ + public static DeviceCommand heaterMotor1Stop() { + return controlMotorCmd(CmdDevice.heater_motor_1, CmdAction.stop, null, "加热区顶升电机加热位1停止"); + } + + /** + * 加热区顶升电机 加热位2停止 + */ + public static DeviceCommand heaterMotor2Stop() { + return controlMotorCmd(CmdDevice.heater_motor_2, CmdAction.stop, null, "加热区顶升电机加热位2停止"); + } + + /** + * 加热区顶升电机 加热位3停止 + */ + public static DeviceCommand heaterMotor3Stop() { + return controlMotorCmd(CmdDevice.heater_motor_3, CmdAction.stop, null, "加热区顶升电机加热位3停止"); + } + + /** + * 加热区顶升电机 加热位4停止 + */ + public static DeviceCommand heaterMotor4Stop() { + return controlMotorCmd(CmdDevice.heater_motor_4, CmdAction.stop, null, "加热区顶升电机加热位4停止"); + } + + /** + * 加热区顶升电机 加热位5停止 + */ + public static DeviceCommand heaterMotor5Stop() { + return controlMotorCmd(CmdDevice.heater_motor_5, CmdAction.stop, null, "加热区顶升电机加热位5停止"); + } + + /** + * 加热区顶升电机 加热位6停止 + */ + public static DeviceCommand heaterMotor6Stop() { + return controlMotorCmd(CmdDevice.heater_motor_6, CmdAction.stop, null, "加热区顶升电机加热位6停止"); + } + + + /** + * 加液泵 泵1设置参数 + */ + public static DeviceCommand acidPump1Set(Double current, CmdDirection direction, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setSpeed(speed); + params.setCurrent(current); + return setInfoCmd(CmdDevice.acid_pump1, CmdAction.set, params, "加液泵1设置参数"); + } + + /** + * 加液泵 泵2设置参数 + */ + public static DeviceCommand acidPump2Set(Double current, CmdDirection direction, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setSpeed(speed); + params.setCurrent(current); + return setInfoCmd(CmdDevice.acid_pump2, CmdAction.set, params, "加液泵2设置参数"); + } + + /** + * 加液泵 泵3设置参数 + */ + public static DeviceCommand acidPump3Set(Double current, CmdDirection direction, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setSpeed(speed); + params.setCurrent(current); + return setInfoCmd(CmdDevice.acid_pump3, CmdAction.set, params, "加液泵3设置参数"); + } + + /** + * 加液泵 泵4设置参数 + */ + public static DeviceCommand acidPump4Set(Double current, CmdDirection direction, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setSpeed(speed); + params.setCurrent(current); + return setInfoCmd(CmdDevice.acid_pump4, CmdAction.set, params, "加液泵4设置参数"); + } + + /** + * 加液泵 泵5设置参数 + */ + public static DeviceCommand acidPump5Set(Double current, CmdDirection direction, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setSpeed(speed); + params.setCurrent(current); + return setInfoCmd(CmdDevice.acid_pump5, CmdAction.set, params, "加液泵5设置参数"); + } + + /** + * 加液泵 泵6设置参数 + */ + public static DeviceCommand acidPump6Set(Double current, CmdDirection direction, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setSpeed(speed); + params.setCurrent(current); + return setInfoCmd(CmdDevice.acid_pump6, CmdAction.set, params, "加液泵6设置参数"); + } + + /** + * 加液泵 泵7设置参数 + */ + public static DeviceCommand acidPump7Set(Double current, CmdDirection direction, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setSpeed(speed); + params.setCurrent(current); + return setInfoCmd(CmdDevice.acid_pump7, CmdAction.set, params, "加液泵7设置参数"); + } + + /** + * 加液泵 泵8设置参数 + */ + public static DeviceCommand acidPump8Set(Double current, CmdDirection direction, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setSpeed(speed); + params.setCurrent(current); + return setInfoCmd(CmdDevice.acid_pump8, CmdAction.set, params, "加液泵8设置参数"); + } + + /** + * 加液泵 泵1移动 + */ + public static DeviceCommand acidPump1Move(CmdDirection direction, Double volume, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setSpeed(speed); + params.setVolume(volume); + return setInfoCmd(CmdDevice.acid_pump1, CmdAction.move, params, "加液泵1移动"); + } + + /** + * 加液泵 泵2移动 + */ + public static DeviceCommand acidPump2Move(CmdDirection direction, Double volume, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setSpeed(speed); + params.setVolume(volume); + return setInfoCmd(CmdDevice.acid_pump2, CmdAction.move, params, "加液泵2移动"); + } + + /** + * 加液泵 泵3移动 + */ + public static DeviceCommand acidPump3Move(CmdDirection direction, Double volume, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setSpeed(speed); + params.setVolume(volume); + return setInfoCmd(CmdDevice.acid_pump3, CmdAction.move, params, "加液泵3移动"); + } + + /** + * 加液泵 泵4移动 + */ + public static DeviceCommand acidPump4Move(CmdDirection direction, Double volume, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setSpeed(speed); + params.setVolume(volume); + return setInfoCmd(CmdDevice.acid_pump4, CmdAction.move, params, "加液泵4移动"); + } + + /** + * 加液泵 泵5移动 + */ + public static DeviceCommand acidPump5Move(CmdDirection direction, Double volume, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setSpeed(speed); + params.setVolume(volume); + return setInfoCmd(CmdDevice.acid_pump5, CmdAction.move, params, "加液泵5移动"); + } + + /** + * 加液泵 泵6移动 + */ + public static DeviceCommand acidPump6Move(CmdDirection direction, Double volume, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setSpeed(speed); + params.setVolume(volume); + return setInfoCmd(CmdDevice.acid_pump6, CmdAction.move, params, "加液泵6移动"); + } + + /** + * 加液泵 泵7移动 + */ + public static DeviceCommand acidPump7Move(CmdDirection direction, Double volume, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setSpeed(speed); + params.setVolume(volume); + return setInfoCmd(CmdDevice.acid_pump7, CmdAction.move, params, "加液泵7移动"); + } + + /** + * 加液泵 泵8移动 + */ + public static DeviceCommand acidPump8Move(CmdDirection direction, Double volume, Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDirection(direction); + params.setSpeed(speed); + params.setVolume(volume); + return setInfoCmd(CmdDevice.acid_pump8, CmdAction.move, params, "加液泵8移动"); + } + + /** + * 加液泵 泵1停止 + */ + public static DeviceCommand acidPump1Stop() { + return setInfoCmd(CmdDevice.acid_pump1, CmdAction.stop, null, "加液泵1停止"); + } + + /** + * 加液泵 泵2停止 + */ + public static DeviceCommand acidPump2Stop() { + return setInfoCmd(CmdDevice.acid_pump2, CmdAction.stop, null, "加液泵2停止"); + } + + /** + * 加液泵 泵3停止 + */ + public static DeviceCommand acidPump3Stop() { + return setInfoCmd(CmdDevice.acid_pump3, CmdAction.stop, null, "加液泵3停止"); + } + + /** + * 加液泵 泵4停止 + */ + public static DeviceCommand acidPump4Stop() { + return setInfoCmd(CmdDevice.acid_pump4, CmdAction.stop, null, "加液泵4停止"); + } + + /** + * 加液泵 泵5停止 + */ + public static DeviceCommand acidPump5Stop() { + return setInfoCmd(CmdDevice.acid_pump5, CmdAction.stop, null, "加液泵5停止"); + } + + /** + * 加液泵 泵6停止 + */ + public static DeviceCommand acidPump6Stop() { + return setInfoCmd(CmdDevice.acid_pump6, CmdAction.stop, null, "加液泵6停止"); + } + + /** + * 加液泵 泵7停止 + */ + public static DeviceCommand acidPump7Stop() { + return setInfoCmd(CmdDevice.acid_pump7, CmdAction.stop, null, "加液泵7停止"); + } + + /** + * 加液泵 泵8停止 + */ + public static DeviceCommand acidPump8Stop() { + return setInfoCmd(CmdDevice.acid_pump8, CmdAction.stop, null, "加液泵8停止"); + } + + + /** + * 夹爪 设置参数 + */ + public static DeviceCommand clawSet(Double speed) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setSpeed(speed); + return setInfoCmd(CmdDevice.claw, CmdAction.set, params, "夹爪设置参数"); + } + + /** + * 夹爪 夹紧 + */ + public static DeviceCommand clawTight(Double distance) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setDistance(distance); + return controlCmd(CmdDevice.claw, CmdAction.tight, params, "夹爪夹紧"); + } + + /** + * 夹爪 松开 + */ + public static DeviceCommand clawTight() { + return controlCmd(CmdDevice.claw, CmdAction.loose, null, "夹爪松开"); + } + + /** + * 夹爪 停止 + */ + public static DeviceCommand clawStop() { + return controlCmd(CmdDevice.claw, CmdAction.stop, null, "夹爪松开"); + } + + + /** + * 风扇 1打开 + */ + public static DeviceCommand fan1Open() { + return controlCmd(CmdDevice.fan1, CmdAction.open, null, "风扇1打开"); + } + + /** + * 风扇 2打开 + */ + public static DeviceCommand fan2Open() { + return controlCmd(CmdDevice.fan2, CmdAction.open, null, "风扇2打开"); + } + + /** + * 风扇 3打开 + */ + public static DeviceCommand fan3Open() { + return controlCmd(CmdDevice.fan3, CmdAction.open, null, "风扇3打开"); + } + + /** + * 风扇 4打开 + */ + public static DeviceCommand fan4Open() { + return controlCmd(CmdDevice.fan4, CmdAction.open, null, "风扇4打开"); + } + + /** + * 风扇 5打开 + */ + public static DeviceCommand fan5Open() { + return controlCmd(CmdDevice.fan5, CmdAction.open, null, "风扇5打开"); + } + + /** + * 风扇 6打开 + */ + public static DeviceCommand fan6Open() { + return controlCmd(CmdDevice.fan6, CmdAction.open, null, "风扇6打开"); + } + + /** + * 风扇 1关闭 + */ + public static DeviceCommand fan1Close() { + return controlCmd(CmdDevice.fan1, CmdAction.close, null, "风扇1关闭"); + } + + /** + * 风扇 2关闭 + */ + public static DeviceCommand fan2Close() { + return controlCmd(CmdDevice.fan2, CmdAction.close, null, "风扇2关闭"); + } + + /** + * 风扇 3关闭 + */ + public static DeviceCommand fan3Close() { + return controlCmd(CmdDevice.fan3, CmdAction.close, null, "风扇3关闭"); + } + + /** + * 风扇 4关闭 + */ + public static DeviceCommand fan4Close() { + return controlCmd(CmdDevice.fan4, CmdAction.close, null, "风扇4关闭"); + } + + /** + * 风扇 5关闭 + */ + public static DeviceCommand fan5Close() { + return controlCmd(CmdDevice.fan5, CmdAction.close, null, "风扇5关闭"); + } + + /** + * 风扇 6关闭 + */ + public static DeviceCommand fan6Close() { + return controlCmd(CmdDevice.fan6, CmdAction.close, null, "风扇6关闭"); + } + + /** + * 水泵电源 开启 + */ + public static DeviceCommand waterPumpPowerOpen() { + return controlCmd(CmdDevice.water_pump_power, CmdAction.open, null, "水泵电源开启"); + } + + /** + * 水泵电源 关闭 + */ + public static DeviceCommand waterPumpPowerClose() { + return controlCmd(CmdDevice.water_pump_power, CmdAction.close, null, "水泵电源关闭"); + } + + /** + * 风机电源 开启 + */ + public static DeviceCommand ventilatorPowerOpen() { + return controlCmd(CmdDevice.ventilator_power, CmdAction.open, null, " 风机电源开启"); + } + + /** + * 风机电源 关闭 + */ + public static DeviceCommand ventilatorPowerClose() { + return controlCmd(CmdDevice.ventilator_power, CmdAction.close, null, "风机电源关闭"); + } + + /** + * 加热棒1 获取温度 + */ + public static DeviceCommand heatRod1Get() { + return getInfoCmd(CmdDevice.heat_rod_1, "加热棒1获取温度"); + } + + /** + * 加热棒2 获取温度 + */ + public static DeviceCommand heatRod2Get() { + return getInfoCmd(CmdDevice.heat_rod_2, "加热棒2获取温度"); + } + + /** + * 加热棒3 获取温度 + */ + public static DeviceCommand heatRod3Get() { + return getInfoCmd(CmdDevice.heat_rod_3, "加热棒3获取温度"); + } + + /** + * 加热棒4 获取温度 + */ + public static DeviceCommand heatRod4Get() { + return getInfoCmd(CmdDevice.heat_rod_4, "加热棒4获取温度"); + } + + /** + * 加热棒5 获取温度 + */ + public static DeviceCommand heatRod5Get() { + return getInfoCmd(CmdDevice.heat_rod_5, "加热棒5获取温度"); + } + + /** + * 加热棒6 获取温度 + */ + public static DeviceCommand heatRod6Get() { + return getInfoCmd(CmdDevice.heat_rod_6, "加热棒6获取温度"); + } + + /** + * 加热棒1 开启加热 + */ + public static DeviceCommand heatRod1Open(Double temperature) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setTemperature(temperature); + return controlCmd(CmdDevice.heat_rod_1, CmdAction.open, params, "加热棒1开启加热"); + } + + /** + * 加热棒2 开启加热 + */ + public static DeviceCommand heatRod2Open(Double temperature) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setTemperature(temperature); + return controlCmd(CmdDevice.heat_rod_2, CmdAction.open, params, "加热棒2开启加热"); + } + + /** + * 加热棒3 开启加热 + */ + public static DeviceCommand heatRod3Open(Double temperature) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setTemperature(temperature); + return controlCmd(CmdDevice.heat_rod_3, CmdAction.open, params, "加热棒3开启加热"); + } + + /** + * 加热棒4 开启加热 + */ + public static DeviceCommand heatRod4Open(Double temperature) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setTemperature(temperature); + return controlCmd(CmdDevice.heat_rod_4, CmdAction.open, params, "加热棒4开启加热"); + } + + /** + * 加热棒5 开启加热 + */ + public static DeviceCommand heatRod5Open(Double temperature) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setTemperature(temperature); + return controlCmd(CmdDevice.heat_rod_5, CmdAction.open, params, "加热棒5开启加热"); + } + + /** + * 加热棒6 开启加热 + */ + public static DeviceCommand heatRod6Open(Double temperature) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setTemperature(temperature); + return controlCmd(CmdDevice.heat_rod_6, CmdAction.open, params, "加热棒6开启加热"); + } + + + /** + * 加热棒1 关闭加热 + */ + public static DeviceCommand heatRod1Close() { + return controlCmd(CmdDevice.heat_rod_1, CmdAction.close, null, "加热棒1关闭加热"); + } + + /** + * 加热棒2 关闭加热 + */ + public static DeviceCommand heatRod2Close() { + return controlCmd(CmdDevice.heat_rod_2, CmdAction.close, null, "加热棒2关闭加热"); + } + + /** + * 加热棒3 关闭加热 + */ + public static DeviceCommand heatRod3Close() { + return controlCmd(CmdDevice.heat_rod_3, CmdAction.close, null, "加热棒3关闭加热"); + } + + /** + * 加热棒4 关闭加热 + */ + public static DeviceCommand heatRod4Close() { + return controlCmd(CmdDevice.heat_rod_4, CmdAction.close, null, "加热棒4关闭加热"); + } + + /** + * 加热棒5 关闭加热 + */ + public static DeviceCommand heatRod5Close() { + return controlCmd(CmdDevice.heat_rod_5, CmdAction.close, null, "加热棒5关闭加热"); + } + + /** + * 加热棒6 关闭加热 + */ + public static DeviceCommand heatRod6Close() { + return controlCmd(CmdDevice.heat_rod_6, CmdAction.close, null, "加热棒6关闭加热"); + } + + /** + * 三色灯开启 + */ + public static DeviceCommand tricolorLightOpen(CmdColor color) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setColor(color); + return controlCmd(CmdDevice.tricolor_light, CmdAction.open, params, "三色灯开启"); + } + + /** + * 三色灯关闭 + */ + public static DeviceCommand tricolorLightClose() { + return controlCmd(CmdDevice.tricolor_light, CmdAction.close, null, "三色灯关闭"); + } + + /** + * 相机补灯光开启 + */ + public static DeviceCommand fillLightOpen(Double brightness) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setBrightness(brightness); + return controlCmd(CmdDevice.fill_light, CmdAction.open, params, "相机补灯光开启"); + } + + /** + * 相机补灯光关闭 + */ + public static DeviceCommand fillLightClose() { + return controlCmd(CmdDevice.fill_light, CmdAction.close, null, "相机补灯光关闭"); + } + + + /** + * 冷阱开启电源 + */ + public static DeviceCommand coldTrapOpenPower() { + return controlCmd(CmdDevice.cold_trap, CmdAction.open_power, null, "冷阱开启电源"); + } + + /** + * 冷阱关闭电源 + */ + public static DeviceCommand coldTrapClosePower() { + return controlCmd(CmdDevice.cold_trap, CmdAction.close_power, null, "冷阱关闭电源"); + } + + /** + * 冷阱设置温度 + */ + public static DeviceCommand coldTrapSet(Double temperature) { + DeviceCommandParams params = new DeviceCommandParams(); + params.setTemperature(temperature); + return setInfoCmd(CmdDevice.cold_trap, CmdAction.close_power, params, "冷阱设置温度"); + } + + /** + * 冷阱打开循环 + */ + public static DeviceCommand coldTrapOpenCircle() { + return controlCmd(CmdDevice.cold_trap, CmdAction.open_circle, null, "冷阱打开循环"); + } + + /** + * 冷阱关闭循环 + */ + public static DeviceCommand coldTrapCloseCircle() { + return controlCmd(CmdDevice.cold_trap, CmdAction.close_circle, null, "冷阱关闭循环"); + } + + /** + * 冷阱开启加热 + */ + public static DeviceCommand coldTrapOpenHeart() { + return controlCmd(CmdDevice.cold_trap, CmdAction.open_heart, null, "冷阱开启加热"); + } + + /** + * 冷阱关闭加热 + */ + public static DeviceCommand coldTrapCloseHeart() { + return controlCmd(CmdDevice.cold_trap, CmdAction.close_heart, null, "冷阱关闭加热"); + } + + /** + * 拍照 + */ + public static DeviceCommand takePhoto() { + return controlCmd(CmdDevice.photo, CmdAction.take_photo, null, "冷阱关闭加热"); + } + + + /** + * 控制设备电机指令 + */ + private static DeviceCommand controlMotorCmd(CmdDevice device, CmdAction action, DeviceCommandParams params, String commandName) { + return deviceCmd("controlMotorCmd", device, action, params, commandName); + } + + /** + * 设置参数指令 + */ + private static DeviceCommand setInfoCmd(CmdDevice device, CmdAction action, DeviceCommandParams params, String commandName) { + return deviceCmd("setInfoCmd", device, action, params, commandName); + } + + /** + * 获取参数指令 + */ + private static DeviceCommand getInfoCmd(CmdDevice device, String commandName) { + return deviceCmd("getInfoCmd", device, CmdAction.get, null, commandName); + } + + + /** + * 设备控制指令 + */ + private static DeviceCommand controlCmd(CmdDevice device, CmdAction action, DeviceCommandParams params, String commandName) { + return deviceCmd("controlCmd", device, action, params, commandName); + } + + /** * 设备指令包装 */ - private static DeviceCommand deviceCmd(String code, String device, String action, Map params, String commandName) { + private static DeviceCommand deviceCmd(String code, CmdDevice device, CmdAction action, DeviceCommandParams params, String commandName) { DeviceCommand cmdToDevice = new DeviceCommand(); cmdToDevice.setCmdCode(code); cmdToDevice.setDevice(device); @@ -21,4 +1147,3 @@ public class DeviceCommandGenerator { return cmdToDevice; } } - diff --git a/src/main/java/com/iflytop/gd/common/cmd/DeviceCommandParams.java b/src/main/java/com/iflytop/gd/common/cmd/DeviceCommandParams.java index fe94dbd..4486ea4 100644 --- a/src/main/java/com/iflytop/gd/common/cmd/DeviceCommandParams.java +++ b/src/main/java/com/iflytop/gd/common/cmd/DeviceCommandParams.java @@ -2,6 +2,7 @@ package com.iflytop.gd.common.cmd; import com.iflytop.gd.common.enums.cmd.CmdAxis; +import com.iflytop.gd.common.enums.cmd.CmdColor; import com.iflytop.gd.common.enums.cmd.CmdDirection; import lombok.Data; @@ -13,5 +14,10 @@ public class DeviceCommandParams { private Double position; private Double speed; private Double angle; + private Double volume; + private Double distance; + private Double temperature; private CmdAxis axis; + private CmdColor color; + private Double brightness; } diff --git a/src/main/java/com/iflytop/gd/common/enums/cmd/CmdAction.java b/src/main/java/com/iflytop/gd/common/enums/cmd/CmdAction.java index 4ec1c71..2019832 100644 --- a/src/main/java/com/iflytop/gd/common/enums/cmd/CmdAction.java +++ b/src/main/java/com/iflytop/gd/common/enums/cmd/CmdAction.java @@ -1,5 +1,6 @@ package com.iflytop.gd.common.enums.cmd; public enum CmdAction { - open, close, stop, start, origin, move, move_joint, set + open, close, stop, start, origin, move, move_x_joint, move_y_joint, move_joint, set, get, tight, loose, + open_power, close_power, open_circle, close_circle, open_heart, close_heart, take_photo } diff --git a/src/main/java/com/iflytop/gd/common/enums/cmd/CmdColor.java b/src/main/java/com/iflytop/gd/common/enums/cmd/CmdColor.java new file mode 100644 index 0000000..988a563 --- /dev/null +++ b/src/main/java/com/iflytop/gd/common/enums/cmd/CmdColor.java @@ -0,0 +1,5 @@ +package com.iflytop.gd.common.enums.cmd; + +public enum CmdColor { + red,green,blue +} diff --git a/src/main/java/com/iflytop/gd/common/enums/cmd/CmdDevice.java b/src/main/java/com/iflytop/gd/common/enums/cmd/CmdDevice.java index 1092fbd..b456b9d 100644 --- a/src/main/java/com/iflytop/gd/common/enums/cmd/CmdDevice.java +++ b/src/main/java/com/iflytop/gd/common/enums/cmd/CmdDevice.java @@ -1,5 +1,10 @@ package com.iflytop.gd.common.enums.cmd; public enum CmdDevice { - door, shake_motor, tray_motor, dual_robot, hbot_x, hbot_y, hbot_z, heater_motor_1, heater_motor_2, heater_motor_3, heater_motor_4, heater_motor_5, heater_motor_6, + door, shake_motor, tray_motor, dual_robot, hbot_x, hbot_y, hbot_z, + heater_motor_1, heater_motor_2, heater_motor_3, heater_motor_4, heater_motor_5, heater_motor_6, + acid_pump1, acid_pump2, acid_pump3, acid_pump4, acid_pump5, acid_pump6, acid_pump7, acid_pump8, + claw, fan1, fan2, fan3, fan4, fan5, fan6, water_pump_power, ventilator_power, + heat_rod_1, heat_rod_2, heat_rod_3, heat_rod_4, heat_rod_5, heat_rod_6, + tricolor_light, fill_light, cold_trap, photo }