| | |
| | | ArrayList pathList = JSON.parseObject(data.toString(), ArrayList.class); |
| | | //取第一条路径 |
| | | Object o1 = pathList.get(commandStep); |
| | | ArrayList path = JSON.parseObject(o1.toString(), ArrayList.class); |
| | | ArrayList objectPath = JSON.parseObject(o1.toString(), ArrayList.class); |
| | | ArrayList<NavigateNode> path = new ArrayList<>(); |
| | | for (Object o2 : objectPath) { |
| | | NavigateNode navigateNode = JSON.parseObject(o2.toString(), NavigateNode.class); |
| | | path.add(navigateNode); |
| | | } |
| | | Integer allDistance = NavigateUtils.getCurrentPathAllDistance(path);//计算当前路径行走总距离 |
| | | |
| | | size = Integer.parseInt(map.get("pathSize").toString()); |
| | | //开始路径 |
| | | JSONObject startPath = JSON.parseObject(path.get(0).toString()); |
| | | NavigateNode startPath = path.get(0); |
| | | //目标路径 |
| | | JSONObject endPath = JSON.parseObject(path.get(path.size() - 1).toString()); |
| | | NavigateNode endPath = path.get(path.size() - 1); |
| | | |
| | | command.setCommandWord((short) 1); |
| | | command.setStartCodeNum(NavigatePositionConvert.xyToPosition(startPath.getIntValue("x"), startPath.getIntValue("y"))); |
| | | command.setStartCodeNum(NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY())); |
| | | command.setMiddleCodeNum((short) 0); |
| | | command.setDistCodeNum(NavigatePositionConvert.xyToPosition(endPath.getIntValue("x"), endPath.getIntValue("y"))); |
| | | command.setStartToDistDistance(1000); |
| | | command.setDistCodeNum(NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY())); |
| | | command.setStartToDistDistance(allDistance); |
| | | command.setMiddleToDistDistance(1000); |
| | | command.setRunDirection(ShuttleRunDirection.get(startPath.get("direction").toString()).id); |
| | | command.setRunDirection(ShuttleRunDirection.get(startPath.getDirection()).id); |
| | | command.setPalletLift((short) 1); |
| | | command.setForceMoveDistance(1000); |
| | | command.setChargeSwitch((short) 2); |
| | |
| | | |
| | | //对主线程抛出等待确认状态waiting |
| | | shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.WAITING); |
| | | //设置四向穿梭车为空闲状态 |
| | | shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE); |
| | | //任务号清零 |
| | | shuttleProtocol.setTaskNo((short) 0); |
| | | |
| | | News.info("四向穿梭车任务执行完成等待确认中,穿梭车号={},任务数据={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command)); |
| | | } |