From 26fe6469a50bdf3b2efe7e545eba34bfcc9e2be2 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Jan 2021 21:30:33 +0100 Subject: [PATCH 1/4] clean up code --- static/scripts/accChart.js | 4 ---- static/scripts/refull.js | 8 -------- .../scripts/{chartfull.js => speedChart.js} | 0 static/scripts/websocket.js | 20 ------------------- templates/index.html | 2 -- templates/replayFull.html | 2 +- 6 files changed, 1 insertion(+), 35 deletions(-) rename static/scripts/{chartfull.js => speedChart.js} (100%) diff --git a/static/scripts/accChart.js b/static/scripts/accChart.js index 2e4557d..cf6f6a3 100644 --- a/static/scripts/accChart.js +++ b/static/scripts/accChart.js @@ -1,6 +1,5 @@ let allAccSerial = [] let allSerialCoords = [] -let allTcpCoords = [] var ctx = document.getElementById('accChart').getContext('2d'); var accChart = new Chart(ctx, { @@ -79,9 +78,6 @@ function addDistances(tcpDataList, serialDataList){ distances.push(distance) } - console.log("tcp coords: " + tcpCoords) - console.log("distances: " + distances) - accChart.data.labels = tcpTimes accChart.data.datasets[0].data = serialHAccs accChart.data.datasets[1].data = distances diff --git a/static/scripts/refull.js b/static/scripts/refull.js index 0d32a2f..a0c5524 100644 --- a/static/scripts/refull.js +++ b/static/scripts/refull.js @@ -7,13 +7,6 @@ function composeTimestamp(servertime){ return composed; } -function calculateDistSerialTCP(coordsSerial, coordsTCP) { - let long = Math.abs(coordsSerial[0] - coordsTCP[0]) - let lat = Math.abs(coordsSerial[1] - coordsTCP[1]) - let squareDist = Math.pow(long, 2) + Math.pow(lat, 2) - return (Math.sqrt(squareDist)) -} - function findBestTimeMatch(num, arr) { var mid; var lo = 0; @@ -55,7 +48,6 @@ function findSerialDataIndex(tcpdataList, serialdataList) { indexes.push(index) } }) - console.log("indexes: " + indexes) } window.addEventListener("load", function(evt) { diff --git a/static/scripts/chartfull.js b/static/scripts/speedChart.js similarity index 100% rename from static/scripts/chartfull.js rename to static/scripts/speedChart.js diff --git a/static/scripts/websocket.js b/static/scripts/websocket.js index cd32146..8105435 100644 --- a/static/scripts/websocket.js +++ b/static/scripts/websocket.js @@ -66,26 +66,6 @@ window.addEventListener("load", function(evt) { console.log("no serial data") } - try{ - if(!(dat.SOURCE_TCP.Position[1] === 0) && !(dat.SOURCE_SERIAL.Position[1] === 0)){ - document.getElementById("diffLong").innerHTML = "Differenz long: " + Math.abs(dat.SOURCE_TCP.Position[1] - dat.SOURCE_SERIAL.Position[1]) - } - if(!(dat.SOURCE_TCP.Position[0] === 0) && !(dat.SOURCE_SERIAL.Position[0] === 0)){ - document.getElementById("diffLat").innerHTML = "Differenz lat: " + Math.abs(dat.SOURCE_TCP.Position[0] - dat.SOURCE_SERIAL.Position[0]) - } - } - catch{ - console.log("no data to compare") - } - - try{ - if(!(dat.SOURCE_SERIAL.Position[2] === 0)){ - addSerialAltData(dat.SOURCE_SERIAL.Position[2]) - } - } - catch{ - console.log("no altitude data") - } try{ if(!(dat.SOURCE_SERIAL.HAcc === 0) && !(dat.SOURCE_SERIAL.VAcc === 0)){ addSerialAccuracy(dat.SOURCE_SERIAL.HAcc, dat.SOURCE_SERIAL.VAcc) diff --git a/templates/index.html b/templates/index.html index c9208c5..29093bb 100644 --- a/templates/index.html +++ b/templates/index.html @@ -38,8 +38,6 @@ - -
diff --git a/templates/replayFull.html b/templates/replayFull.html index 020602d..fd230e8 100644 --- a/templates/replayFull.html +++ b/templates/replayFull.html @@ -39,7 +39,7 @@ - + From fd3f440ab5c47d53fba5346f4b8ee7f02add331e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Jan 2021 21:33:54 +0100 Subject: [PATCH 2/4] clear map data when loadin other replay --- static/scripts/websocket.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/static/scripts/websocket.js b/static/scripts/websocket.js index 8105435..1ec5041 100644 --- a/static/scripts/websocket.js +++ b/static/scripts/websocket.js @@ -207,6 +207,9 @@ window.addEventListener("load", function(evt) { }; document.getElementById("replaystarten").onclick = function(evt) { + emptyTCP.features[0].geometry.coordinates = [] + emptySERIAL.features[0].geometry.coordinates = [] + let sel = document.getElementById("meas") console.log(trackings[sel.selectedIndex].UUID) fetch(`http://localhost:3011/trackings/${trackings[sel.selectedIndex].UUID}?replay=true`, { method: 'GET'}).then(results => { From 76f788c685c22c683949904e974a838148a76ca0 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 9 Jan 2021 02:31:15 +0100 Subject: [PATCH 3/4] add serial speeds to chart --- static/scripts/refull.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/scripts/refull.js b/static/scripts/refull.js index 555c5cc..3bcdea4 100644 --- a/static/scripts/refull.js +++ b/static/scripts/refull.js @@ -91,7 +91,7 @@ window.addEventListener("load", function(evt) { console.log(r.data.Data) console.log(r.data) // if('SOURCE_TCP' in r.data.Data && r.data.Data.SOURCE_TCP.length > 0 && 'SOURCE_SERIAL' in r.data.Data && r.data.Data.SOURCE_SERIAL.length > 0){ - // findSerialDataIndex(r.data.Data.SOURCE_TCP, r.data.Data.SOURCE_SERIAL) + findSerialDataIndex(r.data.Data.SOURCE_TCP, r.data.Data.SOURCE_SERIAL) // addDistances(r.data.Data.SOURCE_TCP, r.data.Data.SOURCE_SERIAL) // } if ('SOURCE_TCP' in r.data.Data && r.data.Data.SOURCE_TCP.length > 0) { From 36f2e35231a677cabb9be31aaaea0db520e2a37d Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Jan 2021 01:56:30 +0100 Subject: [PATCH 4/4] add lamps to visualize smartphone accuracy --- static/scripts/accuracy.js | 5 +++++ static/style.css | 16 ++++++++++++++++ templates/index.html | 30 ++++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/static/scripts/accuracy.js b/static/scripts/accuracy.js index 78fed15..26f71e2 100644 --- a/static/scripts/accuracy.js +++ b/static/scripts/accuracy.js @@ -42,3 +42,8 @@ function addTCPAccuracy(hacc, vacc){ barChart.data.datasets[1].data = [hacc, vacc]; barChart.update(); } +//Farbe der Lampen ändern +// AN: document.getElementById("greenlamp").style.backgroundColor = 'rgba(0, 230, 64, 1)' +// AUS: document.getElementById("greenlamp").style.backgroundColor = 'rgba(0, 100, 0, 1)' +// AN: document.getElementById("redlamp").style.backgroundColor = 'rgba(242, 38, 19, 1)' +// AUS: document.getElementById("redlamp").style.backgroundColor = 'rgba(139, 0, 0, 1)' diff --git a/static/style.css b/static/style.css index 46f0cc6..46d37b9 100644 --- a/static/style.css +++ b/static/style.css @@ -305,6 +305,22 @@ canvas { perspective: 400px; } +.lamp { + width: 50px; + height: 50px; + background-color: gray; + border-radius: 50%; +} + +.lampinner{ + width: 40px; + height: 40px; + position: relative; + top: 5px; + left: 5px; + border-radius: 50%; +} + .cube { width: 200px; height: 200px; diff --git a/templates/index.html b/templates/index.html index 0e96382..3905b56 100644 --- a/templates/index.html +++ b/templates/index.html @@ -62,17 +62,35 @@
-
+

-
-
-
+

+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
@@ -124,7 +142,7 @@
N - E + O S W
@@ -140,7 +158,7 @@
N - E + O S W