| | |
| | | package com.zy.acs.manager.core.service; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.zy.acs.common.enums.AgvDirectionType; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.manager.common.utils.MapDataUtils; |
| | |
| | | |
| | | |
| | | // 角度计算 |
| | | public Double calculateDirection(Code startCode, Code endCode) { |
| | | public Double calculateDirection(Code startCode, Code endCode, int angleOffsetVal) { |
| | | Double x0 = startCode.getX(); |
| | | Double y0 = startCode.getY(); |
| | | |
| | |
| | | double deltaX = x1 - x0; |
| | | double deltaY = y1 - y0; |
| | | double angle = -Math.atan2(deltaX, deltaY); |
| | | int angleOffsetVal = configService.getVal("mapAngleOffsetVal", Integer.class); |
| | | angle = Math.toDegrees(angle) + angleOffsetVal; |
| | | angle = (angle + 360) % 360; // 将角度转换为正值 |
| | | |
| | |
| | | } |
| | | |
| | | // 坐标货架阈值 todo:luxiaotao |
| | | public AgvDirectionType calculateAgvWorkDirection(JSONObject storeDirection, Loc loc, Code code) { |
| | | storeDirection.getString("key"); |
| | | public AgvDirectionType calculateAgvWorkDirection(Loc loc, Code code) { |
| | | Integer compDirect = loc.getCompDirect(); |
| | | AgvDirectionType agvDirectionType = null; |
| | | if (compDirect == 0) { |
| | |
| | | return turnMatrixNode == TurnNodeType.TURN.val; |
| | | } |
| | | |
| | | /** |
| | | * That vehicle is walking if the dynamic node count > 1 |
| | | */ |
| | | @SuppressWarnings("all") |
| | | public boolean isWalkingByVehicle(Integer lev, String vehicle) { |
| | | if (Cools.isEmpty(vehicle)) { |
| | | return false; |
| | | } |
| | | |
| | | lev = Optional.ofNullable(lev).orElse(MapDataDispatcher.MAP_DEFAULT_LEV); |
| | | DynamicNode[][] dynamicMatrix = mapDataDispatcher.getDynamicMatrix(lev); |
| | | |
| | | int count = 0; |
| | | for (int i = 0; i < dynamicMatrix.length; i++) { |
| | | for (int j = 0; j < dynamicMatrix[i].length; j++) { |
| | | if (vehicle.equals(dynamicMatrix[i][j].getVehicle())) { |
| | | count++; |
| | | if (count > 1) { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | public List<String> queryCodeListFromDynamicNode(Integer lev, String nodeType) { |
| | | if (Cools.isEmpty(nodeType)) { |
| | | return new ArrayList<>(); |