From 09cb60c8bcbb4f7371e8b692da9af00c5d4fc538 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 01 八月 2023 15:22:55 +0800
Subject: [PATCH] 小车行走路径锁定方案,走一步锁两步,走完即解锁

---
 src/main/java/com/zy/common/utils/NyHttpUtils.java |   37 ++++++++++++++++++++++++++-----------
 1 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/src/main/java/com/zy/common/utils/NyHttpUtils.java b/src/main/java/com/zy/common/utils/NyHttpUtils.java
index 9176d0c..4228f55 100644
--- a/src/main/java/com/zy/common/utils/NyHttpUtils.java
+++ b/src/main/java/com/zy/common/utils/NyHttpUtils.java
@@ -4,6 +4,8 @@
 import com.alibaba.fastjson.JSONObject;
 import com.zy.common.model.NavigateNode;
 import com.zy.core.model.command.NyShuttleHttpCommand;
+import com.zy.core.model.protocol.NyShuttleProtocol;
+
 import java.util.*;
 
 /**
@@ -52,8 +54,8 @@
         HashMap<String, Object> body = new HashMap<>();
         body.put("requestType", "move");//绉诲姩鍛戒护
         body.put("taskId", wrkNo);//浠诲姟鍙�
-        body.put("start", start);//璧风偣
-        body.put("target", target);//缁堢偣
+        body.put("start", navigateNodeToNyPointNode(start));//璧风偣
+        body.put("target", navigateNodeToNyPointNode(target));//缁堢偣
         request.setBody(body);
 
         httpStandard.setRequest(request);
@@ -68,8 +70,8 @@
         HashMap<String, Object> body = new HashMap<>();
         body.put("requestType", in ? "intoLift" : "outLift");//杩涘嚭鎻愬崌鏈�
         body.put("taskId", wrkNo);//浠诲姟鍙�
-        body.put("start", start);//璧风偣
-        body.put("target", target);//缁堢偣
+        body.put("start", navigateNodeToNyPointNode(start));//璧风偣
+        body.put("target", navigateNodeToNyPointNode(target));//缁堢偣
         request.setBody(body);
 
         httpStandard.setRequest(request);
@@ -273,22 +275,35 @@
         try {
             String response = new HttpHandler.Builder()
                     .setUri(requestUrl)
-                    .setPath("/test")
+                    .setPath("/static/readStatus.json")
                     .setJson(JSON.toJSONString(httpCommand))
                     .build()
-                    .doPost();
+                    .doGet();
             JSONObject jsonObject = JSON.parseObject(response);
-            JSONObject request = jsonObject.getJSONObject("request");
-            JSONObject body = request.getJSONObject("body");
-            if (body.get("result").equals("success")) {
+            JSONObject response2 = jsonObject.getJSONObject("response");
+            JSONObject body = response2.getJSONObject("body");
+
+            if (body.get("responseType").equals("state")) {//璇诲彇鐘舵�侊紝涓嶉渶瑕佸垽鏂璼uccess
                 return body;
             }
 
+            if (body.get("result").equals("success")) {
+                return body;
+            }
         } catch (Exception e) {
-            e.printStackTrace();
+//            e.printStackTrace();
         }
-
         return null;
     }
 
+    //鍦板浘鑺傜偣杞崲鐗涚溂鑺傜偣
+    public static NyShuttleProtocol.NyShuttlePointClass navigateNodeToNyPointNode(NavigateNode node) {
+        int[] NyPosition = NavigatePositionConvert.WCSXyzToNyXyz(node.getX(), node.getY(), node.getZ());//WCS绯荤粺鍧愭爣杞墰鐪煎潗鏍�
+        NyShuttleProtocol.NyShuttlePointClass point = new NyShuttleProtocol.NyShuttlePointClass();
+        point.setX(NyPosition[0]);
+        point.setY(NyPosition[1]);
+        point.setZ(NyPosition[2]);
+        return point;
+    }
+
 }

--
Gitblit v1.9.1