调试货叉指令
This commit is contained in:
@@ -338,45 +338,46 @@ public class KCCommandDemo {
|
||||
public static AgvEvent actionNow() {
|
||||
AgvEvent agvEvent = new AgvEvent(AgvEventConstant.CommandCode_ACT_IMMEDIATELY);
|
||||
//TODO 构建
|
||||
Integer orderId = 1;
|
||||
Integer actionID = 5;
|
||||
|
||||
// //构建Action指令
|
||||
// Action actionLiftUp = new Action(
|
||||
Action actionLiftUp = new Action(
|
||||
ActionSet.fork0x12, //机器人移动到正常点 停止,2个字节
|
||||
(byte) 0x02, //只能执行当前动作
|
||||
actionID, //actionID
|
||||
ActionSet.fork0x12_paramsize,
|
||||
ActionSet.fork0x12(
|
||||
1.1f, //升降高度
|
||||
(byte) 0x01, //1上升 2下降
|
||||
(byte)0x01 //01 开始 任务
|
||||
)
|
||||
);
|
||||
agvEvent.setBody(actionLiftUp.toBytes());
|
||||
|
||||
|
||||
|
||||
// //重置 空指令
|
||||
// Action actionReset = new Action(
|
||||
// ActionSet.fork0x12, //机器人移动到正常点 停止,2个字节
|
||||
// (byte) 0x02, //只能执行当前动作
|
||||
// 1, //actionID
|
||||
// actionID, //actionID
|
||||
// ActionSet.fork0x12_paramsize,
|
||||
// ActionSet.fork0x12(
|
||||
// 1.1f, //升降高度
|
||||
// (byte) 0x01, //1上升 2下降
|
||||
// (byte)0x01 //01 开始 任务
|
||||
// (byte)0x00 //01 开始 任务
|
||||
// )
|
||||
// );
|
||||
// agvEvent.setBody(actionLiftUp.toBytes());
|
||||
|
||||
|
||||
|
||||
//重置 空指令
|
||||
Action actionReset = new Action(
|
||||
ActionSet.cancel0x03, //机器人移动到正常点 停止,2个字节
|
||||
(byte) 0x02, //只能执行当前动作
|
||||
2, //actionID
|
||||
ActionSet.cancle0x03_paramsize,
|
||||
ActionSet.cancel0x12(
|
||||
1, //订单id
|
||||
(byte)0x01 //1 立即停止, 2 正常移动到点再停止
|
||||
)
|
||||
);
|
||||
agvEvent.setBody(actionReset.toBytes());
|
||||
// );
|
||||
// agvEvent.setBody(actionReset.toBytes());
|
||||
//
|
||||
// //构建Action指令
|
||||
// Action actionLiftDown = new Action(
|
||||
// ActionSet.fork0x12, //机器人移动到正常点 停止,2个字节
|
||||
// (byte) 0x02, //只能执行当前动作
|
||||
// 1, //actionID
|
||||
// actionID, //actionID
|
||||
// ActionSet.fork0x12_paramsize,
|
||||
// ActionSet.fork0x12(
|
||||
// 1.1f, //升降高度
|
||||
// 0.1f, //升降高度
|
||||
// (byte) 0x02, //1上升 2下降
|
||||
// (byte)0x01 //01 开始 任务
|
||||
// )
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package org.opentcs.kc.udp.Service;
|
||||
|
||||
import org.opentcs.kc.udp.agv.param.AgvEvent;
|
||||
import org.opentcs.kc.udp.agv.param.AgvEventConstant;
|
||||
import org.opentcs.kc.udp.agv.param.function.navigation.Action;
|
||||
import org.opentcs.kc.udp.agv.param.function.navigation.ActionSet;
|
||||
import org.opentcs.kc.udp.agv.param.rsp.RcvEventPackage;
|
||||
import org.opentcs.kc.udp.io.UDPClient;
|
||||
|
||||
public class ActImmediately extends BaseCommand{
|
||||
|
||||
private static Integer actionId = 20;
|
||||
|
||||
/**
|
||||
* decs: 立即动作指令
|
||||
* 指令:0xB2
|
||||
* author: caixiang
|
||||
* date: 2025/1/17 16:25
|
||||
*/
|
||||
private static AgvEvent actionNow(float execuHeight, byte modeOfMovement) {
|
||||
AgvEvent agvEvent = new AgvEvent(AgvEventConstant.CommandCode_ACT_IMMEDIATELY);
|
||||
//TODO 构建
|
||||
|
||||
//构建Action指令
|
||||
Action actionLiftUp = new Action(
|
||||
ActionSet.fork0x12, //机器人移动到正常点 停止,2个字节
|
||||
(byte) 0x02, //只能执行当前动作
|
||||
actionId, //动作ID
|
||||
ActionSet.fork0x12_paramsize,
|
||||
ActionSet.fork0x12(
|
||||
execuHeight, //升降高度
|
||||
modeOfMovement, //1上升 2下降
|
||||
(byte)0x01 //01 开始任务
|
||||
)
|
||||
);
|
||||
|
||||
actionId++;
|
||||
agvEvent.setBody(actionLiftUp.toBytes());
|
||||
return agvEvent;
|
||||
}
|
||||
|
||||
private static AgvEvent resetCmd() {
|
||||
AgvEvent agvEvent = new AgvEvent(AgvEventConstant.CommandCode_ACT_IMMEDIATELY);
|
||||
//重置 空指令
|
||||
Action actionReset = new Action(
|
||||
ActionSet.fork0x12, //机器人移动到正常点 停止,2个字节
|
||||
(byte) 0x02, //只能执行当前动作
|
||||
actionId, //actionID
|
||||
ActionSet.fork0x12_paramsize,
|
||||
ActionSet.fork0x12(
|
||||
0.1f, //升降高度
|
||||
(byte) 0x01, //1上升 2下降
|
||||
(byte)0x00 //00 无任务
|
||||
)
|
||||
);
|
||||
agvEvent.setBody(actionReset.toBytes());
|
||||
|
||||
actionId++;
|
||||
agvEvent.setBody(actionReset.toBytes());
|
||||
return agvEvent;
|
||||
}
|
||||
|
||||
|
||||
public static void command(float execuHeight, byte modeOfMovement){
|
||||
//0xB2(立即动作指令)
|
||||
AgvEvent agvEvent = actionNow(execuHeight, modeOfMovement);
|
||||
printInfo(agvEvent);
|
||||
RcvEventPackage rcv = UDPClient.localAGV.send(agvEvent);
|
||||
if(rcv.isOk()){
|
||||
System.out.println("0xB2 forklift ok");
|
||||
}else {
|
||||
System.out.println();
|
||||
System.out.println("0xB2 forklift fail");
|
||||
System.out.println("received transationId : "+ "isok:"+rcv.isOk());
|
||||
}
|
||||
}
|
||||
|
||||
public static void reset(){
|
||||
//0xB2(立即动作指令)
|
||||
AgvEvent agvEvent = resetCmd();
|
||||
printInfo(agvEvent);
|
||||
RcvEventPackage rcv = UDPClient.localAGV.send(agvEvent);
|
||||
if(rcv.isOk()){
|
||||
System.out.println("-0xB2 reset ok");
|
||||
}else {
|
||||
System.out.println();
|
||||
System.out.println("-0xB2 reset fail");
|
||||
System.out.println("-received transationId : "+ "isok:"+rcv.isOk());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class HybridNavigation
|
||||
/**
|
||||
* 订单映射最大订单ID.
|
||||
*/
|
||||
private static int currentMaxiOrderId = 0;
|
||||
private static int currentMaxiOrderId = 25;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.opentcs.kc.udp.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.opentcs.kc.udp.agv.param.AgvEvent;
|
||||
import org.opentcs.kc.udp.agv.param.AgvEventConstant;
|
||||
import org.opentcs.kc.udp.agv.param.function.read.ReadParam;
|
||||
import org.opentcs.kc.udp.agv.param.function.read.ReadRsp;
|
||||
import org.opentcs.kc.udp.agv.param.function.read.ReadStrValue;
|
||||
import org.opentcs.kc.udp.agv.param.function.read.ReadValueMember;
|
||||
import org.opentcs.kc.udp.agv.param.rsp.RcvEventPackage;
|
||||
import org.opentcs.kc.udp.io.UDPClient;
|
||||
|
||||
public class ReadValue extends BaseCommand{
|
||||
|
||||
private static AgvEvent readValue() {
|
||||
AgvEvent agvEvent = new AgvEvent(AgvEventConstant.CommandCode_READ);
|
||||
List<ReadValueMember> readValueMemberList = new ArrayList<>();
|
||||
ReadValueMember readValueMember1 = new ReadValueMember(Short.valueOf("10"), Short.valueOf("1"));
|
||||
readValueMemberList.add(readValueMember1);
|
||||
|
||||
List<ReadStrValue> readStrValueList = new ArrayList<>();
|
||||
ReadStrValue readStrValue = new ReadStrValue("Lift", 1, readValueMemberList);
|
||||
readStrValueList.add(readStrValue);
|
||||
|
||||
ReadParam readParam = new ReadParam(agvEvent.getTransationId(), readStrValueList);
|
||||
agvEvent.setBody(readParam.toBytes());
|
||||
|
||||
return agvEvent;
|
||||
}
|
||||
|
||||
public static byte[] command() {
|
||||
AgvEvent agvEvent = readValue();
|
||||
printInfo(agvEvent);
|
||||
RcvEventPackage rcv = UDPClient.localAGV.send(agvEvent);
|
||||
if (rcv.isOk()) {
|
||||
System.out.println();
|
||||
System.out.println("-received " + "isok:" + rcv.isOk() + " dataBytes:");
|
||||
printInfo(rcv);
|
||||
ReadRsp readRsp = new ReadRsp(rcv.getDataBytes());
|
||||
return readRsp.dataValue;
|
||||
}
|
||||
else {
|
||||
System.out.println();
|
||||
System.out.println("-received transationId : " + "isok:" + rcv.isOk());
|
||||
throw new RuntimeException("-read failed");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user