adds ublox data to the map

This commit is contained in:
unknown 2020-12-09 11:15:35 +01:00
parent 074e4f49cc
commit c307f3a300
3 changed files with 51 additions and 16 deletions

11
.idea/workspace.xml generated
View File

@ -24,9 +24,6 @@
<component name="ChangeListManager">
<list default="true" id="99c957e4-aa42-481d-843d-3fbc901e0f79" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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/tcp_only/tcp_only.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/tcp_only/tcp_only.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/core/format.go" beforeDir="false" afterPath="$PROJECT_DIR$/core/format.go" 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$/static/scripts/websocket.js" beforeDir="false" afterPath="$PROJECT_DIR$/static/scripts/websocket.js" afterDir="false" />
</list>
@ -62,7 +59,9 @@
<component name="PropertiesComponent">
<property name="DefaultGoTemplateProperty" value="Go File" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="configurable.Global.GOPATH.is.expanded" value="true" />
<property name="configurable.Module.GOPATH.is.expanded" value="true" />
<property name="configurable.Project.GOPATH.is.expanded" value="true" />
@ -84,7 +83,7 @@
<recent name="$PROJECT_DIR$/serial" />
</key>
</component>
<component name="RunManager" selected="Go Build.go build git.timovolkmann.de/gyrogpsc/cmd/tcp_only">
<component name="RunManager" selected="Go Build.go build git.timovolkmann.de/gyrogpsc/cmd/server">
<configuration default="true" type="ArquillianJUnit" factoryName="" nameIsGenerated="true">
<option name="arquillianRunConfiguration">
<value>
@ -137,8 +136,8 @@
</configuration>
<recent_temporary>
<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="Go Build.go build git.timovolkmann.de/gyrogpsc/cmd/tcp_only" />
<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/serial" />
@ -153,6 +152,8 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1604516509922</updated>
<workItem from="1607463793011" duration="356000" />
<workItem from="1607504119613" duration="3584000" />
</task>
<task id="LOCAL-00001" summary="initial working version">
<created>1604747925521</created>

View File

@ -4,7 +4,19 @@ var map = new mapboxgl.Map({
style: 'mapbox://styles/mapbox/streets-v11',
zoom: 0
});
var empty = {
var emptyTCP = {
type: "FeatureCollection",
features: [
{
type: "Feature",
geometry: {
type: "LineString",
coordinates: []
}
}]
}
var emptySERIAL = {
type: "FeatureCollection",
features: [
{
@ -26,12 +38,13 @@ map.on('load', function () {
// add it to the map
//map.addSource('trace', { type: 'geojson', data: data });
map.addSource('route', { 'type': 'geojson', 'data': empty })
map.addSource('routeTCP', { 'type': 'geojson', 'data': emptyTCP })
map.addSource('routeSERIAL', { 'type': 'geojson', 'data': emptySERIAL })
map.addLayer({
'id': 'route',
'id': 'routeTCP',
'type': 'line',
'source': 'route',
'source': 'routeTCP',
'paint': {
'line-color': 'yellow',
'line-opacity': 0.75,
@ -39,8 +52,20 @@ map.on('load', function () {
}
});
map.addLayer({
'id': 'routeSERIAL',
'type': 'line',
'source': 'routeSERIAL',
'paint': {
'line-color': 'blue',
'line-opacity': 0.75,
'line-width': 5
}
});
// setup the viewport
map.jumpTo({ 'center': [9.19640999, 49.12283027], 'zoom': 14 });
map.jumpTo({ 'center': [9.19640999, 49.12283027], 'zoom': 17 });
map.setPitch(30);
// on a regular basis, add more coordinates from the saved list and update the map
@ -49,9 +74,15 @@ map.on('load', function () {
})
function updateMap (long, lat) {
let coordinates = [long, lat]
empty.features[0].geometry.coordinates.push(coordinates);
map.getSource('route').setData(empty);
map.panTo(coordinates);
function updateMapTCP (long, lat) {
//let coordinates = [long, lat]
emptyTCP.features[0].geometry.coordinates.push([long, lat]);
map.getSource('routeTCP').setData(emptyTCP);
map.panTo([long, lat]);
}
function updateMapSERIAL (long, lat) {
emptySERIAL.features[0].geometry.coordinates.push([long, lat]);
map.getSource('routeSERIAL').setData(emptySERIAL);
//map.panTo([long, lat]);
}

View File

@ -55,7 +55,10 @@ window.addEventListener("load", function(evt) {
// addData(orientation[0] / multiplier)
*/
addData(dat.SOURCE_TCP.Orientation[0])
updateMap(dat.SOURCE_TCP.Position[1], dat.SOURCE_TCP.Position[0])
updateMapTCP(dat.SOURCE_TCP.Position[1], dat.SOURCE_TCP.Position[0])
updateMapSERIAL(dat.SOURCE_SERIAL.Position[1], dat.SOURCE_SERIAL.Position[0])
//updateMap(dat.SOURCE_SERIAL.Position[1], dat.SOURCE_SERIAL.Position[0])
// addData(dat[0])
//document.getElementById("gyroscope").style.transform = `rotateX(${-orientation[0]}deg) rotateY(${orientation[1]}deg) rotateZ(${-orientation[2]}deg) translateZ(50px)`
}