read sensordata and update the map
This commit is contained in:
parent
580ac21ca0
commit
074e4f49cc
74
.idea/workspace.xml
generated
74
.idea/workspace.xml
generated
@ -23,30 +23,12 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="99c957e4-aa42-481d-843d-3fbc901e0f79" name="Default Changelist" comment="">
|
<list default="true" id="99c957e4-aa42-481d-843d-3fbc901e0f79" name="Default Changelist" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/.gitignore" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/cmd/tcp_only/tcp_only.go" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/core/collectors.go" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/core/dispatcher.go" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/core/format.go" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/core/http.go" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/core/pipeline.go" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/static/iphone.json" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/cmd/serial_only/serial_only.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/serial_only/serial_only.go" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmd/server/server.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/server/server.go" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/cmd/server/server.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/server/server.go" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/cmd/server_only/server_only.go" beforeDir="false" />
|
<change beforePath="$PROJECT_DIR$/cmd/tcp_only/tcp_only.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/tcp_only/tcp_only.go" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/dispatcher/dispatcher.go" beforeDir="false" />
|
<change beforePath="$PROJECT_DIR$/core/format.go" beforeDir="false" afterPath="$PROJECT_DIR$/core/format.go" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ex_websocketMessage.json" beforeDir="false" afterPath="$PROJECT_DIR$/static/ex_websocketMessage.json" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/static/scripts/map.js" beforeDir="false" afterPath="$PROJECT_DIR$/static/scripts/map.js" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/static/scripts/websocket.js" beforeDir="false" afterPath="$PROJECT_DIR$/static/scripts/websocket.js" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/hyperimu.json" beforeDir="false" afterPath="$PROJECT_DIR$/static/hyperimu.json" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/static/index.html" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/net/net.go" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/serial_ubx/serial.go" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/ublox/decode.go" beforeDir="false" afterPath="$PROJECT_DIR$/ublox/decode.go" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/ublox/messages.go" beforeDir="false" afterPath="$PROJECT_DIR$/ublox/messages.go" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -58,6 +40,7 @@
|
|||||||
<list>
|
<list>
|
||||||
<option value="Go Application" />
|
<option value="Go Application" />
|
||||||
<option value="Go File" />
|
<option value="Go File" />
|
||||||
|
<option value="JavaScript File" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
@ -87,6 +70,9 @@
|
|||||||
<property name="go.sdk.automatically.set" value="true" />
|
<property name="go.sdk.automatically.set" value="true" />
|
||||||
<property name="go.tried.to.enable.integration.vgo.integrator" value="true" />
|
<property name="go.tried.to.enable.integration.vgo.integrator" value="true" />
|
||||||
<property name="last_opened_file_path" value="$USER_HOME$" />
|
<property name="last_opened_file_path" value="$USER_HOME$" />
|
||||||
|
<property name="project.structure.last.edited" value="Project" />
|
||||||
|
<property name="project.structure.proportion" value="0.0" />
|
||||||
|
<property name="project.structure.side.proportion" value="0.0" />
|
||||||
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
|
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
|
||||||
</component>
|
</component>
|
||||||
<component name="RecentsManager">
|
<component name="RecentsManager">
|
||||||
@ -98,7 +84,18 @@
|
|||||||
<recent name="$PROJECT_DIR$/serial" />
|
<recent name="$PROJECT_DIR$/serial" />
|
||||||
</key>
|
</key>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="Go Build.go build git.timovolkmann.de/gyrogpsc/cmd/serial_only">
|
<component name="RunManager" selected="Go Build.go build git.timovolkmann.de/gyrogpsc/cmd/tcp_only">
|
||||||
|
<configuration default="true" type="ArquillianJUnit" factoryName="" nameIsGenerated="true">
|
||||||
|
<option name="arquillianRunConfiguration">
|
||||||
|
<value>
|
||||||
|
<option name="containerStateName" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="TEST_OBJECT" value="class" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
<configuration name="go build git.timovolkmann.de/gyrogpsc/cmd/serial_only" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
|
<configuration name="go build git.timovolkmann.de/gyrogpsc/cmd/serial_only" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
|
||||||
<module name="gyrogpsc" />
|
<module name="gyrogpsc" />
|
||||||
<working_directory value="$PROJECT_DIR$" />
|
<working_directory value="$PROJECT_DIR$" />
|
||||||
@ -108,6 +105,24 @@
|
|||||||
<directory value="$PROJECT_DIR$" />
|
<directory value="$PROJECT_DIR$" />
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<configuration name="go build git.timovolkmann.de/gyrogpsc/cmd/server" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
|
||||||
|
<module name="gyrogpsc" />
|
||||||
|
<working_directory value="$PROJECT_DIR$" />
|
||||||
|
<kind value="PACKAGE" />
|
||||||
|
<filePath value="$PROJECT_DIR$/cmd/server/server.go" />
|
||||||
|
<package value="git.timovolkmann.de/gyrogpsc/cmd/server" />
|
||||||
|
<directory value="$PROJECT_DIR$" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<configuration name="go build git.timovolkmann.de/gyrogpsc/cmd/tcp_only" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
|
||||||
|
<module name="gyrogpsc" />
|
||||||
|
<working_directory value="$PROJECT_DIR$" />
|
||||||
|
<kind value="PACKAGE" />
|
||||||
|
<filePath value="$PROJECT_DIR$/cmd/tcp_only/tcp_only.go" />
|
||||||
|
<package value="git.timovolkmann.de/gyrogpsc/cmd/tcp_only" />
|
||||||
|
<directory value="$PROJECT_DIR$" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
<configuration name="go build git.timovolkmann.de/gyrogpsc/serial" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
|
<configuration name="go build git.timovolkmann.de/gyrogpsc/serial" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
|
||||||
<module name="gyrogpsc" />
|
<module name="gyrogpsc" />
|
||||||
<working_directory value="$PROJECT_DIR$" />
|
<working_directory value="$PROJECT_DIR$" />
|
||||||
@ -117,21 +132,16 @@
|
|||||||
<directory value="$PROJECT_DIR$" />
|
<directory value="$PROJECT_DIR$" />
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration name="go build server.go" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
|
<configuration name="index.html" type="JavascriptDebugType" temporary="true" nameIsGenerated="true" uri="http://localhost:63342/gyrogpsc/static/index.html" useBuiltInWebServerPort="true">
|
||||||
<module name="gyrogpsc" />
|
|
||||||
<working_directory value="$PROJECT_DIR$" />
|
|
||||||
<kind value="FILE" />
|
|
||||||
<filePath value="$PROJECT_DIR$/server.go" />
|
|
||||||
<directory value="$PROJECT_DIR$" />
|
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
<recent_temporary>
|
<recent_temporary>
|
||||||
<list>
|
<list>
|
||||||
|
<item itemvalue="Go Build.go build git.timovolkmann.de/gyrogpsc/cmd/tcp_only" />
|
||||||
|
<item itemvalue="Go Build.go build git.timovolkmann.de/gyrogpsc/cmd/server" />
|
||||||
|
<item itemvalue="JavaScript Debug.index.html" />
|
||||||
<item itemvalue="Go Build.go build git.timovolkmann.de/gyrogpsc/cmd/serial_only" />
|
<item itemvalue="Go Build.go build git.timovolkmann.de/gyrogpsc/cmd/serial_only" />
|
||||||
<item itemvalue="Go Build.go build git.timovolkmann.de/gyrogpsc/serial" />
|
<item itemvalue="Go Build.go build git.timovolkmann.de/gyrogpsc/serial" />
|
||||||
<item itemvalue="Go Build.go build server.go" />
|
|
||||||
<item itemvalue="Go Build.go build server.go" />
|
|
||||||
<item itemvalue="Go Build.go build git.timovolkmann.de/gyrogpsc/serial" />
|
|
||||||
</list>
|
</list>
|
||||||
</recent_temporary>
|
</recent_temporary>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
TCP_PORT = ":3010"
|
TCP_PORT = ":3010"
|
||||||
HTTP_PORT = ":3011"
|
HTTP_PORT = ":3011"
|
||||||
SERIAL_PORT = "/dev/tty.usbmodem14201"
|
SERIAL_PORT = "COM4"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"git.timovolkmann.de/gyrogpsc/core"
|
"git.timovolkmann.de/gyrogpsc/core"
|
||||||
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -10,9 +11,13 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
log.Println("setup dispatcher")
|
||||||
dispatcher := core.NewDispatcher()
|
dispatcher := core.NewDispatcher()
|
||||||
processor := core.NewPipeline(dispatcher, 20, 10000)
|
log.Println("initialize processing pipeline")
|
||||||
|
processor := core.NewPipeline(dispatcher, 50, 494)
|
||||||
|
processor.Run()
|
||||||
collectRoutines(processor)
|
collectRoutines(processor)
|
||||||
|
log.Println("start http server")
|
||||||
core.HttpListenAndServe(dispatcher, HTTP_PORT)
|
core.HttpListenAndServe(dispatcher, HTTP_PORT)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,8 +7,6 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"math"
|
"math"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/m7shapan/njson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
/*{
|
/*{
|
||||||
@ -159,20 +157,20 @@ func convertIPhoneSensorLog(jsonData []byte) (*Sensordata, error) {
|
|||||||
|
|
||||||
|
|
||||||
func convertAndroidHyperImu(jsonData []byte) (*Sensordata, error) {
|
func convertAndroidHyperImu(jsonData []byte) (*Sensordata, error) {
|
||||||
prep := struct {
|
timestamp := gjson.Get(string(jsonData), "Timestamp").Int()
|
||||||
Timestamp int64 `njson:"Timestamp"`
|
lat := gjson.Get(string(jsonData), "GPS.0").Float()
|
||||||
Position [3]float64 `njson:"GPS"`
|
lon := gjson.Get(string(jsonData), "GPS.1").Float()
|
||||||
Orientation [3]float64 `njson:"orientation"`
|
alt := gjson.Get(string(jsonData), "GPS.2").Float()
|
||||||
}{}
|
pitch := gjson.Get(string(jsonData), "orientation.0").Float()
|
||||||
err := njson.Unmarshal(jsonData, &prep)
|
roll := gjson.Get(string(jsonData), "orientation.1").Float()
|
||||||
if err != nil {
|
yaw := gjson.Get(string(jsonData), "orientation.2").Float()
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
sd := &Sensordata{
|
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)),
|
//Timestamp: time.Unix(0, prep.Timestamp * int64(time.Millisecond)),
|
||||||
Position: prep.Position,
|
Position: [3]float64{lat, lon, alt},
|
||||||
Orientation: prep.Orientation,
|
Orientation: [3]float64{pitch, roll, yaw},
|
||||||
}
|
}
|
||||||
return sd, nil
|
return sd, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,17 +40,17 @@ map.on('load', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// setup the viewport
|
// setup the viewport
|
||||||
map.jumpTo({ 'center': [9.19640999, 49.12283027], 'zoom': 15 });
|
map.jumpTo({ 'center': [9.19640999, 49.12283027], 'zoom': 14 });
|
||||||
map.setPitch(30);
|
map.setPitch(30);
|
||||||
|
|
||||||
// on a regular basis, add more coordinates from the saved list and update the map
|
// on a regular basis, add more coordinates from the saved list and update the map
|
||||||
//var i = 0;
|
//var i = 0;
|
||||||
//var timer = window.setInterval(, 10);
|
//var timer = window.setInterval(, 10);
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function updateMap (coordinates) {
|
function updateMap (long, lat) {
|
||||||
|
let coordinates = [long, lat]
|
||||||
empty.features[0].geometry.coordinates.push(coordinates);
|
empty.features[0].geometry.coordinates.push(coordinates);
|
||||||
map.getSource('route').setData(empty);
|
map.getSource('route').setData(empty);
|
||||||
map.panTo(coordinates);
|
map.panTo(coordinates);
|
||||||
|
|||||||
@ -37,10 +37,10 @@ window.addEventListener("load", function(evt) {
|
|||||||
// let dat = JSON.parse(evt.data)["lsm6dsm gyroscope"]
|
// let dat = JSON.parse(evt.data)["lsm6dsm gyroscope"]
|
||||||
//let dat = JSON.parse(evt.data)["lsm6ds3c gyroscope"]
|
//let dat = JSON.parse(evt.data)["lsm6ds3c gyroscope"]
|
||||||
let dat = JSON.parse(evt.data)
|
let dat = JSON.parse(evt.data)
|
||||||
console.log(evt.data)
|
//console.log(evt.data)
|
||||||
console.log("JSON geparsed onmessage", dat)
|
console.log("JSON geparsed onmessage", dat)
|
||||||
//console.log(dat.orientation)
|
//console.log(dat.SOURCE_TCP.Orientation)
|
||||||
document.getElementById("gyroscope").style.transform = `rotateX(${-((dat.orientation[1]+90)%360)}deg) rotateY(${dat.orientation[0]}deg) rotateZ(${-dat.orientation[2]}deg)`
|
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(orientation[0] / multiplier)
|
||||||
*/
|
*/
|
||||||
addData(dat.orientation[0])
|
addData(dat.SOURCE_TCP.Orientation[0])
|
||||||
setData(dat.GPS[0], dat.GPS[1])
|
updateMap(dat.SOURCE_TCP.Position[1], dat.SOURCE_TCP.Position[0])
|
||||||
// addData(dat[0])
|
// addData(dat[0])
|
||||||
//document.getElementById("gyroscope").style.transform = `rotateX(${-orientation[0]}deg) rotateY(${orientation[1]}deg) rotateZ(${-orientation[2]}deg) translateZ(50px)`
|
//document.getElementById("gyroscope").style.transform = `rotateX(${-orientation[0]}deg) rotateY(${orientation[1]}deg) rotateZ(${-orientation[2]}deg) translateZ(50px)`
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user