From 1bdaf9be340892e1654caea9ed4082b6c61beb3b Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期一, 09 三月 2026 15:54:02 +0800
Subject: [PATCH] #
---
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AvoidWaveCalculator.java | 43 +++++++++++++++++++++++++------------------
1 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AvoidWaveCalculator.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AvoidWaveCalculator.java
index 8dc13fd..e0635cb 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AvoidWaveCalculator.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AvoidWaveCalculator.java
@@ -7,8 +7,8 @@
import com.zy.acs.manager.common.config.RedisProperties;
import com.zy.acs.manager.common.utils.MapDataUtils;
import com.zy.acs.manager.core.constant.MapDataConstant;
+import com.zy.acs.manager.core.domain.PathDto;
import com.zy.acs.manager.core.domain.VehicleFootprint;
-import com.zy.acs.manager.core.domain.VehicleRuntime;
import com.zy.acs.manager.core.service.astart.CodeNodeType;
import com.zy.acs.manager.core.service.astart.DynamicNodeType;
import com.zy.acs.manager.core.service.astart.MapDataDispatcher;
@@ -187,7 +187,8 @@
// 褰撳墠璋冨害杞﹀瀷鐨勬渶澶ф棆杞崐寰�
double bufferRadius = buildFootprint(agvModel).maxExtent();
- Map<String, VehicleRuntime> runtimeCache = new HashMap<>();
+ Map<String, VehicleFootprint> footprintCache = new HashMap<>();
+
for (int i = 0; i < dynamicMatrix.length; i++) {
for (int j = 0; j < dynamicMatrix[i].length; j++) {
DynamicNode dynamicNode = dynamicMatrix[i][j];
@@ -200,11 +201,20 @@
continue;
}
- // cache
- VehicleRuntime runtime = runtimeCache.computeIfAbsent(vehicle, this::loadRuntime);
- assert null != runtime; assert null != runtime.getFootprint();
+ VehicleFootprint footprint = footprintCache.computeIfAbsent(vehicle, this::loadFootprint);
- List<NavigateNode> includeList = mapService.getWaveScopeByCode(lev, codeData, runtime.getFootprint(), runtime.getHeadingRad(), bufferRadius);
+ List<NavigateNode> includeList;
+ Double nodeDirection = dynamicNode.getDirection();
+ if (dynamicNode.isTurn()) {
+ double radius = footprint.maxExtent() + bufferRadius;
+ includeList = mapService.getWaveScopeByCode(lev, codeData, radius);
+ } else if (nodeDirection != null) {
+ double headingRad = Math.toRadians(90 - nodeDirection);
+ includeList = mapService.getWaveScopeByCode(lev, codeData, footprint, headingRad, bufferRadius);
+ } else {
+ double radius = footprint.maxExtent() + bufferRadius;
+ includeList = mapService.getWaveScopeByCode(lev, codeData, radius);
+ }
for (NavigateNode navigateNode : includeList) {
String waveNode = waveMatrix[navigateNode.getX()][navigateNode.getY()];
@@ -217,20 +227,12 @@
return true;
}
- private VehicleRuntime loadRuntime(String agvNo) {
+ private VehicleFootprint loadFootprint(String agvNo) {
AgvModel model = agvModelService.getByAgvNo(agvNo);
if (model == null) {
- return null;
+ throw new CoolException(agvNo + " does not have an model.");
}
- VehicleFootprint footprint = this.buildFootprint(model);
-
- AgvDetail detail = agvDetailService.selectByAgvNo(agvNo);
- if (detail == null || null == detail.getAgvAngle()) {
- throw new CoolException(agvNo + " does not have an agv angle");
- }
- double headingDeg = detail.getAgvAngle();
-
- return new VehicleRuntime(footprint, Math.toRadians(90 - headingDeg));
+ return this.buildFootprint(model);
}
private double toMapLength(Integer mm) {
@@ -318,7 +320,12 @@
DynamicNode dynamicNode = dynamicMatrix[codeMatrixIdx[0]][codeMatrixIdx[1]];
String vehicle = dynamicNode.getVehicle();
if (vehicle.equals(DynamicNodeType.ACCESS.val)) {
- mapDataDispatcher.modifyDynamicMatrix(null, Utils.singletonList(codeMatrixIdx), agv.getUuid());
+ mapDataDispatcher.modifyDynamicMatrix(
+ null,
+ Utils.singletonList(codeMatrixIdx),
+ agv.getUuid(),
+ Utils.singletonList(new PathDto(code.getData(), MapService.mapToNearest(agvDetail.getAgvAngle())))
+ );
}
}
--
Gitblit v1.9.1