Browse Source

5秒更新一次

Rmengdi 2 months ago
parent
commit
a4b8edeef6
1 changed files with 11 additions and 3 deletions
  1. 11 3
      uavps-web/src/views/uavps/parameter/index.vue

+ 11 - 3
uavps-web/src/views/uavps/parameter/index.vue

@@ -490,6 +490,9 @@ export default {
         x: null,
         x: null,
         y: null,
         y: null,
       },
       },
+      // 多久更新一次轨迹
+      updatePathFlag: 125,
+      cycleCount: 0, // 循环计数
     };
     };
   },
   },
   created() {
   created() {
@@ -706,6 +709,9 @@ export default {
           dude.y = data.targetAircraft[0].aircrafts[i].coordinateY;
           dude.y = data.targetAircraft[0].aircrafts[i].coordinateY;
           dude.rotation = Math.atan2(dude.y, dude.x) + Math.PI / 2;
           dude.rotation = Math.atan2(dude.y, dude.x) + Math.PI / 2;
 
 
+          // const rotation = Math.atan2(eastSpeed, northSpeed);
+          // dude.rotation = (-rotation + 2 * Math.PI) % (2 * Math.PI);
+
           dude.id = data.targetAircraft[0].aircrafts[i].aircraftNumber; // 分配唯一编号
           dude.id = data.targetAircraft[0].aircrafts[i].aircraftNumber; // 分配唯一编号
 
 
           this.targetUavAry.push(dude);
           this.targetUavAry.push(dude);
@@ -823,9 +829,11 @@ export default {
           }
           }
         }
         }
       }
       }
-      // 更新路径绘制
-      this.updatePath();
-
+      if (this.cycleCount % this.updatePathFlag == 0) {
+        // 更新路径绘制
+        this.updatePath();
+      }
+      this.cycleCount++;
       // 更新位置
       // 更新位置
       //this.updatePosition();
       //this.updatePosition();
     },
     },