Browse Source

FM600

jx-test
修宁 5 months ago
parent
commit
ddc777795a
  1. 7
      servo/src/main/java/com/galaxis/rcs/plan/path/PathUtils.java
  2. 12
      servo/src/main/java/com/galaxis/rcs/plan/path/PtrPathPlanner.java

7
servo/src/main/java/com/galaxis/rcs/plan/path/PathUtils.java

@ -1,6 +1,7 @@
package com.galaxis.rcs.plan.path; package com.galaxis.rcs.plan.path;
import com.galaxis.rcs.common.enums.LCCDirection; import com.galaxis.rcs.common.enums.LCCDirection;
import com.galaxis.rcs.plan.PlanTaskSequence;
import java.util.*; import java.util.*;
@ -150,8 +151,12 @@ public class PathUtils {
/** /**
* 转换货位方向到AGV所需方向 * 转换货位方向到AGV所需方向
*/ */
public static LCCDirection convertStoreDirection(LCCDirection storeDirection) { public static LCCDirection convertStoreDirection(PlanTaskSequence plan, LCCDirection storeDirection) {
// 转换规则: 货位在路径点的方位 -> AGV所需方向 // 转换规则: 货位在路径点的方位 -> AGV所需方向
if (plan.getAgv().t.toLowerCase().startsWith("fm") || plan.getAgv().t.toLowerCase().startsWith("fit")) {
// if qianfu AGV
return storeDirection;
}
return switch (storeDirection) { return switch (storeDirection) {
case UP -> LCCDirection.RIGHT; // 货位在上方 → 车头向右 case UP -> LCCDirection.RIGHT; // 货位在上方 → 车头向右
case DOWN -> LCCDirection.LEFT; // 货位在下方 → 车头向左 case DOWN -> LCCDirection.LEFT; // 货位在下方 → 车头向左

12
servo/src/main/java/com/galaxis/rcs/plan/path/PtrPathPlanner.java

@ -77,7 +77,7 @@ public class PtrPathPlanner {
// 取货点 // 取货点
String loadRackId = task.from().rackId(); String loadRackId = task.from().rackId();
int pickupBay = task.from().bay(); int pickupBay = task.from().bay();
List<NodeDirection> loadNodeDirectionList = findNodeForStore(loadRackId, pickupBay); List<NodeDirection> loadNodeDirectionList = findNodeForStore(plan, loadRackId, pickupBay);
if (loadNodeDirectionList.isEmpty()) { if (loadNodeDirectionList.isEmpty()) {
throw new RuntimeException("Pickup node not found for rackId=" + loadRackId + ", bay=" + pickupBay); throw new RuntimeException("Pickup node not found for rackId=" + loadRackId + ", bay=" + pickupBay);
} }
@ -85,7 +85,7 @@ public class PtrPathPlanner {
// 放货点 // 放货点
String unloadRackId = task.to().rackId(); String unloadRackId = task.to().rackId();
int unloadBay = task.to().bay(); int unloadBay = task.to().bay();
List<NodeDirection> unloadNodeDirectionList = findNodeForStore(unloadRackId, unloadBay); List<NodeDirection> unloadNodeDirectionList = findNodeForStore(plan, unloadRackId, unloadBay);
if (unloadNodeDirectionList.isEmpty()) { if (unloadNodeDirectionList.isEmpty()) {
throw new RuntimeException("Drop node not found for rackId=" + unloadRackId + ", bay=" + unloadBay); throw new RuntimeException("Drop node not found for rackId=" + unloadRackId + ", bay=" + unloadBay);
} }
@ -143,7 +143,7 @@ public class PtrPathPlanner {
// 放货点 // 放货点
String unloadRackId = task.to().rackId(); String unloadRackId = task.to().rackId();
int unloadBay = task.to().bay(); int unloadBay = task.to().bay();
var unloadNodeDirectionList = findNodeForStore(unloadRackId, unloadBay); var unloadNodeDirectionList = findNodeForStore(plan, unloadRackId, unloadBay);
if (unloadNodeDirectionList.isEmpty()) { if (unloadNodeDirectionList.isEmpty()) {
throw new RuntimeException("Drop node not found for rackId=" + unloadRackId + ", bay=" + unloadBay); throw new RuntimeException("Drop node not found for rackId=" + unloadRackId + ", bay=" + unloadBay);
} }
@ -190,7 +190,7 @@ public class PtrPathPlanner {
// 放货点 // 放货点
String loadRackId = task.to().rackId(); String loadRackId = task.to().rackId();
int unloadBay = task.to().bay(); int unloadBay = task.to().bay();
var loadNodeDirectionList = findNodeForStore(loadRackId, unloadBay); var loadNodeDirectionList = findNodeForStore(plan, loadRackId, unloadBay);
if (loadNodeDirectionList.isEmpty()) { if (loadNodeDirectionList.isEmpty()) {
throw new RuntimeException("Drop node not found for rackId=" + loadRackId + ", bay=" + unloadBay); throw new RuntimeException("Drop node not found for rackId=" + loadRackId + ", bay=" + unloadBay);
} }
@ -230,13 +230,13 @@ public class PtrPathPlanner {
plan.addFinish(); plan.addFinish();
} }
private List<NodeDirection> findNodeForStore(String storeId, int bay) { private List<NodeDirection> findNodeForStore(PlanTaskSequence plan, String storeId, int bay) {
List<Node> nodes = this.graph.getNodesForStore(storeId); List<Node> nodes = this.graph.getNodesForStore(storeId);
List<NodeDirection> results = Lists.newArrayList(); List<NodeDirection> results = Lists.newArrayList();
for (Node node : nodes) { for (Node node : nodes) {
for (StoreLink link : node.storeLinks()) { for (StoreLink link : node.storeLinks()) {
if (link.storeId().equals(storeId) && link.bay() == bay) { if (link.storeId().equals(storeId) && link.bay() == bay) {
LCCDirection agvDirection = convertStoreDirection(link.direction()); LCCDirection agvDirection = convertStoreDirection(plan, link.direction());
results.add(new NodeDirection(node, agvDirection)); results.add(new NodeDirection(node, agvDirection));
} }
} }

Loading…
Cancel
Save