| | |
| | | List<RetreatNavigateNode> enableNodes = new ArrayList<>(); |
| | | |
| | | ArrayList<RetreatNavigateNode> neighborNodes = this.getNeighborNodes(currentNode, existNodes); |
| | | boolean pointOfTurn = false; |
| | | if (neighborNodes.size() >= 2 && !isSame(start, currentNode)) { |
| | | pointOfTurn = true; |
| | | } |
| | | |
| | | // 计算是否为可用转弯点 |
| | | if (pointOfTurn) { |
| | | for (RetreatNavigateNode node : neighborNodes) { |
| | | // lane |
| | | Lane lane = laneService.search(node.getCodeData()); |
| | | if (null != lane) { |
| | | Set<String> lanVehicleSet = new HashSet<>(); |
| | | // 第一步:获取有效转弯点 |
| | | if (null == availablePointOfTurn) { |
| | | // 计算是否为可用转弯点 |
| | | if (neighborNodes.size() >= 2 && !isSame(start, currentNode)) { |
| | | 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); |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | if (lanVehicleSet.size() + 1 > maxAgvCountInLane) { |
| | | continue; |
| | | } |
| | | actuallyLanesOfTurn ++; |
| | | } |
| | | |
| | | actuallyLanesOfTurn ++; |
| | | // 有两条以上可走巷道,则视为有效转弯点 |
| | | if (actuallyLanesOfTurn >= 2) { |
| | | availablePointOfTurn = currentNode; |
| | | availablePointWaveScopeOfTurn = mapService.getWaveScopeByCode(lev, availablePointOfTurn.getCodeData(), avoidDistance) |
| | | .stream().map(NavigateNode::getCodeData).distinct().collect(Collectors.toList()); |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | |
| | |
| | | existNodes.add(node); |
| | | } |
| | | |
| | | |
| | | if (!Cools.isEmpty(enableNodes)) { |
| | | |
| | | if (actuallyLanesOfTurn >= 2) { |
| | | if (actuallyLanesOfTurn < 2) { |
| | | availablePointOfTurn = null; |
| | | availablePointWaveScopeOfTurn = new ArrayList<>(); |
| | | actuallyLanesOfTurn = 0; |
| | | } else { |
| | | if (!Cools.isEmpty(enableNodes)) { |
| | | Collections.sort(enableNodes); |
| | | finialNode = enableNodes.stream().findFirst().orElse(null); |
| | | jam.setCycleAvo(1); |