| | |
| | | /** |
| | | * 检测路径是否可用(可走) |
| | | */ |
| | | public static boolean checkPathIsAvailable(List<NavigateNode> path, Integer shuttleNo, Integer lev) { |
| | | public static boolean checkPathIsAvailable(List<NavigateNode> path, Integer shuttleNo, Integer lev, List<int[]> whitePoints) { |
| | | NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo); |
| | | if (shuttleThread == null) { |
| | | return false; |
| | |
| | | return false; |
| | | } |
| | | |
| | | if (shuttleProtocol.getPoint() == null) { |
| | | return false;//小车不存在节点 |
| | | } |
| | | |
| | | Integer mapType = NavigationMapType.DFX.id; |
| | | if (shuttleProtocol.getLiftPosition() == 1) { |
| | | //下降位置 |
| | | mapType = NavigationMapType.NORMAL.id; |
| | | } |
| | | |
| | | NavigateSolution solution = new NavigateSolution(mapType, lev, null, Utils.getShuttlePoints(shuttleNo, lev));//获取无白名单地图(该地图包含小车坐标) |
| | | NavigateSolution solution = new NavigateSolution(mapType, lev, whitePoints, Utils.getShuttlePoints(shuttleNo, lev));//获取无白名单地图(该地图包含小车坐标) |
| | | int[][] map = solution.map; |
| | | for (NavigateNode node : path) { |
| | | if (shuttleProtocol.getPoint().getX() == node.getX() && shuttleProtocol.getPoint().getY() == node.getY()) { |
| | | continue;//小车坐标和当前检测坐标相同,直接跳过,不检测小车所处当前坐标 |
| | | } |
| | | |
| | | int value = map[node.getX()][node.getY()]; |
| | | if (value != 0 && value != 3 && value != 5) {//母轨道3、子轨道0、充电桩5 |
| | | return false; |
| | |
| | | } |
| | | |
| | | WrkMastMapper wrkMastMapper = SpringUtils.getBean(WrkMastMapper.class); |
| | | WrkMast wrkMast = wrkMastMapper.selectByWorkNo(wrkNo.intValue()); |
| | | |
| | | Object o = redisUtil.get("shuttle_wrk_no_" + wrkNo); |
| | | if (o == null) { |
| | |
| | | } |
| | | |
| | | if (command.getRequest().getBody().get("requestType").equals("move")) { |
| | | ArrayList<int[]> whiteList = new ArrayList<>();//设置节点的白名单 |
| | | if (wrkMast != null && (wrkMast.getIoType() > 100 && wrkMast.getIoType() < 200)) { |
| | | //出库任务,不检测首节点 |
| | | int[] startArr = NavigatePositionConvert.positionToXY(wrkMast.getSourceLocNo());//开始节点 |
| | | whiteList.add(startArr); |
| | | } |
| | | |
| | | //检测路径是否可行走 |
| | | if (!checkPath(command.getNodes(), nextNodes, redisCommand)) { |
| | | if (!checkPath(command.getNodes(), nextNodes, whiteList)) { |
| | | return false; |
| | | } |
| | | |
| | |
| | | * 检测路径是否可行走 |
| | | * 如果路径为目标库位,但不可行走,系统将尝试重新计算路径 |
| | | */ |
| | | private boolean checkPath(List<NavigateNode> currentNodes, List<NavigateNode> nextNodes, ShuttleRedisCommand redisCommand) { |
| | | private boolean checkPath(List<NavigateNode> currentNodes, List<NavigateNode> nextNodes, List<int[]> whitePoints) { |
| | | //检测路径是否可行走(检查路径锁定状态,检测路径是否有其他小车) |
| | | //检测当前行走路径,和下一步路径 |
| | | boolean checkPathIsAvailable = NavigateUtils.checkPathIsAvailable(currentNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo())); |
| | | boolean checkPathIsAvailable = NavigateUtils.checkPathIsAvailable(currentNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo()), whitePoints); |
| | | if (nextNodes == null) { |
| | | if (checkPathIsAvailable) { |
| | | return true;//可行走 |
| | | } |
| | | return false; |
| | | }else { |
| | | boolean checkPathIsAvailable2 = NavigateUtils.checkPathIsAvailable(nextNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo())); |
| | | boolean checkPathIsAvailable2 = NavigateUtils.checkPathIsAvailable(nextNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo()), whitePoints); |
| | | if (checkPathIsAvailable && checkPathIsAvailable2) { |
| | | return true;//可行走 |
| | | } |