diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml index 6d58e5d..f4e397b 100644 --- a/.idea/jsLibraryMappings.xml +++ b/.idea/jsLibraryMappings.xml @@ -1,6 +1,6 @@ - + - \ No newline at end of file + diff --git a/core/pipeline_replay.go b/core/pipeline_replay.go index 096f153..53c0208 100644 --- a/core/pipeline_replay.go +++ b/core/pipeline_replay.go @@ -17,9 +17,15 @@ type pipelineReplay struct { replayChan chan interface{} } -func (r pipelineReplay) Stop() { - r.stopChan <- struct{}{} - close(r.replayChan) +func (p *pipelineReplay) Stop() { + defer func() { + if recover() != nil { + logrus.Debugln("replay channel already closed") + } + }() + logrus.Debugln("send stop signal") + p.stopChan <- struct{}{} + logrus.Debugln("stop signal sent") } func NewReplayPipeline(p Publisher, t *Tracking) *pipelineReplay { @@ -68,6 +74,7 @@ func (p *pipelineReplay) channelFromTracking(t *Tracking) chan interface{} { case <-p.stopChan: logrus.Debugln("replay pipeline closed") } + close(p.replayChan) }() return ch } diff --git a/static/scripts/websocket.js b/static/scripts/websocket.js index 3859a0f..943750d 100644 --- a/static/scripts/websocket.js +++ b/static/scripts/websocket.js @@ -1,12 +1,12 @@ const GRAPH_RES = 100; var dataSmartphone = []; -var ws; window.addEventListener("load", function(evt) { var output = document.getElementById("output"); var checkBoxSmartphone = document.getElementById("checkbox1"); var checkBoxUblox = document.getElementById("checkbox2"); + var ws; const wsOnCloseF = function (evt) { ws = null; @@ -34,12 +34,16 @@ window.addEventListener("load", function(evt) { // let dat = JSON.parse(evt.data)["lsm6dsm gyroscope"] //let dat = JSON.parse(evt.data)["lsm6ds3c gyroscope"] let dat = JSON.parse(evt.data) - dataSmartphone.push(dat) + // dataSmartphone.push(dat) //console.log(evt.data) - console.log("JSON geparsed onmessage", dat) + // console.log("JSON geparsed onmessage", dat) try{ if(!(dat.SOURCE_TCP.Orientation[0] === 0) && !(dat.SOURCE_TCP.Orientation[1] === 0) && !(dat.SOURCE_TCP.Orientation[2] === 0)){ - document.getElementById("gyroscopeTCP").style.transform = `rotateX(${dat.SOURCE_TCP.Orientation[0]}deg) rotateY(${dat.SOURCE_TCP.Orientation[1]}deg) rotateZ(${dat.SOURCE_TCP.Orientation[2]}deg)` + // document.getElementById("gyroscopeTCP").style.transform = `rotateX(${(dat.SOURCE_TCP.Orientation[0])%360}deg) rotateY(${(dat.SOURCE_TCP.Orientation[1])%360}deg) rotateZ(0deg)` + document.getElementById("gyroscopeTCP").style.transform = `rotateY(0deg) rotateX(${(-dat.SOURCE_TCP.Orientation[0])}deg) rotateZ(${(dat.SOURCE_TCP.Orientation[1])}deg) ` + // document.getElementById("gyroscopeTCP").style.transform = `rotateX(${(dat.SOURCE_TCP.Orientation[0])%360}deg) rotateZ(${(dat.SOURCE_TCP.Orientation[1])%360}deg) rotateY(${(dat.SOURCE_TCP.Orientation[2])%360}deg)` + // console.log(dat.SOURCE_TCP.Orientation) + renderTCP(dat.SOURCE_TCP.Orientation[0]*Math.PI/180,-dat.SOURCE_TCP.Orientation[1]*Math.PI/180,dat.SOURCE_TCP.Orientation[2]*Math.PI/180) } if(!(dat.SOURCE_TCP.Position[1] === 0) && !(dat.SOURCE_TCP.Position[0] === 0)){ document.getElementById("TCPlong").innerHTML = "Smartphone long: " + dat.SOURCE_TCP.Position[1] @@ -57,12 +61,14 @@ window.addEventListener("load", function(evt) { } catch{ - console.log("no TCP data") + // console.log("no TCP data") } try{ if(!(dat.SOURCE_SERIAL.Orientation[0] === 0) && /*!(dat.SOURCE_SERIAL.Orientation[1] === 0) &&*/ !(dat.SOURCE_SERIAL.Orientation[2] === 0)){ - document.getElementById("gyroscopeSERIAL").style.transform = `rotateX(${dat.SOURCE_SERIAL.Orientation[0]}deg) rotateY(${dat.SOURCE_SERIAL.Orientation[1]}deg) rotateZ(${dat.SOURCE_SERIAL.Orientation[2]}deg)` + document.getElementById("gyroscopeSERIAL").style.transform = `rotateX(${dat.SOURCE_SERIAL.Orientation[0]}deg) rotateY(${dat.SOURCE_SERIAL.Orientation[1]}deg) rotateZ(0deg)` + // document.getElementById("gyroscopeSERIAL").style.transform = `rotateX(${dat.SOURCE_SERIAL.Orientation[0]}deg) rotateY(${dat.SOURCE_SERIAL.Orientation[1]}deg) rotateZ(${dat.SOURCE_SERIAL.Orientation[2]}deg)` + renderSerial(dat.SOURCE_SERIAL.Orientation[0]*Math.PI/180,dat.SOURCE_SERIAL.Orientation[1]*Math.PI/180,-dat.SOURCE_SERIAL.Orientation[2]*Math.PI/180) } if(!(dat.SOURCE_SERIAL.Position[1] === 0) && !(dat.SOURCE_SERIAL.Position[0] === 0)){ document.getElementById("SERIALlong").innerHTML = "Ublox long: " + dat.SOURCE_SERIAL.Position[1] @@ -78,7 +84,7 @@ window.addEventListener("load", function(evt) { document.getElementById("needle").style.transform = `rotate(${dat.SOURCE_SERIAL.HeadDevice}deg)` } }catch{ - console.log("no serial data") + // console.log("no serial data") } try{ diff --git a/static/style.css b/static/style.css index 46f0cc6..f32653e 100644 --- a/static/style.css +++ b/static/style.css @@ -310,7 +310,7 @@ canvas { height: 200px; position: relative; transform-style: preserve-3d; - transform: translateZ(-100px); + /*transform: translateZ(-100px);*/ transition: transform 25ms; } @@ -328,7 +328,7 @@ canvas { border: 1px solid white; line-height: 200px; font-size: 40px; - font-weight: bold; + /*font-weight: bold;*/ color: white; text-align: center; } @@ -340,11 +340,67 @@ canvas { .cube__face--top { background: hsla(240, 100%, 50%, 0.7); } .cube__face--bottom { background: hsla(300, 100%, 50%, 0.7); } -.cube__face--front { transform: rotateY( 0deg) translateZ(100px); } -.cube__face--right { transform: rotateY( 90deg) translateZ(100px); } -.cube__face--back { transform: rotateY(180deg) translateZ(100px); } -.cube__face--left { transform: rotateY(-90deg) translateZ(100px); } -.cube__face--top { transform: rotateX( 90deg) translateZ(100px); } -.cube__face--bottom { transform: rotateX(-90deg) translateZ(100px); } +.cube__face--front { transform: rotateY( 0deg) translateZ(100px) translateY(50px); height: 100px; line-height: 100px; } +.cube__face--right { transform: rotateY( 90deg) translateZ(100px) translateY(50px); height: 100px; line-height: 100px; } +.cube__face--back { transform: rotateY(180deg) translateZ(100px) translateY(50px); height: 100px; line-height: 100px; } +.cube__face--left { transform: rotateY(-90deg) translateZ(100px) translateY(50px); height: 100px; line-height: 100px; } +.cube__face--top { transform: rotateX( 90deg) translateZ(50px); } +.cube__face--bottom { transform: rotateX(-90deg) translateZ(50px); } label { margin-right: 10px; } + +.slidecontainer { + width: 100%; + overflow: visible; + padding: 10px 0px; +} + +#manCalContainer { + display: none; +} +/*.slider {*/ +/* -webkit-appearance: none;*/ +/* width: 100%;*/ +/* height: 25px;*/ +/* background: #d3d3d3;*/ +/* outline: none;*/ +/* opacity: 0.7;*/ +/* -webkit-transition: .2s;*/ +/* transition: opacity .2s;*/ +/*}*/ + +.slider:hover { + opacity: 1; +} + +.slider::-webkit-slider-thumb { + -webkit-appearance: none; + appearance: none; + width: 20px; + height: 20px; + background: #4CAF50; + cursor: pointer; + border-radius: 50%; + border: none; +} + +.slider::-moz-range-thumb { + width: 20px; + height: 20px; + background: #4CAF50; + cursor: pointer; + border-radius: 50%; + border: none; +} + +.slider { + -webkit-appearance: none; + width: 100%; + height: 8px; + border-radius: 5px; + background: #d3d3d3; + outline: none; + opacity: 0.7; + -webkit-transition: opacity .15s ease-in-out; + transition: opacity .15s ease-in-out; +} diff --git a/templates/index.html b/templates/index.html index c6e6709..cde3bd1 100644 --- a/templates/index.html +++ b/templates/index.html @@ -6,8 +6,11 @@ + + + @@ -78,11 +81,25 @@ +
+
+
+ + + +
+


Manuelle Kalibrierung

+ + + +
+
+

Smartphone

-
front
-
back
+
back
+
front
right
left
top
@@ -92,8 +109,8 @@

Ublox

-
front
-
back
+
back
+
front
right
left
top