Browse Source

PathNotFoundException

master
修宁 6 months ago
parent
commit
3d7175dde1
  1. 5
      servo/src/main/java/com/galaxis/rcs/plan/path/AStarPathPlanner.java
  2. 10
      servo/src/main/java/com/galaxis/rcs/plan/path/PathNotFoundException.java
  3. 15
      servo/src/main/java/com/yvan/logisticsModel/LogisticsRuntime.java
  4. 7
      servo/src/main/java/com/yvan/workbench/controller/RcsController.java

5
servo/src/main/java/com/galaxis/rcs/plan/path/AStarPathPlanner.java

@ -130,7 +130,10 @@ public class AStarPathPlanner {
// } // }
} }
} }
return Collections.emptyList();
// 如果找不到路径,抛出异常
throw new PathNotFoundException(startId, endId, startDirection, endDirection);
// return Collections.emptyList();
} }
/** /**

10
servo/src/main/java/com/galaxis/rcs/plan/path/PathNotFoundException.java

@ -0,0 +1,10 @@
package com.galaxis.rcs.plan.path;
import com.galaxis.rcs.common.enums.LCCDirection;
public class PathNotFoundException extends RuntimeException {
public PathNotFoundException(String startId, String endId, LCCDirection startDir, LCCDirection endDir) {
super(String.format("Path not found from %s(%s) to %s(%s)",
startId, startDir, endId, endDir));
}
}

15
servo/src/main/java/com/yvan/logisticsModel/LogisticsRuntime.java

@ -132,13 +132,14 @@ public class LogisticsRuntime {
* 获取当前空闲的执行器列表 * 获取当前空闲的执行器列表
*/ */
public List<ExecutorItem> getFreeExecutorList() { public List<ExecutorItem> getFreeExecutorList() {
List<ExecutorItem> freeExecutorList = Lists.newArrayList(); return Lists.newArrayList();
for (ExecutorItem executorItem : executorItemMap.values()) { // List<ExecutorItem> freeExecutorList = Lists.newArrayList();
if (executorItem.isFree()) { // for (ExecutorItem executorItem : executorItemMap.values()) {
freeExecutorList.add(executorItem); // if (executorItem.isFree()) {
} // freeExecutorList.add(executorItem);
} // }
return freeExecutorList; // }
// return freeExecutorList;
} }

7
servo/src/main/java/com/yvan/workbench/controller/RcsController.java

@ -294,6 +294,9 @@ public class RcsController {
} }
LogisticsRuntime runtime = LogisticsRuntimeService.INSTANCE.getByProjectEnv(projectUUID, envId); LogisticsRuntime runtime = LogisticsRuntimeService.INSTANCE.getByProjectEnv(projectUUID, envId);
if (runtime == null) {
return R.fail("Project not running: " + projectUUID + ", envId=" + envId);
}
ExecutorItem executorItem = runtime.executorItemMap.get(agvId); ExecutorItem executorItem = runtime.executorItemMap.get(agvId);
if (executorItem == null) { if (executorItem == null) {
@ -311,6 +314,10 @@ public class RcsController {
fromItem = runtime.getStaticItemById(Conv.asString(option.get("forceStartWayPointId"))); fromItem = runtime.getStaticItemById(Conv.asString(option.get("forceStartWayPointId")));
} else { } else {
fromItem = runtime.getStaticItemByLogicXY(agv.logicX, agv.logicY); fromItem = runtime.getStaticItemByLogicXY(agv.logicX, agv.logicY);
if (agv.logicX == 0 && agv.logicY == 0) {
// 如果AGV的逻辑坐标为(0, 0),则尝试从AGV的当前位置获取静态项
return R.fail("AGV position init failed");
}
} }
if (option.get("forceStartDirection") != null) { if (option.get("forceStartDirection") != null) {
fromDirection = LCCDirection.fromString(Conv.asString(option.get("forceStartDirection"))); fromDirection = LCCDirection.fromString(Conv.asString(option.get("forceStartDirection")));

Loading…
Cancel
Save