commit for push
This commit is contained in:
parent
51aa9c7561
commit
503b7e9f4c
@ -12,6 +12,7 @@ import org.opentcs.kc.udp.agv.param.function.b1.SubscribeParam;
|
|||||||
import org.opentcs.kc.udp.agv.param.function.b1.SubscribeRsp;
|
import org.opentcs.kc.udp.agv.param.function.b1.SubscribeRsp;
|
||||||
import org.opentcs.kc.udp.agv.param.function.navigation.*;
|
import org.opentcs.kc.udp.agv.param.function.navigation.*;
|
||||||
import org.opentcs.kc.udp.agv.param.function.read.ReadParam;
|
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.ReadStrValue;
|
||||||
import org.opentcs.kc.udp.agv.param.function.read.ReadValueMember;
|
import org.opentcs.kc.udp.agv.param.function.read.ReadValueMember;
|
||||||
import org.opentcs.kc.udp.agv.param.function.write.WriteParam;
|
import org.opentcs.kc.udp.agv.param.function.write.WriteParam;
|
||||||
@ -37,28 +38,28 @@ import org.opentcs.kc.udp.io.UDPClient;
|
|||||||
public class KCCommandDemo {
|
public class KCCommandDemo {
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
{
|
// {
|
||||||
//0xAF(查询机器人状态)
|
// //0xAF(查询机器人状态)
|
||||||
AgvEvent agvEvent = queryStatus();
|
// AgvEvent agvEvent = queryStatus();
|
||||||
printInfo(agvEvent);
|
// printInfo(agvEvent);
|
||||||
RcvEventPackage rcv = UDPClient.localAGV.send(agvEvent);
|
// RcvEventPackage rcv = UDPClient.localAGV.send(agvEvent);
|
||||||
if(rcv.isOk()){
|
// if(rcv.isOk()){
|
||||||
System.out.println();
|
// System.out.println();
|
||||||
System.out.println("received transationId : "+ "isok:"+rcv.isOk());
|
// System.out.println("received transationId : "+ "isok:"+rcv.isOk());
|
||||||
for (byte b:rcv.getValue()){
|
// for (byte b:rcv.getValue()){
|
||||||
System.out.print(byteToHex(b)+" ");
|
// System.out.print(byteToHex(b)+" ");
|
||||||
}
|
// }
|
||||||
System.out.println();
|
// System.out.println();
|
||||||
System.out.println("---------------------");
|
// System.out.println("---------------------");
|
||||||
for (byte c:rcv.getDataBytes()){
|
// for (byte c:rcv.getDataBytes()){
|
||||||
System.out.print(byteToHex(c)+" ");
|
// System.out.print(byteToHex(c)+" ");
|
||||||
}
|
// }
|
||||||
QueryRobotStatusRsp queryRobotStatusRsp = new QueryRobotStatusRsp(rcv.getDataBytes());
|
// QueryRobotStatusRsp queryRobotStatusRsp = new QueryRobotStatusRsp(rcv.getDataBytes());
|
||||||
}else {
|
// }else {
|
||||||
System.out.println();
|
// System.out.println();
|
||||||
System.out.println("received transationId : "+ "isok:"+rcv.isOk());
|
// System.out.println("received transationId : "+ "isok:"+rcv.isOk());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// {
|
// {
|
||||||
// //0xB0(查询载货状态)
|
// //0xB0(查询载货状态)
|
||||||
@ -210,19 +211,19 @@ public class KCCommandDemo {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
{
|
// {
|
||||||
//0xAE(导航控制导航点控制)
|
// //0xAE(导航控制导航点控制)
|
||||||
AgvEvent agvEvent = navigationControl();
|
// AgvEvent agvEvent = navigationControl();
|
||||||
printInfo(agvEvent);
|
// printInfo(agvEvent);
|
||||||
RcvEventPackage rcv = UDPClient.localAGV.send(agvEvent);
|
// RcvEventPackage rcv = UDPClient.localAGV.send(agvEvent);
|
||||||
if(rcv.isOk()){
|
// if(rcv.isOk()){
|
||||||
System.out.println("0xAE ok");
|
// System.out.println("0xAE ok");
|
||||||
}else {
|
// }else {
|
||||||
System.out.println();
|
// System.out.println();
|
||||||
System.out.println("0xAE fail");
|
// System.out.println("0xAE fail");
|
||||||
System.out.println("received transationId : "+ "isok:"+rcv.isOk());
|
// System.out.println("received transationId : "+ "isok:"+rcv.isOk());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
{
|
{
|
||||||
//0xB2(立即动作指令)
|
//0xB2(立即动作指令)
|
||||||
@ -238,19 +239,7 @@ public class KCCommandDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
//0xB2(立即动作指令)
|
|
||||||
AgvEvent agvEvent = navigationControl();
|
|
||||||
printInfo(agvEvent);
|
|
||||||
RcvEventPackage rcv = UDPClient.localAGV.send(agvEvent);
|
|
||||||
if(rcv.isOk()){
|
|
||||||
System.out.println("0xAE ok");
|
|
||||||
}else {
|
|
||||||
System.out.println();
|
|
||||||
System.out.println("0xAE fail");
|
|
||||||
System.out.println("received transationId : "+ "isok:"+rcv.isOk());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,18 +272,18 @@ public class KCCommandDemo {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* decs: read操作
|
* decs: read操作
|
||||||
* 指令:0x02
|
* 指令:0x01
|
||||||
* author: caixiang
|
* author: caixiang
|
||||||
* date: 2025/1/17 16:25
|
* date: 2025/1/17 16:25
|
||||||
*/
|
*/
|
||||||
public static AgvEvent readValue() {
|
public static AgvEvent readValue() {
|
||||||
AgvEvent agvEvent = new AgvEvent(AgvEventConstant.CommandCode_READ);
|
AgvEvent agvEvent = new AgvEvent(AgvEventConstant.CommandCode_READ);
|
||||||
List<ReadValueMember> readValueMemberList = new ArrayList<>();
|
List<ReadValueMember> readValueMemberList = new ArrayList<>();
|
||||||
ReadValueMember readValueMember1 = new ReadValueMember(Short.valueOf("0"), Short.valueOf("1"));
|
ReadValueMember readValueMember1 = new ReadValueMember(Short.valueOf("10"), Short.valueOf("1"));
|
||||||
readValueMemberList.add(readValueMember1);
|
readValueMemberList.add(readValueMember1);
|
||||||
|
|
||||||
List<ReadStrValue> readStrValueList = new ArrayList<>();
|
List<ReadStrValue> readStrValueList = new ArrayList<>();
|
||||||
ReadStrValue readStrValue = new ReadStrValue("Battry_SOC", 1, readValueMemberList);
|
ReadStrValue readStrValue = new ReadStrValue("Lift", 1, readValueMemberList);
|
||||||
readStrValueList.add(readStrValue);
|
readStrValueList.add(readStrValue);
|
||||||
|
|
||||||
ReadParam readParam = new ReadParam(agvEvent.getTransationId(), readStrValueList);
|
ReadParam readParam = new ReadParam(agvEvent.getTransationId(), readStrValueList);
|
||||||
@ -351,36 +340,38 @@ public class KCCommandDemo {
|
|||||||
//TODO 构建
|
//TODO 构建
|
||||||
Integer orderId = 1;
|
Integer orderId = 1;
|
||||||
|
|
||||||
//构建Action指令
|
// //构建Action指令
|
||||||
Action actionLiftUp = new Action(
|
// Action actionLiftUp = new Action(
|
||||||
ActionSet.stop0x00, //机器人移动到正常点 停止,2个字节
|
// ActionSet.fork0x12, //机器人移动到正常点 停止,2个字节
|
||||||
(byte) 0x02, //只能执行当前动作
|
|
||||||
1, //actionID
|
|
||||||
ActionSet.fork0x12_paramsize,
|
|
||||||
ActionSet.fork0x12(
|
|
||||||
1.1f, //升降高度
|
|
||||||
(byte) 0x01, //1上升 2下降
|
|
||||||
(byte)0x01 //01 开始 任务
|
|
||||||
)
|
|
||||||
);
|
|
||||||
agvEvent.setBody(actionLiftUp.toBytes());
|
|
||||||
//
|
|
||||||
// //重置 空指令
|
|
||||||
// Action actionReset = new Action(
|
|
||||||
// ActionSet.stop0x00, //机器人移动到正常点 停止,2个字节
|
|
||||||
// (byte) 0x02, //只能执行当前动作
|
// (byte) 0x02, //只能执行当前动作
|
||||||
// 2, //actionID
|
// 1, //actionID
|
||||||
// ActionSet.cancle0x03_paramsize,
|
// ActionSet.fork0x12_paramsize,
|
||||||
// ActionSet.cancel0x12(
|
// ActionSet.fork0x12(
|
||||||
// 1, //订单id
|
// 1.1f, //升降高度
|
||||||
// (byte)0x01 //1 立即停止, 2 正常移动到点再停止
|
// (byte) 0x01, //1上升 2下降
|
||||||
|
// (byte)0x01 //01 开始 任务
|
||||||
// )
|
// )
|
||||||
// );
|
// );
|
||||||
// agvEvent.setBody(actionReset.toBytes());
|
// 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());
|
||||||
//
|
//
|
||||||
// //构建Action指令
|
// //构建Action指令
|
||||||
// Action actionLiftDown = new Action(
|
// Action actionLiftDown = new Action(
|
||||||
// ActionSet.stop0x00, //机器人移动到正常点 停止,2个字节
|
// ActionSet.fork0x12, //机器人移动到正常点 停止,2个字节
|
||||||
// (byte) 0x02, //只能执行当前动作
|
// (byte) 0x02, //只能执行当前动作
|
||||||
// 1, //actionID
|
// 1, //actionID
|
||||||
// ActionSet.fork0x12_paramsize,
|
// ActionSet.fork0x12_paramsize,
|
||||||
|
@ -11,8 +11,8 @@ public class ActionSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static byte stop0x01 = 0x01;
|
public static byte stop0x01 = 0x01;
|
||||||
public static byte stop0x00 = 0x00;
|
public static byte fork0x12 = 0x12;
|
||||||
|
public static byte cancel0x03 = 0x03;
|
||||||
|
|
||||||
public static byte recover0x02 = 0x02;
|
public static byte recover0x02 = 0x02;
|
||||||
public static byte cancelTask0x03 = 0x03;
|
public static byte cancelTask0x03 = 0x03;
|
||||||
|
@ -10,13 +10,12 @@ import org.opentcs.kc.udp.agv.param.AgvEvent;
|
|||||||
public class main {
|
public class main {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// //size 148 ,contentSize = 148-28 = 120
|
||||||
//size 148 ,contentSize = 148-28 = 120
|
// String errSrc = "d4 97 44 9c cb cf 0b 4c 95 51 d8 61 70 f1 e7 94 01 01 00 00 10 af 00 00 00 68 00 00 00 00 00 00 53 3a 48 bd 32 fb 7b bc ca 13 03 ba 01 00 00 00 0c 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 01 00 00 00 00 00 00 05 00 00 00 01 00 00 00 01 01 00 00 02 00 00 00 02 00 00 00 01 00 00 00 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00";
|
||||||
String errSrc = "d4 97 44 9c cb cf 0b 4c 95 51 d8 61 70 f1 e7 94 01 01 00 00 10 af 00 00 00 68 00 00 00 00 00 00 53 3a 48 bd 32 fb 7b bc ca 13 03 ba 01 00 00 00 0c 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 01 00 00 00 00 00 00 05 00 00 00 01 00 00 00 01 01 00 00 02 00 00 00 02 00 00 00 01 00 00 00 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00";
|
// String okSrc = "d4 97 44 9c cb cf 0b 4c 95 51 d8 61 70 f1 e7 94 01 01 03 00 10 af 00 00 64 00 00 00 01 00 00 00 73 1c 30 3d 66 ba 03 3d d9 51 59 bb 00 00 00 00 0c 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0a 01 02 00 00 00 00 00 00 00 00 00 73 1c 30 3d 66 ba 03 3d d9 51 59 bb 00 00 00 00 0c 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 ";
|
||||||
String okSrc = "d4 97 44 9c cb cf 0b 4c 95 51 d8 61 70 f1 e7 94 01 01 03 00 10 af 00 00 64 00 00 00 01 00 00 00 73 1c 30 3d 66 ba 03 3d d9 51 59 bb 00 00 00 00 0c 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0a 01 02 00 00 00 00 00 00 00 00 00 73 1c 30 3d 66 ba 03 3d d9 51 59 bb 00 00 00 00 0c 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 ";
|
// String[] s = errSrc.split(" ");
|
||||||
String[] s = errSrc.split(" ");
|
// System.out.println("size: " + s.length);
|
||||||
System.out.println("size: " + s.length);
|
// printInfo(s);
|
||||||
printInfo(s);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user