| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据分片生成动作 ( 车辆可能已经做过一些任务了,正在等待下一段任务 ) |
| | | */ |
| | |
| | | throw new CoolException("AGV[" + agvNo + "]定位偏移..."); |
| | | } |
| | | |
| | | String lastCorner = null; |
| | | //String lastCorner = null; |
| | | Integer index = -1; |
| | | for (int i = pathList.size(); i <0; i++) { |
| | | Code nextCode = codeService.getCacheByData(pathList.get(i - 1)); |
| | | if (i == 0) { |
| | | continue; |
| | | } |
| | | Code nextCode = codeService.getCacheByData(pathList.get(i)); |
| | | if (nextCode!=null&&nextCode.getCornerBool()){ |
| | | lastCorner =pathList.get(i - 1); |
| | | //lastCorner = pathList.get(i); |
| | | index = i; |
| | | } |
| | | } |
| | | |
| | |
| | | if (i == 0) { |
| | | continue; |
| | | } |
| | | |
| | | String next = pathListPart.get(i); |
| | | |
| | | Code nextCode = codeService.getCacheByData(next); |
| | | Double nextDirection = mapService.calculateDirection(lastCode, nextCode, angleOffsetVal); |
| | | Double nextDirection; |
| | | |
| | | boolean reverse = false; |
| | | if (lastCorner.equals(lastCode)){ |
| | | // DOTO |
| | | if (index >= i) { |
| | | // DOTO 添加转弯 |
| | | Code endCode = codeService.getCacheByData(pathList.get(pathList.size() - 1)); |
| | | nextDirection = mapService.calculateDirection(lastCode, endCode, angleOffsetVal); |
| | | if (nextDirection.equals((workDirection + 180) % 360)) { |
| | | nextDirection = workDirection; |
| | | reverse = true; |
| | | } |
| | | |
| | | }else { |
| | | nextDirection = mapService.calculateDirection(lastCode, nextCode, angleOffsetVal); |
| | | |
| | | // 第一步:如果下一个方向正好是作业方向的相反方向,则重置下一个方向为作业方向,标记 reverse = true |
| | | if (nextDirection.equals((workDirection + 180) % 360)) { |
| | | nextDirection = workDirection; |
| | |
| | | |
| | | log.info("{}号Agv动作组装完成,指令数量:{}", agvNo, newActionList.size()); |
| | | } catch (Exception e) { |
| | | log.error("mainService.generateAction", e); |
| | | log.error("mainService.generateActionV2", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | |
| | | if (!Cools.isEmpty(pathList)) { |
| | |
| | | mapDataDispatcher.clearDynamicMatrixByCodeList(null, codeMatrixIdxList); |
| | | } |
| | | |
| | | throw new RuntimeException("generateAction method caught an exception, rolling back transaction.", e); |
| | | throw new RuntimeException("generateActionV2 method caught an exception, rolling back transaction.", e); |
| | | } |
| | | } |
| | | |