From 0d430c08f37bc6c9cadfc368cada9680228eb49d Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期四, 29 一月 2026 09:05:14 +0800
Subject: [PATCH] 小车方向
---
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java | 30 ++++++++++++++++++------------
1 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
index 2c07e57..85176d3 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -765,14 +765,13 @@
boolean first = true;
for (Segment segment : segmentList) {
-
// 鍒嗘鎵�灞炵殑Task
Task task = taskService.getById(segment.getTaskId());
TaskPosDto.PosType posType = Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType()));
// 鐩爣鏄惁涓虹珯鐐�
- boolean isStation = posType == TaskPosDto.PosType.ORI_STA || posType == TaskPosDto.PosType.DEST_STA;
+ boolean isStation = posType == TaskPosDto.PosType.ORI_STA || posType == TaskPosDto.PosType.DEST_STA || posType == TaskPosDto.PosType.MOVE;
// 鐩爣鏄惁涓哄簱浣�
- boolean isLoc = posType == TaskPosDto.PosType.ORI_LOC || posType == TaskPosDto.PosType.DEST_LOC;
+ boolean isLoc = posType == TaskPosDto.PosType.ORI_LOC || posType == TaskPosDto.PosType.DEST_LOC || posType == TaskPosDto.PosType.MOVE ;
// 绔欑偣鍦扮爜
List<String> turnCodes = Arrays.asList("00000050", "00000051", "00000052", "00000053", "00000054");
// 搴撲綅鍦扮爜
@@ -785,21 +784,17 @@
// 璧拌璺緞鑺傜偣
// List<String> pathList = mapService.checkoutPath(agv.getUuid(), lastCode, code);
List<String> pathListPart = pathList.subList(pathList.indexOf(lastCode.getData()), pathList.indexOf(code.getData()) + 1);
-
for (int i = 0; i < pathListPart.size(); i++) {
if (i == 0) {
continue;
}
-
String next = pathListPart.get(i);
-
Code nextCode = codeService.getCacheByData(next);
Double nextDirection = mapService.calculateDirection(lastCode, nextCode, angleOffsetVal);
-
// 绗竴姝ワ細濡傛灉涓嬩竴涓柟鍚戞濂芥槸浣滀笟鏂瑰悜鐨勭浉鍙嶆柟鍚戯紝鍒欓噸缃笅涓�涓柟鍚戜负浣滀笟鏂瑰悜锛屾爣璁� reverse = true
boolean reverse = false;
if (nextDirection.equals((workDirection + 180) % 360)) {
- if ((isStation && turnCodes.contains(lastCode.getData())) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
+ if ((isStation && turnCodes.contains(lastCode.getData())) || (isLoc && locTurnCodes.contains(nextCode.getData()) && locTurnCodes.contains(lastCode.getData()))) {
reverse = false;
lastDirection = nextDirection;
} else {
@@ -852,7 +847,7 @@
180);
} else {
Double turnDirection = nextDirection;
- if (turnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000050")) {
+ if (turnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000050") || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
turnDirection = 180.0;
reverse = false;
}
@@ -882,7 +877,6 @@
lastDirection = nextDirection;
}
} else {
- // if (isStation && lastCode.getData().equals("00000050")) {
if ((isStation && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
// turn
reverse = false;
@@ -895,7 +889,7 @@
ActionTypeType.TurnCorner.desc, // 鍚嶇О
mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D, // 灞炴�у��
lastCode.getData(), // 鍦伴潰鐮�
- String.valueOf(180), // 鍔ㄤ綔鍙傛暟
+ String.valueOf(nextCode.getData().equals("00000051") ? 0 : 180 ), // 鍔ㄤ綔鍙傛暟
ActionTypeType.TurnCorner.val(), // 鍔ㄤ綔绫诲瀷
actionPrepareSts, // 鍔ㄤ綔杩涘害
agvId, // AGV
@@ -940,6 +934,19 @@
lastDirection = nextDirection;
}
+ // 濡傛灉褰撳墠鍦扮爜鍜屼笅涓�涓湴鐮侀兘鍦ㄧ珯鐐瑰湴鐮侀泦鍚堝唴锛屽垯鏍规嵁鍦ㄩ泦鍚堜腑鐨勯『搴忓喅瀹氳杩涙柟鍚戝拰鏄惁鍊掗��
+ if (turnCodes.contains(lastCode.getData()) && turnCodes.contains(nextCode.getData())) {
+ int lastIndex = turnCodes.indexOf(lastCode.getData());
+ int nextIndex = turnCodes.indexOf(nextCode.getData());
+ if (nextIndex > lastIndex) {
+ nextDirection = 180D;
+ reverse = false;
+ } else if (nextIndex < lastIndex) {
+ nextDirection = 0D;
+ reverse = true;
+ }
+ }
+
// run
ActionTypeType actionType = ActionTypeType.StraightAheadTurnable;
if (reverse) {
@@ -980,7 +987,6 @@
} else {
nextCode = codeService.getCacheByData(lastCode.getData());
}
-
if ((isStation && turnCodes.contains(lastCode.getData())) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
turnDirection = workDirection + 180.0;
}
--
Gitblit v1.9.1