Bladeren bron

更新棋盘

xiewenjie 3 jaren geleden
bovenliggende
commit
f18eea5b19

+ 7 - 7
src/main/java/com/fdkk/fdkkmeta/ctroller/DevController.java

@@ -67,9 +67,9 @@ public class DevController   {
                 BreakpointsEntity breakpointsEntity=new BreakpointsEntity();
                 breakpointsEntity.setAppId("0000000001");
                 PointPO po=new PointPO();
-                po.setX(a.getJSONObject("position").getDoubleValue("x"));
-                po.setY(a.getJSONObject("position").getDoubleValue("y"));
-                po.setZ(a.getJSONObject("position").getDoubleValue("z"));
+                po.setX(a.getJSONObject("position").getDoubleValue("x")*100);
+                po.setY(a.getJSONObject("position").getDoubleValue("y")*100);
+                po.setZ(a.getJSONObject("position").getDoubleValue("z")*100);
                 breakpointsEntity.setPosition(po);
                 breakpointsEntity.setBreakPointId(a.getLong("id"));
 
@@ -79,7 +79,7 @@ public class DevController   {
                 breakpointsService.save(breakpointsEntity);
             }
         }
-
+//        //break*100
 //        File[] ls = FileUtil.ls(path);
 //        for (File l : ls) {
 //            List<File> files = FileUtil.loopFiles(l);
@@ -107,7 +107,7 @@ public class DevController   {
 //                        po.setY(a.getJSONObject("position").getDoubleValue("y"));
 //                        po.setZ(a.getJSONObject("position").getDoubleValue("z"));
 //                        rotateFrameEntity.setCameraPosition(po);
-//                        rotateFrameEntity.setBreakPointId(l.getName());
+//                        rotateFrameEntity.setBreakPointId(Long.parseLong(l.getName()));
 //                        rotateFrameEntity.setAppId("0000000001");
 //                        rotateFrameEntityList.add(rotateFrameEntity);
 //                        }
@@ -136,8 +136,8 @@ public class DevController   {
 //                        moveFrameEntity.setCameraPosition(po);
 //                        String name = file.getName().replace(".json", "");
 //                        String[] s1 = name.split("_");
-//                        moveFrameEntity.setStartBreakPointId(Integer.parseInt(s1[0]));
-//                        moveFrameEntity.setEndBreakPointId(Integer.parseInt(s1[1]));
+//                        moveFrameEntity.setStartBreakPointId(Long.parseLong(s1[0]));
+//                        moveFrameEntity.setEndBreakPointId(Long.parseLong(s1[1]));
 //                        moveFrameEntity.setAngle(Integer.parseInt(s1[2]));
 //                        moveFrameEntity.setFrameIndex(a.getInteger("frame"));
 //                        moveFrameEntity.setDirectory(file.getName().replace(".json",""));

+ 3 - 3
src/main/java/com/fdkk/fdkkmeta/grpcService/sceneGrpcServer.java

@@ -266,7 +266,7 @@ public class sceneGrpcServer extends SceneGrpcServiceGrpc.SceneGrpcServiceImplBa
             PointPO e=new PointPO();
             e.setX(Double.parseDouble(end.getX()));
             e.setY(Double.parseDouble(end.getY()));
-            e.setZ(Double.parseDouble(end.getY()));
+            e.setZ(Double.parseDouble(end.getZ()));
             po.setE_location(e);
             po.setS_location(s);
             po.setSceneCode(appId);
@@ -379,8 +379,8 @@ public class sceneGrpcServer extends SceneGrpcServiceGrpc.SceneGrpcServiceImplBa
 			//builder.addTraceIds()
 			//.setVehicle(null)
 			builder.setVehicle("");
-			builder.setNewUserStates(0, userState);
-			builder.setActionResponses(0, 0);             //这个要查查
+			builder.addNewUserStates( userState);
+			builder.addActionResponses(0);             //这个要查查
 			builder.setGetStateType(0);
 			builder.setCode(0);
 			builder.setMsg("OK");

+ 3 - 3
src/main/java/com/fdkk/fdkkmeta/test/test.java

@@ -143,9 +143,9 @@ public class test {
             po.setId(i );
             if (s.length == 12) {
                 double[] oldPoint = {Double.valueOf(s[0]), Double.valueOf(s[1]), Double.valueOf(s[2])};
-                po.setX(oldPoint[0]);
-                po.setY(oldPoint[1]);
-                po.setZ(oldPoint[2]);
+                po.setX(oldPoint[0]*100);
+                po.setY(oldPoint[1]*100);
+                po.setZ(oldPoint[2]*100);
                 po.setWeight(Double.parseDouble(s[3]));
                 List<String> strings = Arrays.asList(s[4], s[5], s[6], s[7], s[8], s[9], s[10], s[11]);
                 List<Integer> contact = strings.stream().map(a->{

+ 11 - 0
src/main/java/com/fdkk/fdkkmeta/util/kesar/GetRoute.java

@@ -2,6 +2,7 @@ package com.fdkk.fdkkmeta.util.kesar;
 
 import cn.hutool.core.io.LineHandler;
 import cn.hutool.core.io.file.FileReader;
+import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -98,6 +99,7 @@ public class GetRoute {
                 startDistance[0] = _startDistance;
             }
             Double _endDistance = GetRoute.g_AStar.calcH(_end, coord);
+            log.info("_endDistance{}",_endDistance);
             if (_endDistance <= endDistance[0]) {
                 GetRoute.minEndId = po;
                 endDistance[0] = _endDistance;
@@ -108,6 +110,15 @@ public class GetRoute {
         GetRoute.log.info("棋盘获取路线点-开始点{},{}", _start.x, _start.y);
         GetRoute.log.info("棋盘获取路线点-结束点{},{}", _end.x, _end.y);
         //  开始结束点一样就直接返回
+        if (ObjectUtil.isNull(minStartId)){
+            GetRoute.log.info("找不到开始点");
+            return null;
+        }
+        if (ObjectUtil.isNull(minEndId)){
+            GetRoute.log.info("找不到结束点");
+            return null;
+        }
+
         if (minStartId.getId()==minEndId.getId()){
             GetRoute.log.info("超过1.1米就找不到路径startDistance {},endDistance{}", startDistance[0], endDistance[0]);
             GetRoute.log.info("开始最近距离{} ", startDistance[0]);