diff --git a/.idea/misc.xml b/.idea/misc.xml index 0e93714..37abf4b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - - + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..81e9551 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1604516509922 + + + 1604747925521 + + + 1604747940729 + + + 1604768327573 + + + 1604777752387 + + + 1605444355479 + + + + + + + + + + + + + + + + true + + \ No newline at end of file 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/index.html b/static/index.html index fa99f9b..0f6a538 100644 --- a/static/index.html +++ b/static/index.html @@ -3,89 +3,14 @@ - + + + + +