ajuste no fluxo de trajetoria dinamica

This commit is contained in:
Diego Freitas 2024-12-20 16:19:47 -03:00
parent 58aeccaafe
commit 115edbb702
30 changed files with 743 additions and 511 deletions

Binary file not shown.

View File

@ -3,28 +3,24 @@
"WorkspaceRootPath": "C:\\ZendionINC\\agrobot_base\\AgroBase\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|c:\\zendioninc\\agrobot_base\\agrobase\\agrobase\\services\\serialservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\services\\serialservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|c:\\zendioninc\\agrobot_base\\agrobase\\agrobase\\models\\mapasmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\models\\mapasmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|c:\\zendioninc\\agrobot_base\\agrobase\\agrobase\\models\\operacoes\\operacaomodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\models\\operacoes\\operacaomodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|c:\\zendioninc\\agrobot_base\\agrobase\\agrobase\\models\\operacoes\\operacaomapagpsmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\models\\operacoes\\operacaomapagpsmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|C:\\ZendionINC\\agrobot_base\\AgroBase\\agrobase\\forms\\operacoes\\frmresultadosoperacao.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\forms\\operacoes\\frmresultadosoperacao.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|c:\\zendioninc\\agrobot_base\\agrobase\\agrobase\\forms\\frmsimulacaomapagps.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\forms\\frmsimulacaomapagps.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|c:\\zendioninc\\agrobot_base\\agrobase\\agrobase\\forms\\operacoes\\frmresultadosoperacao.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\forms\\operacoes\\frmresultadosoperacao.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|c:\\zendioninc\\agrobot_base\\agrobase\\agrobase\\forms\\frmsimulacaomapagps.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\forms\\frmsimulacaomapagps.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
},
{
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|c:\\zendioninc\\agrobot_base\\agrobase\\agrobase\\services\\bld300rservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\services\\bld300rservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|c:\\zendioninc\\agrobot_base\\agrobase\\agrobase\\services\\mks057dservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\services\\mks057dservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|c:\\zendioninc\\agrobot_base\\agrobase\\agrobase\\services\\loraservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\services\\loraservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
@ -34,84 +30,71 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 0,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "SerialService.cs",
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Services\\SerialService.cs",
"RelativeDocumentMoniker": "AgroBase\\Services\\SerialService.cs",
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Services\\SerialService.cs",
"RelativeToolTip": "AgroBase\\Services\\SerialService.cs",
"ViewState": "AQIAAB8AAAAAAAAAAAAswDICAABAAAAA",
"DocumentIndex": 1,
"Title": "OperacaoMapaGPSModel.cs",
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\Operacoes\\OperacaoMapaGPSModel.cs",
"RelativeDocumentMoniker": "AgroBase\\Models\\Operacoes\\OperacaoMapaGPSModel.cs",
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\Operacoes\\OperacaoMapaGPSModel.cs",
"RelativeToolTip": "AgroBase\\Models\\Operacoes\\OperacaoMapaGPSModel.cs",
"ViewState": "AQIAACUBAAAAAAAAAADwv94BAAAQAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-12-19T18:48:58.803Z",
"WhenOpened": "2024-12-20T17:02:32.094Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 5,
"Title": "MKS057DService.cs",
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Services\\MKS057DService.cs",
"RelativeDocumentMoniker": "AgroBase\\Services\\MKS057DService.cs",
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Services\\MKS057DService.cs",
"RelativeToolTip": "AgroBase\\Services\\MKS057DService.cs",
"ViewState": "AQIAACICAAAAAAAAAAAcwDYAAABDAAAA",
"DocumentIndex": 0,
"Title": "MapasModel.cs",
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\MapasModel.cs",
"RelativeDocumentMoniker": "AgroBase\\Models\\MapasModel.cs",
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\MapasModel.cs",
"RelativeToolTip": "AgroBase\\Models\\MapasModel.cs",
"ViewState": "AQIAALEDAAAAAAAAAAAQwMkDAAAUAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-12-19T18:34:37.033Z",
"WhenOpened": "2024-12-20T15:56:52.02Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "BLD300RService.cs",
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Services\\BLD300RService.cs",
"RelativeDocumentMoniker": "AgroBase\\Services\\BLD300RService.cs",
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Services\\BLD300RService.cs",
"RelativeToolTip": "AgroBase\\Services\\BLD300RService.cs",
"ViewState": "AQIAAAoAAAAAAAAAAAAiwM0AAAAxAAAA",
"Title": "LoRaService.cs",
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Services\\LoRaService.cs",
"RelativeDocumentMoniker": "AgroBase\\Services\\LoRaService.cs",
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Services\\LoRaService.cs",
"RelativeToolTip": "AgroBase\\Services\\LoRaService.cs",
"ViewState": "AQIAAOkAAAAAAAAAAAA8wDwBAAAgAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-12-19T18:32:13.222Z",
"WhenOpened": "2024-12-20T13:47:28.742Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "frmSimulacaoMapaGPS.cs",
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Forms\\frmSimulacaoMapaGPS.cs",
"RelativeDocumentMoniker": "AgroBase\\Forms\\frmSimulacaoMapaGPS.cs",
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Forms\\frmSimulacaoMapaGPS.cs",
"RelativeToolTip": "AgroBase\\Forms\\frmSimulacaoMapaGPS.cs",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-12-20T11:42:56.089Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "frmResultadosOperacao.cs [Design]",
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Forms\\Operacoes\\frmResultadosOperacao.cs",
"RelativeDocumentMoniker": "AgroBase\\Forms\\Operacoes\\frmResultadosOperacao.cs",
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Forms\\Operacoes\\frmResultadosOperacao.cs [Design]",
"RelativeToolTip": "AgroBase\\Forms\\Operacoes\\frmResultadosOperacao.cs [Design]",
"Title": "frmSimulacaoMapaGPS.cs [Design]",
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Forms\\frmSimulacaoMapaGPS.cs",
"RelativeDocumentMoniker": "AgroBase\\Forms\\frmSimulacaoMapaGPS.cs",
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Forms\\frmSimulacaoMapaGPS.cs [Design]",
"RelativeToolTip": "AgroBase\\Forms\\frmSimulacaoMapaGPS.cs [Design]",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-12-19T12:57:34.196Z",
"WhenOpened": "2024-12-20T12:52:20.933Z",
"EditorCaption": " [Design]"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "frmResultadosOperacao.cs",
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Forms\\Operacoes\\frmResultadosOperacao.cs",
"RelativeDocumentMoniker": "AgroBase\\Forms\\Operacoes\\frmResultadosOperacao.cs",
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Forms\\Operacoes\\frmResultadosOperacao.cs",
"RelativeToolTip": "AgroBase\\Forms\\Operacoes\\frmResultadosOperacao.cs",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAoDAAAzAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-12-18T19:37:53.993Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "OperacaoModel.cs",
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\Operacoes\\OperacaoModel.cs",
"RelativeDocumentMoniker": "AgroBase\\Models\\Operacoes\\OperacaoModel.cs",
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\Operacoes\\OperacaoModel.cs",
"RelativeToolTip": "AgroBase\\Models\\Operacoes\\OperacaoModel.cs",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAHEJAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-12-17T20:14:20.606Z",
"EditorCaption": ""
}
]
}

View File

@ -170,7 +170,7 @@ namespace AgroBase.Forms.Operacoes
}
bool atuadorAtivado = Variaveis.OperacaoEmAndamento.DispAtu.Dados.Conectado;
chbPulverizador.Checked = atuadorAtivado;
chbPulverizador.Enabled = atuadorAtivado;
if (!atuadorAtivado)
{
chbPulverizador.Checked = false;

View File

@ -32,6 +32,8 @@
this.pnlMapa = new System.Windows.Forms.Panel();
this.picLoading = new System.Windows.Forms.PictureBox();
this.pnlInformacoes = new System.Windows.Forms.Panel();
this.btnLimparRuas = new System.Windows.Forms.Button();
this.btnNovaRua = new System.Windows.Forms.Button();
this.btnGerarMapa = new System.Windows.Forms.Button();
this.lblOrientacao = new System.Windows.Forms.Label();
this.chbSalvar = new System.Windows.Forms.CheckBox();
@ -42,8 +44,8 @@
this.lblPrecisao = new System.Windows.Forms.Label();
this.lblLongitude = new System.Windows.Forms.Label();
this.lblLatitude = new System.Windows.Forms.Label();
this.btnNovaRua = new System.Windows.Forms.Button();
this.btnLimparRuas = new System.Windows.Forms.Button();
this.txtLatitude = new System.Windows.Forms.TextBox();
this.txtLongitude = new System.Windows.Forms.TextBox();
this.pnlMapa.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picLoading)).BeginInit();
this.pnlInformacoes.SuspendLayout();
@ -79,6 +81,8 @@
//
// pnlInformacoes
//
this.pnlInformacoes.Controls.Add(this.txtLongitude);
this.pnlInformacoes.Controls.Add(this.txtLatitude);
this.pnlInformacoes.Controls.Add(this.btnLimparRuas);
this.pnlInformacoes.Controls.Add(this.btnNovaRua);
this.pnlInformacoes.Controls.Add(this.btnGerarMapa);
@ -98,6 +102,26 @@
this.pnlInformacoes.Size = new System.Drawing.Size(1271, 46);
this.pnlInformacoes.TabIndex = 3;
//
// btnLimparRuas
//
this.btnLimparRuas.Location = new System.Drawing.Point(1108, 12);
this.btnLimparRuas.Name = "btnLimparRuas";
this.btnLimparRuas.Size = new System.Drawing.Size(75, 23);
this.btnLimparRuas.TabIndex = 12;
this.btnLimparRuas.Text = "Reiniciar";
this.btnLimparRuas.UseVisualStyleBackColor = true;
this.btnLimparRuas.Click += new System.EventHandler(this.btnLimparRuas_Click);
//
// btnNovaRua
//
this.btnNovaRua.Location = new System.Drawing.Point(1027, 12);
this.btnNovaRua.Name = "btnNovaRua";
this.btnNovaRua.Size = new System.Drawing.Size(75, 23);
this.btnNovaRua.TabIndex = 11;
this.btnNovaRua.Text = "Nova Rua";
this.btnNovaRua.UseVisualStyleBackColor = true;
this.btnNovaRua.Click += new System.EventHandler(this.btnNovaRua_Click);
//
// btnGerarMapa
//
this.btnGerarMapa.Location = new System.Drawing.Point(1189, 12);
@ -182,12 +206,12 @@
// lblLongitude
//
this.lblLongitude.AutoSize = true;
this.lblLongitude.Location = new System.Drawing.Point(131, 17);
this.lblLongitude.Location = new System.Drawing.Point(141, 17);
this.lblLongitude.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblLongitude.Name = "lblLongitude";
this.lblLongitude.Size = new System.Drawing.Size(66, 13);
this.lblLongitude.Size = new System.Drawing.Size(31, 13);
this.lblLongitude.TabIndex = 2;
this.lblLongitude.Text = "Longitude: 0";
this.lblLongitude.Text = "Long";
//
// lblLatitude
//
@ -195,29 +219,25 @@
this.lblLatitude.Location = new System.Drawing.Point(9, 17);
this.lblLatitude.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblLatitude.Name = "lblLatitude";
this.lblLatitude.Size = new System.Drawing.Size(57, 13);
this.lblLatitude.Size = new System.Drawing.Size(22, 13);
this.lblLatitude.TabIndex = 1;
this.lblLatitude.Text = "Latitude: 0";
this.lblLatitude.Text = "Lat";
//
// btnNovaRua
// txtLatitude
//
this.btnNovaRua.Location = new System.Drawing.Point(1027, 12);
this.btnNovaRua.Name = "btnNovaRua";
this.btnNovaRua.Size = new System.Drawing.Size(75, 23);
this.btnNovaRua.TabIndex = 11;
this.btnNovaRua.Text = "Nova Rua";
this.btnNovaRua.UseVisualStyleBackColor = true;
this.btnNovaRua.Click += new System.EventHandler(this.btnNovaRua_Click);
this.txtLatitude.Location = new System.Drawing.Point(36, 14);
this.txtLatitude.Name = "txtLatitude";
this.txtLatitude.ReadOnly = true;
this.txtLatitude.Size = new System.Drawing.Size(100, 20);
this.txtLatitude.TabIndex = 13;
//
// btnLimparRuas
// txtLongitude
//
this.btnLimparRuas.Location = new System.Drawing.Point(1108, 12);
this.btnLimparRuas.Name = "btnLimparRuas";
this.btnLimparRuas.Size = new System.Drawing.Size(75, 23);
this.btnLimparRuas.TabIndex = 12;
this.btnLimparRuas.Text = "Reiniciar";
this.btnLimparRuas.UseVisualStyleBackColor = true;
this.btnLimparRuas.Click += new System.EventHandler(this.btnLimparRuas_Click);
this.txtLongitude.Location = new System.Drawing.Point(177, 14);
this.txtLongitude.Name = "txtLongitude";
this.txtLongitude.ReadOnly = true;
this.txtLongitude.Size = new System.Drawing.Size(100, 20);
this.txtLongitude.TabIndex = 14;
//
// frmGPS
//
@ -256,5 +276,7 @@
private System.Windows.Forms.Button btnGerarMapa;
private System.Windows.Forms.Button btnNovaRua;
private System.Windows.Forms.Button btnLimparRuas;
private System.Windows.Forms.TextBox txtLongitude;
private System.Windows.Forms.TextBox txtLatitude;
}
}

View File

@ -43,8 +43,8 @@ namespace AgroBase.Forms
{
lblAltitude.Text = "Altitude: " + GPSService.UltimaLeitura.Altitude.ToString("0.0");
lblDatahora.Text = "Ultima Leitura: " + GPSService.UltimaLeitura.DataHora.ToString("HH:mm:ss");
lblLatitude.Text = "Latitude: " + GPSService.UltimaLeitura.Latitude.ToString();
lblLongitude.Text = "Longitude: " + GPSService.UltimaLeitura.Longitude.ToString();
txtLatitude.Text = GPSService.UltimaLeitura.Latitude.ToString();
txtLongitude.Text = GPSService.UltimaLeitura.Longitude.ToString();
lblPrecisao.Text = "Precisão: " + GPSService.UltimaLeitura.PrecisaoHorizontal.ToString();
lblSatelites.Text = "Satélites: " + GPSService.UltimaLeitura.NumeroSatelites.ToString();
lblVelocidade.Text = "Velocidade: " + GPSService.UltimaLeitura.Velocidade.ToString("0.00") + " km/h";

View File

@ -29,6 +29,13 @@
private void InitializeComponent()
{
this.pnlOpcoes = new System.Windows.Forms.Panel();
this.lblKd = new System.Windows.Forms.Label();
this.txtKd = new System.Windows.Forms.TextBox();
this.lblKi = new System.Windows.Forms.Label();
this.txtKi = new System.Windows.Forms.TextBox();
this.lblKp = new System.Windows.Forms.Label();
this.txtKp = new System.Windows.Forms.TextBox();
this.btnReiniciar = new System.Windows.Forms.Button();
this.lblQtdErro = new System.Windows.Forms.Label();
this.chbAutomatico = new System.Windows.Forms.CheckBox();
this.txtQtdErro = new System.Windows.Forms.TextBox();
@ -83,13 +90,6 @@
this.lblAproximando = new System.Windows.Forms.Label();
this.lblDistProx = new System.Windows.Forms.Label();
this.lblDistAnt = new System.Windows.Forms.Label();
this.btnReiniciar = new System.Windows.Forms.Button();
this.lblKp = new System.Windows.Forms.Label();
this.txtKp = new System.Windows.Forms.TextBox();
this.lblKi = new System.Windows.Forms.Label();
this.txtKi = new System.Windows.Forms.TextBox();
this.lblKd = new System.Windows.Forms.Label();
this.txtKd = new System.Windows.Forms.TextBox();
this.pnlOpcoes.SuspendLayout();
this.gpbSonar.SuspendLayout();
this.gpbGPS.SuspendLayout();
@ -128,6 +128,77 @@
this.pnlOpcoes.Size = new System.Drawing.Size(1379, 100);
this.pnlOpcoes.TabIndex = 0;
//
// lblKd
//
this.lblKd.AutoSize = true;
this.lblKd.Location = new System.Drawing.Point(1147, 57);
this.lblKd.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblKd.Name = "lblKd";
this.lblKd.Size = new System.Drawing.Size(20, 13);
this.lblKd.TabIndex = 37;
this.lblKd.Text = "Kd";
//
// txtKd
//
this.txtKd.Location = new System.Drawing.Point(1149, 72);
this.txtKd.Margin = new System.Windows.Forms.Padding(2);
this.txtKd.Name = "txtKd";
this.txtKd.Size = new System.Drawing.Size(54, 20);
this.txtKd.TabIndex = 36;
this.txtKd.Text = "1";
this.txtKd.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblKi
//
this.lblKi.AutoSize = true;
this.lblKi.Location = new System.Drawing.Point(1089, 56);
this.lblKi.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblKi.Name = "lblKi";
this.lblKi.Size = new System.Drawing.Size(16, 13);
this.lblKi.TabIndex = 35;
this.lblKi.Text = "Ki";
//
// txtKi
//
this.txtKi.Location = new System.Drawing.Point(1091, 71);
this.txtKi.Margin = new System.Windows.Forms.Padding(2);
this.txtKi.Name = "txtKi";
this.txtKi.Size = new System.Drawing.Size(54, 20);
this.txtKi.TabIndex = 34;
this.txtKi.Text = "1";
this.txtKi.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblKp
//
this.lblKp.AutoSize = true;
this.lblKp.Location = new System.Drawing.Point(1031, 56);
this.lblKp.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblKp.Name = "lblKp";
this.lblKp.Size = new System.Drawing.Size(20, 13);
this.lblKp.TabIndex = 33;
this.lblKp.Text = "Kp";
//
// txtKp
//
this.txtKp.Location = new System.Drawing.Point(1033, 71);
this.txtKp.Margin = new System.Windows.Forms.Padding(2);
this.txtKp.Name = "txtKp";
this.txtKp.Size = new System.Drawing.Size(54, 20);
this.txtKp.TabIndex = 32;
this.txtKp.Text = "1";
this.txtKp.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// btnReiniciar
//
this.btnReiniciar.Location = new System.Drawing.Point(1231, 16);
this.btnReiniciar.Margin = new System.Windows.Forms.Padding(2);
this.btnReiniciar.Name = "btnReiniciar";
this.btnReiniciar.Size = new System.Drawing.Size(121, 20);
this.btnReiniciar.TabIndex = 31;
this.btnReiniciar.Text = "Reiniciar Simulação";
this.btnReiniciar.UseVisualStyleBackColor = true;
this.btnReiniciar.Click += new System.EventHandler(this.btnReiniciar_Click);
//
// lblQtdErro
//
this.lblQtdErro.AutoSize = true;
@ -532,7 +603,7 @@
this.txtLongitude.Name = "txtLongitude";
this.txtLongitude.Size = new System.Drawing.Size(135, 20);
this.txtLongitude.TabIndex = 15;
this.txtLongitude.Text = "-47,3815481565223";
this.txtLongitude.Text = "-47,3721381666667";
this.txtLongitude.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// txtLatitude
@ -542,7 +613,7 @@
this.txtLatitude.Name = "txtLatitude";
this.txtLatitude.Size = new System.Drawing.Size(135, 20);
this.txtLatitude.TabIndex = 14;
this.txtLatitude.Text = "-22,2131153491009";
this.txtLatitude.Text = "-22,1789853333333";
this.txtLatitude.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// btnIniciarGPS
@ -738,77 +809,6 @@
this.lblDistAnt.TabIndex = 24;
this.lblDistAnt.Text = "Distância Ponto Anterior: 0,00 m";
//
// btnReiniciar
//
this.btnReiniciar.Location = new System.Drawing.Point(1231, 16);
this.btnReiniciar.Margin = new System.Windows.Forms.Padding(2);
this.btnReiniciar.Name = "btnReiniciar";
this.btnReiniciar.Size = new System.Drawing.Size(121, 20);
this.btnReiniciar.TabIndex = 31;
this.btnReiniciar.Text = "Reiniciar Simulação";
this.btnReiniciar.UseVisualStyleBackColor = true;
this.btnReiniciar.Click += new System.EventHandler(this.btnReiniciar_Click);
//
// lblKp
//
this.lblKp.AutoSize = true;
this.lblKp.Location = new System.Drawing.Point(1031, 56);
this.lblKp.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblKp.Name = "lblKp";
this.lblKp.Size = new System.Drawing.Size(20, 13);
this.lblKp.TabIndex = 33;
this.lblKp.Text = "Kp";
//
// txtKp
//
this.txtKp.Location = new System.Drawing.Point(1033, 71);
this.txtKp.Margin = new System.Windows.Forms.Padding(2);
this.txtKp.Name = "txtKp";
this.txtKp.Size = new System.Drawing.Size(54, 20);
this.txtKp.TabIndex = 32;
this.txtKp.Text = "1";
this.txtKp.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblKi
//
this.lblKi.AutoSize = true;
this.lblKi.Location = new System.Drawing.Point(1089, 56);
this.lblKi.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblKi.Name = "lblKi";
this.lblKi.Size = new System.Drawing.Size(16, 13);
this.lblKi.TabIndex = 35;
this.lblKi.Text = "Ki";
//
// txtKi
//
this.txtKi.Location = new System.Drawing.Point(1091, 71);
this.txtKi.Margin = new System.Windows.Forms.Padding(2);
this.txtKi.Name = "txtKi";
this.txtKi.Size = new System.Drawing.Size(54, 20);
this.txtKi.TabIndex = 34;
this.txtKi.Text = "1";
this.txtKi.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblKd
//
this.lblKd.AutoSize = true;
this.lblKd.Location = new System.Drawing.Point(1147, 57);
this.lblKd.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblKd.Name = "lblKd";
this.lblKd.Size = new System.Drawing.Size(20, 13);
this.lblKd.TabIndex = 37;
this.lblKd.Text = "Kd";
//
// txtKd
//
this.txtKd.Location = new System.Drawing.Point(1149, 72);
this.txtKd.Margin = new System.Windows.Forms.Padding(2);
this.txtKd.Name = "txtKd";
this.txtKd.Size = new System.Drawing.Size(54, 20);
this.txtKd.TabIndex = 36;
this.txtKd.Text = "1";
this.txtKd.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// frmSimulacaoMapaGPS
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

View File

@ -156,7 +156,7 @@ namespace AgroBase.Models
{
get
{
return MargemLimiteEntradaRua * 3.0;
return MargemLimiteEntradaRua * 1.2;
}
}
public bool NaMargemEntradaRua
@ -768,12 +768,30 @@ namespace AgroBase.Models
GerandoTrajetoria = true;
double distanciaEntreRuas = DistanciaEntreRuas(TrajetoriaMapa) / 2.0;
double distanciaEntreRuas = 1.5;
try
{
distanciaEntreRuas = DistanciaEntreRuas(TrajetoriaMapa) / 2.0;
}
catch (Exception e)
{
}
List<GPSModel> Caminho = new List<GPSModel>();
List<List<GPSModel>> _TrajetoriaProjetada = new List<List<GPSModel>>();
int _extremoMaisProximoMapa = ExtremoMaisProximoMapa;
StatusCarroMapa statusCarro = Variaveis.OperacaoEmAndamento.OpMapaGPS.ReferencialRuaGPS.StatusAtual;
StatusCarroMapa statusCarro = StatusCarroMapa.Parado;
try
{
statusCarro = Variaveis.OperacaoEmAndamento.OpMapaGPS.ReferencialRuaGPS.StatusAtual;
}
catch (Exception ex)
{
}
StatusCarroMapa statusCarroAnterior = Variaveis.OperacaoEmAndamento.OpMapaGPS.ReferencialRuaGPS._EtapaAnterior;
DirecaoCarroRua direcaoRua = DirecaoCarroRua.Parado;
lock (TrajetoriaDinamica_Lock)
@ -873,6 +891,18 @@ namespace AgroBase.Models
{
PontoComparar = PrimeiroPonto;
}
GPSModel Ponto2Rua = RuaProjetada[1];
double anguloPontoComparar = GPSService.CalcularOrientacao(inicio, PontoComparar);
double anguloPonto2 = GPSService.CalcularOrientacao(inicio, Ponto2Rua);
double difAnguloPontoComparar = anguloProjetar - anguloPontoComparar;
double difAnguloPonto2 = anguloProjetar - anguloPonto2;
if (difAnguloPonto2 < difAnguloPontoComparar)
{
PontoComparar = Ponto2Rua;
RuaProjetada.RemoveAt(0);
}
}
// Se o robo estiver se afastando do ponto mais proximo, e estiver dentro da rua, e houver mais pontos na trajetoria
else if (!aproximando && dentroRua && RuaProjetada.Count() > (idxPontoMaisProximo + 1))
@ -939,15 +969,22 @@ namespace AgroBase.Models
if (!AddUltimoPonto)
{
Variaveis.OperacaoEmAndamento.OpMapaGPS.ReferencialRuaGPS.VerificaFimRuaAtual();
if (!Variaveis.OperacaoEmAndamento.OpMapaGPS.Concluido)
/*if (!Variaveis.OperacaoEmAndamento.OpMapaGPS.Concluido)
{
GerandoTrajetoria = false;
GerarTrajetoriaDinamica();
}
return;
return;*/
if (Variaveis.OperacaoEmAndamento.OpMapaGPS.Concluido)
{
break;
}
else
{
direcaoRua = direcaoRua == DirecaoCarroRua.Ida ? DirecaoCarroRua.Volta : DirecaoCarroRua.Ida;
}
}
if (AddUltimoPonto)
else
{
_caminho.Add(UltimoPonto);
}

View File

@ -475,6 +475,10 @@ namespace AgroBase.Models.Operacoes
get
{
bool emCurva = Variaveis.OperacaoEmAndamento.Mapa.IdxRuaAtual > 0;
if (emCurva)
{
}
bool proximoEntradaRua = Variaveis.OperacaoEmAndamento.Mapa.DistanciaAteProximoPonto <= (Variaveis.OperacaoEmAndamento.Mapa.DistanciaProjecaoRua * 5.0);
bool Manobrando = emCurva && proximoEntradaRua && EmManobra;

View File

@ -109,6 +109,7 @@ namespace AgroBase.Services
PenultimaLeitura.NumeroSatelites = UltimaLeitura.NumeroSatelites;
PenultimaLeitura.Velocidade = UltimaLeitura.Velocidade;
PenultimaLeitura.Orientacao = UltimaLeitura.Orientacao;
PenultimaLeitura.Momento = UltimaLeitura.Momento;
if (parts[2] != "" && parts[3] != "")
{
@ -122,6 +123,7 @@ namespace AgroBase.Services
UltimaLeitura.PrecisaoHorizontal = double.TryParse(parts[8], NumberStyles.Float, CultureInfo.InvariantCulture, out double hdop) ? hdop : 0;
UltimaLeitura.Altitude = ConvertToDouble(parts[9]);
UltimaLeitura.Orientacao = CalcularOrientacao(PenultimaLeitura, UltimaLeitura);
UltimaLeitura.Momento = DateTime.Now;
//APIService.AtualizarCoordenadasGPS(UltimaLeitura, APIService.GPS_IDcoordenadasRobo);
AtualizarCoordenadasGPS();

View File

@ -310,7 +310,14 @@ namespace AgroBase.Services
private static void VerificaProtocoloCompleto()
{
byte[] buffer = new byte[1];
_PortaLoRa.Read(buffer, 0, 1);
try
{
_PortaLoRa.Read(buffer, 0, 1);
}
catch (Exception ex)
{
}
byte caractere0 = buffer[0];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -25,7 +25,7 @@
<meta name="viewport" content="width=device-width,
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
#map_716b2f9a277e253156a3c81301c5d3fb {
#map_7ffdf7e9660fa074d0ac34b1006d7fa5 {
position: relative;
width: 100.0%;
height: 100.0%;
@ -39,14 +39,14 @@
<body>
<div class="folium-map" id="map_716b2f9a277e253156a3c81301c5d3fb" ></div>
<div class="folium-map" id="map_7ffdf7e9660fa074d0ac34b1006d7fa5" ></div>
</body>
<script>
var map_716b2f9a277e253156a3c81301c5d3fb = L.map(
"map_716b2f9a277e253156a3c81301c5d3fb",
var map_7ffdf7e9660fa074d0ac34b1006d7fa5 = L.map(
"map_7ffdf7e9660fa074d0ac34b1006d7fa5",
{
center: [0.0, 0.0],
crs: L.CRS.EPSG3857,
@ -59,6 +59,15 @@
var tile_layer_a25deb24eee870b8488b5f524118d864 = L.tileLayer(
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
{"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors", "detectRetina": false, "maxNativeZoom": 19, "maxZoom": 19, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
);
tile_layer_a25deb24eee870b8488b5f524118d864.addTo(map_7ffdf7e9660fa074d0ac34b1006d7fa5);
</script>
<script>
@ -78,7 +87,7 @@
}
trajeto_json_add({"features": []});
trajeto_json.addTo(map_716b2f9a277e253156a3c81301c5d3fb);
trajeto_json.addTo(map_7ffdf7e9660fa074d0ac34b1006d7fa5);
function adicionarGeometria(novaGeometria) {
trajeto_json.addData(novaGeometria);
@ -136,7 +145,7 @@
var marcadorDinamico = L.marker([0, 0], {
icon: customIcon
}).addTo(map_716b2f9a277e253156a3c81301c5d3fb);
}).addTo(map_7ffdf7e9660fa074d0ac34b1006d7fa5);
// Conectar ao broker MQTT
const client = mqtt.connect('ws://localhost:9001'); // Use wss para conexão segura
@ -174,7 +183,7 @@
marcadorDinamico.setRotationAngle(angulo);
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
map_716b2f9a277e253156a3c81301c5d3fb.setView(novaPosicao, map_716b2f9a277e253156a3c81301c5d3fb.getZoom());
map_7ffdf7e9660fa074d0ac34b1006d7fa5.setView(novaPosicao, map_7ffdf7e9660fa074d0ac34b1006d7fa5.getZoom());
});
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1,185 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"Id":"1","Name":"Projeto","Length":21.332976190943135,"Dist1":0.0,"Dist2":0.0},"geometry":{"id":"0","type":"LineString","coordinates":[[-47.381495333333334,-22.213068166666666],[-47.381469166666669,-22.213091333333335],[-47.38141825,-22.213137833333334],[-47.3813925,-22.213161666666668],[-47.381369666666664,-22.2131845]]}},{"type":"Feature","properties":{"Id":"2","Name":"Projeto","Length":24.045328359726675,"Dist1":0.0,"Dist2":0.0},"geometry":{"id":"1","type":"LineString","coordinates":[[-47.381340166666668,-22.213175666666668],[-47.381375333333331,-22.213137166666666],[-47.38140933333333,-22.213102666666668],[-47.381453666666665,-22.213058166666666],[-47.381496666666663,-22.213015666666667]]}}]}
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"Id": "1",
"Name": "Projeto",
"Length": 23.747936168010394,
"Dist1": 0,
"Dist2": 0
},
"geometry": {
"id": null,
"type": "LineString",
"coordinates": [
[
-47.372156833333335,
-22.178973166666665
],
[
-47.372197666666665,
-22.178952
],
[
-47.37225933333333,
-22.178925833333334
],
[
-47.372304666666665,
-22.178904666666668
],
[
-47.372361833333336,
-22.178876166666665
]
]
}
},
{
"type": "Feature",
"properties": {
"Id": "2",
"Name": "Projeto",
"Length": 23.891304512285874,
"Dist1": 0,
"Dist2": 0
},
"geometry": {
"id": null,
"type": "LineString",
"coordinates": [
[
-47.3723795,
-22.178883333333335
],
[
-47.372341166666665,
-22.178902666666666
],
[
-47.37229466666667,
-22.178925666666668
],
[
-47.372234666666664,
-22.1789555
],
[
-47.372178166666664,
-22.178984833333335
]
]
}
},
{
"type": "Feature",
"properties": {
"Id": "3",
"Name": "Projeto",
"Length": 23.838775018394195,
"Dist1": 0,
"Dist2": 0
},
"geometry": {
"id": null,
"type": "LineString",
"coordinates": [
[
-47.372177666666666,
-22.1790005
],
[
-47.3722225,
-22.178979166666668
],
[
-47.3722845,
-22.178951166666668
],
[
-47.3723305,
-22.17893116666667
],
[
-47.372374666666666,
-22.178911
]
]
}
},
{
"type": "Feature",
"properties": {
"Id": "4",
"Name": "Projeto",
"Length": 23.760554463105805,
"Dist1": 0,
"Dist2": 0
},
"geometry": {
"id": null,
"type": "LineString",
"coordinates": [
[
-47.37239483333333,
-22.178915166666666
],
[
-47.37235066666667,
-22.178935166666665
],
[
-47.37228916666667,
-22.178960833333335
],
[
-47.372228666666665,
-22.17898883333333
],
[
-47.372188,
-22.179009166666667
]
]
}
},
{
"type": "Feature",
"properties": {
"Id": "5",
"Name": "Projeto",
"Length": 23.888166936433826,
"Dist1": 0,
"Dist2": 0
},
"geometry": {
"id": null,
"type": "LineString",
"coordinates": [
[
-47.37217866666667,
-22.179029
],
[
-47.372224833333334,
-22.179004
],
[
-47.372283,
-22.178976166666665
],
[
-47.37232683333333,
-22.178956333333332
],
[
-47.37238383333333,
-22.1789295
]
]
}
}
]
}

View File

@ -25,7 +25,7 @@
<meta name="viewport" content="width=device-width,
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
#map_2a97fe143e1a57c5373ce602f0b267bf {
#map_9034793df63b374d39a4a61bf37fbd28 {
position: relative;
width: 100.0%;
height: 100.0%;
@ -39,16 +39,16 @@
<body>
<div class="folium-map" id="map_2a97fe143e1a57c5373ce602f0b267bf" ></div>
<div class="folium-map" id="map_9034793df63b374d39a4a61bf37fbd28" ></div>
</body>
<script>
var map_2a97fe143e1a57c5373ce602f0b267bf = L.map(
"map_2a97fe143e1a57c5373ce602f0b267bf",
var map_9034793df63b374d39a4a61bf37fbd28 = L.map(
"map_9034793df63b374d39a4a61bf37fbd28",
{
center: [-22.213100083333334, -47.38141841666666],
center: [-22.178952583333334, -47.37227583333333],
crs: L.CRS.EPSG3857,
zoom: 12,
zoomControl: true,
@ -60,225 +60,127 @@
var tile_layer_cec48e9f9320eca1ecf867866cacccd7 = L.tileLayer(
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
{"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors", "detectRetina": false, "maxNativeZoom": 19, "maxZoom": 19, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
);
tile_layer_cec48e9f9320eca1ecf867866cacccd7.addTo(map_2a97fe143e1a57c5373ce602f0b267bf);
var trajetosSelecionados = {};
var RuasSelecionadas = [];
function enviarSelecaoParaServidor() {
client.publish("selecao_ruas_mapa", JSON.stringify(RuasSelecionadas), function (err) {
/*if (!err) {
console.log("Mensagem publicada com sucesso");
} else {
console.error("Falha ao publicar mensagem", err);
}*/
});
}
function geo_json_02e5d4ac6c7aea7e6316347630612906_onEachFeature(feature, layer) {
function geo_json_22aa7538e788ea968ed1f94f70dc67a1_onEachFeature(feature, layer) {
layer.on({
click: function(e) {
// Verificar se o trajeto já está selecionado
if (trajetosSelecionados[feature.id]) {
// Se já está selecionado, reverta para a cor original e remova da seleção
e.target.setStyle({
color: '#3388ff' // Cor original
});
delete trajetosSelecionados[feature.id];
RuasSelecionadas.splice(RuasSelecionadas.indexOf(feature.id), 1);
} else {
// Se não está selecionado, mude a cor para indicar seleção e adicione ao objeto de seleção
e.target.setStyle({
color: 'blue' // Cor de seleção
});
trajetosSelecionados[feature.id] = true;
RuasSelecionadas.push(feature.id);
}
enviarSelecaoParaServidor();
}/*, mouseover: function(e) {
// Mostrar tooltip com o ID da geometria quando o mouse passar sobre a linha
var tooltip = L.tooltip({
direction: 'auto', // Leaflet determina a melhor posição
sticky: true // Faz com que o tooltip siga o cursor do mouse
})
.setContent('Rua ' + feature.id); // Define o conteúdo do tooltip
// Abre o tooltip na posição atual do mouse
var latLng = e.latlng;
tooltip.setLatLng(latLng);
layer.bindTooltip(tooltip).openTooltip(latLng);
}*/
});
};
var geo_json_02e5d4ac6c7aea7e6316347630612906 = L.geoJson(null, {
onEachFeature: geo_json_02e5d4ac6c7aea7e6316347630612906_onEachFeature,
var geo_json_22aa7538e788ea968ed1f94f70dc67a1 = L.geoJson(null, {
onEachFeature: geo_json_22aa7538e788ea968ed1f94f70dc67a1_onEachFeature,
});
function geo_json_02e5d4ac6c7aea7e6316347630612906_add (data) {
geo_json_02e5d4ac6c7aea7e6316347630612906
function geo_json_22aa7538e788ea968ed1f94f70dc67a1_add (data) {
geo_json_22aa7538e788ea968ed1f94f70dc67a1
.addData(data);
}
geo_json_02e5d4ac6c7aea7e6316347630612906_add({"features": [{"geometry": {"coordinates": [[-47.38149533333333, -22.213068166666666], [-47.38146916666667, -22.213091333333335], [-47.38141825, -22.213137833333334], [-47.3813925, -22.213161666666668], [-47.381369666666664, -22.2131845]], "id": "0", "type": "LineString"}, "id": 0, "properties": {"Dist1": 0.0, "Dist2": 0.0, "Id": "1", "Length": 21.332976190943135, "Name": "Projeto"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.38134016666667, -22.213175666666668], [-47.38137533333333, -22.213137166666666], [-47.38140933333333, -22.213102666666668], [-47.381453666666665, -22.213058166666666], [-47.38149666666666, -22.213015666666667]], "id": "1", "type": "LineString"}, "id": 1, "properties": {"Dist1": 0.0, "Dist2": 0.0, "Id": "2", "Length": 24.045328359726675, "Name": "Projeto"}, "type": "Feature"}], "type": "FeatureCollection"});
geo_json_22aa7538e788ea968ed1f94f70dc67a1_add({"features": [{"geometry": {"coordinates": [[-47.372156833333335, -22.178973166666665], [-47.372197666666665, -22.178952], [-47.37225933333333, -22.178925833333334], [-47.372304666666665, -22.178904666666668], [-47.372361833333336, -22.178876166666665]], "id": null, "type": "LineString"}, "id": 0, "properties": {"Dist1": 0, "Dist2": 0, "Id": "1", "Length": 23.747936168010394, "Name": "Projeto"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.3723795, -22.178883333333335], [-47.372341166666665, -22.178902666666666], [-47.37229466666667, -22.178925666666668], [-47.372234666666664, -22.1789555], [-47.372178166666664, -22.178984833333335]], "id": null, "type": "LineString"}, "id": 1, "properties": {"Dist1": 0, "Dist2": 0, "Id": "2", "Length": 23.891304512285874, "Name": "Projeto"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.372177666666666, -22.1790005], [-47.3722225, -22.178979166666668], [-47.3722845, -22.178951166666668], [-47.3723305, -22.17893116666667], [-47.372374666666666, -22.178911]], "id": null, "type": "LineString"}, "id": 2, "properties": {"Dist1": 0, "Dist2": 0, "Id": "3", "Length": 23.838775018394195, "Name": "Projeto"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.37239483333333, -22.178915166666666], [-47.37235066666667, -22.178935166666665], [-47.37228916666667, -22.178960833333335], [-47.372228666666665, -22.17898883333333], [-47.372188, -22.179009166666667]], "id": null, "type": "LineString"}, "id": 3, "properties": {"Dist1": 0, "Dist2": 0, "Id": "4", "Length": 23.760554463105805, "Name": "Projeto"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.37217866666667, -22.179029], [-47.372224833333334, -22.179004], [-47.372283, -22.178976166666665], [-47.37232683333333, -22.178956333333332], [-47.37238383333333, -22.1789295]], "id": null, "type": "LineString"}, "id": 4, "properties": {"Dist1": 0, "Dist2": 0, "Id": "5", "Length": 23.888166936433826, "Name": "Projeto"}, "type": "Feature"}], "type": "FeatureCollection"});
geo_json_02e5d4ac6c7aea7e6316347630612906.addTo(map_2a97fe143e1a57c5373ce602f0b267bf);
geo_json_22aa7538e788ea968ed1f94f70dc67a1.addTo(map_9034793df63b374d39a4a61bf37fbd28);
</script>
<script src="folium/mqtt.min.js"></script>
<script src="folium/leaflet.rotatedMarker.js"></script>
<script>
function trajeto_json_onEachFeature(feature, layer) {
layer.on({
});
};
var trajeto_json = L.geoJson(null, {
onEachFeature: trajeto_json_onEachFeature,
var marcadores = {};
var trajetos = {};
function criarMarcador(id, coordenadas, orientacao) {
var marcador;
if (id == 1) {
marcador = L.marker(coordenadas, {}).addTo(map_9034793df63b374d39a4a61bf37fbd28);
var icon = L.AwesomeMarkers.icon(
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
);
marcador.setIcon(icon);
}
else {
var customIcon = L.icon({
iconUrl: 'folium/images/position_marker.png',
iconSize: [32, 32],
iconAnchor: [16, 16],
popupAnchor: [0, -16]
});
marcador = L.marker(coordenadas, { icon: customIcon }).addTo(map_9034793df63b374d39a4a61bf37fbd28);
marcador.setRotationAngle(orientacao);
}
var popup = L.popup({"maxWidth": "100%"});
var html = $(`<div id="html_${id}" style="width: 100.0%; height: 100.0%;">Endereco: ${id}</div>`)[0];
popup.setContent(html);
marcador.bindPopup(popup)
marcadores[id] = marcador;
}
function criarTrajeto(id) {
trajetos[id] = L.geoJson(null, {
style: function(feature) {
return {color: 'red'};
return { color: 'red' };
}
}).addTo(map_9034793df63b374d39a4a61bf37fbd28);
}
function atualizarMarcador(id, coordenadas, orientacao) {
var marcador = marcadores[id];
if (marcador) {
marcador.setLatLng(coordenadas);
marcador.setRotationAngle(orientacao);
}
}
function atualizarTrajeto(id, coordenadas) {
var trajeto = trajetos[id];
if (trajeto) {
var feature = trajeto.toGeoJSON().features.find(f => f.id === id);
if (feature) {
var ultima = [0.0, 0.0];
if (feature.geometry.coordinates.length > 0) {
ultima = feature.geometry.coordinates[feature.geometry.coordinates.length - 1];
}
if (!saoCoordenadasIguais(ultima, coordenadas, 0.000001)) {
feature.geometry.coordinates.push(coordenadas);
trajeto.clearLayers();
trajeto.addData(feature);
}
}
}
);
function trajeto_json_add (data) {
trajeto_json.addData(data);
}
trajeto_json_add({"features": []});
trajeto_json.addTo(map_2a97fe143e1a57c5373ce602f0b267bf);
function adicionarGeometria(novaGeometria) {
trajeto_json.addData(novaGeometria);
}
function saoCoordenadasIguais(coord1, coord2, tolerancia) {
return Math.abs(coord1[0] - coord2[0]) < tolerancia && Math.abs(coord1[1] - coord2[1]) < tolerancia;
}
function adicionarCoordenada(idGeometria, novaCoordenada) {
var feature = trajeto_json.toGeoJSON().features.find(f => f.id === idGeometria);
if (feature) {
var ultima = [0.0,0.0];
if (feature.geometry.coordinates.length > 0) {
ultima = feature.geometry.coordinates[feature.geometry.coordinates.length - 1];
}
if (!saoCoordenadasIguais(ultima, novaCoordenada, 0.000001)) {
feature.geometry.coordinates.push(novaCoordenada);
var ft = feature;
trajeto_json.clearLayers();
trajeto_json.addData(ft);
}
function adicionarDados(id, coordenadas, orientacao, foco) {
if (!marcadores[id]) {
criarMarcador(id, coordenadas, orientacao);
criarTrajeto(id);
trajetos[id].addData({
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": []
},
"properties": {"Dist1": 0.0, "Dist2": 0.0, "Id": id, "Length": 0.0, "Name": "Trajeto"},
"id": id
});
} else {
console.log("Feature com ID " + idGeometria + " não encontrada.");
atualizarMarcador(id, coordenadas, orientacao);
atualizarTrajeto(id, [coordenadas[1], coordenadas[0]]);
}
if (foco) {
map_9034793df63b374d39a4a61bf37fbd28.setView(coordenadas, map_9034793df63b374d39a4a61bf37fbd28.getZoom());
}
}
adicionarGeometria({
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": []
},
"properties": {"Dist1": 0.0, "Dist2": 0.0, "Id": 1517, "Length": 21.724783283, "Name": "Projeto"},
"id": "Tj"
});
const client = mqtt.connect('ws://localhost:9001'); // Use wss para conexao segura
</script>
<script>
function trajeto_dinamico_json_onEachFeature(feature, layer) {
layer.on({
});
};
var trajeto_dinamico_json = L.geoJson(null, {
onEachFeature: trajeto_dinamico_json_onEachFeature,
style: function(feature) {
return {color: 'green'};
}
}
);
function trajeto_dinamico_json_add (data) {
trajeto_dinamico_json.addData(data);
}
trajeto_dinamico_json_add({"features": []});
trajeto_dinamico_json.addTo(map_2a97fe143e1a57c5373ce602f0b267bf);
function adicionarGeometriaDinamica(novaGeometria) {
trajeto_dinamico_json.addData(novaGeometria);
}
function adicionarCoordenadaDinamica(idGeometria, coordenadas) {
var feature = trajeto_dinamico_json.toGeoJSON().features.find(f => f.id === idGeometria);
if (feature) {
feature.geometry.coordinates = [];
coordenadas.forEach(x => feature.geometry.coordinates.push([x.longitude, x.latitude]));
var ft = feature;
trajeto_dinamico_json.clearLayers();
trajeto_dinamico_json.addData(ft);
} else {
console.log("Feature com ID " + idGeometria + " nao encontrada.");
}
}
adicionarGeometriaDinamica({
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": []
},
"properties": {"Dist1": 0.0, "Dist2": 0.0, "Id": 1517, "Length": 21.724783283, "Name": "Projeto"},
"id": "TjD"
});
</script>
<script src="folium/mqtt.min.js"></script>
<script src="folium/leaflet.rotatedMarker.js"></script>
<script>
let posicaoAtualEquipamento = {
lat: 0,
long: 0
};
let posicaoAtualBase = {
lat: 0,
long: 0
};
var customIcon = L.icon({
iconUrl: 'folium/images/position_marker.png',
iconSize: [32, 32],
iconAnchor: [16, 16],
popupAnchor: [0, -16]
});
var marcadorEquipamento = L.marker([0, 0], {
icon: customIcon
}).addTo(map_2a97fe143e1a57c5373ce602f0b267bf);
var marcadorBase = L.marker([0, 0], {}).addTo(map_2a97fe143e1a57c5373ce602f0b267bf);
var icon = L.AwesomeMarkers.icon(
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
);
marcadorBase.setIcon(icon);
// Conectar ao broker MQTT
const client = mqtt.connect('ws://localhost:9001'); // Use wss para conexão segura
// Quando conectado, inscreva-se no tópico desejado
client.on('connect', function () {
console.log('Conectado ao broker MQTT');
// Inscrever-se no tópico
client.subscribe('coordenadas_gps', function (err) {
if (!err) {
console.log("Inscricao bem-sucedida no topico");
@ -286,116 +188,21 @@
console.error("Falha na inscricao do topico", err);
}
});
client.subscribe('trajetoria_dinamica', function (err) {
if (!err) {
console.log("Inscricao bem-sucedida no topico");
} else {
console.error("Falha na inscricao do topico", err);
}
});
client.subscribe('selecao_ruas_mapa', function (err) {
if (!err) {
console.log("Inscricao bem-sucedida no topico");
} else {
console.error("Falha na inscricao do topico", err);
}
});
});
// Lidar com mensagens recebidas para o topico inscrito
client.on('message', function (topic, message) {
var dados = JSON.parse(message);
if (topic === "trajetoria_dinamica") {
adicionarCoordenadaDinamica("TjD", dados); // "Tj" é o ID da feature no GeoJSON
}
else if (topic === "coordenadas_gps") {
// A mensagem e um Buffer, converta para string ou objeto conforme necessario
//console.log(`Mensagem recebida no topico '${topic}': ${message.toString()}`);
if (topic === 'coordenadas_gps') {
var id = dados.id;
var novaLatitude = dados.latitude;
var novaLongitude = dados.longitude;
var novaPosicao = [novaLatitude, novaLongitude];
var orientacao = dados.orientacao;
var foco = dados.foco;
if (id == 1) {
marcadorBase.setLatLng(novaPosicao);
// Calcular angulo de rotacao
var angulo = dados.orientacao;
posicaoAtualBase.lat = novaPosicao[0];
posicaoAtualBase.long = novaPosicao[1];
// Rotacionar o marcador para o angulo calculado
marcadorBase.setRotationAngle(angulo);
}
else {
marcadorEquipamento.setLatLng(novaPosicao);
// Calcular angulo de rotacao
var angulo = dados.orientacao;
posicaoAtualEquipamento.lat = novaPosicao[0];
posicaoAtualEquipamento.long = novaPosicao[1];
// Rotacionar o marcador para o angulo calculado
marcadorEquipamento.setRotationAngle(angulo);
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
}
if (foco) {
map_2a97fe143e1a57c5373ce602f0b267bf.setView(novaPosicao, map_2a97fe143e1a57c5373ce602f0b267bf.getZoom());
}
adicionarDados(id, novaPosicao, orientacao, foco);
}
else if (topic === 'selecao_ruas_mapa') {
var selecionadas = dados;
if (selecionadas.length != RuasSelecionadas.length) {
atualizarSelecaoRuas(selecionadas);
}
}
});
// Função para atualizar a seleção das ruas e mudar a cor no mapa
function atualizarSelecaoRuas(selecionadas) {
selecionadas = JSON.parse(selecionadas);
RuasSelecionadas = Array.isArray(selecionadas) ? [...selecionadas] : [];
geo_json_02e5d4ac6c7aea7e6316347630612906.eachLayer(function (layer) {
if (RuasSelecionadas.includes(parseInt(layer.feature.id))) {
layer.setStyle({ color: 'blue' });
} else {
layer.setStyle({ color: '#3388ff' }); // Cor original
}
});
}
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {
// Converter latitudes e longitudes de graus para radianos
const latA = P1latitude * (Math.PI / 180.0);
const lonA = P1longitude * (Math.PI / 180.0);
const latB = P2latitude * (Math.PI / 180.0);
const lonB = P2longitude * (Math.PI / 180.0);
// Calcular a diferença de longitude
const deltaLon = lonB - lonA;
// Calcular a direção
const y = Math.sin(deltaLon) * Math.cos(latB);
const x = Math.cos(latA) * Math.sin(latB) - Math.sin(latA) * Math.cos(latB) * Math.cos(deltaLon);
const direcaoRadianos = Math.atan2(y, x);
// Converter a direção de radianos para graus
let direcaoGraus = direcaoRadianos * (180.0 / Math.PI);
// Normalizar a direção para que esteja no intervalo de 0 a 360 graus
direcaoGraus = (direcaoGraus + 360) % 360;
return direcaoGraus;
}
</script>
</html>