This commit is contained in:
xuzhiheng 2025-05-06 10:34:46 +08:00
parent 2d9c7b4eec
commit 36cbb1a802

View File

@ -151,6 +151,10 @@ public class LoopbackCommunicationAdapter
* 用于判断是否切换执行订单 * 用于判断是否切换执行订单
*/ */
private static String uniqueOrderName; private static String uniqueOrderName;
/**
* AGV最后上报时间
*/
private static long AFLastReportTime;
/** /**
* Creates a new instance. * Creates a new instance.
@ -360,6 +364,8 @@ public class LoopbackCommunicationAdapter
if (body[21] == (byte) 0xAF) { if (body[21] == (byte) 0xAF) {
//最后上报时间 //最后上报时间
Date now = new Date();
AFLastReportTime = now.getTime();
System.out.println("0xAF sub success"); System.out.println("0xAF sub success");
@ -548,7 +554,7 @@ public class LoopbackCommunicationAdapter
getProcessModel().setState(Vehicle.State.EXECUTING); getProcessModel().setState(Vehicle.State.EXECUTING);
//阻塞当前线程至0xAF订阅结束 //阻塞当前线程至0xAF订阅结束 todo 为了避免并发可能要注释
while (true) { while (true) {
Date now = new Date(); Date now = new Date();
if ((now.getTime() - sub0xafDeadline) >= 200) { if ((now.getTime() - sub0xafDeadline) >= 200) {
@ -664,9 +670,16 @@ public class LoopbackCommunicationAdapter
} }
//获取AGV最终经过点 //获取AGV最终经过点
QueryRobotStatusRsp qryRobotStatusRsp = QryRobotStatus.command(); String currentPoint = null;
String currentPoint = (qryRobotStatusRsp.locationStatusInfo.lastPassPointId).toString(); long specifyTheTime = SubRobotStatue.intervalTime * 2 + 200;
initVehiclePosition(currentPoint); Date now = new Date();
if ((now.getTime() - AFLastReportTime) <= specifyTheTime) {
QueryRobotStatusRsp qryRobotStatusRsp = QryRobotStatus.command();
currentPoint = (qryRobotStatusRsp.locationStatusInfo.lastPassPointId).toString();
initVehiclePosition(currentPoint);
} else {
currentPoint = getProcessModel().getPosition();
}
//判断当前AGV点位是否和最新点位相同 //判断当前AGV点位是否和最新点位相同
if (currentPoint.equals(LAST_PASSED_POINT)) { if (currentPoint.equals(LAST_PASSED_POINT)) {