some improvements
This commit is contained in:
parent
c7140d8394
commit
e0ebf17cab
@ -148,7 +148,7 @@ func ConvertUbxSensorData(msg interface{}) (*SensorData, error) {
|
||||
sd.HeadMotion = float64(v.HeadMot_dege5) / 1e+5
|
||||
sd.HeadDevice = float64(v.HeadVeh_dege5) / 1e+5
|
||||
sd.HeadingAcc = float64(v.HeadAcc_dege5) / 1e+5
|
||||
sd.Speed = float64(v.GSpeed_mm_s) * 3.6e-3
|
||||
sd.Speed = float64(v.GSpeed_mm_s) * 1e-3
|
||||
case *ublox.HnrPvt:
|
||||
//logrus.Println("HNR-PVT")
|
||||
sd.itow = v.ITOW_ms
|
||||
@ -161,7 +161,7 @@ func ConvertUbxSensorData(msg interface{}) (*SensorData, error) {
|
||||
sd.HeadMotion = float64(v.HeadMot_dege5) / 1e+5
|
||||
sd.HeadDevice = float64(v.HeadVeh_dege5) / 1e+5
|
||||
sd.HeadingAcc = float64(v.HeadAcc_dege5) / 1e+5
|
||||
sd.Speed = float64(v.GSpeed_mm_s) + 3.6e-3
|
||||
sd.Speed = float64(v.GSpeed_mm_s) * 1e-3 // mm in m/s
|
||||
case *ublox.NavAtt:
|
||||
//logrus.Println("NAV-ATT")
|
||||
sd.itow = v.ITOW_ms
|
||||
|
||||
@ -45,7 +45,6 @@ func (d *dispatcher) Publish(message string) {
|
||||
return
|
||||
}
|
||||
logrus.Tracef("publishing to %v listeners\n", len(d.listeners))
|
||||
logrus.Trace(message)
|
||||
for _, ch := range d.listeners {
|
||||
select {
|
||||
case ch <- message:
|
||||
|
||||
@ -21,7 +21,7 @@ func NewRecordPipeline(p Publisher, s Tracker, netChan chan interface{}, serialC
|
||||
flowStore := flow.NewMap(storeFunc(s), 1)
|
||||
|
||||
dataSanitizer := flow.NewMap(replaySanitizeFunc(), 1)
|
||||
flowReorder := NewRearranger()
|
||||
//flowReorder := NewRearranger()
|
||||
|
||||
flowJson := flow.NewMap(jsonFunc, 1)
|
||||
sinkPub := newPublishSink(p)
|
||||
@ -29,7 +29,7 @@ func NewRecordPipeline(p Publisher, s Tracker, netChan chan interface{}, serialC
|
||||
// wire up and execute
|
||||
demux := flow.Merge(collNet.Via(transNet), collSer.Via(transSer))
|
||||
//go demux.Via(flowDelay).Via(flowStore).Via(flowJson).To(sinkPub)
|
||||
go demux.Via(flowStore).Via(dataSanitizer).Via(flowReorder).Via(flowJson).To(sinkPub)
|
||||
go demux.Via(flowStore).Via(dataSanitizer).Via(flowJson).To(sinkPub)
|
||||
return &pipelineRecord{}
|
||||
}
|
||||
|
||||
|
||||
@ -18,14 +18,14 @@ func NewReplayPipeline(p Publisher, t *Tracking) *pipelineReplay {
|
||||
// set pipeline up and wire it together
|
||||
collNet := ext.NewChanSource(channelFromTracking(t))
|
||||
dataSanitizer := flow.NewMap(replaySanitizeFunc(), 1)
|
||||
flowReorder := NewRearranger()
|
||||
//flowReorder := NewRearranger()
|
||||
|
||||
flowJson := flow.NewMap(jsonFunc, 1)
|
||||
sinkPub := newPublishSink(p)
|
||||
|
||||
// wire up and execute
|
||||
//go collNet.Via(dataSanitizer).Via(flowJson).To(sinkPub)
|
||||
go collNet.Via(dataSanitizer).Via(flowReorder).Via(flowJson).To(sinkPub)
|
||||
go collNet.Via(dataSanitizer).Via(flowJson).To(sinkPub)
|
||||
return &pipelineReplay{}
|
||||
}
|
||||
|
||||
@ -43,19 +43,20 @@ func channelFromTracking(t *Tracking) chan interface{} {
|
||||
go func() {
|
||||
lastTs := t.Data[0].Servertime.UnixNano()
|
||||
lastTsNow := time.Now().UTC().UnixNano()
|
||||
i := 0
|
||||
for i <= len(t.Data)-1 {
|
||||
durationSinceLastEvent := t.Data[i].Servertime.UnixNano() - lastTs
|
||||
timeCounter := time.Now().UTC().UnixNano() - lastTsNow
|
||||
if timeCounter >= durationSinceLastEvent {
|
||||
i := 0
|
||||
for i <= len(t.Data)-1 {
|
||||
durationSinceLastEvent := t.Data[i].Servertime.UnixNano() - lastTs
|
||||
timeCounter := time.Now().UTC().UnixNano() - lastTsNow
|
||||
if timeCounter >= durationSinceLastEvent {
|
||||
ch <- &(t.Data[i])
|
||||
logrus.Traceln("replay tracking: ", t.Data[i])
|
||||
lastTs = t.Data[i].Servertime.UnixNano()
|
||||
lastTsNow = time.Now().UTC().UnixNano()
|
||||
i++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logrus.Infoln("replay: pushed all tracking data to pipeline")
|
||||
logrus.Infoln("replay: pushed all tracking data to pipeline")
|
||||
}()
|
||||
return ch
|
||||
}
|
||||
@ -86,7 +87,7 @@ func replaySanitizeFunc() flow.MapFunc {
|
||||
sd.Timestamp = sd.Servertime.Add(time.Duration(lastOff))
|
||||
}
|
||||
if sd.Servertime.Before(time.Unix(1608422400, 0)) && sd.Speed != 0 && sd.Source() == SOURCE_SERIAL {
|
||||
sd.Speed = sd.Speed * 3.6 * 3.6
|
||||
sd.Speed = sd.Speed * 3.6
|
||||
}
|
||||
return sd
|
||||
}
|
||||
|
||||
@ -162,4 +162,4 @@ function addSpeedTcp(speedTCP){
|
||||
mySpeedometer.data.datasets[0].data = [speedTCPpercent, 100-speedTCPpercent];
|
||||
document.getElementById("speedTCP").innerHTML = "Speed Smartphone (km/h): " + speedTCPkmh.toFixed(1)
|
||||
mySpeedometer.update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,107 @@
|
||||
const GRAPH_RES = 100;
|
||||
var dataSmartphone = [];
|
||||
window.addEventListener("load", function(evt) {
|
||||
var orientation = [0,0,0];
|
||||
var multiplier = 180/Math.PI/15
|
||||
var output = document.getElementById("output");
|
||||
var input = document.getElementById("input");
|
||||
var checkBoxSmartphone = document.getElementById("checkbox1");
|
||||
var checkBoxUblox = document.getElementById("checkbox2");
|
||||
var ws;
|
||||
ws = new WebSocket("ws://localhost:3011/ws");
|
||||
ws.onopen = function(evt) {
|
||||
print("OPEN");
|
||||
}
|
||||
ws.onclose = function(evt) {
|
||||
ws = null;
|
||||
print2("CLOSE");
|
||||
}
|
||||
ws.onmessage = function(evt) {
|
||||
//print2("RESPONSE: " + evt.data);
|
||||
// let dat = JSON.parse(evt.data)["bmi26x gyroscope"]
|
||||
// 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)
|
||||
//console.log(evt.data)
|
||||
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)`
|
||||
}
|
||||
if(!(dat.SOURCE_TCP.Position[1] === 0) && !(dat.SOURCE_TCP.Position[0] === 0)){
|
||||
document.getElementById("TCPlong").innerHTML = "Smartphone long: " + dat.SOURCE_TCP.Position[1]
|
||||
document.getElementById("TCPlat").innerHTML = "Smartphone lat: " + dat.SOURCE_TCP.Position[0]
|
||||
updateMapTCP(dat.SOURCE_TCP.Position[1], dat.SOURCE_TCP.Position[0])
|
||||
map.panTo([dat.SOURCE_TCP.Position[1], dat.SOURCE_TCP.Position[0]])
|
||||
}
|
||||
if(!(dat.SOURCE_TCP.Speed === 0)){
|
||||
addSpeedTcp(dat.SOURCE_TCP.Speed);
|
||||
}
|
||||
if(!(dat.SOURCE_TCP.HeadDevice === 0)){
|
||||
addCompassTCP(dat.SOURCE_TCP.HeadDevice)
|
||||
document.getElementById("compassTCP").innerHTML = "Smartphone: " + dat.SOURCE_TCP.HeadDevice.toFixed(0) + "°"
|
||||
}
|
||||
}
|
||||
catch{
|
||||
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)`
|
||||
}
|
||||
if(!(dat.SOURCE_SERIAL.Position[1] === 0) && !(dat.SOURCE_SERIAL.Position[0] === 0)){
|
||||
document.getElementById("SERIALlong").innerHTML = "Ublox long: " + dat.SOURCE_SERIAL.Position[1]
|
||||
document.getElementById("SERIALlat").innerHTML = "Ublox lat: " + dat.SOURCE_SERIAL.Position[0]
|
||||
updateMapSERIAL(dat.SOURCE_SERIAL.Position[1], dat.SOURCE_SERIAL.Position[0])
|
||||
map.panTo([dat.SOURCE_SERIAL.Position[1], dat.SOURCE_SERIAL.Position[0]])
|
||||
}
|
||||
if(!(dat.SOURCE_SERIAL.Speed === 0)){
|
||||
addSpeedSerial(dat.SOURCE_SERIAL.Speed);
|
||||
}
|
||||
if(!(dat.SOURCE_SERIAL.HeadDevice === 0)){
|
||||
addCompassSerial(dat.SOURCE_SERIAL.HeadDevice)
|
||||
document.getElementById("compassSERIAL").innerHTML = "Ublox: " + dat.SOURCE_SERIAL.HeadDevice.toFixed(0) + "°"
|
||||
}
|
||||
}catch{
|
||||
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")
|
||||
}
|
||||
|
||||
if(!(dat.SOURCE_SERIAL.Position[2] === 0)){
|
||||
addSerialAltData(dat.SOURCE_SERIAL.Position[2])
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
console.log(dat)
|
||||
orientation[0] += dat[0] * multiplier
|
||||
orientation[1] += dat[1] * multiplier
|
||||
orientation[2] += dat[2] * multiplier
|
||||
// dataset.push(orientation[0])
|
||||
// while (dataset.length >= 50) {
|
||||
// dataset.shift();
|
||||
// }
|
||||
// addData(orientation[0] / multiplier)
|
||||
*/
|
||||
}
|
||||
|
||||
ws.onerror = function(evt) {
|
||||
print("ERROR: " + evt.data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
var print = function(message) {
|
||||
var d = document.createElement("div");
|
||||
d.textContent = message;
|
||||
@ -20,18 +114,10 @@ window.addEventListener("load", function(evt) {
|
||||
output.replaceChild(d, oldNode)
|
||||
};
|
||||
document.getElementById("open").onclick = function(evt) {
|
||||
if (ws && ws.OPEN) {
|
||||
print2("Websocket already open")
|
||||
return false;
|
||||
}
|
||||
ws = new WebSocket("ws://localhost:3011/ws");
|
||||
ws.onopen = function(evt) {
|
||||
print("OPEN");
|
||||
}
|
||||
ws.onclose = function(evt) {
|
||||
ws = null;
|
||||
print2("CLOSE");
|
||||
}
|
||||
// if (ws && ws.OPEN) {
|
||||
// print2("Websocket already open")
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if(checkBoxSmartphone.checked && checkBoxUblox.checked){
|
||||
fetch('http://localhost:3011/trackings?serial=true&tcp=true', { method: 'POST', body: 'some test data'})
|
||||
@ -59,100 +145,6 @@ window.addEventListener("load", function(evt) {
|
||||
checkBoxSmartphone.disabled = true;
|
||||
checkBoxUblox.disabled = true;
|
||||
|
||||
ws.onmessage = function(evt) {
|
||||
//print2("RESPONSE: " + evt.data);
|
||||
// let dat = JSON.parse(evt.data)["bmi26x gyroscope"]
|
||||
// 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)
|
||||
//console.log(evt.data)
|
||||
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)`
|
||||
}
|
||||
if(!(dat.SOURCE_TCP.Position[1] === 0) && !(dat.SOURCE_TCP.Position[0] === 0)){
|
||||
document.getElementById("TCPlong").innerHTML = "Smartphone long: " + dat.SOURCE_TCP.Position[1]
|
||||
document.getElementById("TCPlat").innerHTML = "Smartphone lat: " + dat.SOURCE_TCP.Position[0]
|
||||
updateMapTCP(dat.SOURCE_TCP.Position[1], dat.SOURCE_TCP.Position[0])
|
||||
map.panTo([dat.SOURCE_TCP.Position[1], dat.SOURCE_TCP.Position[0]])
|
||||
}
|
||||
if(!(dat.SOURCE_TCP.Speed === 0)){
|
||||
addSpeedTcp(dat.SOURCE_TCP.Speed);
|
||||
}
|
||||
if(!(dat.SOURCE_TCP.HeadDevice === 0)){
|
||||
addCompassTCP(dat.SOURCE_TCP.HeadDevice)
|
||||
document.getElementById("compassTCP").innerHTML = "Smartphone: " + dat.SOURCE_TCP.HeadDevice.toFixed(0) + "°"
|
||||
}
|
||||
}
|
||||
catch{
|
||||
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)`
|
||||
}
|
||||
if(!(dat.SOURCE_SERIAL.Position[1] === 0) && !(dat.SOURCE_SERIAL.Position[0] === 0)){
|
||||
document.getElementById("SERIALlong").innerHTML = "Ublox long: " + dat.SOURCE_SERIAL.Position[1]
|
||||
document.getElementById("SERIALlat").innerHTML = "Ublox lat: " + dat.SOURCE_SERIAL.Position[0]
|
||||
updateMapSERIAL(dat.SOURCE_SERIAL.Position[1], dat.SOURCE_SERIAL.Position[0])
|
||||
map.panTo([dat.SOURCE_SERIAL.Position[1], dat.SOURCE_SERIAL.Position[0]])
|
||||
}
|
||||
if(!(dat.SOURCE_SERIAL.Speed === 0)){
|
||||
addSpeedSerial(dat.SOURCE_SERIAL.Speed);
|
||||
}
|
||||
if(!(dat.SOURCE_SERIAL.HeadDevice === 0)){
|
||||
addCompassSerial(dat.SOURCE_SERIAL.HeadDevice)
|
||||
document.getElementById("compassSERIAL").innerHTML = "Ublox: " + dat.SOURCE_SERIAL.HeadDevice.toFixed(0) + "°"
|
||||
}
|
||||
}catch{
|
||||
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")
|
||||
}
|
||||
|
||||
if(!(dat.SOURCE_SERIAL.Position[2] === 0)){
|
||||
addSerialAltData(dat.SOURCE_SERIAL.Position[2])
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
console.log(dat)
|
||||
orientation[0] += dat[0] * multiplier
|
||||
orientation[1] += dat[1] * multiplier
|
||||
orientation[2] += dat[2] * multiplier
|
||||
// dataset.push(orientation[0])
|
||||
// while (dataset.length >= 50) {
|
||||
// dataset.shift();
|
||||
// }
|
||||
// addData(orientation[0] / multiplier)
|
||||
*/
|
||||
}
|
||||
|
||||
ws.onerror = function(evt) {
|
||||
print("ERROR: " + evt.data);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
document.getElementById("send").onclick = function(evt) {
|
||||
if (!ws) {
|
||||
return false;
|
||||
}
|
||||
print("SEND: " + input.value);
|
||||
ws.send(input.value);
|
||||
return false;
|
||||
};
|
||||
document.getElementById("close").onclick = function(evt) {
|
||||
@ -165,7 +157,7 @@ window.addEventListener("load", function(evt) {
|
||||
|
||||
//------------------------Buttons------------------------------
|
||||
|
||||
document.getElementById("messung starten").onclick = function(evt) {
|
||||
document.getElementById("messungstarten").onclick = function(evt) {
|
||||
if (ws) {
|
||||
fetch('http://localhost:3011/trackings/', { method: 'PATCH', body: 'some data'})
|
||||
.then(results => results.json())
|
||||
@ -175,7 +167,7 @@ window.addEventListener("load", function(evt) {
|
||||
return false;
|
||||
};
|
||||
|
||||
document.getElementById("messung beenden").onclick = function(evt) {
|
||||
document.getElementById("messungbeenden").onclick = function(evt) {
|
||||
if (ws) {
|
||||
fetch('http://localhost:3011/trackings/', { method: 'PUT', body: 'some data'})
|
||||
.then(results => results.json())
|
||||
@ -185,7 +177,7 @@ window.addEventListener("load", function(evt) {
|
||||
return false;
|
||||
};
|
||||
|
||||
document.getElementById("alles beenden").onclick = function(evt) {
|
||||
document.getElementById("allesbeenden").onclick = function(evt) {
|
||||
if (ws) {
|
||||
fetch('http://localhost:3011/trackings/', { method: 'DELETE', body: 'some data'})
|
||||
.then(results => results.json())
|
||||
@ -196,4 +188,40 @@ window.addEventListener("load", function(evt) {
|
||||
}
|
||||
return false;
|
||||
};
|
||||
});
|
||||
var trackings = null;
|
||||
document.getElementById("messungladen").onclick = function(evt) {
|
||||
fetch('http://localhost:3011/trackings/', { method: 'GET'}).then(results => {
|
||||
return results.json()
|
||||
}).then(r => {
|
||||
console.log(r)
|
||||
if (!'data' in r) {
|
||||
return
|
||||
}
|
||||
trackings = r.data
|
||||
let sel = document.getElementById("meas")
|
||||
r.data.forEach(tracking => {
|
||||
console.log(tracking)
|
||||
var option = document.createElement("option");
|
||||
option.text = tracking.TimeCreated + " Size: " + tracking.Size
|
||||
sel.add(option)
|
||||
})
|
||||
sel.disabled = false
|
||||
document.getElementById("replaystarten").disabled = false
|
||||
|
||||
})
|
||||
};
|
||||
|
||||
document.getElementById("replaystarten").onclick = function(evt) {
|
||||
let sel = document.getElementById("meas")
|
||||
console.log(trackings[sel.selectedIndex].UUID)
|
||||
fetch(`http://localhost:3011/trackings/${trackings[sel.selectedIndex].UUID}`, { method: 'GET'}).then(results => {
|
||||
return results.json()
|
||||
}).then(r => {
|
||||
console.log(r.data.Data)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -7,7 +7,6 @@ import (
|
||||
"github.com/dgraph-io/badger/v2"
|
||||
"github.com/google/uuid"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/tidwall/pretty"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
@ -70,10 +69,10 @@ func (r *badgerStore) Save(tr core.Tracking) error {
|
||||
err = r.sensordatDb.Update(func(txn *badger.Txn) error {
|
||||
for _, v := range tr.Data {
|
||||
k := createRecordKey(tr.UUID, v.Source(), v.Timestamp)
|
||||
logrus.Trace(v, " len key ->", len(k))
|
||||
//logrus.Trace(v, " len key ->", len(k))
|
||||
j, err2 := json.Marshal(v)
|
||||
logrus.Traceln("save record k/v:\n", tr.UUID.String(), v.Timestamp.Format(time.RFC3339Nano))
|
||||
logrus.Traceln(string(pretty.Pretty(j)))
|
||||
//logrus.Traceln(string(pretty.Pretty(j)))
|
||||
if err2 != nil {
|
||||
return err2
|
||||
}
|
||||
@ -174,9 +173,9 @@ func (r *badgerStore) Load(id uuid.UUID) (*core.Tracking, error) {
|
||||
el.Timestamp = recTime
|
||||
el.SetSource(source)
|
||||
err2 := item.Value(func(val []byte) error {
|
||||
logrus.Traceln(string(val))
|
||||
//logrus.Traceln(string(val))
|
||||
err3 := json.Unmarshal(val, &el)
|
||||
logrus.Traceln(err3, el)
|
||||
//logrus.Traceln(err3, el)
|
||||
return err3
|
||||
})
|
||||
if err2 != nil {
|
||||
@ -218,11 +217,11 @@ func createRecordKey(uid uuid.UUID, source core.SourceId, timestamp time.Time) [
|
||||
}
|
||||
|
||||
func unmarshalDataKey(key []byte) (uuid.UUID, core.SourceId, time.Time) {
|
||||
logrus.Trace("key len ->", len(key))
|
||||
//logrus.Trace("key len ->", len(key))
|
||||
prefix := string(key[:36])
|
||||
suffix := string(key[37:])
|
||||
middle := string(key[36:37])
|
||||
logrus.Traceln("load as:", prefix, middle, suffix)
|
||||
//logrus.Traceln("load as:", prefix, middle, suffix)
|
||||
var source core.SourceId
|
||||
switch middle {
|
||||
case "1":
|
||||
@ -238,7 +237,7 @@ func unmarshalDataKey(key []byte) (uuid.UUID, core.SourceId, time.Time) {
|
||||
if err != nil {
|
||||
logrus.Errorln("corrupted key", err)
|
||||
}
|
||||
logrus.Traceln(uid, timestamp)
|
||||
//logrus.Traceln(uid, timestamp)
|
||||
|
||||
//timestamp := time.Unix(0, int64(binary.BigEndian.Uint64(suffix)))
|
||||
return uid, source, timestamp
|
||||
|
||||
@ -6,198 +6,34 @@
|
||||
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
|
||||
<script src="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.js"></script>
|
||||
<link href="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.css" rel="stylesheet" />
|
||||
<style>
|
||||
body { margin: 0; padding: 0; }
|
||||
#map { position: absolute; top: 0; bottom: 0; width: 100%; }
|
||||
</style>
|
||||
<script src="static/scripts/websocket.js"></script>
|
||||
<style>
|
||||
|
||||
.legend {
|
||||
background-color: #fff;
|
||||
border-radius: 3px;
|
||||
bottom: 30px;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;
|
||||
padding: 10px;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.legend h4 {
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
|
||||
.legend div span {
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
height: 10px;
|
||||
margin-right: 5px;
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
body{margin:0; padding:0; font-size:13px; font-family:Georgia, "Times New Roman", Times, serif; color:#919191; background-color:#232323;}
|
||||
|
||||
.float-child {
|
||||
width: 45%;
|
||||
float: left;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.outer {
|
||||
position: relative;
|
||||
width: 300px;
|
||||
height: 200px;
|
||||
margin: 50px;
|
||||
}
|
||||
|
||||
canvas {
|
||||
position: absolute;
|
||||
}
|
||||
.speedMin {
|
||||
position: absolute;
|
||||
left: 0%;
|
||||
transform: translate(-50%, 0);
|
||||
font-size: 30px;
|
||||
bottom: 0;
|
||||
margin-bottom: -50px;
|
||||
}
|
||||
.speed14 {
|
||||
position: absolute;
|
||||
left: 8%;
|
||||
transform: translate(-50%, 0);
|
||||
font-size: 20px;
|
||||
bottom: 0;
|
||||
margin-bottom: 90px;
|
||||
}
|
||||
.speedMed {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translate(-50%, 0);
|
||||
font-size: 20px;
|
||||
bottom: 0;
|
||||
margin-bottom: 140px;
|
||||
}
|
||||
.speed34 {
|
||||
position: absolute;
|
||||
left: 92%;
|
||||
transform: translate(-50%, 0);
|
||||
font-size: 20px;
|
||||
bottom: 0;
|
||||
margin-bottom: 90px;
|
||||
}
|
||||
.speedMax {
|
||||
position: absolute;
|
||||
Left: 100%;
|
||||
transform: translate(-50%, 0);
|
||||
font-size: 30px;
|
||||
bottom: 0;
|
||||
margin-bottom: -50px;
|
||||
}
|
||||
|
||||
.compassNorth {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translate(-50%, 0);
|
||||
font-size: 30px;
|
||||
bottom: 70%;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
.compassSouth {
|
||||
position: absolute;
|
||||
Left: 50%;
|
||||
transform: translate(-50%, 0);
|
||||
font-size: 30px;
|
||||
bottom: -70%;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
.compassWest {
|
||||
position: absolute;
|
||||
left: 0%;
|
||||
transform: translate(-50%, 0);
|
||||
font-size: 30px;
|
||||
bottom: 50%;
|
||||
margin-bottom: -50px;
|
||||
}
|
||||
.compassEast {
|
||||
position: absolute;
|
||||
Left: 100%;
|
||||
transform: translate(-50%, 0);
|
||||
font-size: 30px;
|
||||
bottom: 50%;
|
||||
margin-bottom: -50px;
|
||||
}
|
||||
|
||||
|
||||
.scene {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border: 0px solid #CCC;
|
||||
margin: 75px;
|
||||
perspective: 400px;
|
||||
}
|
||||
|
||||
.cube {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
position: relative;
|
||||
transform-style: preserve-3d;
|
||||
transform: translateZ(-100px);
|
||||
transition: transform 25ms;
|
||||
}
|
||||
|
||||
.cube.show-front { transform:translateZ(-100px) rotateY( 0deg); }
|
||||
.cube.show-right { transform:translateZ(-100px) rotateY( -90deg); }
|
||||
.cube.show-back { transform:translateZ(-100px) rotateY(-180deg); }
|
||||
.cube.show-left { transform:translateZ(-100px) rotateY( 90deg); }
|
||||
.cube.show-top { transform:translateZ(-100px) rotateX( -90deg); }
|
||||
.cube.show-bottom { transform:translateZ(-100px) rotateX( 90deg); }
|
||||
|
||||
.cube__face {
|
||||
position: absolute;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border: 1px solid white;
|
||||
line-height: 200px;
|
||||
font-size: 40px;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.cube__face--front { background: hsla( 0, 100%, 50%, 0.7); }
|
||||
.cube__face--right { background: hsla( 60, 100%, 50%, 0.7); }
|
||||
.cube__face--back { background: hsla(120, 100%, 50%, 0.7); }
|
||||
.cube__face--left { background: hsla(180, 100%, 50%, 0.7); }
|
||||
.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); }
|
||||
|
||||
label { margin-right: 10px; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="static/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<table style="font-size: small">
|
||||
<tr>
|
||||
<td valign="top" width="100%">
|
||||
<p>"Verbinden" clicken um eine Verbindung mit dem Server aufzubauen. {{.}}</p>
|
||||
<label><input type="checkbox" id="checkbox1" value="smartphone"> TCP</label><br>
|
||||
<label><input type="checkbox" id="checkbox2" value="ublox"> SERIAL</label><br>
|
||||
<button id="open">Verbinden</button>
|
||||
<button id="close">Trennen</button>
|
||||
<p style="display: none" ><input id="input" type="text" value="Hello world!"><button id="send">Send</button></p>
|
||||
<p>"Verbinden" klicken um eine Verbindung mit dem Server aufzubauen. {{.}}</p>
|
||||
<div class="controls">
|
||||
<label><input type="checkbox" id="checkbox1" value="smartphone"> TCP</label><br>
|
||||
<label><input type="checkbox" id="checkbox2" value="ublox"> SERIAL</label><br>
|
||||
<button id="open">Livetracking starten</button>
|
||||
<button id="close" style="display: none">Trennen</button>
|
||||
|
||||
<button id="messung starten">Messung starten</button>
|
||||
<button id="messung beenden">Messung beenden</button>
|
||||
<button id="messung laden">Messung laden</button>
|
||||
<button id="alles beenden">Alles Beenden</button><br>
|
||||
<button id="allesbeenden" style="margin-right: 16px;">Pipeline stoppen</button>
|
||||
<button id="messungstarten">Aufnahme starten</button>
|
||||
<button id="messungbeenden" style="margin-right: 16px;">Aufnahme beenden</button>
|
||||
<button id="messungladen" style="margin-right: 16px;">Aufnahmen laden</button>
|
||||
|
||||
<label>Aufnahmen:
|
||||
<select name="meas" id="meas" disabled>
|
||||
</select>
|
||||
</label>
|
||||
<button id="replaystarten" style="margin-right: 16px;" disabled>Wiedergabe starten</button>
|
||||
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<label id="tracking state" style= "font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif">Tracking state: </label><br>
|
||||
<label id="TCPlong" style= "font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif">Smartphone long: </label>
|
||||
<label id="TCPlat" style= "font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif">Smartphone lat: </label>
|
||||
@ -289,4 +125,4 @@
|
||||
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script>
|
||||
<script src="static/scripts/chart.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@ -107,10 +107,6 @@
|
||||
<form>
|
||||
<button id="open">Verbinden</button>
|
||||
<button id="close">Trennen</button>
|
||||
<p style="display: none" >
|
||||
<input id="input" type="text" value="Hello world!">
|
||||
<button id="send">Send</button>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<button id="messung starten">Messung starten</button>
|
||||
@ -177,4 +173,4 @@
|
||||
</div>
|
||||
<script src="static/scripts/chart.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@ -230,6 +230,7 @@ func createFiberWebsocketHandler(s core.Subscriber) func(conn *websocket.Conn) {
|
||||
defer s.Unsubscribe(dispatcherId)
|
||||
for {
|
||||
cmsg := <-channel
|
||||
logrus.Traceln("write to ws:", cmsg)
|
||||
err := c.WriteMessage(websocket.TextMessage, []byte(cmsg))
|
||||
if err != nil {
|
||||
logrus.Info("close websocket connection")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user