From f9f3b4c4cd6b174f776b15360b0d063a9d0b829b Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 04 十一月 2024 17:01:23 +0800
Subject: [PATCH] #
---
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/RetreatNavigateService.java | 113 ++++++++++++++++++++++++++++++--------------------------
1 files changed, 61 insertions(+), 52 deletions(-)
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/RetreatNavigateService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/RetreatNavigateService.java
index d52e290..2de4a3a 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/RetreatNavigateService.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/RetreatNavigateService.java
@@ -1,8 +1,8 @@
package com.zy.acs.manager.core.service;
import com.zy.acs.common.utils.RedisSupport;
-import com.zy.acs.framework.common.Cools;
import com.zy.acs.common.utils.Utils;
+import com.zy.acs.framework.common.Cools;
import com.zy.acs.manager.common.utils.MapDataUtils;
import com.zy.acs.manager.core.constant.MapDataConstant;
import com.zy.acs.manager.core.domain.Lane;
@@ -166,8 +166,9 @@
openQueue.add(start);
existNodes.add(start);
- RetreatNavigateNode firstPointOfTurn = null;
- List<String> firstPointWaveScopeOfTurn = new ArrayList<>();
+ RetreatNavigateNode availablePointOfTurn = null;
+ List<String> availablePointWaveScopeOfTurn = new ArrayList<>();
+ int actuallyLanesOfTurn = 0;
while (openQueue.size() > 0 && null == finialNode) {
@@ -175,15 +176,52 @@
List<RetreatNavigateNode> enableNodes = new ArrayList<>();
ArrayList<RetreatNavigateNode> neighborNodes = this.getNeighborNodes(currentNode, existNodes);
- int forks = neighborNodes.size();
- if (firstPointOfTurn == null && forks >= 2 && !isSame(start, currentNode)) {
- firstPointOfTurn = currentNode;
- firstPointWaveScopeOfTurn = mapService.getWaveScopeByCode(lev, firstPointOfTurn.getCodeData(), avoidDistance)
- .stream().map(NavigateNode::getCodeData).distinct().collect(Collectors.toList());
+ boolean pointOfTurn = false;
+ if (neighborNodes.size() >= 2 && !isSame(start, currentNode)) {
+ pointOfTurn = true;
}
- label: for (RetreatNavigateNode node : neighborNodes) {
+ // 璁$畻鏄惁涓哄彲鐢ㄨ浆寮偣
+ if (pointOfTurn) {
+ for (RetreatNavigateNode node : neighborNodes) {
+ // lane
+ Lane lane = laneService.search(node.getCodeData());
+ if (null != lane) {
+ Set<String> lanVehicleSet = new HashSet<>();
+ List<String> laneCodes = lane.getCodes();
+ for (String laneCodeData : laneCodes) {
+ int[] laneCodeMatrixIdx = mapDataDispatcher.getCodeMatrixIdx(null, laneCodeData);
+ // scan dynamicMatrix or WaveMatrix
+ DynamicNode laneDynamicNode = dynamicMatrix[laneCodeMatrixIdx[0]][laneCodeMatrixIdx[1]];
+ String laneVehicle = laneDynamicNode.getVehicle();
+ assert !laneVehicle.equals(DynamicNodeType.BLOCK.val);
+ if (!laneVehicle.equals(DynamicNodeType.ACCESS.val)) {
+ if (!laneVehicle.equals(agvNo)) {
+ lanVehicleSet.add(laneVehicle);
+// redis.setObject(RedisConstant.AGV_TO_STANDBY_FLAG, laneVehicle, true, 30);
+ }
+ }
+ }
+
+ if (lanVehicleSet.size() + 1 > maxAgvCountInLane) {
+ continue;
+ }
+ }
+
+ actuallyLanesOfTurn ++;
+ }
+
+ if (actuallyLanesOfTurn >= 2) {
+ availablePointOfTurn = currentNode;
+ availablePointWaveScopeOfTurn = mapService.getWaveScopeByCode(lev, availablePointOfTurn.getCodeData(), avoidDistance)
+ .stream().map(NavigateNode::getCodeData).distinct().collect(Collectors.toList());
+ }
+
+ }
+
+
+ label: for (RetreatNavigateNode node : neighborNodes) {
int weight = 0;
// wave
@@ -197,6 +235,11 @@
continue;
}
if (1 < mapDataDispatcher.queryCodeListFromDynamicNode(lev, otherWave).size()) {
+
+ if (null != availablePointOfTurn && actuallyLanesOfTurn > 0) {
+ actuallyLanesOfTurn --;
+ }
+
continue label;
} else {
weight += WEIGHT_CALC_COEFFICIENT;
@@ -204,34 +247,8 @@
}
}
- // lane
- Lane lane = laneService.search(node.getCodeData());
- if (null != lane) {
- Set<String> lanVehicleSet = new HashSet<>();
-
- List<String> laneCodes = lane.getCodes();
- for (String laneCodeData : laneCodes) {
- int[] laneCodeMatrixIdx = mapDataDispatcher.getCodeMatrixIdx(null, laneCodeData);
- // scan dynamicMatrix or WaveMatrix
- DynamicNode laneDynamicNode = dynamicMatrix[laneCodeMatrixIdx[0]][laneCodeMatrixIdx[1]];
- String laneVehicle = laneDynamicNode.getVehicle();
- assert !laneVehicle.equals(DynamicNodeType.BLOCK.val);
- if (!laneVehicle.equals(DynamicNodeType.ACCESS.val)) {
- if (!laneVehicle.equals(agvNo)) {
- lanVehicleSet.add(laneVehicle);
-// redis.setObject(RedisConstant.AGV_TO_STANDBY_FLAG, laneVehicle, true, 30);
- }
- }
- }
-
- if (lanVehicleSet.size() + 1 > maxAgvCountInLane) {
- continue;
- }
- }
-
- // have cross turn road
- if (null != firstPointOfTurn) {
- if (!firstPointWaveScopeOfTurn.contains(node.getCodeData())) {
+ if (null != availablePointOfTurn) {
+ if (!availablePointWaveScopeOfTurn.contains(node.getCodeData())) {
enableNodes.add(node);
}
}
@@ -243,10 +260,14 @@
existNodes.add(node);
}
+
if (!Cools.isEmpty(enableNodes)) {
- Collections.sort(enableNodes);
- finialNode = enableNodes.stream().findFirst().orElse(null);
- jam.setCycleAvo(1);
+
+ if (actuallyLanesOfTurn >= 2) {
+ Collections.sort(enableNodes);
+ finialNode = enableNodes.stream().findFirst().orElse(null);
+ jam.setCycleAvo(1);
+ }
}
}
@@ -254,18 +275,6 @@
}
return finialNode;
- }
-
- private int calcNodeWeightVal(List<String> otherWaveList) {
- int weightVal = 0;
-
- if (!Cools.isEmpty(otherWaveList)) {
-
-
- }
-
-
- return weightVal;
}
// 鑾峰彇鍥涘懆鑺傜偣
--
Gitblit v1.9.1