Forráskód Böngészése

实时位置改动

Jay 6 hónapja
szülő
commit
5222320607

+ 7 - 7
public/plugin/uwb/strategy-manager/y-up-r-strategy.js

@@ -35,13 +35,13 @@ export class YUpRStrategy extends Strategy {
    * @param {Object} localPosition - 本地位置
    */
   convertLocalToWorld(localPosition) {
-  var quaternion = new THREE.Quaternion(this.originPointPose.worldQuaternion.x,this.originPointPose.worldQuaternion.y,this.originPointPose.worldQuaternion.z,this.originPointPose.worldQuaternion.w);
-  var rotationMatrix = new THREE.Matrix4().makeRotationFromQuaternion(quaternion);
-  var translationMatrix = new THREE.Matrix4().makeTranslation(this.originPointPose.worldPosition.x,this.originPointPose.worldPosition.y,this.originPointPose.worldPosition.z);
-  var transformationMatrix = new THREE.Matrix4().multiplyMatrices(translationMatrix, rotationMatrix);
-// 用转换矩阵将本地坐标转为世界坐标
-  let worldPosition = localPosition.applyMatrix4(transformationMatrix);
-  console.log('======打印当前的worldPosition======',worldPosition);
+    var quaternion = new THREE.Quaternion(this.originPointPose.worldQuaternion.x, this.originPointPose.worldQuaternion.y, this.originPointPose.worldQuaternion.z, this.originPointPose.worldQuaternion.w);
+    var rotationMatrix = new THREE.Matrix4().makeRotationFromQuaternion(quaternion);
+    var translationMatrix = new THREE.Matrix4().makeTranslation(this.originPointPose.worldPosition.x, this.originPointPose.worldPosition.y, this.originPointPose.worldPosition.z);
+    var transformationMatrix = new THREE.Matrix4().multiplyMatrices(translationMatrix, rotationMatrix);
+    // 用转换矩阵将本地坐标转为世界坐标
+    let worldPosition = localPosition.applyMatrix4(transformationMatrix);
+    console.log('======打印当前的worldPosition======', worldPosition);
     return worldPosition
 
   }

+ 65 - 16
src/main.js

@@ -5,8 +5,14 @@ import modules from "./store/index";
 import VueSocketIO from "vue-socket.io";
 import Vuex from 'vuex'
 import vuescroll from 'vuescroll';
+import axios from "axios";
+import ElementUI from "element-ui";
+import "element-ui/lib/theme-chalk/index.css";
 
 
+Vue.use(ElementUI);
+Vue.prototype.$axios = axios;
+
 // 在这里设置全局配置
 Vue.use(vuescroll, {
   ops: {
@@ -29,14 +35,12 @@ Vue.use(vuescroll, {
 
 Vue.config.productionTip = false;
 
-var strUrl=window.location.href;
+var strUrl = window.location.href;
 var strIp = "";
-if(strUrl.indexOf("172.16.50.4")!=-1)
-{
+if (strUrl.indexOf("172.16.50.4") != -1) {
   strIp = "172.16.50.4:19703";
 }
-else
-{
+else {
   strIp = "47.102.97.214";
 }
 
@@ -44,7 +48,7 @@ Vue.use(
   new VueSocketIO({
     debug: true,
     connection: "ws://" + strIp,
-    //connection: "ws://121.42.8.157:19703",
+    // connection: "ws://121.42.8.157:19703",
     options: {
       transports: ["websocket", "polling"],
     },
@@ -67,8 +71,6 @@ window.vm = new Vue({
   created: function () {
     // console.log('created init home page')
     // init()
-    
-    
   },
   mounted: function () {
     console.log("mounted init home page");
@@ -93,8 +95,59 @@ window.vm = new Vue({
           console.log("receive [login] msg from server: " + data);
         });
         this.sockets.subscribe("CALL", (data) => {
-          // console.log('receive [CALL] msg from server: ' + data)
+          console.log('receive [CALL] msg from server: ' + data)
         });
+        // this.sockets.subscribe('PUSH', (data) => {
+        //   if (data.cmd === 'tof_data_oneAntenna') {
+        //     if (data.data.length !== 0) {
+        //       this.$store.commit('tof_data_oneAntenna', data.data)
+        //     }
+        //   }
+        //   // if (cmd === 'event') {
+        //   //   this.$store.commit('deviceStateData', datas)
+        //   // } else if (cmd === 'light_state') {
+        //   //   // this.$store.commit('lightStateData', datas)
+        //   // } else if (cmd === 'pos_map') {
+        //   //   // console.log('drawCard')
+        //   //   // this.$store.commit('devicePosData', datas)
+        //   //   this.$store.commit('drawCard', datas)
+        //   // } else if (data.cmd === 'load_history_completed') {
+        //   //   this.$store.commit('loadHistoryDone', data)
+        //   // } else if (data.cmd === 'tof_data') {
+        //   //   if (data.data.length !== 0) {
+        //   //     this.$store.commit('sxqMapSelect', data)
+        //   //     // this.$store.commit('logMsgm', data.data)
+        //   //     // console.log(data.data.toString())
+        //   //   }
+        //   // } else if (data.cmd === 'sb_raw_data') {
+        //   //   if (data.data.length !== 0) {
+        //   //     this.$store.commit('sxqSelect', data)
+        //   //     // this.$store.commit('logMsgm', data.data)
+        //   //     // console.log(data.data.toString())
+        //   //   }
+        //   // } else if (data.cmd === 'tdoa_2d_raw_data') {
+        //   //   if (data.data.length !== 0) {
+        //   //     this.$store.commit('tdoa_2d_raw_data', data)
+        //   //   }
+        //   // } else if (data.cmd === 'tof_data_oneAntenna') {
+        //   //   if (data.data.length !== 0) {
+        //   //     this.$store.commit('tof_data_oneAntenna', data)
+        //   //   }
+        //   // } else if (data.cmd === 'pdoa_3d_raw_data') {
+        //   //   if (data.data.length !== 0) {
+        //   //     this.$store.commit('tdoa3dSelect', data)
+        //   //   }
+        //   // }
+        // })
+        this.sockets.subscribe('FILE', (data) => {
+          if (data.cmd === 'upload_more') {
+            this.$store.commit('uploadChunk', data)
+          } else if (data.cmd === 'upload_done') {
+            this.$store.commit('uploadDone', data)
+          }
+        })
+
+
       }
     },
   },
@@ -133,12 +186,12 @@ window.vm = new Vue({
           console.log(JSON.stringify(data));
         }
       );
-      console.log(this);
+      // console.log(this);
       this.init();
     },
 
     device_state(data) {
-      console.log(data);
+      console.log("device_state", data);
     },
   },
   router,
@@ -149,8 +202,4 @@ window.vm = new Vue({
 
 // window.vm.initService();
 
-import ElementUI from "element-ui";
-import "element-ui/lib/theme-chalk/index.css";
-Vue.use(ElementUI);
-import axios from "axios";
-Vue.prototype.$axios = axios;
+

+ 31 - 16
src/store/modules/bench/actions.js

@@ -1,7 +1,9 @@
+// import { resolve } from "core-js/fn/promise";
 import * as benchApi from "../../../api/bench.js";
 
 export default {
   async fetchBenchList({ commit }, data) {
+    // return new Promise(async(resolve, reject) => {    })
     try {
       let benchList = []
       if (data) {
@@ -10,19 +12,32 @@ export default {
         benchList = await benchApi.fetchBenchList()
       }
       commit("setBenchList", benchList.data.data);
-      benchList.data.data.forEach(async b => {
-        const bench = await benchApi.getBenchDetail(b.id);
-        commit("setBenchDetail", bench.data.data)
-      })
+      // benchList.data.data.forEach(async b => {
+      //   const bench = await benchApi.getBenchDetail(b.id);
+      //   commit("setBenchDetail", bench.data.data)
+      //   console.log("台架数量刷新时间需晚于当前时间:", Date.now())
+      // })
+      // let pArr = [];
+      // benchList.data.data.forEach(b => {
+      //   let p = new Promise(async(resolve, reject) => {
+      //     const bench = await benchApi.getBenchDetail(b.id);
+      //     commit("setBenchDetail", bench.data.data)
+      //     console.log("台架数量刷新时间需晚于当前时间:", Date.now())
+      //     resolve()
+      //   })
+      //   pArr.push(p)
+      // })
+      // await Promise.all(pArr)
     } catch (err) {
       console.log("error", "服务异常", 1000);
     }
+
   },
-  async getMatchedBench({commit}, data) {
+  async getMatchedBench({ commit }, data) {
     let benchList = await benchApi.getMatchedBench(data);
     commit("setMatchedBenchList", benchList.data.result.matchSuccessAgent)
   },
-  async getBenchDetail({commit}, benchId) {
+  async getBenchDetail({ commit }, benchId) {
     try {
       const bench = await benchApi.getBenchDetail(benchId);
       commit("setBenchDetail", bench.data.data)
@@ -30,31 +45,31 @@ export default {
       console.log("error", "服务异常", 1000)
     }
   },
-  setBenchImgList({commit}, data) {
-    commit('setBenchImgList',data)
+  setBenchImgList({ commit }, data) {
+    commit('setBenchImgList', data)
   },
-  removeBenchImgList({commit}, data) {
-    commit('removeBenchImgList',data)
+  removeBenchImgList({ commit }, data) {
+    commit('removeBenchImgList', data)
   },
-  filterBenchList({commit}, data) {
+  filterBenchList({ commit }, data) {
     commit('filterBenchList', data)
   },
   setFilterBenchFlag({ commit }, flag) {
     commit('setFilterBenchFlag', flag)
   },
-  filterBenchListByName({commit}, value) {
+  filterBenchListByName({ commit }, value) {
     commit('setFilterBenchListByName', value)
   },
-  setMouseOverBench({commit}, data) {
+  setMouseOverBench({ commit }, data) {
     commit('setMouseOverBench', data)
   },
-  addRemoteBenchList({commit}, data) {
+  addRemoteBenchList({ commit }, data) {
     commit('addRemoteBenchList', data);
   },
-  popRemoteBenchList({commit}, data) {
+  popRemoteBenchList({ commit }, data) {
     commit('popRemoteBenchList')
   },
-  setCurrentBench({commit}, data) {
+  setCurrentBench({ commit }, data) {
     commit('setCurrentBench', data)
   }
 };

+ 4 - 0
src/store/modules/bench/index.js

@@ -5,6 +5,10 @@ export default {
   namespaced: true,
   state() {
     return {
+      // 真实数据
+      realTimeData: new Map(),
+      realTimePos: new Map(),
+      
       benchMap: {},
       benchList: [],
       filterBenchList: [],

+ 22 - 3
src/store/modules/bench/mutations.js

@@ -1,4 +1,26 @@
 export default {
+  tof_data_oneAntenna(state, realtimeData) {
+    /*
+    [card_id, x, y, 距离1, 基站1, ...]
+    ["0010000001222", -0.5170840944234106, -0.3224454833139634, 2.1333767, 30001, 5.302964940000001, 30002,…]
+    */
+    let data = realtimeData[0];
+    console.log(data)
+    if (data) {
+      let card_id = data[0];
+      let x = data[1];
+      let y = data[2];
+      // data.data[data.data.length - 1][0] = '0010000001' + data.data[data.data.length - 1][0].substring(data.data[data.data.length - 1][0].length - 3)
+      if (state.realTimePos === null || state.realTimePos === undefined) {
+        state.realTimePos = new Map()
+      }
+      state.realTimePos.set(card_id, { x: x, y: y})
+      // if (!state.realTimePos.has(card_id)) {
+      // } else {
+      // }
+    }
+  },
+
   setBenchList(state, benchList) {
 
     benchList.forEach((bench, i) => {
@@ -100,9 +122,6 @@ export default {
     benchObject.description = bench.description;
     benchObject.equipment = bench.equipment[0];
     benchObject.slave = bench.equipment[0].slave;
-
-
-
   },
   setMatchedBenchList(state, benchList) {
     benchList.forEach(b => {

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1062 - 622
src/uwb-sample.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 428 - 476
src/views/ordinaryPage/index.vue