atualizacao gps
This commit is contained in:
parent
3667fa49c9
commit
4743f1947e
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -68,11 +68,15 @@ namespace AgroBase.Forms
|
|||
chromiumWebBrowser = new ChromiumWebBrowser(mapaService.MapaUrl);
|
||||
this.pnlMapa.Controls.Add(chromiumWebBrowser);
|
||||
chromiumWebBrowser.Dock = DockStyle.Fill;
|
||||
|
||||
InjectJavaScriptFunctionsAsync();
|
||||
|
||||
//tmrUpdate.Stop();
|
||||
}
|
||||
else if (!picLoading.Visible && GPSService.UltimaLeitura != null)
|
||||
{
|
||||
mapaService.AtualizarPosicaoMapaGPS(GPSService.UltimaLeitura.Latitude, GPSService.UltimaLeitura.Longitude);
|
||||
chromiumWebBrowser.Reload();
|
||||
//chromiumWebBrowser.Reload();
|
||||
|
||||
lblDatahora.Text = "Ultima Leitura: " + GPSService.UltimaLeitura.DataHora.ToString("dd/MM/yyyy HH:mm:ss");
|
||||
lblLatitude.Text = "Latitude: " + GPSService.UltimaLeitura.Latitude;
|
||||
|
|
@ -84,6 +88,45 @@ namespace AgroBase.Forms
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void InjectJavaScriptFunctionsAsync()
|
||||
{
|
||||
if (chromiumWebBrowser != null && chromiumWebBrowser.CanExecuteJavascriptInMainFrame)
|
||||
{
|
||||
string script = @"
|
||||
// Esta função será chamada para atualizar a posição do marcador
|
||||
function updateMarkerPosition(lat, lon) {
|
||||
// Acesse o mapa do Folium e atualize o marcador
|
||||
var map = window._leaflet_map; // Folium armazena o mapa na variável global _leaflet_map
|
||||
if (map) {
|
||||
var newLatLng = new L.LatLng(lat, lon);
|
||||
if (window.gpsMarker) {
|
||||
window.gpsMarker.setLatLng(newLatLng);
|
||||
} else {
|
||||
window.gpsMarker = L.marker(newLatLng).addTo(map);
|
||||
}
|
||||
map.panTo(newLatLng);
|
||||
}
|
||||
}
|
||||
|
||||
// Esta função busca a nova localização e atualiza o marcador
|
||||
function fetchAndUpdateMarker() {
|
||||
fetch('/marker_data')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
updateMarkerPosition(data.lat, data.lon);
|
||||
})
|
||||
.catch(error => console.error('Error fetching marker data:', error));
|
||||
}
|
||||
|
||||
// Defina um intervalo para atualizar o marcador regularmente
|
||||
setInterval(fetchAndUpdateMarker, 1000); // Atualiza a cada segundo
|
||||
";
|
||||
|
||||
chromiumWebBrowser.ExecuteScriptAsync(script);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,12 @@ def update_marker():
|
|||
last_known_location = (data['lat'], data['lon'])
|
||||
return jsonify({'message': 'Coordenadas atualizadas com sucesso!'}), 200
|
||||
|
||||
# Rota para obter as coordenadas do marcador
|
||||
@app.route('/get_marker')
|
||||
def get_marker():
|
||||
global last_known_location
|
||||
return jsonify(last_known_location)
|
||||
|
||||
if __name__ == '__main__':
|
||||
port = 5000 # Porta padrão
|
||||
if len(sys.argv) > 1:
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,62 +1,62 @@
|
|||
[
|
||||
{
|
||||
"timestamp": 1704472484.9266078,
|
||||
"angulo": -5.000644597558448,
|
||||
"distancia_esquerda": 433,
|
||||
"distancia_direita": 249
|
||||
"timestamp": 1706207157.286162,
|
||||
"angulo": 71.05021207288564,
|
||||
"distancia_esquerda": 0,
|
||||
"distancia_direita": 0
|
||||
},
|
||||
{
|
||||
"timestamp": 1704472484.9573126,
|
||||
"angulo": -5.3558250428552014,
|
||||
"distancia_esquerda": 435,
|
||||
"distancia_direita": 250
|
||||
"timestamp": 1706207157.3177145,
|
||||
"angulo": 70.54673441821694,
|
||||
"distancia_esquerda": 0,
|
||||
"distancia_direita": 0
|
||||
},
|
||||
{
|
||||
"timestamp": 1704472484.9890833,
|
||||
"angulo": -4.289153328818998,
|
||||
"distancia_esquerda": 424,
|
||||
"distancia_direita": 252
|
||||
"timestamp": 1706207157.3347442,
|
||||
"angulo": 70.54673441821694,
|
||||
"distancia_esquerda": 0,
|
||||
"distancia_direita": 0
|
||||
},
|
||||
{
|
||||
"timestamp": 1704472485.0372036,
|
||||
"angulo": -6.6544250460065655,
|
||||
"distancia_esquerda": 432,
|
||||
"distancia_direita": 264
|
||||
"timestamp": 1706207157.350775,
|
||||
"angulo": 70.35967000187458,
|
||||
"distancia_esquerda": 0,
|
||||
"distancia_direita": 0
|
||||
},
|
||||
{
|
||||
"timestamp": 1704472485.0718324,
|
||||
"angulo": -5.119082256336242,
|
||||
"distancia_esquerda": 431,
|
||||
"distancia_direita": 252
|
||||
"timestamp": 1706207157.3843591,
|
||||
"angulo": 70.7433948934613,
|
||||
"distancia_esquerda": 0,
|
||||
"distancia_direita": 0
|
||||
},
|
||||
{
|
||||
"timestamp": 1704472485.1011403,
|
||||
"angulo": -5.119082256336242,
|
||||
"distancia_esquerda": 432,
|
||||
"distancia_direita": 251
|
||||
"timestamp": 1706207157.4129052,
|
||||
"angulo": 71.39646382981618,
|
||||
"distancia_esquerda": 0,
|
||||
"distancia_direita": 0
|
||||
},
|
||||
{
|
||||
"timestamp": 1704472485.1334994,
|
||||
"angulo": -8.764100827877996,
|
||||
"distancia_esquerda": 449,
|
||||
"distancia_direita": 265
|
||||
"timestamp": 1706207157.4474494,
|
||||
"angulo": 70.31913432628744,
|
||||
"distancia_esquerda": 0,
|
||||
"distancia_direita": 0
|
||||
},
|
||||
{
|
||||
"timestamp": 1704472485.1670296,
|
||||
"angulo": -11.768288932020653,
|
||||
"distancia_esquerda": 463,
|
||||
"distancia_direita": 277
|
||||
"timestamp": 1706207157.5130808,
|
||||
"angulo": 70.1965576383513,
|
||||
"distancia_esquerda": 0,
|
||||
"distancia_direita": 0
|
||||
},
|
||||
{
|
||||
"timestamp": 1704472485.2005017,
|
||||
"angulo": -4.289153328818998,
|
||||
"distancia_esquerda": 426,
|
||||
"distancia_direita": 250
|
||||
"timestamp": 1706207157.5446432,
|
||||
"angulo": 71.24957569783066,
|
||||
"distancia_esquerda": 0,
|
||||
"distancia_direita": 0
|
||||
},
|
||||
{
|
||||
"timestamp": 1704472485.230556,
|
||||
"angulo": -5.710593137499643,
|
||||
"distancia_esquerda": 437,
|
||||
"distancia_direita": 251
|
||||
"timestamp": 1706207157.5737095,
|
||||
"angulo": 70.41346870851675,
|
||||
"distancia_esquerda": 0,
|
||||
"distancia_direita": 0
|
||||
}
|
||||
]
|
||||
|
|
@ -1,60 +1,60 @@
|
|||
[
|
||||
{
|
||||
"timestamp": 1705668456.3716004,
|
||||
"timestamp": 1706207234.1478736,
|
||||
"x_max": 640.0,
|
||||
"y_max": 480.0,
|
||||
"objetos": []
|
||||
},
|
||||
{
|
||||
"timestamp": 1705668456.403601,
|
||||
"timestamp": 1706207234.1804538,
|
||||
"x_max": 640.0,
|
||||
"y_max": 480.0,
|
||||
"objetos": []
|
||||
},
|
||||
{
|
||||
"timestamp": 1705668456.435601,
|
||||
"timestamp": 1706207234.2275376,
|
||||
"x_max": 640.0,
|
||||
"y_max": 480.0,
|
||||
"objetos": []
|
||||
},
|
||||
{
|
||||
"timestamp": 1705668456.467606,
|
||||
"timestamp": 1706207234.26012,
|
||||
"x_max": 640.0,
|
||||
"y_max": 480.0,
|
||||
"objetos": []
|
||||
},
|
||||
{
|
||||
"timestamp": 1705668456.49963,
|
||||
"timestamp": 1706207234.292677,
|
||||
"x_max": 640.0,
|
||||
"y_max": 480.0,
|
||||
"objetos": []
|
||||
},
|
||||
{
|
||||
"timestamp": 1705668456.5316322,
|
||||
"timestamp": 1706207234.324238,
|
||||
"x_max": 640.0,
|
||||
"y_max": 480.0,
|
||||
"objetos": []
|
||||
},
|
||||
{
|
||||
"timestamp": 1705668456.5636382,
|
||||
"timestamp": 1706207234.3568075,
|
||||
"x_max": 640.0,
|
||||
"y_max": 480.0,
|
||||
"objetos": []
|
||||
},
|
||||
{
|
||||
"timestamp": 1705668456.596145,
|
||||
"timestamp": 1706207234.3888829,
|
||||
"x_max": 640.0,
|
||||
"y_max": 480.0,
|
||||
"objetos": []
|
||||
},
|
||||
{
|
||||
"timestamp": 1705668456.6281466,
|
||||
"timestamp": 1706207234.4204524,
|
||||
"x_max": 640.0,
|
||||
"y_max": 480.0,
|
||||
"objetos": []
|
||||
},
|
||||
{
|
||||
"timestamp": 1705668456.6601517,
|
||||
"timestamp": 1706207234.4525228,
|
||||
"x_max": 640.0,
|
||||
"y_max": 480.0,
|
||||
"objetos": []
|
||||
|
|
|
|||
|
|
@ -23,6 +23,12 @@ def update_marker():
|
|||
last_known_location = (data['lat'], data['lon'])
|
||||
return jsonify({'message': 'Coordenadas atualizadas com sucesso!'}), 200
|
||||
|
||||
# Rota para obter as coordenadas do marcador
|
||||
@app.route('/get_marker')
|
||||
def get_marker():
|
||||
global last_known_location
|
||||
return jsonify(last_known_location)
|
||||
|
||||
if __name__ == '__main__':
|
||||
port = 5000 # Porta padrão
|
||||
if len(sys.argv) > 1:
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
{"Conectado":true,"Sensores":[{"LogGrafico":[],"ID":"TMVET","Prioridade":0,"Descricao":"Temperatura Motor Esquerdo Trás","Componente":411,"Aferir":false,"DelayAmostragem":200,"Inicializado":false,"Testando":false,"Funcoes":[12],"Parametros":[],"UnidadeMedida":null,"Leituras":[81.06],"ValorMinimo":-273.15,"ValorMaximo":91.13},{"LogGrafico":[],"ID":"TMVEF","Prioridade":0,"Descricao":"Temperatura Motor Esquerdo Frente","Componente":411,"Aferir":false,"DelayAmostragem":200,"Inicializado":false,"Testando":false,"Funcoes":[12],"Parametros":[],"UnidadeMedida":null,"Leituras":[88.94],"ValorMinimo":-273.15,"ValorMaximo":106.36},{"LogGrafico":[],"ID":"TMVDT","Prioridade":0,"Descricao":"Temperatura Motor Direito Trás","Componente":411,"Aferir":false,"DelayAmostragem":200,"Inicializado":false,"Testando":false,"Funcoes":[12],"Parametros":[],"UnidadeMedida":null,"Leituras":[77.52],"ValorMinimo":-273.15,"ValorMaximo":102.19},{"LogGrafico":[],"ID":"TMVDF","Prioridade":0,"Descricao":"Temperatura Motor Direito Frente","Componente":411,"Aferir":false,"DelayAmostragem":200,"Inicializado":false,"Testando":false,"Funcoes":[12],"Parametros":[],"UnidadeMedida":null,"Leituras":[82.86],"ValorMinimo":-273.15,"ValorMaximo":115.74},{"LogGrafico":[],"ID":"VBAT","Prioridade":20,"Descricao":"Tensão da bateria","Componente":112,"Aferir":true,"DelayAmostragem":500,"Inicializado":false,"Testando":false,"Funcoes":[28],"Parametros":[["V offset","002.60"],["R1","120000"],["R2","010000"]],"UnidadeMedida":null,"Leituras":[831.0,0.87,11.31],"ValorMinimo":0.0,"ValorMaximo":17391345664.0},{"LogGrafico":[],"ID":"ABAT","Prioridade":10,"Descricao":"Corrente da bateria","Componente":322,"Aferir":true,"DelayAmostragem":500,"Inicializado":false,"Testando":false,"Funcoes":[29],"Parametros":[["V offset","00.610"],["Sensibilidade","000.17"]],"UnidadeMedida":null,"Leituras":[871.0,0.7,0.54],"ValorMinimo":-0.79,"ValorMaximo":8.36},{"LogGrafico":[],"ID":"TBAT","Prioridade":5,"Descricao":"Temperatura da bateria","Componente":411,"Aferir":true,"DelayAmostragem":500,"Inicializado":false,"Testando":false,"Funcoes":[12],"Parametros":[],"UnidadeMedida":null,"Leituras":[31.15],"ValorMinimo":-273.15,"ValorMaximo":127.38}]}
|
||||
{"Conectado":false,"Sensores":[{"LogGrafico":[],"ID":"TMVET","Prioridade":0,"Descricao":"Temperatura Motor Esquerdo Trás","Componente":411,"Aferir":false,"DelayAmostragem":200,"Inicializado":false,"Testando":false,"Funcoes":[12],"Parametros":[],"UnidadeMedida":null,"Leituras":[81.06],"ValorMinimo":0.0,"ValorMaximo":0.0},{"LogGrafico":[],"ID":"TMVEF","Prioridade":0,"Descricao":"Temperatura Motor Esquerdo Frente","Componente":411,"Aferir":false,"DelayAmostragem":200,"Inicializado":false,"Testando":false,"Funcoes":[12],"Parametros":[],"UnidadeMedida":null,"Leituras":[88.94],"ValorMinimo":0.0,"ValorMaximo":0.0},{"LogGrafico":[],"ID":"TMVDT","Prioridade":0,"Descricao":"Temperatura Motor Direito Trás","Componente":411,"Aferir":false,"DelayAmostragem":200,"Inicializado":false,"Testando":false,"Funcoes":[12],"Parametros":[],"UnidadeMedida":null,"Leituras":[77.52],"ValorMinimo":0.0,"ValorMaximo":0.0},{"LogGrafico":[],"ID":"TMVDF","Prioridade":0,"Descricao":"Temperatura Motor Direito Frente","Componente":411,"Aferir":false,"DelayAmostragem":200,"Inicializado":false,"Testando":false,"Funcoes":[12],"Parametros":[],"UnidadeMedida":null,"Leituras":[82.86],"ValorMinimo":0.0,"ValorMaximo":0.0},{"LogGrafico":[],"ID":"VBAT","Prioridade":20,"Descricao":"Tensão da bateria","Componente":112,"Aferir":true,"DelayAmostragem":500,"Inicializado":false,"Testando":false,"Funcoes":[28],"Parametros":[["V offset","-00.90"],["R1","120000"],["R2","010000"]],"UnidadeMedida":null,"Leituras":[4095.0,3.23,42.0],"ValorMinimo":0.0,"ValorMaximo":0.0},{"LogGrafico":[],"ID":"ABAT","Prioridade":10,"Descricao":"Corrente da bateria","Componente":322,"Aferir":true,"DelayAmostragem":500,"Inicializado":false,"Testando":false,"Funcoes":[29],"Parametros":[["V offset","00.330"],["Sensibilidade","000.17"]],"UnidadeMedida":null,"Leituras":[798.0,0.64,1.84],"ValorMinimo":0.0,"ValorMaximo":0.0},{"LogGrafico":[],"ID":"TBAT","Prioridade":5,"Descricao":"Temperatura da bateria","Componente":411,"Aferir":true,"DelayAmostragem":500,"Inicializado":false,"Testando":false,"Funcoes":[12],"Parametros":[],"UnidadeMedida":null,"Leituras":[34.34],"ValorMinimo":0.0,"ValorMaximo":0.0}]}
|
||||
Binary file not shown.
Loading…
Reference in New Issue