diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 35bcfb8..765d4dd 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -23,30 +23,12 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -58,6 +40,7 @@
+
@@ -87,6 +70,9 @@
+
+
+
@@ -98,7 +84,18 @@
-
+
+
+
+
+
+
+
+
@@ -108,6 +105,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -117,21 +132,16 @@
-
-
-
-
-
-
+
+
+
+
-
-
-
diff --git a/cmd/server/server.go b/cmd/server/server.go
index 0ccdd93..c8ffed1 100644
--- a/cmd/server/server.go
+++ b/cmd/server/server.go
@@ -8,7 +8,7 @@ import (
const (
TCP_PORT = ":3010"
HTTP_PORT = ":3011"
- SERIAL_PORT = "/dev/tty.usbmodem14201"
+ SERIAL_PORT = "COM4"
)
func main() {
diff --git a/cmd/tcp_only/tcp_only.go b/cmd/tcp_only/tcp_only.go
index 5e21bac..d535377 100644
--- a/cmd/tcp_only/tcp_only.go
+++ b/cmd/tcp_only/tcp_only.go
@@ -2,6 +2,7 @@ package main
import (
"git.timovolkmann.de/gyrogpsc/core"
+ "log"
)
const (
@@ -10,9 +11,13 @@ const (
)
func main() {
+ log.Println("setup dispatcher")
dispatcher := core.NewDispatcher()
- processor := core.NewPipeline(dispatcher, 20, 10000)
+ log.Println("initialize processing pipeline")
+ processor := core.NewPipeline(dispatcher, 50, 494)
+ processor.Run()
collectRoutines(processor)
+ log.Println("start http server")
core.HttpListenAndServe(dispatcher, HTTP_PORT)
}
diff --git a/core/format.go b/core/format.go
index 8440163..4124f64 100644
--- a/core/format.go
+++ b/core/format.go
@@ -7,8 +7,6 @@ import (
"log"
"math"
"time"
-
- "github.com/m7shapan/njson"
)
/*{
@@ -159,20 +157,20 @@ func convertIPhoneSensorLog(jsonData []byte) (*Sensordata, error) {
func convertAndroidHyperImu(jsonData []byte) (*Sensordata, error) {
- prep := struct {
- Timestamp int64 `njson:"Timestamp"`
- Position [3]float64 `njson:"GPS"`
- Orientation [3]float64 `njson:"orientation"`
- }{}
- err := njson.Unmarshal(jsonData, &prep)
- if err != nil {
- return nil, err
- }
+ timestamp := gjson.Get(string(jsonData), "Timestamp").Int()
+ lat := gjson.Get(string(jsonData), "GPS.0").Float()
+ lon := gjson.Get(string(jsonData), "GPS.1").Float()
+ alt := gjson.Get(string(jsonData), "GPS.2").Float()
+ pitch := gjson.Get(string(jsonData), "orientation.0").Float()
+ roll := gjson.Get(string(jsonData), "orientation.1").Float()
+ yaw := gjson.Get(string(jsonData), "orientation.2").Float()
+
sd := &Sensordata{
- Timestamp: prep.Timestamp * int64(time.Millisecond),
+ SourceId: SOURCE_TCP,
+ Timestamp: timestamp * int64(time.Millisecond),
//Timestamp: time.Unix(0, prep.Timestamp * int64(time.Millisecond)),
- Position: prep.Position,
- Orientation: prep.Orientation,
+ Position: [3]float64{lat, lon, alt},
+ Orientation: [3]float64{pitch, roll, yaw},
}
return sd, nil
}
diff --git a/static/scripts/map.js b/static/scripts/map.js
index 8ee2a10..05456b1 100644
--- a/static/scripts/map.js
+++ b/static/scripts/map.js
@@ -40,17 +40,17 @@ map.on('load', function () {
});
// setup the viewport
- map.jumpTo({ 'center': [9.19640999, 49.12283027], 'zoom': 15 });
+ map.jumpTo({ 'center': [9.19640999, 49.12283027], 'zoom': 14 });
map.setPitch(30);
// on a regular basis, add more coordinates from the saved list and update the map
//var i = 0;
//var timer = window.setInterval(, 10);
-
})
-function updateMap (coordinates) {
+function updateMap (long, lat) {
+ let coordinates = [long, lat]
empty.features[0].geometry.coordinates.push(coordinates);
map.getSource('route').setData(empty);
map.panTo(coordinates);
diff --git a/static/scripts/websocket.js b/static/scripts/websocket.js
index d8f2bb4..57ab2f0 100644
--- a/static/scripts/websocket.js
+++ b/static/scripts/websocket.js
@@ -37,10 +37,10 @@ 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)
- console.log(evt.data)
+ //console.log(evt.data)
console.log("JSON geparsed onmessage", dat)
- //console.log(dat.orientation)
- document.getElementById("gyroscope").style.transform = `rotateX(${-((dat.orientation[1]+90)%360)}deg) rotateY(${dat.orientation[0]}deg) rotateZ(${-dat.orientation[2]}deg)`
+ //console.log(dat.SOURCE_TCP.Orientation)
+ document.getElementById("gyroscope").style.transform = `rotateX(${-((dat.SOURCE_TCP.Orientation[1]+90)%360)}deg) rotateY(${dat.SOURCE_TCP.Orientation[0]}deg) rotateZ(${-dat.SOURCE_TCP.Orientation[2]}deg)`
/*
@@ -54,8 +54,8 @@ window.addEventListener("load", function(evt) {
// }
// addData(orientation[0] / multiplier)
*/
- addData(dat.orientation[0])
- setData(dat.GPS[0], dat.GPS[1])
+ addData(dat.SOURCE_TCP.Orientation[0])
+ updateMap(dat.SOURCE_TCP.Position[1], dat.SOURCE_TCP.Position[0])
// addData(dat[0])
//document.getElementById("gyroscope").style.transform = `rotateX(${-orientation[0]}deg) rotateY(${orientation[1]}deg) rotateZ(${-orientation[2]}deg) translateZ(50px)`
}