ajustes na trajetoria dinamica
This commit is contained in:
parent
fa935e9e31
commit
d8ff416274
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -3,16 +3,24 @@
|
||||||
"WorkspaceRootPath": "C:\\ZendionINC\\agrobot_base\\AgroBase\\",
|
"WorkspaceRootPath": "C:\\ZendionINC\\agrobot_base\\AgroBase\\",
|
||||||
"Documents": [
|
"Documents": [
|
||||||
{
|
{
|
||||||
"AbsoluteMoniker": "D:0:0:{59859C63-CD79-4CAA-B8DE-3C30B8DF05C2}|AgroMonitor\\AgroMonitor.csproj|c:\\zendioninc\\agrobot_base\\agrobase\\agromonitor\\forms\\frmajustesoperacao.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\\models\\trajetoriamapaoperacaomodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||||
"RelativeMoniker": "D:0:0:{59859C63-CD79-4CAA-B8DE-3C30B8DF05C2}|AgroMonitor\\AgroMonitor.csproj|solutionrelative:agromonitor\\forms\\frmajustesoperacao.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
|
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\models\\trajetoriamapaoperacaomodel.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}",
|
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|c:\\zendioninc\\agrobot_base\\agrobase\\agrobase\\models\\variaveis.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||||
|
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\models\\variaveis.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\\ihm\\frmdialogomapa.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||||
|
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\forms\\ihm\\frmdialogomapa.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}"
|
"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:{59859C63-CD79-4CAA-B8DE-3C30B8DF05C2}|AgroMonitor\\AgroMonitor.csproj|c:\\zendioninc\\agrobot_base\\agrobase\\agromonitor\\forms\\frmajustesoperacao.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:{59859C63-CD79-4CAA-B8DE-3C30B8DF05C2}|AgroMonitor\\AgroMonitor.csproj|solutionrelative:agromonitor\\forms\\frmajustesoperacao.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}"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"DocumentGroupContainers": [
|
"DocumentGroupContainers": [
|
||||||
|
|
@ -22,45 +30,72 @@
|
||||||
"DocumentGroups": [
|
"DocumentGroups": [
|
||||||
{
|
{
|
||||||
"DockedWidth": 200,
|
"DockedWidth": 200,
|
||||||
"SelectedChildIndex": 2,
|
"SelectedChildIndex": 4,
|
||||||
"Children": [
|
"Children": [
|
||||||
{
|
{
|
||||||
"$type": "Document",
|
"$type": "Document",
|
||||||
"DocumentIndex": 1,
|
"DocumentIndex": 1,
|
||||||
"Title": "OperacaoModel.cs",
|
"Title": "Variaveis.cs",
|
||||||
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\Operacoes\\OperacaoModel.cs",
|
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\Variaveis.cs",
|
||||||
"RelativeDocumentMoniker": "AgroBase\\Models\\Operacoes\\OperacaoModel.cs",
|
"RelativeDocumentMoniker": "AgroBase\\Models\\Variaveis.cs",
|
||||||
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\Operacoes\\OperacaoModel.cs",
|
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\Variaveis.cs",
|
||||||
"RelativeToolTip": "AgroBase\\Models\\Operacoes\\OperacaoModel.cs",
|
"RelativeToolTip": "AgroBase\\Models\\Variaveis.cs",
|
||||||
"ViewState": "AQIAALQBAAAAAAAAAAAqwAICAAAqAAAA",
|
"ViewState": "AQIAAAAAAAAAAAAAAAAAAD8AAAAAAAAA",
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||||
"WhenOpened": "2025-03-10T19:30:22.3Z",
|
"WhenOpened": "2025-03-14T14:04:39.077Z",
|
||||||
"EditorCaption": ""
|
"EditorCaption": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"$type": "Document",
|
"$type": "Document",
|
||||||
"DocumentIndex": 2,
|
"DocumentIndex": 2,
|
||||||
"Title": "frmAjustesOperacao.cs",
|
"Title": "frmDialogoMapa.cs",
|
||||||
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroMonitor\\Forms\\frmAjustesOperacao.cs",
|
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Forms\\IHM\\frmDialogoMapa.cs",
|
||||||
"RelativeDocumentMoniker": "AgroMonitor\\Forms\\frmAjustesOperacao.cs",
|
"RelativeDocumentMoniker": "AgroBase\\Forms\\IHM\\frmDialogoMapa.cs",
|
||||||
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroMonitor\\Forms\\frmAjustesOperacao.cs",
|
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Forms\\IHM\\frmDialogoMapa.cs",
|
||||||
"RelativeToolTip": "AgroMonitor\\Forms\\frmAjustesOperacao.cs",
|
"RelativeToolTip": "AgroBase\\Forms\\IHM\\frmDialogoMapa.cs",
|
||||||
"ViewState": "AQIAAA8AAAAAAAAAAAAlwDQAAAA2AAAA",
|
"ViewState": "AQIAAAAAAAAAAAAAAAAAAHoAAAAsAAAA",
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||||
"WhenOpened": "2025-03-10T19:30:12.426Z",
|
"WhenOpened": "2025-03-14T13:39:06.76Z",
|
||||||
|
"EditorCaption": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$type": "Document",
|
||||||
|
"DocumentIndex": 3,
|
||||||
|
"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": "AQIAAAMAAAAAAAAAAAAAALwEAAAIAAAA",
|
||||||
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||||
|
"WhenOpened": "2025-03-13T13:43:04.793Z",
|
||||||
|
"EditorCaption": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$type": "Document",
|
||||||
|
"DocumentIndex": 4,
|
||||||
|
"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": "AQIAAAAAAAAAAAAAAAAAABEAAAAIAAAA",
|
||||||
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||||
|
"WhenOpened": "2025-03-13T13:35:57.112Z",
|
||||||
"EditorCaption": ""
|
"EditorCaption": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"$type": "Document",
|
"$type": "Document",
|
||||||
"DocumentIndex": 0,
|
"DocumentIndex": 0,
|
||||||
"Title": "frmAjustesOperacao.cs [Design]",
|
"Title": "TrajetoriaMapaOperacaoModel.cs",
|
||||||
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroMonitor\\Forms\\frmAjustesOperacao.cs",
|
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\TrajetoriaMapaOperacaoModel.cs",
|
||||||
"RelativeDocumentMoniker": "AgroMonitor\\Forms\\frmAjustesOperacao.cs",
|
"RelativeDocumentMoniker": "AgroBase\\Models\\TrajetoriaMapaOperacaoModel.cs",
|
||||||
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroMonitor\\Forms\\frmAjustesOperacao.cs [Design]",
|
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\TrajetoriaMapaOperacaoModel.cs",
|
||||||
"RelativeToolTip": "AgroMonitor\\Forms\\frmAjustesOperacao.cs [Design]",
|
"RelativeToolTip": "AgroBase\\Models\\TrajetoriaMapaOperacaoModel.cs",
|
||||||
|
"ViewState": "AQIAAAAAAAAAAAAAAAAAALUAAAAtAAAA",
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||||
"WhenOpened": "2025-03-10T19:30:06.777Z",
|
"WhenOpened": "2025-03-11T19:51:48.72Z",
|
||||||
"EditorCaption": " [Design]"
|
"EditorCaption": ""
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,14 @@
|
||||||
this.lblModoOperacao = new System.Windows.Forms.Label();
|
this.lblModoOperacao = new System.Windows.Forms.Label();
|
||||||
this.txtModoOperacao = new System.Windows.Forms.TextBox();
|
this.txtModoOperacao = new System.Windows.Forms.TextBox();
|
||||||
this.pnlSensores = new System.Windows.Forms.Panel();
|
this.pnlSensores = new System.Windows.Forms.Panel();
|
||||||
|
this.txtStatusCarro = new System.Windows.Forms.TextBox();
|
||||||
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
|
this.txtMargemCorredor = new System.Windows.Forms.TextBox();
|
||||||
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
|
this.txtDentroCorredor = new System.Windows.Forms.TextBox();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.txtDistanciasEsqDir = new System.Windows.Forms.TextBox();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.lblPrecisaoGPS = new System.Windows.Forms.Label();
|
this.lblPrecisaoGPS = new System.Windows.Forms.Label();
|
||||||
this.lblCorrecaoGPS = new System.Windows.Forms.Label();
|
this.lblCorrecaoGPS = new System.Windows.Forms.Label();
|
||||||
this.btnCodFalha = new System.Windows.Forms.Button();
|
this.btnCodFalha = new System.Windows.Forms.Button();
|
||||||
|
|
@ -392,6 +400,14 @@
|
||||||
// pnlSensores
|
// pnlSensores
|
||||||
//
|
//
|
||||||
this.pnlSensores.AutoScroll = true;
|
this.pnlSensores.AutoScroll = true;
|
||||||
|
this.pnlSensores.Controls.Add(this.txtStatusCarro);
|
||||||
|
this.pnlSensores.Controls.Add(this.label4);
|
||||||
|
this.pnlSensores.Controls.Add(this.txtMargemCorredor);
|
||||||
|
this.pnlSensores.Controls.Add(this.label3);
|
||||||
|
this.pnlSensores.Controls.Add(this.txtDentroCorredor);
|
||||||
|
this.pnlSensores.Controls.Add(this.label2);
|
||||||
|
this.pnlSensores.Controls.Add(this.txtDistanciasEsqDir);
|
||||||
|
this.pnlSensores.Controls.Add(this.label1);
|
||||||
this.pnlSensores.Controls.Add(this.lblPrecisaoGPS);
|
this.pnlSensores.Controls.Add(this.lblPrecisaoGPS);
|
||||||
this.pnlSensores.Controls.Add(this.lblCorrecaoGPS);
|
this.pnlSensores.Controls.Add(this.lblCorrecaoGPS);
|
||||||
this.pnlSensores.Controls.Add(this.btnCodFalha);
|
this.pnlSensores.Controls.Add(this.btnCodFalha);
|
||||||
|
|
@ -433,6 +449,82 @@
|
||||||
this.pnlSensores.Size = new System.Drawing.Size(307, 497);
|
this.pnlSensores.Size = new System.Drawing.Size(307, 497);
|
||||||
this.pnlSensores.TabIndex = 32;
|
this.pnlSensores.TabIndex = 32;
|
||||||
//
|
//
|
||||||
|
// txtStatusCarro
|
||||||
|
//
|
||||||
|
this.txtStatusCarro.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
|
||||||
|
this.txtStatusCarro.Location = new System.Drawing.Point(167, 736);
|
||||||
|
this.txtStatusCarro.Name = "txtStatusCarro";
|
||||||
|
this.txtStatusCarro.ReadOnly = true;
|
||||||
|
this.txtStatusCarro.Size = new System.Drawing.Size(120, 26);
|
||||||
|
this.txtStatusCarro.TabIndex = 43;
|
||||||
|
this.txtStatusCarro.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
this.label4.AutoSize = true;
|
||||||
|
this.label4.Location = new System.Drawing.Point(6, 739);
|
||||||
|
this.label4.Name = "label4";
|
||||||
|
this.label4.Size = new System.Drawing.Size(99, 20);
|
||||||
|
this.label4.TabIndex = 42;
|
||||||
|
this.label4.Text = "Status Carro";
|
||||||
|
//
|
||||||
|
// txtMargemCorredor
|
||||||
|
//
|
||||||
|
this.txtMargemCorredor.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
|
||||||
|
this.txtMargemCorredor.Location = new System.Drawing.Point(167, 704);
|
||||||
|
this.txtMargemCorredor.Name = "txtMargemCorredor";
|
||||||
|
this.txtMargemCorredor.ReadOnly = true;
|
||||||
|
this.txtMargemCorredor.Size = new System.Drawing.Size(120, 26);
|
||||||
|
this.txtMargemCorredor.TabIndex = 41;
|
||||||
|
this.txtMargemCorredor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
this.label3.AutoSize = true;
|
||||||
|
this.label3.Location = new System.Drawing.Point(6, 707);
|
||||||
|
this.label3.Name = "label3";
|
||||||
|
this.label3.Size = new System.Drawing.Size(133, 20);
|
||||||
|
this.label3.TabIndex = 40;
|
||||||
|
this.label3.Text = "Margem Corredor";
|
||||||
|
//
|
||||||
|
// txtDentroCorredor
|
||||||
|
//
|
||||||
|
this.txtDentroCorredor.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
|
||||||
|
this.txtDentroCorredor.Location = new System.Drawing.Point(167, 672);
|
||||||
|
this.txtDentroCorredor.Name = "txtDentroCorredor";
|
||||||
|
this.txtDentroCorredor.ReadOnly = true;
|
||||||
|
this.txtDentroCorredor.Size = new System.Drawing.Size(120, 26);
|
||||||
|
this.txtDentroCorredor.TabIndex = 39;
|
||||||
|
this.txtDentroCorredor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(6, 675);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(124, 20);
|
||||||
|
this.label2.TabIndex = 38;
|
||||||
|
this.label2.Text = "Dentro Corredor";
|
||||||
|
//
|
||||||
|
// txtDistanciasEsqDir
|
||||||
|
//
|
||||||
|
this.txtDistanciasEsqDir.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F);
|
||||||
|
this.txtDistanciasEsqDir.Location = new System.Drawing.Point(164, 640);
|
||||||
|
this.txtDistanciasEsqDir.Name = "txtDistanciasEsqDir";
|
||||||
|
this.txtDistanciasEsqDir.ReadOnly = true;
|
||||||
|
this.txtDistanciasEsqDir.Size = new System.Drawing.Size(120, 26);
|
||||||
|
this.txtDistanciasEsqDir.TabIndex = 37;
|
||||||
|
this.txtDistanciasEsqDir.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(3, 643);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(147, 20);
|
||||||
|
this.label1.TabIndex = 36;
|
||||||
|
this.label1.Text = "Distancias Esq / Dir";
|
||||||
|
//
|
||||||
// lblPrecisaoGPS
|
// lblPrecisaoGPS
|
||||||
//
|
//
|
||||||
this.lblPrecisaoGPS.AutoSize = true;
|
this.lblPrecisaoGPS.AutoSize = true;
|
||||||
|
|
@ -774,5 +866,13 @@
|
||||||
private System.Windows.Forms.Panel pnlMapaDinamico;
|
private System.Windows.Forms.Panel pnlMapaDinamico;
|
||||||
private System.Windows.Forms.Label lblPrecisaoGPS;
|
private System.Windows.Forms.Label lblPrecisaoGPS;
|
||||||
private System.Windows.Forms.Label lblCorrecaoGPS;
|
private System.Windows.Forms.Label lblCorrecaoGPS;
|
||||||
|
private System.Windows.Forms.TextBox txtStatusCarro;
|
||||||
|
private System.Windows.Forms.Label label4;
|
||||||
|
private System.Windows.Forms.TextBox txtMargemCorredor;
|
||||||
|
private System.Windows.Forms.Label label3;
|
||||||
|
private System.Windows.Forms.TextBox txtDentroCorredor;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.TextBox txtDistanciasEsqDir;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -183,6 +183,11 @@ namespace AgroBase.Forms.IHM
|
||||||
|
|
||||||
tkbAnguloDirecional.Value = Math.Abs(Convert.ToInt32(_Sensoriamento.Controle.Angulo));
|
tkbAnguloDirecional.Value = Math.Abs(Convert.ToInt32(_Sensoriamento.Controle.Angulo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
txtDistanciasEsqDir.Text = _Sensoriamento.Trajetoria.DistanciaEsquerda.ToString("0.00") + " / " + _Sensoriamento.Trajetoria.DistanciaDireita.ToString("0.00");
|
||||||
|
txtDentroCorredor.Text = _Sensoriamento.Trajetoria.CorredorAtual.Dentro ? "Sim" : "Não";
|
||||||
|
txtMargemCorredor.Text = _Sensoriamento.Trajetoria.NaMargemDoCorredor ? "Sim" : "Não";
|
||||||
|
txtStatusCarro.Text = _Sensoriamento.Trajetoria.StatusCarro.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pnlOrientacao_Paint(object sender, PaintEventArgs e)
|
private void pnlOrientacao_Paint(object sender, PaintEventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,10 @@ namespace AgroBase.Forms.Operacoes
|
||||||
{
|
{
|
||||||
frmDialogo.Show();
|
frmDialogo.Show();
|
||||||
await frmDialogo.AtualizarRuasSelecionadas(ruasSelecionadas);
|
await frmDialogo.AtualizarRuasSelecionadas(ruasSelecionadas);
|
||||||
|
if (frmInstancial.DebugMode)
|
||||||
|
{
|
||||||
|
frmDialogo.AtualizarMapaDinamico();
|
||||||
|
}
|
||||||
frmDialogo.IniciarOperacao();
|
frmDialogo.IniciarOperacao();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -157,8 +161,6 @@ namespace AgroBase.Forms.Operacoes
|
||||||
{
|
{
|
||||||
(bool sucesso, List<string> ruas) = await Variaveis.OperacaoEmAndamento.CarregarParametrizacaoOperacao(frmDialogo.pnlMapa, frmDialogo.lblMapaCarregado, path);
|
(bool sucesso, List<string> ruas) = await Variaveis.OperacaoEmAndamento.CarregarParametrizacaoOperacao(frmDialogo.pnlMapa, frmDialogo.lblMapaCarregado, path);
|
||||||
|
|
||||||
await Task.Delay(1000);
|
|
||||||
|
|
||||||
ruasSelecionadas = ruas;
|
ruasSelecionadas = ruas;
|
||||||
|
|
||||||
foreach (var chb in fpnlInformacoes.Controls.OfType<CheckBox>())
|
foreach (var chb in fpnlInformacoes.Controls.OfType<CheckBox>())
|
||||||
|
|
@ -172,7 +174,7 @@ namespace AgroBase.Forms.Operacoes
|
||||||
txtDescricao.Text = Variaveis.OperacaoEmAndamento.Descricao;
|
txtDescricao.Text = Variaveis.OperacaoEmAndamento.Descricao;
|
||||||
txtCriadoEm.Text = new FileInfo(path).CreationTime.ToString("dd/MM/yyyy HH:mm");
|
txtCriadoEm.Text = new FileInfo(path).CreationTime.ToString("dd/MM/yyyy HH:mm");
|
||||||
txtRuasPercorrer.Text = Variaveis.OperacaoEmAndamento.Mapa.RuasPercorrer.Count().ToString();
|
txtRuasPercorrer.Text = Variaveis.OperacaoEmAndamento.Mapa.RuasPercorrer.Count().ToString();
|
||||||
txtDistanciaTotal.Text = Variaveis.OperacaoEmAndamento.Trajetoria.DistanciaTotal.ToString("0.00");
|
txtDistanciaTotal.Text = (Variaveis.OperacaoEmAndamento.Trajetoria?.DistanciaTotal ?? 0).ToString("0.00");
|
||||||
string tempo = Variaveis.OperacaoEmAndamento.Trajetoria?.TempoEstimadoOperacao;
|
string tempo = Variaveis.OperacaoEmAndamento.Trajetoria?.TempoEstimadoOperacao;
|
||||||
txtTempoEstimado.Text = tempo;
|
txtTempoEstimado.Text = tempo;
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -128,17 +128,17 @@ namespace AgroBase.Forms.Operacoes
|
||||||
{
|
{
|
||||||
OperacaoDadosModel data = JsonConvert.DeserializeObject<OperacaoDadosModel>(File.ReadAllText(ofd.FileName));
|
OperacaoDadosModel data = JsonConvert.DeserializeObject<OperacaoDadosModel>(File.ReadAllText(ofd.FileName));
|
||||||
|
|
||||||
LogsOperacao = JsonConvert.DeserializeObject<OperacaoSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.operacao)).ToList();
|
LogsOperacao = JsonConvert.DeserializeObject<OperacaoSensoriamentoLogModel[]>(OperacaoModel.DeserializarDadosOperacao(ofd.FileName, data.operacao)).ToList();
|
||||||
LogsGPS = JsonConvert.DeserializeObject<GPSModel[]>(DeserializarDadosOperacao(ofd.FileName, data.gps ?? Enums.T_Code.Gps.ToString())).ToList();
|
LogsGPS = JsonConvert.DeserializeObject<GPSModel[]>(OperacaoModel.DeserializarDadosOperacao(ofd.FileName, data.gps ?? Enums.T_Code.Gps.ToString())).ToList();
|
||||||
LogsDirecional = JsonConvert.DeserializeObject<DirSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.dir ?? Enums.T_Code.Dir.ToString())).ToList();
|
LogsDirecional = JsonConvert.DeserializeObject<DirSensoriamentoLogModel[]>(OperacaoModel.DeserializarDadosOperacao(ofd.FileName, data.dir ?? Enums.T_Code.Dir.ToString())).ToList();
|
||||||
LogsMovimentacao = JsonConvert.DeserializeObject<MovSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.mov ?? Enums.T_Code.Mov.ToString())).ToList();
|
LogsMovimentacao = JsonConvert.DeserializeObject<MovSensoriamentoLogModel[]>(OperacaoModel.DeserializarDadosOperacao(ofd.FileName, data.mov ?? Enums.T_Code.Mov.ToString())).ToList();
|
||||||
LogsAtuador = JsonConvert.DeserializeObject<AtuSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.atu ?? Enums.T_Code.Atu.ToString())).ToList();
|
LogsAtuador = JsonConvert.DeserializeObject<AtuSensoriamentoLogModel[]>(OperacaoModel.DeserializarDadosOperacao(ofd.FileName, data.atu ?? Enums.T_Code.Atu.ToString())).ToList();
|
||||||
LogsSensoriamento = JsonConvert.DeserializeObject<SensoriamentoMensagemJsonModel[]>(DeserializarDadosOperacao(ofd.FileName, data.sen ?? Enums.T_Code.Sen.ToString())).ToList();
|
LogsSensoriamento = JsonConvert.DeserializeObject<SensoriamentoMensagemJsonModel[]>(OperacaoModel.DeserializarDadosOperacao(ofd.FileName, data.sen ?? Enums.T_Code.Sen.ToString())).ToList();
|
||||||
LogsPzem = JsonConvert.DeserializeObject<PzmSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.pzm ?? Enums.T_Code.Pzm.ToString())).ToList();
|
LogsPzem = JsonConvert.DeserializeObject<PzmSensoriamentoLogModel[]>(OperacaoModel.DeserializarDadosOperacao(ofd.FileName, data.pzm ?? Enums.T_Code.Pzm.ToString())).ToList();
|
||||||
LogsWt901C = JsonConvert.DeserializeObject<WitSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.wit ?? Enums.T_Code.Wit.ToString())).ToList();
|
LogsWt901C = JsonConvert.DeserializeObject<WitSensoriamentoLogModel[]>(OperacaoModel.DeserializarDadosOperacao(ofd.FileName, data.wit ?? Enums.T_Code.Wit.ToString())).ToList();
|
||||||
LogsA05 = JsonConvert.DeserializeObject<UltrasonicA05Model[]>(DeserializarDadosOperacao(ofd.FileName, data.a05 ?? Enums.T_Code.A05.ToString())).ToList();
|
LogsA05 = JsonConvert.DeserializeObject<UltrasonicA05Model[]>(OperacaoModel.DeserializarDadosOperacao(ofd.FileName, data.a05 ?? Enums.T_Code.A05.ToString())).ToList();
|
||||||
//LogsKinect = JsonConvert.DeserializeObject<KinectModel[]>(DeserializarDadosOperacao(ofd.FileName, data.knt ?? Enums.T_Code.Knt.ToString())).ToList();
|
//LogsKinect = JsonConvert.DeserializeObject<KinectModel[]>(DeserializarDadosOperacao(ofd.FileName, data.knt ?? Enums.T_Code.Knt.ToString())).ToList();
|
||||||
LogsCam_Caminho = JsonConvert.DeserializeObject<CamCaminhoSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, data.cam_caminho)).ToList();
|
LogsCam_Caminho = JsonConvert.DeserializeObject<CamCaminhoSensoriamentoLogModel[]>(OperacaoModel.DeserializarDadosOperacao(ofd.FileName, data.cam_caminho)).ToList();
|
||||||
pathImagensSonarRGB = ofd.FileName.Replace("data.lgop", data.knt + "/rgb_");
|
pathImagensSonarRGB = ofd.FileName.Replace("data.lgop", data.knt + "/rgb_");
|
||||||
pathImagensMapaCalor = ofd.FileName.Replace("data.lgop", data.knt + "/heat_");
|
pathImagensMapaCalor = ofd.FileName.Replace("data.lgop", data.knt + "/heat_");
|
||||||
pathImagensCaminho = ofd.FileName.Replace("data.lgop", data.cam_caminho + "/");
|
pathImagensCaminho = ofd.FileName.Replace("data.lgop", data.cam_caminho + "/");
|
||||||
|
|
@ -149,7 +149,7 @@ namespace AgroBase.Forms.Operacoes
|
||||||
flwCameras.Controls.Clear();
|
flwCameras.Controls.Clear();
|
||||||
foreach (string cam in data.cam_solo)
|
foreach (string cam in data.cam_solo)
|
||||||
{
|
{
|
||||||
LogsCam_Solo.Add(JsonConvert.DeserializeObject<CamSoloSensoriamentoLogModel[]>(DeserializarDadosOperacao(ofd.FileName, cam)).ToList());
|
LogsCam_Solo.Add(JsonConvert.DeserializeObject<CamSoloSensoriamentoLogModel[]>(OperacaoModel.DeserializarDadosOperacao(ofd.FileName, cam)).ToList());
|
||||||
pathImagensSolo.Add(ofd.FileName.Replace("data.lgop", cam + "/"));
|
pathImagensSolo.Add(ofd.FileName.Replace("data.lgop", cam + "/"));
|
||||||
PictureBox pic = new PictureBox()
|
PictureBox pic = new PictureBox()
|
||||||
{
|
{
|
||||||
|
|
@ -879,17 +879,6 @@ namespace AgroBase.Forms.Operacoes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string DeserializarDadosOperacao(string caminho, string arquivo)
|
|
||||||
{
|
|
||||||
string opPath = caminho.Replace("data.lgop", arquivo) + ".json";
|
|
||||||
string opStr = File.ReadAllText(opPath);
|
|
||||||
if (!opStr.EndsWith("]"))
|
|
||||||
{
|
|
||||||
opStr += "]";
|
|
||||||
}
|
|
||||||
return opStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Bitmap CarregarImagemCamera(string Caminho)
|
private Bitmap CarregarImagemCamera(string Caminho)
|
||||||
{
|
{
|
||||||
string caminhoCompleto = Caminho + trbMomento.Value + ".jpg";
|
string caminhoCompleto = Caminho + trbMomento.Value + ".jpg";
|
||||||
|
|
@ -1011,6 +1000,10 @@ namespace AgroBase.Forms.Operacoes
|
||||||
txtVelocidadeControle.Text = ((Log.Controle?.PercentualVelocidadeSP ?? 0) / VariaveisEquipamento.RPM_Max_Roda * 100).ToString() + " rpm";
|
txtVelocidadeControle.Text = ((Log.Controle?.PercentualVelocidadeSP ?? 0) / VariaveisEquipamento.RPM_Max_Roda * 100).ToString() + " rpm";
|
||||||
txtErvasIdentificadas.Text = $"{totalAtuacoes}";
|
txtErvasIdentificadas.Text = $"{totalAtuacoes}";
|
||||||
|
|
||||||
|
txtDistanciaEsquerda.Text = Log.Trajetoria.DistanciaEsquerda.ToString("0.00");
|
||||||
|
txtDistanciaDireita.Text = Log.Trajetoria.DistanciaDireita.ToString("0.00");
|
||||||
|
txtNaMargem.Text = Log.Trajetoria.NaMargemDoCorredor ? "Sim" : "Não";
|
||||||
|
|
||||||
lblPercentualOperacao.Text = $"Operação {Log.Trajetoria.ProgressoTrajeto.ToString("0.00")}%";
|
lblPercentualOperacao.Text = $"Operação {Log.Trajetoria.ProgressoTrajeto.ToString("0.00")}%";
|
||||||
FuncoesGlobais.PreencheValorProgressBar(pgbPercentualOperacao, Log.Trajetoria.ProgressoTrajeto);
|
FuncoesGlobais.PreencheValorProgressBar(pgbPercentualOperacao, Log.Trajetoria.ProgressoTrajeto);
|
||||||
txtDistanciaPercorrida.Text = distanciaPercorrida.ToString("0.00") + " m / " + Log.Trajetoria.DistanciaTotal.ToString("0.00") + " m";
|
txtDistanciaPercorrida.Text = distanciaPercorrida.ToString("0.00") + " m / " + Log.Trajetoria.DistanciaTotal.ToString("0.00") + " m";
|
||||||
|
|
@ -1088,8 +1081,8 @@ namespace AgroBase.Forms.Operacoes
|
||||||
txtGPS_Data.Text = (Log?.DataHora ?? MomentoAtual).ToString("dd/MM HH:mm:ss");
|
txtGPS_Data.Text = (Log?.DataHora ?? MomentoAtual).ToString("dd/MM HH:mm:ss");
|
||||||
txtGPS_Latitude.Text = (Log?.Latitude ?? 0).ToString();
|
txtGPS_Latitude.Text = (Log?.Latitude ?? 0).ToString();
|
||||||
txtGPS_Longitude.Text = (Log?.Longitude ?? 0).ToString();
|
txtGPS_Longitude.Text = (Log?.Longitude ?? 0).ToString();
|
||||||
txtGPS_Orientacao.Text = (Log?.CursoVerdadeiro ?? 0).ToString();
|
txtGPS_Orientacao.Text = (Log?.QualidadeFix ?? Enums.TiposCorrecaoGPS.SemCorrecao).ToString();
|
||||||
txtGPS_Precisao.Text = (Log?.PrecisaoHorizontal ?? 0).ToString();
|
txtGPS_Precisao.Text = (Log?.PrecisaoCm ?? 0).ToString("0.00") + " cm";
|
||||||
txtGPS_Satelites.Text = (Log?.NumeroSatelites ?? 0).ToString();
|
txtGPS_Satelites.Text = (Log?.NumeroSatelites ?? 0).ToString();
|
||||||
txtGPS_Velocidade.Text = (Log?.Velocidade ?? 0).ToString("0.00") + " (" + ((Log?.Velocidade ?? 0) * GPSUtils.ConversaoNosKmh).ToString("0.00") + " km/h)";
|
txtGPS_Velocidade.Text = (Log?.Velocidade ?? 0).ToString("0.00") + " (" + ((Log?.Velocidade ?? 0) * GPSUtils.ConversaoNosKmh).ToString("0.00") + " km/h)";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,13 @@
|
||||||
{
|
{
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSimulacaoMapaGPS));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSimulacaoMapaGPS));
|
||||||
this.pnlOpcoes = new System.Windows.Forms.Panel();
|
this.pnlOpcoes = new System.Windows.Forms.Panel();
|
||||||
|
this.label7 = new System.Windows.Forms.Label();
|
||||||
|
this.txtErroTempoComando = new System.Windows.Forms.TextBox();
|
||||||
|
this.lblCarregado = new System.Windows.Forms.Label();
|
||||||
|
this.btnCarregarTrajetoria = new System.Windows.Forms.Button();
|
||||||
|
this.label6 = new System.Windows.Forms.Label();
|
||||||
|
this.txtTempoGPS = new System.Windows.Forms.TextBox();
|
||||||
|
this.btnCarregarOperacao = new System.Windows.Forms.Button();
|
||||||
this.label5 = new System.Windows.Forms.Label();
|
this.label5 = new System.Windows.Forms.Label();
|
||||||
this.cmbTipoControleDirecional = new System.Windows.Forms.ComboBox();
|
this.cmbTipoControleDirecional = new System.Windows.Forms.ComboBox();
|
||||||
this.lblKd = new System.Windows.Forms.Label();
|
this.lblKd = new System.Windows.Forms.Label();
|
||||||
|
|
@ -103,6 +110,13 @@
|
||||||
//
|
//
|
||||||
// pnlOpcoes
|
// pnlOpcoes
|
||||||
//
|
//
|
||||||
|
this.pnlOpcoes.Controls.Add(this.label7);
|
||||||
|
this.pnlOpcoes.Controls.Add(this.txtErroTempoComando);
|
||||||
|
this.pnlOpcoes.Controls.Add(this.lblCarregado);
|
||||||
|
this.pnlOpcoes.Controls.Add(this.btnCarregarTrajetoria);
|
||||||
|
this.pnlOpcoes.Controls.Add(this.label6);
|
||||||
|
this.pnlOpcoes.Controls.Add(this.txtTempoGPS);
|
||||||
|
this.pnlOpcoes.Controls.Add(this.btnCarregarOperacao);
|
||||||
this.pnlOpcoes.Controls.Add(this.label5);
|
this.pnlOpcoes.Controls.Add(this.label5);
|
||||||
this.pnlOpcoes.Controls.Add(this.cmbTipoControleDirecional);
|
this.pnlOpcoes.Controls.Add(this.cmbTipoControleDirecional);
|
||||||
this.pnlOpcoes.Controls.Add(this.lblKd);
|
this.pnlOpcoes.Controls.Add(this.lblKd);
|
||||||
|
|
@ -127,10 +141,83 @@
|
||||||
this.pnlOpcoes.Size = new System.Drawing.Size(1379, 100);
|
this.pnlOpcoes.Size = new System.Drawing.Size(1379, 100);
|
||||||
this.pnlOpcoes.TabIndex = 0;
|
this.pnlOpcoes.TabIndex = 0;
|
||||||
//
|
//
|
||||||
|
// label7
|
||||||
|
//
|
||||||
|
this.label7.AutoSize = true;
|
||||||
|
this.label7.Location = new System.Drawing.Point(1277, 20);
|
||||||
|
this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||||
|
this.label7.Name = "label7";
|
||||||
|
this.label7.Size = new System.Drawing.Size(76, 13);
|
||||||
|
this.label7.TabIndex = 45;
|
||||||
|
this.label7.Text = "Delay Controle";
|
||||||
|
//
|
||||||
|
// txtErroTempoComando
|
||||||
|
//
|
||||||
|
this.txtErroTempoComando.Location = new System.Drawing.Point(1279, 35);
|
||||||
|
this.txtErroTempoComando.Margin = new System.Windows.Forms.Padding(2);
|
||||||
|
this.txtErroTempoComando.Name = "txtErroTempoComando";
|
||||||
|
this.txtErroTempoComando.Size = new System.Drawing.Size(88, 20);
|
||||||
|
this.txtErroTempoComando.TabIndex = 44;
|
||||||
|
this.txtErroTempoComando.Text = "1";
|
||||||
|
this.txtErroTempoComando.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
|
//
|
||||||
|
// lblCarregado
|
||||||
|
//
|
||||||
|
this.lblCarregado.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.lblCarregado.AutoSize = true;
|
||||||
|
this.lblCarregado.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F);
|
||||||
|
this.lblCarregado.Location = new System.Drawing.Point(269, 82);
|
||||||
|
this.lblCarregado.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||||
|
this.lblCarregado.Name = "lblCarregado";
|
||||||
|
this.lblCarregado.Size = new System.Drawing.Size(53, 13);
|
||||||
|
this.lblCarregado.TabIndex = 43;
|
||||||
|
this.lblCarregado.Text = "Simulador";
|
||||||
|
//
|
||||||
|
// btnCarregarTrajetoria
|
||||||
|
//
|
||||||
|
this.btnCarregarTrajetoria.Location = new System.Drawing.Point(263, 13);
|
||||||
|
this.btnCarregarTrajetoria.Margin = new System.Windows.Forms.Padding(2);
|
||||||
|
this.btnCarregarTrajetoria.Name = "btnCarregarTrajetoria";
|
||||||
|
this.btnCarregarTrajetoria.Size = new System.Drawing.Size(121, 27);
|
||||||
|
this.btnCarregarTrajetoria.TabIndex = 43;
|
||||||
|
this.btnCarregarTrajetoria.Text = "Carregar Trajetória";
|
||||||
|
this.btnCarregarTrajetoria.UseVisualStyleBackColor = true;
|
||||||
|
this.btnCarregarTrajetoria.Click += new System.EventHandler(this.btnCarregarTrajetoria_Click);
|
||||||
|
//
|
||||||
|
// label6
|
||||||
|
//
|
||||||
|
this.label6.AutoSize = true;
|
||||||
|
this.label6.Location = new System.Drawing.Point(1276, 55);
|
||||||
|
this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||||
|
this.label6.Name = "label6";
|
||||||
|
this.label6.Size = new System.Drawing.Size(65, 13);
|
||||||
|
this.label6.TabIndex = 42;
|
||||||
|
this.label6.Text = "Tempo GPS";
|
||||||
|
//
|
||||||
|
// txtTempoGPS
|
||||||
|
//
|
||||||
|
this.txtTempoGPS.Location = new System.Drawing.Point(1279, 70);
|
||||||
|
this.txtTempoGPS.Name = "txtTempoGPS";
|
||||||
|
this.txtTempoGPS.Size = new System.Drawing.Size(88, 20);
|
||||||
|
this.txtTempoGPS.TabIndex = 41;
|
||||||
|
this.txtTempoGPS.Text = "200";
|
||||||
|
this.txtTempoGPS.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
|
//
|
||||||
|
// btnCarregarOperacao
|
||||||
|
//
|
||||||
|
this.btnCarregarOperacao.Location = new System.Drawing.Point(138, 13);
|
||||||
|
this.btnCarregarOperacao.Margin = new System.Windows.Forms.Padding(2);
|
||||||
|
this.btnCarregarOperacao.Name = "btnCarregarOperacao";
|
||||||
|
this.btnCarregarOperacao.Size = new System.Drawing.Size(121, 27);
|
||||||
|
this.btnCarregarOperacao.TabIndex = 40;
|
||||||
|
this.btnCarregarOperacao.Text = "Carregar Operação";
|
||||||
|
this.btnCarregarOperacao.UseVisualStyleBackColor = true;
|
||||||
|
this.btnCarregarOperacao.Click += new System.EventHandler(this.btnCarregarOperacao_Click);
|
||||||
|
//
|
||||||
// label5
|
// label5
|
||||||
//
|
//
|
||||||
this.label5.AutoSize = true;
|
this.label5.AutoSize = true;
|
||||||
this.label5.Location = new System.Drawing.Point(1099, 20);
|
this.label5.Location = new System.Drawing.Point(1145, 20);
|
||||||
this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||||
this.label5.Name = "label5";
|
this.label5.Name = "label5";
|
||||||
this.label5.Size = new System.Drawing.Size(120, 13);
|
this.label5.Size = new System.Drawing.Size(120, 13);
|
||||||
|
|
@ -141,7 +228,7 @@
|
||||||
//
|
//
|
||||||
this.cmbTipoControleDirecional.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.cmbTipoControleDirecional.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
this.cmbTipoControleDirecional.FormattingEnabled = true;
|
this.cmbTipoControleDirecional.FormattingEnabled = true;
|
||||||
this.cmbTipoControleDirecional.Location = new System.Drawing.Point(1103, 35);
|
this.cmbTipoControleDirecional.Location = new System.Drawing.Point(1149, 35);
|
||||||
this.cmbTipoControleDirecional.Name = "cmbTipoControleDirecional";
|
this.cmbTipoControleDirecional.Name = "cmbTipoControleDirecional";
|
||||||
this.cmbTipoControleDirecional.Size = new System.Drawing.Size(111, 21);
|
this.cmbTipoControleDirecional.Size = new System.Drawing.Size(111, 21);
|
||||||
this.cmbTipoControleDirecional.TabIndex = 38;
|
this.cmbTipoControleDirecional.TabIndex = 38;
|
||||||
|
|
@ -150,7 +237,7 @@
|
||||||
// lblKd
|
// lblKd
|
||||||
//
|
//
|
||||||
this.lblKd.AutoSize = true;
|
this.lblKd.AutoSize = true;
|
||||||
this.lblKd.Location = new System.Drawing.Point(1158, 57);
|
this.lblKd.Location = new System.Drawing.Point(1204, 57);
|
||||||
this.lblKd.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
this.lblKd.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||||
this.lblKd.Name = "lblKd";
|
this.lblKd.Name = "lblKd";
|
||||||
this.lblKd.Size = new System.Drawing.Size(20, 13);
|
this.lblKd.Size = new System.Drawing.Size(20, 13);
|
||||||
|
|
@ -159,7 +246,7 @@
|
||||||
//
|
//
|
||||||
// txtKd
|
// txtKd
|
||||||
//
|
//
|
||||||
this.txtKd.Location = new System.Drawing.Point(1160, 72);
|
this.txtKd.Location = new System.Drawing.Point(1206, 71);
|
||||||
this.txtKd.Margin = new System.Windows.Forms.Padding(2);
|
this.txtKd.Margin = new System.Windows.Forms.Padding(2);
|
||||||
this.txtKd.Name = "txtKd";
|
this.txtKd.Name = "txtKd";
|
||||||
this.txtKd.Size = new System.Drawing.Size(54, 20);
|
this.txtKd.Size = new System.Drawing.Size(54, 20);
|
||||||
|
|
@ -170,7 +257,7 @@
|
||||||
// lblKi
|
// lblKi
|
||||||
//
|
//
|
||||||
this.lblKi.AutoSize = true;
|
this.lblKi.AutoSize = true;
|
||||||
this.lblKi.Location = new System.Drawing.Point(1100, 56);
|
this.lblKi.Location = new System.Drawing.Point(1146, 56);
|
||||||
this.lblKi.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
this.lblKi.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||||
this.lblKi.Name = "lblKi";
|
this.lblKi.Name = "lblKi";
|
||||||
this.lblKi.Size = new System.Drawing.Size(16, 13);
|
this.lblKi.Size = new System.Drawing.Size(16, 13);
|
||||||
|
|
@ -179,7 +266,7 @@
|
||||||
//
|
//
|
||||||
// txtKi
|
// txtKi
|
||||||
//
|
//
|
||||||
this.txtKi.Location = new System.Drawing.Point(1102, 71);
|
this.txtKi.Location = new System.Drawing.Point(1148, 71);
|
||||||
this.txtKi.Margin = new System.Windows.Forms.Padding(2);
|
this.txtKi.Margin = new System.Windows.Forms.Padding(2);
|
||||||
this.txtKi.Name = "txtKi";
|
this.txtKi.Name = "txtKi";
|
||||||
this.txtKi.Size = new System.Drawing.Size(54, 20);
|
this.txtKi.Size = new System.Drawing.Size(54, 20);
|
||||||
|
|
@ -190,7 +277,7 @@
|
||||||
// lblKp
|
// lblKp
|
||||||
//
|
//
|
||||||
this.lblKp.AutoSize = true;
|
this.lblKp.AutoSize = true;
|
||||||
this.lblKp.Location = new System.Drawing.Point(1041, 56);
|
this.lblKp.Location = new System.Drawing.Point(1087, 56);
|
||||||
this.lblKp.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
this.lblKp.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||||
this.lblKp.Name = "lblKp";
|
this.lblKp.Name = "lblKp";
|
||||||
this.lblKp.Size = new System.Drawing.Size(20, 13);
|
this.lblKp.Size = new System.Drawing.Size(20, 13);
|
||||||
|
|
@ -199,7 +286,7 @@
|
||||||
//
|
//
|
||||||
// txtKp
|
// txtKp
|
||||||
//
|
//
|
||||||
this.txtKp.Location = new System.Drawing.Point(1044, 71);
|
this.txtKp.Location = new System.Drawing.Point(1090, 71);
|
||||||
this.txtKp.Margin = new System.Windows.Forms.Padding(2);
|
this.txtKp.Margin = new System.Windows.Forms.Padding(2);
|
||||||
this.txtKp.Name = "txtKp";
|
this.txtKp.Name = "txtKp";
|
||||||
this.txtKp.Size = new System.Drawing.Size(54, 20);
|
this.txtKp.Size = new System.Drawing.Size(54, 20);
|
||||||
|
|
@ -209,7 +296,7 @@
|
||||||
//
|
//
|
||||||
// btnReiniciar
|
// btnReiniciar
|
||||||
//
|
//
|
||||||
this.btnReiniciar.Location = new System.Drawing.Point(259, 13);
|
this.btnReiniciar.Location = new System.Drawing.Point(263, 44);
|
||||||
this.btnReiniciar.Margin = new System.Windows.Forms.Padding(2);
|
this.btnReiniciar.Margin = new System.Windows.Forms.Padding(2);
|
||||||
this.btnReiniciar.Name = "btnReiniciar";
|
this.btnReiniciar.Name = "btnReiniciar";
|
||||||
this.btnReiniciar.Size = new System.Drawing.Size(121, 27);
|
this.btnReiniciar.Size = new System.Drawing.Size(121, 27);
|
||||||
|
|
@ -221,7 +308,7 @@
|
||||||
// lblQtdErro
|
// lblQtdErro
|
||||||
//
|
//
|
||||||
this.lblQtdErro.AutoSize = true;
|
this.lblQtdErro.AutoSize = true;
|
||||||
this.lblQtdErro.Location = new System.Drawing.Point(1041, 20);
|
this.lblQtdErro.Location = new System.Drawing.Point(1087, 20);
|
||||||
this.lblQtdErro.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
this.lblQtdErro.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||||
this.lblQtdErro.Name = "lblQtdErro";
|
this.lblQtdErro.Name = "lblQtdErro";
|
||||||
this.lblQtdErro.Size = new System.Drawing.Size(45, 13);
|
this.lblQtdErro.Size = new System.Drawing.Size(45, 13);
|
||||||
|
|
@ -231,7 +318,7 @@
|
||||||
// chbAutomatico
|
// chbAutomatico
|
||||||
//
|
//
|
||||||
this.chbAutomatico.AutoSize = true;
|
this.chbAutomatico.AutoSize = true;
|
||||||
this.chbAutomatico.Location = new System.Drawing.Point(243, 62);
|
this.chbAutomatico.Location = new System.Drawing.Point(14, 80);
|
||||||
this.chbAutomatico.Margin = new System.Windows.Forms.Padding(2);
|
this.chbAutomatico.Margin = new System.Windows.Forms.Padding(2);
|
||||||
this.chbAutomatico.Name = "chbAutomatico";
|
this.chbAutomatico.Name = "chbAutomatico";
|
||||||
this.chbAutomatico.Size = new System.Drawing.Size(137, 17);
|
this.chbAutomatico.Size = new System.Drawing.Size(137, 17);
|
||||||
|
|
@ -242,7 +329,7 @@
|
||||||
//
|
//
|
||||||
// txtQtdErro
|
// txtQtdErro
|
||||||
//
|
//
|
||||||
this.txtQtdErro.Location = new System.Drawing.Point(1043, 35);
|
this.txtQtdErro.Location = new System.Drawing.Point(1089, 35);
|
||||||
this.txtQtdErro.Margin = new System.Windows.Forms.Padding(2);
|
this.txtQtdErro.Margin = new System.Windows.Forms.Padding(2);
|
||||||
this.txtQtdErro.Name = "txtQtdErro";
|
this.txtQtdErro.Name = "txtQtdErro";
|
||||||
this.txtQtdErro.Size = new System.Drawing.Size(54, 20);
|
this.txtQtdErro.Size = new System.Drawing.Size(54, 20);
|
||||||
|
|
@ -252,7 +339,7 @@
|
||||||
//
|
//
|
||||||
// btnAtualizarLeitura
|
// btnAtualizarLeitura
|
||||||
//
|
//
|
||||||
this.btnAtualizarLeitura.Location = new System.Drawing.Point(7, 56);
|
this.btnAtualizarLeitura.Location = new System.Drawing.Point(138, 44);
|
||||||
this.btnAtualizarLeitura.Margin = new System.Windows.Forms.Padding(2);
|
this.btnAtualizarLeitura.Margin = new System.Windows.Forms.Padding(2);
|
||||||
this.btnAtualizarLeitura.Name = "btnAtualizarLeitura";
|
this.btnAtualizarLeitura.Name = "btnAtualizarLeitura";
|
||||||
this.btnAtualizarLeitura.Size = new System.Drawing.Size(121, 27);
|
this.btnAtualizarLeitura.Size = new System.Drawing.Size(121, 27);
|
||||||
|
|
@ -263,7 +350,7 @@
|
||||||
//
|
//
|
||||||
// btnCarregarMapa
|
// btnCarregarMapa
|
||||||
//
|
//
|
||||||
this.btnCarregarMapa.Location = new System.Drawing.Point(7, 13);
|
this.btnCarregarMapa.Location = new System.Drawing.Point(13, 13);
|
||||||
this.btnCarregarMapa.Margin = new System.Windows.Forms.Padding(2);
|
this.btnCarregarMapa.Margin = new System.Windows.Forms.Padding(2);
|
||||||
this.btnCarregarMapa.Name = "btnCarregarMapa";
|
this.btnCarregarMapa.Name = "btnCarregarMapa";
|
||||||
this.btnCarregarMapa.Size = new System.Drawing.Size(121, 27);
|
this.btnCarregarMapa.Size = new System.Drawing.Size(121, 27);
|
||||||
|
|
@ -274,7 +361,7 @@
|
||||||
//
|
//
|
||||||
// btnIniciarSimulacao
|
// btnIniciarSimulacao
|
||||||
//
|
//
|
||||||
this.btnIniciarSimulacao.Location = new System.Drawing.Point(132, 13);
|
this.btnIniciarSimulacao.Location = new System.Drawing.Point(13, 44);
|
||||||
this.btnIniciarSimulacao.Margin = new System.Windows.Forms.Padding(2);
|
this.btnIniciarSimulacao.Margin = new System.Windows.Forms.Padding(2);
|
||||||
this.btnIniciarSimulacao.Name = "btnIniciarSimulacao";
|
this.btnIniciarSimulacao.Name = "btnIniciarSimulacao";
|
||||||
this.btnIniciarSimulacao.Size = new System.Drawing.Size(121, 27);
|
this.btnIniciarSimulacao.Size = new System.Drawing.Size(121, 27);
|
||||||
|
|
@ -294,7 +381,7 @@
|
||||||
this.gpbSonar.Controls.Add(this.txtDistanciaSonar);
|
this.gpbSonar.Controls.Add(this.txtDistanciaSonar);
|
||||||
this.gpbSonar.Controls.Add(this.lblAnguloI);
|
this.gpbSonar.Controls.Add(this.lblAnguloI);
|
||||||
this.gpbSonar.Controls.Add(this.txtAnguloInicial);
|
this.gpbSonar.Controls.Add(this.txtAnguloInicial);
|
||||||
this.gpbSonar.Location = new System.Drawing.Point(796, 2);
|
this.gpbSonar.Location = new System.Drawing.Point(851, 2);
|
||||||
this.gpbSonar.Margin = new System.Windows.Forms.Padding(2);
|
this.gpbSonar.Margin = new System.Windows.Forms.Padding(2);
|
||||||
this.gpbSonar.Name = "gpbSonar";
|
this.gpbSonar.Name = "gpbSonar";
|
||||||
this.gpbSonar.Padding = new System.Windows.Forms.Padding(2);
|
this.gpbSonar.Padding = new System.Windows.Forms.Padding(2);
|
||||||
|
|
@ -412,7 +499,7 @@
|
||||||
this.gpbGPS.Controls.Add(this.txtLongitude);
|
this.gpbGPS.Controls.Add(this.txtLongitude);
|
||||||
this.gpbGPS.Controls.Add(this.txtLatitude);
|
this.gpbGPS.Controls.Add(this.txtLatitude);
|
||||||
this.gpbGPS.Controls.Add(this.btnIniciarGPS);
|
this.gpbGPS.Controls.Add(this.btnIniciarGPS);
|
||||||
this.gpbGPS.Location = new System.Drawing.Point(389, 2);
|
this.gpbGPS.Location = new System.Drawing.Point(447, 2);
|
||||||
this.gpbGPS.Margin = new System.Windows.Forms.Padding(2);
|
this.gpbGPS.Margin = new System.Windows.Forms.Padding(2);
|
||||||
this.gpbGPS.Name = "gpbGPS";
|
this.gpbGPS.Name = "gpbGPS";
|
||||||
this.gpbGPS.Padding = new System.Windows.Forms.Padding(2);
|
this.gpbGPS.Padding = new System.Windows.Forms.Padding(2);
|
||||||
|
|
@ -544,7 +631,7 @@
|
||||||
this.txtLongitude.Name = "txtLongitude";
|
this.txtLongitude.Name = "txtLongitude";
|
||||||
this.txtLongitude.Size = new System.Drawing.Size(135, 20);
|
this.txtLongitude.Size = new System.Drawing.Size(135, 20);
|
||||||
this.txtLongitude.TabIndex = 15;
|
this.txtLongitude.TabIndex = 15;
|
||||||
this.txtLongitude.Text = "-47,3952849455";
|
this.txtLongitude.Text = "-47,395287179";
|
||||||
this.txtLongitude.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
this.txtLongitude.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
//
|
//
|
||||||
// txtLatitude
|
// txtLatitude
|
||||||
|
|
@ -554,7 +641,7 @@
|
||||||
this.txtLatitude.Name = "txtLatitude";
|
this.txtLatitude.Name = "txtLatitude";
|
||||||
this.txtLatitude.Size = new System.Drawing.Size(135, 20);
|
this.txtLatitude.Size = new System.Drawing.Size(135, 20);
|
||||||
this.txtLatitude.TabIndex = 14;
|
this.txtLatitude.TabIndex = 14;
|
||||||
this.txtLatitude.Text = "-22,1721529805";
|
this.txtLatitude.Text = "-22,1721627463333";
|
||||||
this.txtLatitude.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
this.txtLatitude.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
//
|
//
|
||||||
// btnIniciarGPS
|
// btnIniciarGPS
|
||||||
|
|
@ -975,5 +1062,12 @@
|
||||||
private System.Windows.Forms.Label lblTempoRestante;
|
private System.Windows.Forms.Label lblTempoRestante;
|
||||||
private System.Windows.Forms.Label lblPercentualRua;
|
private System.Windows.Forms.Label lblPercentualRua;
|
||||||
private System.Windows.Forms.Label lblPercentualOperacao;
|
private System.Windows.Forms.Label lblPercentualOperacao;
|
||||||
|
private System.Windows.Forms.Button btnCarregarOperacao;
|
||||||
|
private System.Windows.Forms.Label label6;
|
||||||
|
private System.Windows.Forms.TextBox txtTempoGPS;
|
||||||
|
private System.Windows.Forms.Button btnCarregarTrajetoria;
|
||||||
|
private System.Windows.Forms.Label lblCarregado;
|
||||||
|
private System.Windows.Forms.Label label7;
|
||||||
|
private System.Windows.Forms.TextBox txtErroTempoComando;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
using AgroBase.Models;
|
using AgroBase.Models;
|
||||||
using AgroBase.Services;
|
using AgroBase.Services;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
@ -16,7 +18,10 @@ namespace AgroBase.Forms
|
||||||
bool parar = false;
|
bool parar = false;
|
||||||
DateTime UltimaAtualizacaoControle = DateTime.MinValue;
|
DateTime UltimaAtualizacaoControle = DateTime.MinValue;
|
||||||
double tempoGps = (1000.0 / GPSService.TaxaAmostragemHz);
|
double tempoGps = (1000.0 / GPSService.TaxaAmostragemHz);
|
||||||
int ticksControle = GPSService.TaxaAmostragemHz;
|
int ticksControleMax = 0;
|
||||||
|
int ticksControle = 0;
|
||||||
|
List<GPSModel> passosOperacao = new List<GPSModel>();
|
||||||
|
int idxPassoOperacao = 0;
|
||||||
|
|
||||||
DateTime UltimaAtualizacaoGps = DateTime.MinValue;
|
DateTime UltimaAtualizacaoGps = DateTime.MinValue;
|
||||||
|
|
||||||
|
|
@ -46,6 +51,8 @@ namespace AgroBase.Forms
|
||||||
tmrLeitura = new AsyncTaskTimerModel("tmrLeitura", tmrLeitura_Tick, (int)tempoGps, this);
|
tmrLeitura = new AsyncTaskTimerModel("tmrLeitura", tmrLeitura_Tick, (int)tempoGps, this);
|
||||||
tmrLeitura.Start();
|
tmrLeitura.Start();
|
||||||
|
|
||||||
|
txtTempoGPS.Text = tempoGps.ToString();
|
||||||
|
|
||||||
Variaveis.OperacaoEmAndamento.Mapa = new MapasModel()
|
Variaveis.OperacaoEmAndamento.Mapa = new MapasModel()
|
||||||
{
|
{
|
||||||
pnlMapa = pnlMapa,
|
pnlMapa = pnlMapa,
|
||||||
|
|
@ -65,12 +72,21 @@ namespace AgroBase.Forms
|
||||||
|
|
||||||
private async Task tmrLeitura_Tick()
|
private async Task tmrLeitura_Tick()
|
||||||
{
|
{
|
||||||
|
int.TryParse(txtTempoGPS.Text, out int tempo);
|
||||||
|
if (tempo > 0)
|
||||||
|
{
|
||||||
|
tempoGps = tempo;
|
||||||
|
}
|
||||||
|
tmrLeitura.SetInterval((int)tempoGps);
|
||||||
|
ticksControleMax = (int)(Variaveis.OperacaoEmAndamento.Controle.TiposControle.First(x => x.Tipo == T_Code.Dir).DelayEnvioComando / tempoGps);
|
||||||
|
|
||||||
AtualizarDadosTela();
|
AtualizarDadosTela();
|
||||||
|
|
||||||
if (chbAutomatico.Checked)
|
if (chbAutomatico.Checked)
|
||||||
{
|
{
|
||||||
btnAcrescentarGPS_Click(btnAcrescentarGPS, new EventArgs());
|
btnAcrescentarGPS_Click(btnAcrescentarGPS, new EventArgs());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AtualizarDadosTela()
|
private void AtualizarDadosTela()
|
||||||
|
|
@ -182,43 +198,56 @@ namespace AgroBase.Forms
|
||||||
|
|
||||||
private void btnAcrescentarGPS_Click(object sender, EventArgs e)
|
private void btnAcrescentarGPS_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (Variaveis.OperacaoEmAndamento.StatusAtual == StatusOperacao.Concluido || Variaveis.OperacaoEmAndamento.StatusAtual == StatusOperacao.Aguardando)
|
GPSModel novaPosicao = new GPSModel();
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var ControleDir = Variaveis.OperacaoEmAndamento.Controle.TiposControle.FirstOrDefault(x => x.Tipo == T_Code.Dir);
|
|
||||||
double anguloControle = double.Parse(txtAnguloControle.Text);
|
|
||||||
|
|
||||||
bool atualizarAnguloControle = (ticksControle >= GPSService.TaxaAmostragemHz - 1) || (chbAutomatico.Checked && UltimaAtualizacaoControle < ControleDir.UltimoComando);
|
|
||||||
if (atualizarAnguloControle)
|
|
||||||
{
|
|
||||||
ticksControle = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ticksControle++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (atualizarAnguloControle)
|
|
||||||
{
|
|
||||||
btnCalcularAngulo_Click(new object(), new EventArgs());
|
|
||||||
UltimaAtualizacaoControle = ControleDir.UltimoComando;
|
|
||||||
anguloControle = double.Parse(txtAnguloControle.Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Obtém os parâmetros
|
|
||||||
double anguloAtual = double.Parse(txtAnguloGPS.Text);
|
|
||||||
double velocidadeMs = FuncoesMatematicas.CalculaVelocidadeMsPercentual(Variaveis.OperacaoEmAndamento.SimulacaoRpmControle);
|
double velocidadeMs = FuncoesMatematicas.CalculaVelocidadeMsPercentual(Variaveis.OperacaoEmAndamento.SimulacaoRpmControle);
|
||||||
double velocidade = FuncoesMatematicas.ConverteMsParaKmh(velocidadeMs);
|
double velocidade = FuncoesMatematicas.ConverteMsParaKmh(velocidadeMs);
|
||||||
|
|
||||||
TimeSpan tempoPassado =
|
if (passosOperacao.Count > 0 && Variaveis.OperacaoEmAndamento.Simulando)
|
||||||
!chbAutomatico.Checked || UltimaAtualizacaoGps == DateTime.MinValue ? // esta no modo manual
|
{
|
||||||
new TimeSpan((int)tempoGps * 10000) : // 1 tick do tempo gps
|
novaPosicao = passosOperacao[Math.Min(passosOperacao.Count - 1, idxPassoOperacao)];
|
||||||
DateTime.Now - UltimaAtualizacaoGps; // tempo decorrido entre ticks do timer de leitura
|
idxPassoOperacao++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Variaveis.OperacaoEmAndamento.StatusAtual == StatusOperacao.Concluido || Variaveis.OperacaoEmAndamento.StatusAtual == StatusOperacao.Aguardando)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Calcula a nova posicao do robo
|
var ControleDir = Variaveis.OperacaoEmAndamento.Controle.TiposControle.FirstOrDefault(x => x.Tipo == T_Code.Dir);
|
||||||
GPSModel novaPosicao = VariaveisEquipamento.SimularNovaPosicao(Variaveis.OperacaoEmAndamento.Controle.TipoMovimento, anguloControle, velocidadeMs, tempoPassado.TotalSeconds, anguloAtual, GPSService.UltimaLeitura);
|
double anguloControle = double.Parse(txtAnguloControle.Text);
|
||||||
|
|
||||||
|
double.TryParse(txtErroTempoComando.Text, out double fatorErro);
|
||||||
|
int ticksMax = (int)(ticksControleMax * Math.Max(1, fatorErro));
|
||||||
|
|
||||||
|
bool atualizarAnguloControle = (ticksControle >= ticksMax); // || (chbAutomatico.Checked && UltimaAtualizacaoControle < ControleDir.UltimoComando);
|
||||||
|
if (atualizarAnguloControle)
|
||||||
|
{
|
||||||
|
ticksControle = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ticksControle++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (atualizarAnguloControle)
|
||||||
|
{
|
||||||
|
btnCalcularAngulo_Click(new object(), new EventArgs());
|
||||||
|
UltimaAtualizacaoControle = ControleDir.UltimoComando;
|
||||||
|
anguloControle = double.Parse(txtAnguloControle.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Obtém os parâmetros
|
||||||
|
double anguloAtual = double.Parse(txtAnguloGPS.Text);
|
||||||
|
|
||||||
|
TimeSpan tempoPassado =
|
||||||
|
!chbAutomatico.Checked || UltimaAtualizacaoGps == DateTime.MinValue ? // esta no modo manual
|
||||||
|
new TimeSpan((int)tempoGps * 10000) : // 1 tick do tempo gps
|
||||||
|
DateTime.Now - UltimaAtualizacaoGps; // tempo decorrido entre ticks do timer de leitura
|
||||||
|
|
||||||
|
// Calcula a nova posicao do robo
|
||||||
|
novaPosicao = VariaveisEquipamento.SimularNovaPosicao(Variaveis.OperacaoEmAndamento.Controle.TipoMovimento, anguloControle, velocidadeMs, tempoPassado.TotalSeconds, anguloAtual, GPSService.UltimaLeitura);
|
||||||
|
}
|
||||||
|
|
||||||
// Atualiza a interface gráfica
|
// Atualiza a interface gráfica
|
||||||
txtAnguloGPS.Text = novaPosicao.OrientacaoReal.ToString("0.00");
|
txtAnguloGPS.Text = novaPosicao.OrientacaoReal.ToString("0.00");
|
||||||
|
|
@ -264,6 +293,54 @@ namespace AgroBase.Forms
|
||||||
Variaveis.OperacaoEmAndamento.Mapa.btnCarregar_Click((Control)sender, e);
|
Variaveis.OperacaoEmAndamento.Mapa.btnCarregar_Click((Control)sender, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnCarregarOperacao_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
passosOperacao = new List<GPSModel>();
|
||||||
|
txtTempoGPS.Text = tempoGps.ToString();
|
||||||
|
idxPassoOperacao = 0;
|
||||||
|
lblCarregado.Text = "Simulador";
|
||||||
|
|
||||||
|
OpenFileDialog ofd = new OpenFileDialog();
|
||||||
|
ofd.Filter = "Arquivos de Operação|*.lgop";
|
||||||
|
ofd.InitialDirectory = Application.StartupPath + "\\" + Variaveis.CaminhoOperacoes;
|
||||||
|
if (ofd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
OperacaoDadosModel data = JsonConvert.DeserializeObject<OperacaoDadosModel>(File.ReadAllText(ofd.FileName));
|
||||||
|
|
||||||
|
passosOperacao = JsonConvert.DeserializeObject<GPSModel[]>(OperacaoModel.DeserializarDadosOperacao(ofd.FileName, data.gps ?? Enums.T_Code.Gps.ToString())).ToList();
|
||||||
|
|
||||||
|
txtTempoGPS.Text = "1000";
|
||||||
|
lblCarregado.Text = "Operação";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnCarregarTrajetoria_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
passosOperacao = new List<GPSModel>();
|
||||||
|
txtTempoGPS.Text = tempoGps.ToString();
|
||||||
|
idxPassoOperacao = 0;
|
||||||
|
lblCarregado.Text = "Simulador";
|
||||||
|
|
||||||
|
OpenFileDialog ofd = new OpenFileDialog();
|
||||||
|
ofd.Filter = "Arquivos de Trajetória|*.json";
|
||||||
|
ofd.InitialDirectory = Application.StartupPath + "\\" + Variaveis.CaminhoMapasConvertidos;
|
||||||
|
if (ofd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
var DadosMapa = JsonConvert.DeserializeObject<MapaFeatureCollectionModel>(File.ReadAllText(ofd.FileName));
|
||||||
|
|
||||||
|
passosOperacao = DadosMapa.features[0].geometry.coordinates
|
||||||
|
.Select(x => new GPSModel()
|
||||||
|
{
|
||||||
|
Latitude = x[1],
|
||||||
|
Longitude = x[0]
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
txtTempoGPS.Text = "200";
|
||||||
|
lblCarregado.Text = "Trajetória";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void pnlOrientacaoTrajeto_Paint(object sender, PaintEventArgs e)
|
private void pnlOrientacaoTrajeto_Paint(object sender, PaintEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -347,5 +424,7 @@ namespace AgroBase.Forms
|
||||||
{
|
{
|
||||||
Variaveis.OperacaoEmAndamento.Controle.TipoControleDirecional = (TiposControladorDirecional)cmbTipoControleDirecional.SelectedIndex;
|
Variaveis.OperacaoEmAndamento.Controle.TipoControleDirecional = (TiposControladorDirecional)cmbTipoControleDirecional.SelectedIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ namespace AgroBase.Models
|
||||||
|
|
||||||
for (int j = 0; j <= numInterpolacoes; j++)
|
for (int j = 0; j <= numInterpolacoes; j++)
|
||||||
{
|
{
|
||||||
double fator = (double)j / numInterpolacoes;
|
double fator = numInterpolacoes == 0 ? 0 : ((double)j / numInterpolacoes);
|
||||||
GPSModel pontoInterpolado = InterpolarPonto(pontoA, pontoB, fator);
|
GPSModel pontoInterpolado = InterpolarPonto(pontoA, pontoB, fator);
|
||||||
|
|
||||||
// Calcula a distância até o ponto interpolado
|
// Calcula a distância até o ponto interpolado
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ namespace AgroBase.Models
|
||||||
|
|
||||||
public void btnCarregar_Click(object sender, EventArgs e, string caminhoArquivo = "", bool monitoramento = false)
|
public void btnCarregar_Click(object sender, EventArgs e, string caminhoArquivo = "", bool monitoramento = false)
|
||||||
{
|
{
|
||||||
|
mapaService.Carregado = false;
|
||||||
|
|
||||||
string script = monitoramento ? PythonService.ScriptMapFollower : PythonService.ScriptMapConverter;
|
string script = monitoramento ? PythonService.ScriptMapFollower : PythonService.ScriptMapConverter;
|
||||||
mapaService.CarregarMapa(script, MapasVariaveisModel.NomeArquivoMapaInterativo, MapasVariaveisModel.NomeArquivoMapaInterativoSaida, caminhoArquivo);
|
mapaService.CarregarMapa(script, MapasVariaveisModel.NomeArquivoMapaInterativo, MapasVariaveisModel.NomeArquivoMapaInterativoSaida, caminhoArquivo);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,39 @@ namespace AgroBase.Models.Operacoes
|
||||||
|
|
||||||
#region DIRECIONAL
|
#region DIRECIONAL
|
||||||
|
|
||||||
|
public void DefinirDadosControleDir()
|
||||||
|
{
|
||||||
|
if (Variaveis.OperacaoEmAndamento.Modo != ModoOperacao.MapaGPS)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (Variaveis.OperacaoEmAndamento.Controle.TipoControleDirecional)
|
||||||
|
{
|
||||||
|
case TiposControladorDirecional.PID:
|
||||||
|
{
|
||||||
|
DefinirAnguloSP();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TiposControladorDirecional.MPC:
|
||||||
|
{
|
||||||
|
var MPC = Variaveis.OperacaoEmAndamento.Controle.ControladorMPC;
|
||||||
|
var Trajetoria = Variaveis.OperacaoEmAndamento.Trajetoria;
|
||||||
|
|
||||||
|
(double steeringAngle, Enums.TipoMovimentoDirecional mode) = MPC.ComputeControl(
|
||||||
|
GPSService.UltimaLeitura.Latitude, GPSService.UltimaLeitura.Longitude, Variaveis.OperacaoEmAndamento.Sensoriamento.Gps.AnguloCarroDefinido,
|
||||||
|
Trajetoria.ProximoPonto.Posicao.Latitude, Trajetoria.ProximoPonto.Posicao.Longitude, Trajetoria.ProximoPonto.Orientacao,
|
||||||
|
Variaveis.OperacaoEmAndamento.Controle.PercentualVelocidadeSP, Trajetoria.DistanciaEsquerda, Trajetoria.DistanciaDireita, new List<Obstaculo>());
|
||||||
|
|
||||||
|
var Controle = Variaveis.OperacaoEmAndamento.Controle;
|
||||||
|
|
||||||
|
Controle.Angulo = steeringAngle;
|
||||||
|
Controle.TipoMovimento = mode;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DefinirAnguloSP()
|
private void DefinirAnguloSP()
|
||||||
{
|
{
|
||||||
DefinirTipoMovimento();
|
DefinirTipoMovimento();
|
||||||
|
|
@ -37,7 +70,6 @@ namespace AgroBase.Models.Operacoes
|
||||||
{
|
{
|
||||||
var _Trajetoria = Variaveis.OperacaoEmAndamento.Sensoriamento.Trajetoria;
|
var _Trajetoria = Variaveis.OperacaoEmAndamento.Sensoriamento.Trajetoria;
|
||||||
var _Controle = Variaveis.OperacaoEmAndamento.Controle;
|
var _Controle = Variaveis.OperacaoEmAndamento.Controle;
|
||||||
var statusCarroRua = _Trajetoria.StatusCarro;
|
|
||||||
|
|
||||||
double erroOrientacao = 0.0;
|
double erroOrientacao = 0.0;
|
||||||
double anguloCamera = Variaveis.OperacaoEmAndamento.Sensoriamento.AnguloRuaCamera;
|
double anguloCamera = Variaveis.OperacaoEmAndamento.Sensoriamento.AnguloRuaCamera;
|
||||||
|
|
@ -56,15 +88,17 @@ namespace AgroBase.Models.Operacoes
|
||||||
!_Trajetoria.CorredorAtual.Dentro ? 0 :
|
!_Trajetoria.CorredorAtual.Dentro ? 0 :
|
||||||
(_Trajetoria.DistanciaEsquerda - _Trajetoria.DistanciaDireita);
|
(_Trajetoria.DistanciaEsquerda - _Trajetoria.DistanciaDireita);
|
||||||
|
|
||||||
|
double distanciaProximoPonto = _Trajetoria.ProximoPonto.DistanciaAtual;
|
||||||
|
|
||||||
double erroUltrassom = UltrasonicA05Helper.CalcularErroUltrassons();
|
double erroUltrassom = UltrasonicA05Helper.CalcularErroUltrassons();
|
||||||
|
|
||||||
double erroCombinado = CalcularErroCombinado(erroLateral, erroOrientacao, erroUltrassom, anguloCarro, anguloRua, statusCarroRua);
|
double erroCombinado = CalcularErroCombinado(erroLateral, erroOrientacao, erroUltrassom, distanciaProximoPonto);
|
||||||
|
|
||||||
AjustarGanhosPID(_Controle.PercentualVelocidadeSP);
|
AjustarGanhosPID(_Controle.PercentualVelocidadeSP);
|
||||||
|
|
||||||
var PID = _Controle.PIDdirecional;
|
var PID = _Controle.PIDdirecional;
|
||||||
// Atualiza o PID com o erro combinado
|
// Atualiza o PID com o erro combinado
|
||||||
if (statusCarroRua != StatusCarroMapa.Parado)
|
if (_Trajetoria.StatusCarro != StatusCarroMapa.Parado)
|
||||||
{
|
{
|
||||||
if (_Controle.TipoMovimento == TipoMovimentoDirecional.MovimentoArco)
|
if (_Controle.TipoMovimento == TipoMovimentoDirecional.MovimentoArco)
|
||||||
{
|
{
|
||||||
|
|
@ -86,38 +120,50 @@ namespace AgroBase.Models.Operacoes
|
||||||
_Controle.Angulo = correcaoAngulo;
|
_Controle.Angulo = correcaoAngulo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private double CalcularErroCombinado(double erroLateral, double erroOrientacao, double erroUltrassons, double anguloCarro, double anguloRua, StatusCarroMapa statusCarroRua)
|
private double CalcularErroCombinado(double erroLateral, double erroOrientacao, double erroUltrassons, double distanciaProximoPonto)
|
||||||
{
|
{
|
||||||
bool carroDentroRua = Variaveis.OperacaoEmAndamento.Sensoriamento.Trajetoria.CorredorAtual.Dentro;
|
bool carroDentroRua = Variaveis.OperacaoEmAndamento.Sensoriamento.Trajetoria.CorredorAtual.Dentro;
|
||||||
bool naMargeRua = Variaveis.OperacaoEmAndamento.Sensoriamento.Trajetoria.NaMargemDoCorredor;
|
bool naMargeRua = Variaveis.OperacaoEmAndamento.Sensoriamento.Trajetoria.NaMargemDoCorredor;
|
||||||
|
|
||||||
// Se estiver fora do corredor, erro lateral não deve ser considerado
|
// Quando o robô está dentro do corredor, queremos priorizar a centralização primeiro
|
||||||
double multiplicadorErroLateral = carroDentroRua ?
|
double pesoLateral;
|
||||||
(erroLateral < 1 ? 10.0 : erroLateral > 10.0 && erroLateral < 100.0 ? 0.0 : erroLateral > 100.0 ? 0.1 : 1.0) :
|
double pesoOrientacao;
|
||||||
0.0;
|
double pesoUltrassons = 0; // Por enquanto, ultrassons desativados
|
||||||
|
|
||||||
double erroPosicaoLateral =
|
// Converte erro lateral (metros) para graus
|
||||||
(Variaveis.OperacaoEmAndamento.Trajetoria.RuasPlantacao.Count() == 1) ? 0 :
|
double erroLateralEmGraus = Math.Atan2(erroLateral, distanciaProximoPonto) * (180.0 / Math.PI);
|
||||||
(erroLateral * multiplicadorErroLateral);
|
|
||||||
|
|
||||||
// Ajusta pesos dinamicamente
|
if (carroDentroRua)
|
||||||
double pesoLateral = 0; // carroDentroRua ? FuncoesMatematicas.Clamp(Math.Abs(erroPosicaoLateral) / 10.0, 0, 1) : 0.0;
|
{
|
||||||
double pesoOrientacao = 1 - pesoLateral; // Quando fora do corredor, esse valor será 1
|
// Normaliza os erros para um intervalo entre 0 e 1
|
||||||
double pesoUltrassons = 1 - pesoOrientacao - pesoLateral; // Ajuste final para manter total = 1
|
double erroOrientacaoNormalizado = Math.Min(Math.Abs(erroOrientacao) / 5.0, 1.0); // Assume 10° como erro máximo
|
||||||
|
|
||||||
// Se o peso do ultrassom ficar negativo, normalizamos para manter os valores entre 0 e 1
|
// Usa a mesma regra de peso dinâmica
|
||||||
pesoUltrassons = Math.Max(0, pesoUltrassons);
|
pesoOrientacao = Math.Max(0.3, erroOrientacaoNormalizado); // Quanto maior o erro de orientação, maior seu peso
|
||||||
|
|
||||||
// Calcula o erro combinado ponderando os três erros
|
pesoOrientacao = 1.0;
|
||||||
|
pesoLateral = 1.0 - pesoOrientacao; // Quanto menor o erro de orientação, maior o peso lateral
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Quando está fora do corredor, prioriza a orientação
|
||||||
|
pesoLateral = 0;
|
||||||
|
pesoOrientacao = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Garante que os pesos somem exatamente 1
|
||||||
|
pesoUltrassons = Math.Max(0, 1 - pesoLateral - pesoOrientacao);
|
||||||
|
|
||||||
|
// Calcula o erro combinado ponderado pelos pesos
|
||||||
double erroCombinado =
|
double erroCombinado =
|
||||||
(erroOrientacao * pesoOrientacao) +
|
(erroOrientacao * pesoOrientacao) +
|
||||||
(erroPosicaoLateral * pesoLateral) +
|
(erroLateralEmGraus * pesoLateral) +
|
||||||
(erroUltrassons * pesoUltrassons);
|
(erroUltrassons * pesoUltrassons);
|
||||||
|
|
||||||
return erroCombinado;
|
return erroCombinado;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AjustarGanhosPID(double velocidadePercnt)
|
/*private void AjustarGanhosPID(double velocidadePercnt)
|
||||||
{
|
{
|
||||||
var PID = Variaveis.OperacaoEmAndamento.Controle.PIDdirecional;
|
var PID = Variaveis.OperacaoEmAndamento.Controle.PIDdirecional;
|
||||||
|
|
||||||
|
|
@ -128,14 +174,39 @@ namespace AgroBase.Models.Operacoes
|
||||||
PID.Kp = PID.KpBase - (0.5 * Math.Pow(fatorVelocidade, 2)); // Reduz Kp mais agressivamente em altas velocidades
|
PID.Kp = PID.KpBase - (0.5 * Math.Pow(fatorVelocidade, 2)); // Reduz Kp mais agressivamente em altas velocidades
|
||||||
PID.Ki = fatorVelocidade > 0.8 ? 0.0 : PID.KiBase - (0.01 * fatorVelocidade); // Desativa Ki em altas velocidades
|
PID.Ki = fatorVelocidade > 0.8 ? 0.0 : PID.KiBase - (0.01 * fatorVelocidade); // Desativa Ki em altas velocidades
|
||||||
PID.Kd = PID.KdBase + (0.05 * Math.Pow(fatorVelocidade, 2)); // Aumenta Kd exponencialmente para amortecer oscilações
|
PID.Kd = PID.KdBase + (0.05 * Math.Pow(fatorVelocidade, 2)); // Aumenta Kd exponencialmente para amortecer oscilações
|
||||||
|
}*/
|
||||||
|
|
||||||
|
private void AjustarGanhosPID(double velocidadePercnt)
|
||||||
|
{
|
||||||
|
var PID = Variaveis.OperacaoEmAndamento.Controle.PIDdirecional;
|
||||||
|
|
||||||
|
double fatorVelocidade = Math.Min(velocidadePercnt / 100.0, 1.0);
|
||||||
|
|
||||||
|
// 🔹 Redução mais suave de Kp
|
||||||
|
PID.Kp = PID.KpBase - (0.4 * Math.Pow(fatorVelocidade, 1.5)); // Ajuste menos agressivo
|
||||||
|
|
||||||
|
// 🔹 Redução mais controlada do Ki
|
||||||
|
PID.Ki = fatorVelocidade > 0.7 ? 0.0 : PID.KiBase - (0.005 * fatorVelocidade); // Ki desativa mais cedo
|
||||||
|
|
||||||
|
// 🔹 Aumento um pouco mais forte do Kd
|
||||||
|
PID.Kd = PID.KdBase + (0.07 * Math.Pow(fatorVelocidade, 2)); // Amortecimento mais forte
|
||||||
|
|
||||||
|
// 🔹 Log opcional para monitorar ajustes (remover depois de testes)
|
||||||
|
Console.WriteLine($"PID Ajustado: Kp={PID.Kp:F3}, Ki={PID.Ki:F3}, Kd={PID.Kd:F3}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region MOVIMENTACAO
|
#region MOVIMENTACAO
|
||||||
|
|
||||||
private void DefinirVelocidadeSP()
|
public void DefinirDadosControleMov()
|
||||||
{
|
{
|
||||||
|
if (Variaveis.OperacaoEmAndamento.Modo != ModoOperacao.MapaGPS)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var Controle = Variaveis.OperacaoEmAndamento.Controle;
|
var Controle = Variaveis.OperacaoEmAndamento.Controle;
|
||||||
var statusAtual = Variaveis.OperacaoEmAndamento.Trajetoria.StatusAtual;
|
var statusAtual = Variaveis.OperacaoEmAndamento.Trajetoria.StatusAtual;
|
||||||
|
|
||||||
|
|
@ -226,44 +297,11 @@ namespace AgroBase.Models.Operacoes
|
||||||
|
|
||||||
public void CalculaDadosMovimentacaoAutonoma()
|
public void CalculaDadosMovimentacaoAutonoma()
|
||||||
{
|
{
|
||||||
if (Variaveis.OperacaoEmAndamento.Modo != ModoOperacao.MapaGPS)
|
DefinirDadosControleMov();
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DefinirVelocidadeSP();
|
|
||||||
|
|
||||||
switch (Variaveis.OperacaoEmAndamento.Controle.TipoControleDirecional)
|
|
||||||
{
|
|
||||||
case TiposControladorDirecional.PID:
|
|
||||||
{
|
|
||||||
DefinirAnguloSP();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TiposControladorDirecional.MPC:
|
|
||||||
{
|
|
||||||
var MPC = Variaveis.OperacaoEmAndamento.Controle.ControladorMPC;
|
|
||||||
var Trajetoria = Variaveis.OperacaoEmAndamento.Trajetoria;
|
|
||||||
|
|
||||||
(double steeringAngle, Enums.TipoMovimentoDirecional mode) = MPC.ComputeControl(
|
|
||||||
GPSService.UltimaLeitura.Latitude, GPSService.UltimaLeitura.Longitude, Variaveis.OperacaoEmAndamento.Sensoriamento.Gps.AnguloCarroDefinido,
|
|
||||||
Trajetoria.ProximoPonto.Posicao.Latitude, Trajetoria.ProximoPonto.Posicao.Longitude, Trajetoria.ProximoPonto.Orientacao,
|
|
||||||
Variaveis.OperacaoEmAndamento.Controle.PercentualVelocidadeSP, Trajetoria.DistanciaEsquerda, Trajetoria.DistanciaDireita, new List<Obstaculo>());
|
|
||||||
|
|
||||||
var Controle = Variaveis.OperacaoEmAndamento.Controle;
|
|
||||||
|
|
||||||
Controle.Angulo = steeringAngle;
|
|
||||||
Controle.TipoMovimento = mode;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
DefinirDadosControleDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OperacaoMapaGPSSensoriamentoModel
|
public class OperacaoMapaGPSSensoriamentoModel
|
||||||
|
|
|
||||||
|
|
@ -408,7 +408,8 @@ namespace AgroBase.Models
|
||||||
|
|
||||||
Variaveis.OperacaoEmAndamento.Mapa.btnCarregar_Click(new object(), new EventArgs(), path);
|
Variaveis.OperacaoEmAndamento.Mapa.btnCarregar_Click(new object(), new EventArgs(), path);
|
||||||
|
|
||||||
await Task.Delay(1500);
|
bool condicaoMapaCarregado() => Variaveis.OperacaoEmAndamento.Mapa.mapaService.Carregado;
|
||||||
|
bool resultado = await FuncoesGlobais.AguardarCondicaoAsync(condicaoMapaCarregado, 5000, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (true, ruasSelecionadas);
|
return (true, ruasSelecionadas);
|
||||||
|
|
@ -811,6 +812,14 @@ namespace AgroBase.Models
|
||||||
|
|
||||||
SalvarLogs(false);
|
SalvarLogs(false);
|
||||||
|
|
||||||
|
string caminhoArquivoGps = Path.Combine(Variaveis.CaminhoLogsDispositivos, "Gps", ID + ".json");
|
||||||
|
if (!File.Exists(caminhoArquivoGps))
|
||||||
|
{
|
||||||
|
MapaFeatureCollectionModel mapa = MapasService.ConverterPontosParaMapa(new List<List<GPSModel>>() { Variaveis.OperacaoEmAndamento.GPSTrajetoria });
|
||||||
|
string json = JsonConvert.SerializeObject(mapa);
|
||||||
|
File.WriteAllText(caminhoArquivoGps, json);
|
||||||
|
}
|
||||||
|
|
||||||
Variaveis.OperacaoEmAndamento.Finalizando = false;
|
Variaveis.OperacaoEmAndamento.Finalizando = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -955,6 +964,19 @@ namespace AgroBase.Models
|
||||||
GPSTrajetoria = new List<GPSModel>();
|
GPSTrajetoria = new List<GPSModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static string DeserializarDadosOperacao(string caminho, string arquivo)
|
||||||
|
{
|
||||||
|
string opPath = caminho.Replace("data.lgop", arquivo) + ".json";
|
||||||
|
string opStr = File.ReadAllText(opPath);
|
||||||
|
if (!opStr.EndsWith("]"))
|
||||||
|
{
|
||||||
|
opStr += "]";
|
||||||
|
}
|
||||||
|
return opStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region CAMERAS
|
#region CAMERAS
|
||||||
|
|
@ -1198,7 +1220,7 @@ namespace AgroBase.Models
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Variaveis.OperacaoEmAndamento.OpMapaGPS.CalculaDadosMovimentacaoAutonoma();
|
//Variaveis.OperacaoEmAndamento.OpMapaGPS.CalculaDadosMovimentacaoAutonoma();
|
||||||
Variaveis.OperacaoEmAndamento.AtualizarDadosControle(false);
|
Variaveis.OperacaoEmAndamento.AtualizarDadosControle(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1252,6 +1274,8 @@ namespace AgroBase.Models
|
||||||
{
|
{
|
||||||
case T_Code.Mov:
|
case T_Code.Mov:
|
||||||
{
|
{
|
||||||
|
Variaveis.OperacaoEmAndamento.OpMapaGPS.DefinirDadosControleMov();
|
||||||
|
|
||||||
if (_Controle.RPM_SP == 0)
|
if (_Controle.RPM_SP == 0)
|
||||||
{
|
{
|
||||||
_Controle.Direcao = Direcao.Parado;
|
_Controle.Direcao = Direcao.Parado;
|
||||||
|
|
@ -1278,7 +1302,9 @@ namespace AgroBase.Models
|
||||||
}
|
}
|
||||||
case T_Code.Dir:
|
case T_Code.Dir:
|
||||||
{
|
{
|
||||||
if (_Controle.Angulo == 0)
|
Variaveis.OperacaoEmAndamento.OpMapaGPS.DefinirDadosControleDir();
|
||||||
|
|
||||||
|
/*if (_Controle.Angulo == 0)
|
||||||
{
|
{
|
||||||
_Controle.Direcao = Direcao.Parado;
|
_Controle.Direcao = Direcao.Parado;
|
||||||
}
|
}
|
||||||
|
|
@ -1303,6 +1329,19 @@ namespace AgroBase.Models
|
||||||
{
|
{
|
||||||
_Controle.Direcao = Direcao.Direita;
|
_Controle.Direcao = Direcao.Direita;
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if (_Controle.Angulo > 0)
|
||||||
|
{
|
||||||
|
_Controle.Direcao = Direcao.Direita;
|
||||||
|
}
|
||||||
|
else if (_Controle.Angulo < 0)
|
||||||
|
{
|
||||||
|
_Controle.Direcao = Direcao.Esquerda;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_Controle.Direcao = Direcao.Parado;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Só enviar comando se a direção realmente mudou
|
// Só enviar comando se a direção realmente mudou
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using AgroBase.Forms;
|
using AgroBase.Services;
|
||||||
using AgroBase.Services;
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace AgroBase.Models
|
namespace AgroBase.Models
|
||||||
|
|
@ -10,11 +9,11 @@ namespace AgroBase.Models
|
||||||
public double SetPoint { get; set; } = 0.0; // Valor desejado (setpoint)
|
public double SetPoint { get; set; } = 0.0; // Valor desejado (setpoint)
|
||||||
public double ValorAtual { get; private set; } = 0.0; // Valor atual do processo
|
public double ValorAtual { get; private set; } = 0.0; // Valor atual do processo
|
||||||
public double Saida { get; private set; } = 0.0; // Saída do controlador PID
|
public double Saida { get; private set; } = 0.0; // Saída do controlador PID
|
||||||
public double KpBase { get; set; } = 0.65; // Ganho proporcional
|
public double KpBase { get; set; } = 0.55; // 0.65; // Ganho proporcional
|
||||||
public double Kp { get; set; } = 0.65; // Ganho proporcional
|
public double Kp { get; set; } = 0.65; // Ganho proporcional
|
||||||
public double KiBase { get; set; } = 0.015; // Ganho integral
|
public double KiBase { get; set; } = 0.005; // 0.015; // Ganho integral
|
||||||
public double Ki { get; set; } = 0.015; // Ganho integral
|
public double Ki { get; set; } = 0.015; // Ganho integral
|
||||||
public double KdBase { get; set; } = 0.055; // Ganho derivativo
|
public double KdBase { get; set; } = 0.08; // 0.055; // Ganho derivativo
|
||||||
public double Kd { get; set; } = 0.055; // Ganho derivativo
|
public double Kd { get; set; } = 0.055; // Ganho derivativo
|
||||||
|
|
||||||
// Limites e configurações
|
// Limites e configurações
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using AgroBase.Services;
|
using AgroBase.Services;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
@ -25,6 +26,7 @@ namespace AgroBase.Models
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public DateTime UltimaAtualizacaoDados { get; set; } = DateTime.MinValue;
|
public DateTime UltimaAtualizacaoDados { get; set; } = DateTime.MinValue;
|
||||||
|
[JsonProperty]
|
||||||
public double TempoEntreLeituras { get; private set; }
|
public double TempoEntreLeituras { get; private set; }
|
||||||
private void AtuaalizarTempoEntreLeituras()
|
private void AtuaalizarTempoEntreLeituras()
|
||||||
{
|
{
|
||||||
|
|
@ -44,6 +46,10 @@ namespace AgroBase.Models
|
||||||
{
|
{
|
||||||
return RuasPlantacao[CorredorAtual.Idx][0]; // Acessa diretamente o primeiro ponto da rua
|
return RuasPlantacao[CorredorAtual.Idx][0]; // Acessa diretamente o primeiro ponto da rua
|
||||||
}
|
}
|
||||||
|
else if (CorredorAtual == null && RuasPlantacao.Count > 0)
|
||||||
|
{
|
||||||
|
return RuasPlantacao[0][0];
|
||||||
|
}
|
||||||
|
|
||||||
return new GPSModel(); // Pode ser null se preferir
|
return new GPSModel(); // Pode ser null se preferir
|
||||||
}
|
}
|
||||||
|
|
@ -57,6 +63,10 @@ namespace AgroBase.Models
|
||||||
{
|
{
|
||||||
return RuasPlantacao[CorredorAtual.Idx][RuasPlantacao.Count - 1]; // Acessa diretamente o ultimo ponto da rua
|
return RuasPlantacao[CorredorAtual.Idx][RuasPlantacao.Count - 1]; // Acessa diretamente o ultimo ponto da rua
|
||||||
}
|
}
|
||||||
|
else if (CorredorAtual == null && RuasPlantacao.Count > 0)
|
||||||
|
{
|
||||||
|
return RuasPlantacao[0][RuasPlantacao.Count - 1];
|
||||||
|
}
|
||||||
|
|
||||||
return new GPSModel(); // Pode ser null se preferir
|
return new GPSModel(); // Pode ser null se preferir
|
||||||
}
|
}
|
||||||
|
|
@ -74,6 +84,7 @@ namespace AgroBase.Models
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonProperty]
|
||||||
public List<int> CorredoresNaoFinalizados { get; private set; }
|
public List<int> CorredoresNaoFinalizados { get; private set; }
|
||||||
private void AtualizarCorredoresNaoFinalizados()
|
private void AtualizarCorredoresNaoFinalizados()
|
||||||
{
|
{
|
||||||
|
|
@ -92,10 +103,21 @@ namespace AgroBase.Models
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PontoTrajetoriaModel> _TrajetoriaFixa { get; set; }
|
public List<PontoTrajetoriaModel> _TrajetoriaFixa { get; set; }
|
||||||
|
private bool _TrajetoriaFixaDefinida
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _TrajetoriaFixa != null && _TrajetoriaFixa.Count > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[JsonProperty]
|
||||||
public List<PontoTrajetoriaModel> _TrajetoriaJanela { get; private set; }
|
public List<PontoTrajetoriaModel> _TrajetoriaJanela { get; private set; }
|
||||||
private void AtualizarTrajetoriaJanela()
|
private void AtualizarTrajetoriaJanela()
|
||||||
{
|
{
|
||||||
_TrajetoriaJanela = new List<PontoTrajetoriaModel>();
|
_TrajetoriaJanela = new List<PontoTrajetoriaModel>();
|
||||||
|
|
||||||
|
if (!_TrajetoriaFixaDefinida) return;
|
||||||
|
|
||||||
for (int i = idxInicialJanela; i <= idxFinalJanela; i++)
|
for (int i = idxInicialJanela; i <= idxFinalJanela; i++)
|
||||||
{
|
{
|
||||||
_TrajetoriaJanela.Add(_TrajetoriaFixa[i]);
|
_TrajetoriaJanela.Add(_TrajetoriaFixa[i]);
|
||||||
|
|
@ -111,7 +133,7 @@ namespace AgroBase.Models
|
||||||
var trajetoria = new List<GPSModel> { GPSService.UltimaLeitura };
|
var trajetoria = new List<GPSModel> { GPSService.UltimaLeitura };
|
||||||
|
|
||||||
// Se a trajetória fixa estiver vazia, retorna apenas a leitura atual
|
// Se a trajetória fixa estiver vazia, retorna apenas a leitura atual
|
||||||
if (_TrajetoriaFixa == null || _TrajetoriaFixa.Count == 0)
|
if (!_TrajetoriaFixaDefinida)
|
||||||
{
|
{
|
||||||
return trajetoria;
|
return trajetoria;
|
||||||
}
|
}
|
||||||
|
|
@ -129,6 +151,7 @@ namespace AgroBase.Models
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonProperty]
|
||||||
public static double DistanciaMaximaEntreLeituras { get; private set; }
|
public static double DistanciaMaximaEntreLeituras { get; private set; }
|
||||||
public void AtualizarDistanciaMaximaEntreLeituras()
|
public void AtualizarDistanciaMaximaEntreLeituras()
|
||||||
{
|
{
|
||||||
|
|
@ -141,13 +164,21 @@ namespace AgroBase.Models
|
||||||
private int idxFinalJanela = 0;
|
private int idxFinalJanela = 0;
|
||||||
private void AtualizarIndicesJanela()
|
private void AtualizarIndicesJanela()
|
||||||
{
|
{
|
||||||
if (_TrajetoriaFixa == null || _TrajetoriaFixa.Count == 0) return;
|
if (!_TrajetoriaFixaDefinida) return;
|
||||||
|
|
||||||
idxInicialJanela = Math.Max(0, (PontoAtual?.idxPonto ?? 0) - JanelaAtualizacaoDePontos / 2);
|
idxInicialJanela = Math.Max(0, (PontoAtual?.idxPonto ?? 0) - JanelaAtualizacaoDePontos / 2);
|
||||||
idxFinalJanela = Math.Min(_TrajetoriaFixa.Count - 1, (PontoAtual?.idxPonto ?? 0) + JanelaAtualizacaoDePontos / 2);
|
idxFinalJanela = Math.Min(_TrajetoriaFixa.Count - 1, (PontoAtual?.idxPonto ?? 0) + JanelaAtualizacaoDePontos / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonProperty]
|
||||||
public CorredorTrajetoriaModel CorredorAtual { get; private set; }
|
public CorredorTrajetoriaModel CorredorAtual { get; private set; }
|
||||||
|
private bool _CorredorAtualDefinido
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (CorredorAtual?.Pontos?.Count ?? 0) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
private void AtualizarCorredorAtual()
|
private void AtualizarCorredorAtual()
|
||||||
{
|
{
|
||||||
if (_Corredores == null || _Corredores.Count == 0)
|
if (_Corredores == null || _Corredores.Count == 0)
|
||||||
|
|
@ -160,7 +191,7 @@ namespace AgroBase.Models
|
||||||
|
|
||||||
if ((CorredorAtual?.Idx ?? 0) != idxNovoCorredor)
|
if ((CorredorAtual?.Idx ?? 0) != idxNovoCorredor)
|
||||||
{
|
{
|
||||||
CorredorAtual.AtualizarDados();
|
CorredorAtual?.AtualizarDados();
|
||||||
}
|
}
|
||||||
|
|
||||||
CorredorAtual = _Corredores[idxNovoCorredor];
|
CorredorAtual = _Corredores[idxNovoCorredor];
|
||||||
|
|
@ -174,97 +205,63 @@ namespace AgroBase.Models
|
||||||
return PontoAtual?.Direcao ?? Enums.DirecaoCarroRua.Parado;
|
return PontoAtual?.Direcao ?? Enums.DirecaoCarroRua.Parado;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[JsonProperty]
|
||||||
public double AnguloMedioCorredor { get; private set; }
|
public double AnguloMedioCorredor { get; private set; }
|
||||||
private void AtualizarAnguloMedioCorredor()
|
private void AtualizarAnguloMedioCorredor()
|
||||||
{
|
{
|
||||||
AnguloMedioCorredor = GPSUtils.CalcularOrientacao(PontoAtual.Posicao, ProximoPonto.Posicao);
|
AnguloMedioCorredor = GPSUtils.CalcularOrientacao(PontoAtual.Posicao, ProximoPonto.Posicao);
|
||||||
}
|
}
|
||||||
|
[JsonProperty]
|
||||||
public double AnguloCaminho { get; private set; }
|
public double AnguloCaminho { get; private set; }
|
||||||
private void AtualizarAnguloCaminho()
|
private void AtualizarAnguloCaminho()
|
||||||
{
|
{
|
||||||
GPSModel pontoComparar = ProximoPonto != null ? ProximoPonto.Posicao : PontoAtual.Posicao;
|
GPSModel pontoComparar = ProximoPonto != null ? ProximoPonto.Posicao : PontoAtual.Posicao;
|
||||||
AnguloCaminho = GPSUtils.CalcularOrientacao(GPSService.UltimaLeitura, pontoComparar);
|
AnguloCaminho = GPSUtils.CalcularOrientacao(GPSService.UltimaLeitura, pontoComparar);
|
||||||
}
|
}
|
||||||
|
[JsonProperty]
|
||||||
public double DistanciaEsquerda { get; private set; }
|
public double DistanciaEsquerda { get; private set; }
|
||||||
|
[JsonProperty]
|
||||||
public double DistanciaDireita { get; private set; }
|
public double DistanciaDireita { get; private set; }
|
||||||
private void AtualizarDistanciasLaterais()
|
private void AtualizarDistanciasLaterais()
|
||||||
{
|
{
|
||||||
DistanciaEsquerda = CalcularDistanciaLateral(true);
|
DistanciaEsquerda = CalcularDistanciaLateral(true);
|
||||||
DistanciaDireita = CalcularDistanciaLateral(false);
|
DistanciaDireita = CalcularDistanciaLateral(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private double CalcularDistanciaLateral(bool ladoEsquerdo)
|
private double CalcularDistanciaLateral(bool ladoEsquerdo)
|
||||||
{
|
{
|
||||||
// Verifica se o corredor atual existe
|
// Verifica se o corredor atual existe
|
||||||
if (CorredorAtual == null)
|
if (!_CorredorAtualDefinido) return 0;
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
var pontosDoCorredor = CorredorAtual.Pontos;
|
var rua = ladoEsquerdo ? new List<GPSModel>(RuasPlantacao[CorredorAtual.idxRuaEsquerda]) : new List<GPSModel>(RuasPlantacao[CorredorAtual.idxRuaDireita]);
|
||||||
if (CorredorAtual.QtdPontos == 0)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pega o primeiro ponto do corredor atual
|
double anguloAprojetar = GPSUtils.CalcularOrientacao(rua[rua.Count - 1], rua[0]);
|
||||||
var pontoCorredor = pontosDoCorredor[0];
|
double anguloBprojetar = GPSUtils.CalcularOrientacao(rua[0], rua[rua.Count - 1]);
|
||||||
|
GPSModel pontoA = GPSUtils.GerarPontoDeslocado(rua[0], anguloAprojetar, 10);
|
||||||
|
GPSModel pontoB = GPSUtils.GerarPontoDeslocado(rua[rua.Count - 1], anguloBprojetar, 10);
|
||||||
|
|
||||||
// Calcula as distâncias até os extremos da rua
|
rua.Insert(0, pontoA);
|
||||||
double distPP = GPSUtils.DistanciaEntrePontos(pontoCorredor.Posicao, PrimeiroPontoRuaMapa);
|
rua.Add(pontoB);
|
||||||
double distUP = GPSUtils.DistanciaEntrePontos(pontoCorredor.Posicao, UltimoPontoRuaMapa);
|
|
||||||
|
|
||||||
int extremoInicial = (distPP < distUP) ? 0 : 1;
|
int qtdPontosRua = Convert.ToInt32(GPSUtils.DistanciaDoTrecho(rua));
|
||||||
|
rua = GPSUtils.InterpolarRota(rua, qtdPontosRua);
|
||||||
// Determina a rua correta de acordo com o lado e a posição do extremo inicial
|
|
||||||
List<GPSModel> rua;
|
|
||||||
if (ladoEsquerdo)
|
|
||||||
{
|
|
||||||
rua = (extremoInicial == 0) ? RuasPlantacao[CorredorAtual.Idx + 1] : RuasPlantacao[CorredorAtual.Idx];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rua = (extremoInicial == 0) ? RuasPlantacao[CorredorAtual.Idx] : RuasPlantacao[CorredorAtual.Idx + 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Evita erro de índice (se for o último corredor, não há IdxCorredorAtual + 1)
|
|
||||||
int idxMax = RuasPlantacao.Count - 1;
|
|
||||||
int idxRua = Math.Min(CorredorAtual.Idx + ((ladoEsquerdo && extremoInicial == 0) || (!ladoEsquerdo && extremoInicial == 1) ? 1 : 0), idxMax);
|
|
||||||
rua = RuasPlantacao[idxRua];
|
|
||||||
|
|
||||||
// Calcula a menor distância entre o robô e a rua
|
// Calcula a menor distância entre o robô e a rua
|
||||||
double distancia = GPSUtils.CalcularMenorDistanciaAteTrecho(GPSService.UltimaLeitura, rua);
|
double distancia = GPSUtils.CalcularMenorDistanciaAteTrecho(GPSService.UltimaLeitura, rua);
|
||||||
|
|
||||||
// Determina se está para dentro ou para fora da borda
|
|
||||||
// Obtemos dois pontos consecutivos para formar o vetor da rua
|
|
||||||
GPSModel pontoA = rua[0];
|
|
||||||
GPSModel pontoB = rua[Math.Min(1, rua.Count - 1)]; // Garante que não ultrapasse o limite do array
|
|
||||||
|
|
||||||
// Calcula o vetor entre os pontos da rua e o vetor entre o ponto A e o GPS
|
// Calcula o vetor entre os pontos da rua e o vetor entre o ponto A e o GPS
|
||||||
double crossProduct = (pontoB.Longitude - pontoA.Longitude) * (GPSService.UltimaLeitura.Latitude - pontoA.Latitude) -
|
double crossProduct =
|
||||||
(pontoB.Latitude - pontoA.Latitude) * (GPSService.UltimaLeitura.Longitude - pontoA.Longitude);
|
(pontoB.Longitude - pontoA.Longitude) * (GPSService.UltimaLeitura.Latitude - pontoA.Latitude) -
|
||||||
|
(pontoB.Latitude - pontoA.Latitude) * (GPSService.UltimaLeitura.Longitude - pontoA.Longitude);
|
||||||
|
|
||||||
// Define o sinal da distância baseado no produto vetorial
|
// Ajusta a distância com base no sentido de deslocamento do robô
|
||||||
if (extremoInicial == 1)
|
if ((PontoAtual.Direcao == DirecaoCarroRua.Volta && ladoEsquerdo) || (PontoAtual.Direcao == DirecaoCarroRua.Ida && !ladoEsquerdo))
|
||||||
{
|
{
|
||||||
if (ladoEsquerdo)
|
distancia *= crossProduct > 0 ? 1 : -1;
|
||||||
{
|
|
||||||
distancia *= crossProduct > 0 ? 1 : -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
distancia *= crossProduct < 0 ? 1 : -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ladoEsquerdo)
|
distancia *= crossProduct > 0 ? -1 : 1;
|
||||||
{
|
|
||||||
distancia *= crossProduct > 0 ? -1 : 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
distancia *= crossProduct < 0 ? -1 : 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ajusta a largura do robô no cálculo final
|
// Ajusta a largura do robô no cálculo final
|
||||||
|
|
@ -273,11 +270,12 @@ namespace AgroBase.Models
|
||||||
|
|
||||||
return distancia;
|
return distancia;
|
||||||
}
|
}
|
||||||
|
[JsonProperty]
|
||||||
public PontoTrajetoriaModel PontoAtual { get; private set; }
|
public PontoTrajetoriaModel PontoAtual { get; private set; }
|
||||||
private void DefinirPontoAtual()
|
private void DefinirPontoAtual()
|
||||||
{
|
{
|
||||||
// ✅ Evita processamento desnecessário se a lista for nula ou vazia
|
// ✅ Evita processamento desnecessário se a lista for nula ou vazia
|
||||||
if (_TrajetoriaFixa == null || _TrajetoriaFixa.Count == 0)
|
if (!_TrajetoriaFixaDefinida)
|
||||||
{
|
{
|
||||||
PontoAtual = null;
|
PontoAtual = null;
|
||||||
return;
|
return;
|
||||||
|
|
@ -295,16 +293,27 @@ namespace AgroBase.Models
|
||||||
|
|
||||||
PontoAtual = null;
|
PontoAtual = null;
|
||||||
}
|
}
|
||||||
|
[JsonProperty]
|
||||||
public PontoTrajetoriaModel ProximoPonto { get; private set; }
|
public PontoTrajetoriaModel ProximoPonto { get; private set; }
|
||||||
private void DefinirProximoPonto()
|
private void DefinirProximoPonto()
|
||||||
{
|
{
|
||||||
if (_TrajetoriaFixa == null || _TrajetoriaFixa.Count == 0)
|
if (!_TrajetoriaFixaDefinida)
|
||||||
{
|
{
|
||||||
ProximoPonto = null;
|
ProximoPonto = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Busca eficiente: percorre do começo ao fim para achar o primeiro não visitado
|
if (PontoAtual.idxPonto == _TrajetoriaFixa.Count() - 1)
|
||||||
|
{
|
||||||
|
ProximoPonto = PontoAtual;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int idx = (_TrajetoriaJanela.IndexOf(PontoAtual) + 1);
|
||||||
|
ProximoPonto = _TrajetoriaJanela[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*// Busca eficiente: percorre do começo ao fim para achar o primeiro não visitado
|
||||||
for (int i = idxInicialJanela; i <= idxFinalJanela; i++)
|
for (int i = idxInicialJanela; i <= idxFinalJanela; i++)
|
||||||
{
|
{
|
||||||
if (!_TrajetoriaFixa[i].Visitado)
|
if (!_TrajetoriaFixa[i].Visitado)
|
||||||
|
|
@ -315,12 +324,14 @@ namespace AgroBase.Models
|
||||||
}
|
}
|
||||||
|
|
||||||
ProximoPonto = PontoAtual; // Se não houver pontos não visitados, retorna o último ponto visitado
|
ProximoPonto = PontoAtual; // Se não houver pontos não visitados, retorna o último ponto visitado
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
[JsonProperty]
|
||||||
public PontoTrajetoriaModel PontoMaisProximo { get; private set; }
|
public PontoTrajetoriaModel PontoMaisProximo { get; private set; }
|
||||||
private void DefinirPontoMaisProximo()
|
private void DefinirPontoMaisProximo()
|
||||||
{
|
{
|
||||||
// ✅ Evita processamento desnecessário se a lista for nula ou vazia
|
// ✅ Evita processamento desnecessário se a lista for nula ou vazia
|
||||||
if (_TrajetoriaFixa == null || _TrajetoriaFixa.Count == 0)
|
if (!_TrajetoriaFixaDefinida)
|
||||||
{
|
{
|
||||||
PontoMaisProximo = null;
|
PontoMaisProximo = null;
|
||||||
return;
|
return;
|
||||||
|
|
@ -345,6 +356,7 @@ namespace AgroBase.Models
|
||||||
PontoMaisProximo = melhorPonto;
|
PontoMaisProximo = melhorPonto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[JsonProperty]
|
||||||
public bool NaMargemDoCorredor { get; private set; }
|
public bool NaMargemDoCorredor { get; private set; }
|
||||||
private void AtualizarNaMargemDoCorredor()
|
private void AtualizarNaMargemDoCorredor()
|
||||||
{
|
{
|
||||||
|
|
@ -358,17 +370,19 @@ namespace AgroBase.Models
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[JsonProperty]
|
||||||
public bool ManobrandoEntreRuas { get; private set; }
|
public bool ManobrandoEntreRuas { get; private set; }
|
||||||
private void AtualizarManobrandoEntreRuas()
|
private void AtualizarManobrandoEntreRuas()
|
||||||
{
|
{
|
||||||
bool proximoAentrada = (ProximoPonto.PontoBorda || ProximoPonto.PontoLigacao) && ProximoPonto.DistanciaAtual < DistanciaManobraEntreRuas;
|
bool proximoAentrada = (ProximoPonto.PontoBorda || ProximoPonto.PontoLigacao) && ProximoPonto.DistanciaAtual < DistanciaManobraEntreRuas;
|
||||||
ManobrandoEntreRuas = (proximoAentrada && StatusAtual == StatusCarroMapa.Direcionando) || NaMargemDoCorredor;
|
ManobrandoEntreRuas = (proximoAentrada && StatusAtual == StatusCarroMapa.Direcionando) || NaMargemDoCorredor;
|
||||||
}
|
}
|
||||||
|
[JsonProperty]
|
||||||
public StatusCarroMapa StatusAtual { get; private set; }
|
public StatusCarroMapa StatusAtual { get; private set; }
|
||||||
private void AtualizarStatusAtual()
|
private void AtualizarStatusAtual()
|
||||||
{
|
{
|
||||||
StatusAtual = StatusCarroMapa.Parado;
|
StatusAtual = StatusCarroMapa.Parado;
|
||||||
if (ProximoPonto != null)
|
if (ProximoPonto != null && CorredorAtual != null)
|
||||||
{
|
{
|
||||||
if (!CorredorAtual.Dentro && (PontoAtual.Tipo == TipoPontoRua.PosicaoRobo || PontoAtual.PontoLigacao || ProximoPonto.PontoLigacao))
|
if (!CorredorAtual.Dentro && (PontoAtual.Tipo == TipoPontoRua.PosicaoRobo || PontoAtual.PontoLigacao || ProximoPonto.PontoLigacao))
|
||||||
{
|
{
|
||||||
|
|
@ -392,23 +406,29 @@ namespace AgroBase.Models
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[JsonProperty]
|
||||||
public double DistanciaTotal { get; private set; }
|
public double DistanciaTotal { get; private set; }
|
||||||
|
[JsonProperty]
|
||||||
public double DistanciaPercorrida { get; private set; }
|
public double DistanciaPercorrida { get; private set; }
|
||||||
private void AtualizarDistanciaPercorrida()
|
private void AtualizarDistanciaPercorrida()
|
||||||
{
|
{
|
||||||
DistanciaPercorrida = _Corredores.Sum(x => x.DistanciaPercorrida);
|
DistanciaPercorrida = _Corredores?.Sum(x => x.DistanciaPercorrida) ?? 0;
|
||||||
}
|
}
|
||||||
|
[JsonProperty]
|
||||||
public double DistanciaRestante { get; private set; }
|
public double DistanciaRestante { get; private set; }
|
||||||
private void AtualizarDistanciaRestante()
|
private void AtualizarDistanciaRestante()
|
||||||
{
|
{
|
||||||
DistanciaRestante = GPSUtils.DistanciaDoTrecho(TrajetoriaDinamica);
|
DistanciaRestante = GPSUtils.DistanciaDoTrecho(TrajetoriaDinamica ?? new List<GPSModel>());
|
||||||
}
|
}
|
||||||
|
[JsonProperty]
|
||||||
public double PercentualTrajetoria { get; private set; }
|
public double PercentualTrajetoria { get; private set; }
|
||||||
public void AtualizarPercentualTrajetoria()
|
public void AtualizarPercentualTrajetoria()
|
||||||
{
|
{
|
||||||
PercentualTrajetoria = (DistanciaPercorrida / DistanciaTotal) * 100.0;
|
PercentualTrajetoria = DistanciaTotal > 0 ? (DistanciaPercorrida / DistanciaTotal) * 100.0 : 0;
|
||||||
}
|
}
|
||||||
|
[JsonProperty]
|
||||||
public string TempoEstimadoOperacao { get; private set; }
|
public string TempoEstimadoOperacao { get; private set; }
|
||||||
|
[JsonProperty]
|
||||||
public string TempoEstimadoRestante { get; private set; }
|
public string TempoEstimadoRestante { get; private set; }
|
||||||
public void AtualizarTempoEstimado(double? velocidadeSemErvasMs = null, double? velocidadeComErvasMs = null)
|
public void AtualizarTempoEstimado(double? velocidadeSemErvasMs = null, double? velocidadeComErvasMs = null)
|
||||||
{
|
{
|
||||||
|
|
@ -459,10 +479,35 @@ namespace AgroBase.Models
|
||||||
TempoEstimadoRestante = totalRestante.ToString("HH:mm:ss");
|
TempoEstimadoRestante = totalRestante.ToString("HH:mm:ss");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void MarcarPontosIntermediariosNaoVisitados()
|
||||||
|
{
|
||||||
|
if (!_TrajetoriaFixaDefinida) return;
|
||||||
|
|
||||||
|
for (int i = PontoAtual.idxPonto; i >= Math.Max(0, PontoAtual.idxPonto - JanelaAtualizacaoDePontos); i--)
|
||||||
|
{
|
||||||
|
var ponto = _TrajetoriaFixa[i];
|
||||||
|
if (!ponto.Visitado)
|
||||||
|
{
|
||||||
|
ponto.Visitado = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void AtualizarPropriedadesPontosTrajetoria()
|
||||||
|
{
|
||||||
|
if (!_TrajetoriaFixaDefinida) return;
|
||||||
|
|
||||||
|
// Atualiza apenas os pontos dentro do intervalo definido
|
||||||
|
foreach (var ponto in _TrajetoriaJanela)
|
||||||
|
{
|
||||||
|
ponto.AtualizarPropriedades();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void AtualizarDadosTrajetoria()
|
private void AtualizarDadosTrajetoria()
|
||||||
{
|
{
|
||||||
if (_TrajetoriaFixa == null || _TrajetoriaFixa.Count == 0) return;
|
if (!_TrajetoriaFixaDefinida) return;
|
||||||
|
|
||||||
AtuaalizarTempoEntreLeituras();
|
AtuaalizarTempoEntreLeituras();
|
||||||
AtualizarDistanciaMaximaEntreLeituras();
|
AtualizarDistanciaMaximaEntreLeituras();
|
||||||
|
|
@ -473,6 +518,7 @@ namespace AgroBase.Models
|
||||||
DefinirPontoAtual();
|
DefinirPontoAtual();
|
||||||
AtualizarCorredorAtual();
|
AtualizarCorredorAtual();
|
||||||
DefinirProximoPonto();
|
DefinirProximoPonto();
|
||||||
|
MarcarPontosIntermediariosNaoVisitados();
|
||||||
DefinirPontoMaisProximo();
|
DefinirPontoMaisProximo();
|
||||||
AtualizarAnguloMedioCorredor();
|
AtualizarAnguloMedioCorredor();
|
||||||
AtualizarAnguloCaminho();
|
AtualizarAnguloCaminho();
|
||||||
|
|
@ -487,16 +533,6 @@ namespace AgroBase.Models
|
||||||
AtualizarTempoEstimado();
|
AtualizarTempoEstimado();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AtualizarPropriedadesPontosTrajetoria()
|
|
||||||
{
|
|
||||||
if (_TrajetoriaFixa == null || _TrajetoriaFixa.Count == 0) return;
|
|
||||||
|
|
||||||
// Atualiza apenas os pontos dentro do intervalo definido
|
|
||||||
foreach (var ponto in _TrajetoriaJanela)
|
|
||||||
{
|
|
||||||
ponto.AtualizarPropriedades();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void LoopAtualizaDados()
|
public void LoopAtualizaDados()
|
||||||
|
|
@ -645,7 +681,8 @@ namespace AgroBase.Models
|
||||||
(List<List<GPSModel>> corredores, List<double> CorredoresLarguras) = ProjetarCorredores();
|
(List<List<GPSModel>> corredores, List<double> CorredoresLarguras) = ProjetarCorredores();
|
||||||
Corredores = corredores;
|
Corredores = corredores;
|
||||||
|
|
||||||
Enums.DirecaoCarroRua direcaoAtual = ExtremoMaisProximoMapa == 0 ? Enums.DirecaoCarroRua.Ida : Enums.DirecaoCarroRua.Volta;
|
//Enums.DirecaoCarroRua direcaoAtual = ExtremoMaisProximoMapa == 0 ? Enums.DirecaoCarroRua.Ida : Enums.DirecaoCarroRua.Volta;
|
||||||
|
Enums.DirecaoCarroRua direcaoAtual = Enums.DirecaoCarroRua.Ida;
|
||||||
|
|
||||||
PontoTrajetoriaModel PontoRobo = new PontoTrajetoriaModel(TipoPontoRua.PosicaoRobo)
|
PontoTrajetoriaModel PontoRobo = new PontoTrajetoriaModel(TipoPontoRua.PosicaoRobo)
|
||||||
{
|
{
|
||||||
|
|
@ -759,7 +796,7 @@ namespace AgroBase.Models
|
||||||
Direcao = direcaoAtual,
|
Direcao = direcaoAtual,
|
||||||
Orientacao = GPSUtils.CalcularOrientacao(_trajetoriaFixa.Last().Posicao, UltimoPonto),
|
Orientacao = GPSUtils.CalcularOrientacao(_trajetoriaFixa.Last().Posicao, UltimoPonto),
|
||||||
Visitado = false,
|
Visitado = false,
|
||||||
LarguraCorredor = !ultimoCorredor ? LarguraCorredorPadrao : (LarguraCorredorPadrao / 2.0)
|
LarguraCorredor = !ultimoCorredor ? LarguraCorredorPadrao : LarguraCorredorPadrao / 2.0
|
||||||
};
|
};
|
||||||
_trajetoriaFixa.Add(PontoFinal);
|
_trajetoriaFixa.Add(PontoFinal);
|
||||||
|
|
||||||
|
|
@ -767,21 +804,47 @@ namespace AgroBase.Models
|
||||||
}
|
}
|
||||||
|
|
||||||
_TrajetoriaFixa = new List<PontoTrajetoriaModel>(_trajetoriaFixa);
|
_TrajetoriaFixa = new List<PontoTrajetoriaModel>(_trajetoriaFixa);
|
||||||
|
|
||||||
|
(List<GPSModel> ruaEsq, List<GPSModel> ruaDir) = DeterminarRuasLaterais(GPSService.UltimaLeitura, _trajetoriaFixa[1].Posicao, RuasPlantacao[0], RuasPlantacao[1]);
|
||||||
|
int idxEsq = RuasPlantacao.IndexOf(ruaEsq);
|
||||||
|
int idxDir = RuasPlantacao.IndexOf(ruaDir);
|
||||||
|
int incEsq = 0;
|
||||||
|
int incDir = 0;
|
||||||
|
|
||||||
_Corredores = _TrajetoriaFixa
|
_Corredores = _TrajetoriaFixa
|
||||||
.GroupBy(x => x.idxCorredor)
|
.GroupBy(x => x.idxCorredor)
|
||||||
.Select(x =>
|
.Select((x, i) =>
|
||||||
{
|
{
|
||||||
double distanciaTotal = GPSUtils.DistanciaDoTrecho(x.Select(y => y.Posicao).ToList());
|
double distanciaTotal = GPSUtils.DistanciaDoTrecho(x.Select(y => y.Posicao).ToList());
|
||||||
|
|
||||||
return new CorredorTrajetoriaModel()
|
bool par = (i % 2 == 0);
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
if (idxDir == 0)
|
||||||
|
{
|
||||||
|
incDir += !par ? 2 : 0;
|
||||||
|
incEsq += !par ? 0 : 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
incDir += par ? 2 : 0;
|
||||||
|
incEsq += par ? 0 : 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var obj = new CorredorTrajetoriaModel()
|
||||||
{
|
{
|
||||||
Idx = x.Key,
|
Idx = x.Key,
|
||||||
Largura = CorredoresLarguras[x.Key],
|
Largura = CorredoresLarguras[x.Key],
|
||||||
DistanciaTotal = distanciaTotal,
|
DistanciaTotal = distanciaTotal,
|
||||||
Pontos = x.ToList(),
|
Pontos = x.ToList(),
|
||||||
QtdPontos = x.Count(),
|
QtdPontos = x.Count(),
|
||||||
DistanciaPercorrida = 0
|
DistanciaPercorrida = 0,
|
||||||
|
idxRuaDireita = idxDir + incDir,
|
||||||
|
idxRuaEsquerda = idxEsq + incEsq
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return obj;
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
|
@ -878,6 +941,34 @@ namespace AgroBase.Models
|
||||||
return 0; // Se não encontrar, assuma o último waypoint
|
return 0; // Se não encontrar, assuma o último waypoint
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private (List<GPSModel> ruaEsquerda, List<GPSModel> ruaDireita) DeterminarRuasLaterais(GPSModel robo, GPSModel proximoPonto, List<GPSModel> rua1, List<GPSModel> rua2)
|
||||||
|
{
|
||||||
|
// Determinar qual está à esquerda e qual está à direita
|
||||||
|
bool rua1EstaEsquerda = EstaEsquerda(robo, proximoPonto, Centroide(rua1));
|
||||||
|
|
||||||
|
return rua1EstaEsquerda ? (rua1, rua2) : (rua2, rua1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retorna o ponto central da rua (média das coordenadas)
|
||||||
|
private GPSModel Centroide(List<GPSModel> rua)
|
||||||
|
{
|
||||||
|
double latMedia = rua.Average(p => p.Latitude);
|
||||||
|
double lonMedia = rua.Average(p => p.Longitude);
|
||||||
|
return new GPSModel { Latitude = latMedia, Longitude = lonMedia };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determina se um ponto está à esquerda ou à direita do movimento do robô
|
||||||
|
private bool EstaEsquerda(GPSModel robo, GPSModel proximoPonto, GPSModel ponto)
|
||||||
|
{
|
||||||
|
double dxRobo = proximoPonto.Longitude - robo.Longitude;
|
||||||
|
double dyRobo = proximoPonto.Latitude - robo.Latitude;
|
||||||
|
double dxPonto = ponto.Longitude - robo.Longitude;
|
||||||
|
double dyPonto = ponto.Latitude - robo.Latitude;
|
||||||
|
|
||||||
|
double crossProduct = (dxRobo * dyPonto) - (dyRobo * dxPonto);
|
||||||
|
return crossProduct > 0; // Se for positivo, está à esquerda; se for negativo, está à direita.
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CorredorTrajetoriaModel
|
public class CorredorTrajetoriaModel
|
||||||
|
|
@ -888,10 +979,16 @@ namespace AgroBase.Models
|
||||||
public double DistanciaPercorrida { get; set; }
|
public double DistanciaPercorrida { get; set; }
|
||||||
public List<PontoTrajetoriaModel> Pontos { get; set; }
|
public List<PontoTrajetoriaModel> Pontos { get; set; }
|
||||||
public int QtdPontos { get; set; }
|
public int QtdPontos { get; set; }
|
||||||
|
[JsonProperty]
|
||||||
public bool Dentro { get; private set; }
|
public bool Dentro { get; private set; }
|
||||||
|
[JsonProperty]
|
||||||
public double DistanciaRestante { get; private set; }
|
public double DistanciaRestante { get; private set; }
|
||||||
|
[JsonProperty]
|
||||||
public double Progresso { get; private set; }
|
public double Progresso { get; private set; }
|
||||||
|
[JsonProperty]
|
||||||
public bool Concluido { get; private set; }
|
public bool Concluido { get; private set; }
|
||||||
|
public int idxRuaEsquerda { get; set; }
|
||||||
|
public int idxRuaDireita { get; set; }
|
||||||
|
|
||||||
public void AtualizarDados()
|
public void AtualizarDados()
|
||||||
{
|
{
|
||||||
|
|
@ -899,7 +996,16 @@ namespace AgroBase.Models
|
||||||
// Itera diretamente sem criar uma lista temporária
|
// Itera diretamente sem criar uma lista temporária
|
||||||
foreach (var ponto in Pontos)
|
foreach (var ponto in Pontos)
|
||||||
{
|
{
|
||||||
if (ponto.NaMargem && (ponto.Tipo == Enums.TipoPontoRua.Rua || ponto.PontoBorda))
|
// Precisa estar na margem do ponto e, ser um ponto de rua, que significa que já está dentro, ou então de borda, e que esteja se afastando do centro dele
|
||||||
|
if (
|
||||||
|
ponto.NaMargem &&
|
||||||
|
(ponto.Tipo == Enums.TipoPontoRua.Rua ||
|
||||||
|
(
|
||||||
|
(ponto.Tipo == TipoPontoRua.BordaEntrada && !ponto.Aproximando) ||
|
||||||
|
(ponto.Tipo == TipoPontoRua.BordaSaida && ponto.Aproximando)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Dentro = true;
|
Dentro = true;
|
||||||
break; // Encontramos um ponto válido, podemos sair
|
break; // Encontramos um ponto válido, podemos sair
|
||||||
|
|
@ -907,7 +1013,7 @@ namespace AgroBase.Models
|
||||||
}
|
}
|
||||||
|
|
||||||
DistanciaRestante = DistanciaTotal - DistanciaPercorrida;
|
DistanciaRestante = DistanciaTotal - DistanciaPercorrida;
|
||||||
Progresso = FuncoesMatematicas.Clamp((DistanciaPercorrida / DistanciaTotal) * 100.0, 0, 100);
|
Progresso = (DistanciaTotal > 0) ? FuncoesMatematicas.Clamp((DistanciaPercorrida / DistanciaTotal) * 100.0, 0, 100) : 0;
|
||||||
Concluido = !Pontos.Any(x => !x.Visitado);
|
Concluido = !Pontos.Any(x => !x.Visitado);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -922,6 +1028,8 @@ namespace AgroBase.Models
|
||||||
QtdPontos = QtdPontos,
|
QtdPontos = QtdPontos,
|
||||||
Dentro = Dentro,
|
Dentro = Dentro,
|
||||||
Concluido = Concluido,
|
Concluido = Concluido,
|
||||||
|
idxRuaEsquerda = idxRuaEsquerda,
|
||||||
|
idxRuaDireita = idxRuaDireita,
|
||||||
DistanciaRestante = DistanciaRestante,
|
DistanciaRestante = DistanciaRestante,
|
||||||
Progresso = Progresso,
|
Progresso = Progresso,
|
||||||
Pontos = new List<PontoTrajetoriaModel>()
|
Pontos = new List<PontoTrajetoriaModel>()
|
||||||
|
|
@ -948,14 +1056,23 @@ namespace AgroBase.Models
|
||||||
public bool Visitado { get; set; } = false;
|
public bool Visitado { get; set; } = false;
|
||||||
|
|
||||||
// ✅ Agora, propriedades podem ser atualizadas com `set; private`
|
// ✅ Agora, propriedades podem ser atualizadas com `set; private`
|
||||||
|
[JsonProperty]
|
||||||
public double OrientacaoAtual { get; private set; }
|
public double OrientacaoAtual { get; private set; }
|
||||||
|
[JsonProperty]
|
||||||
public double OrientacaoAnterior { get; private set; }
|
public double OrientacaoAnterior { get; private set; }
|
||||||
|
[JsonProperty]
|
||||||
public double DistanciaTrajeto { get; private set; }
|
public double DistanciaTrajeto { get; private set; }
|
||||||
|
[JsonProperty]
|
||||||
public double DistanciaAtual { get; private set; }
|
public double DistanciaAtual { get; private set; }
|
||||||
|
[JsonProperty]
|
||||||
public double DistanciaAnterior { get; private set; }
|
public double DistanciaAnterior { get; private set; }
|
||||||
|
[JsonProperty]
|
||||||
public bool Aproximando { get; private set; }
|
public bool Aproximando { get; private set; }
|
||||||
|
[JsonProperty]
|
||||||
public bool NaMargem { get; private set; }
|
public bool NaMargem { get; private set; }
|
||||||
|
[JsonProperty]
|
||||||
public bool PontoBorda { get; private set; }
|
public bool PontoBorda { get; private set; }
|
||||||
|
[JsonProperty]
|
||||||
public bool PontoLigacao { get; private set; }
|
public bool PontoLigacao { get; private set; }
|
||||||
|
|
||||||
// ✅ Construtor: Calcula propriedades fixas uma única vez
|
// ✅ Construtor: Calcula propriedades fixas uma única vez
|
||||||
|
|
@ -988,7 +1105,8 @@ namespace AgroBase.Models
|
||||||
TrajetoriaMapaOperacaoModel.DistanciaEntrePontos;
|
TrajetoriaMapaOperacaoModel.DistanciaEntrePontos;
|
||||||
|
|
||||||
// Define o limite de distância para considerar o ponto como visitado
|
// Define o limite de distância para considerar o ponto como visitado
|
||||||
double limiteDistancia = Math.Ceiling(TrajetoriaMapaOperacaoModel.DistanciaMaximaEntreLeituras / distanciaEntrePontos) * 2 * distanciaEntrePontos;
|
double fatorAjuste = Tipo == TipoPontoRua.CruvaEntreCorredores ? 1.5 : 2.0; // Curvas podem ter menos tolerância
|
||||||
|
double limiteDistancia = Math.Ceiling(TrajetoriaMapaOperacaoModel.DistanciaMaximaEntreLeituras / distanciaEntrePontos) * fatorAjuste * distanciaEntrePontos;
|
||||||
|
|
||||||
// Se o ponto está dentro da margem e dentro do limite de distância, marca como visitado
|
// Se o ponto está dentro da margem e dentro do limite de distância, marca como visitado
|
||||||
if (NaMargem && DistanciaTrajeto <= limiteDistancia)
|
if (NaMargem && DistanciaTrajeto <= limiteDistancia)
|
||||||
|
|
@ -1065,7 +1183,7 @@ namespace AgroBase.Models
|
||||||
|
|
||||||
private void AtualizarNaMargem()
|
private void AtualizarNaMargem()
|
||||||
{
|
{
|
||||||
NaMargem = DistanciaAtual < (LarguraCorredor / 1.2);
|
NaMargem = DistanciaAtual < (LarguraCorredor * 0.8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,9 @@ namespace AgroBase.Models
|
||||||
|
|
||||||
public static GPSModel SimularNovaPosicao(TipoMovimentoDirecional tipoMovimento, double anguloControle, double velocidadeMs, double tempoDelta, double anguloAtual, GPSModel PosicaoAtual)
|
public static GPSModel SimularNovaPosicao(TipoMovimentoDirecional tipoMovimento, double anguloControle, double velocidadeMs, double tempoDelta, double anguloAtual, GPSModel PosicaoAtual)
|
||||||
{
|
{
|
||||||
|
// Fator de correção da curva
|
||||||
|
double k = 1.0 + 0.5 * Math.Exp(-Math.Abs(anguloControle) / 15.0);
|
||||||
|
|
||||||
// Converte o ângulo de controle para radianos
|
// Converte o ângulo de controle para radianos
|
||||||
double anguloControleRad = anguloControle * (Math.PI / 180.0);
|
double anguloControleRad = anguloControle * (Math.PI / 180.0);
|
||||||
|
|
||||||
|
|
@ -266,6 +269,9 @@ namespace AgroBase.Models
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aplica o fator de correção da curva
|
||||||
|
R *= k;
|
||||||
|
|
||||||
// Calcula a rotação angular com base na velocidade e no raio
|
// Calcula a rotação angular com base na velocidade e no raio
|
||||||
double omega = velocidadeMs / R;
|
double omega = velocidadeMs / R;
|
||||||
|
|
||||||
|
|
@ -623,10 +629,24 @@ namespace AgroBase.Models
|
||||||
return timeSpan.ToString(@"hh\:mm\:ss");
|
return timeSpan.ToString(@"hh\:mm\:ss");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DelaySincrono(int ms)
|
public static async Task<bool> AguardarCondicaoAsync(Func<bool> condicao, int timeoutMs = 5000, int delayMs = 200, Func<bool> forcarLiberacao = null)
|
||||||
{
|
{
|
||||||
DateTime Agora = DateTime.Now;
|
var tempoInicial = DateTime.Now;
|
||||||
while (Agora < DateTime.Now.AddMilliseconds(-ms)) { }
|
|
||||||
|
while (!condicao())
|
||||||
|
{
|
||||||
|
// Se atingiu o timeout, interrompe e retorna false
|
||||||
|
if ((DateTime.Now - tempoInicial).TotalMilliseconds >= timeoutMs)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Se a variável de liberação for passada e retornar true, interrompe o loop
|
||||||
|
if (forcarLiberacao != null && forcarLiberacao())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
await Task.Delay(delayMs);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true; // Condição atingida dentro do tempo limite
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ namespace AgroBase.Services
|
||||||
if (Iniciado)
|
if (Iniciado)
|
||||||
{
|
{
|
||||||
DefinirDispositivo();
|
DefinirDispositivo();
|
||||||
|
Task.Run(async () => await ConfigurarModulo());
|
||||||
Task.Run(async () => await AplicarCorrecaoRTK());
|
Task.Run(async () => await AplicarCorrecaoRTK());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -83,11 +84,26 @@ namespace AgroBase.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ConfigurarModulo()
|
private static async Task ConfigurarModulo()
|
||||||
{
|
{
|
||||||
|
string freq = (1.0 / TaxaAmostragemHz).ToString("0.0").Replace(",", ".");
|
||||||
|
string[] comandos = new string[]
|
||||||
|
{
|
||||||
|
$"unlog\r\n",
|
||||||
|
$"unlog\r\ngngga {freq}\r\ngpths {freq}\r\n"
|
||||||
|
};
|
||||||
|
|
||||||
|
await Task.Delay(2000);
|
||||||
|
|
||||||
|
foreach (string comando in comandos)
|
||||||
|
{
|
||||||
|
byte[] bytesComando = Encoding.ASCII.GetBytes(comando);
|
||||||
|
PortaGPS.Write(bytesComando, 0, bytesComando.Length);
|
||||||
|
await Task.Delay(1000); // Pequeno delay para evitar sobrecarga na comunicação
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static StringBuilder _buffer = new StringBuilder();
|
private static StringBuilder _buffer = new StringBuilder();
|
||||||
|
|
||||||
private static void PortaGPS_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
private static void PortaGPS_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||||
|
|
@ -132,6 +148,32 @@ namespace AgroBase.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static DateTime ultimaRecepcao = DateTime.MinValue;
|
||||||
|
private static double frequenciaRecepcao = 0; // Em Hz
|
||||||
|
private static double intervaloRecepcao = 0; // Em milissegundos
|
||||||
|
private static void LogTempoLeitura()
|
||||||
|
{
|
||||||
|
DateTime agora = DateTime.Now;
|
||||||
|
|
||||||
|
if (ultimaRecepcao != DateTime.MinValue)
|
||||||
|
{
|
||||||
|
// Calcula o intervalo entre recepções (em segundos)
|
||||||
|
intervaloRecepcao = (agora - ultimaRecepcao).TotalMilliseconds;
|
||||||
|
|
||||||
|
// Calcula a frequência (Hz) => f = 1 / T, onde T é o intervalo em segundos
|
||||||
|
if (intervaloRecepcao > 0)
|
||||||
|
{
|
||||||
|
frequenciaRecepcao = 1000.0 / intervaloRecepcao;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Log no console (ou pode ser salvo em um arquivo)
|
||||||
|
Console.WriteLine($"GPS - Intervalo: {intervaloRecepcao:F2} ms | Frequência: {frequenciaRecepcao:F2} Hz");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Atualiza o timestamp da última recepção
|
||||||
|
ultimaRecepcao = agora;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void ProcessarDadosNMEA(string nmeaData)
|
private static void ProcessarDadosNMEA(string nmeaData)
|
||||||
{
|
{
|
||||||
|
|
@ -143,27 +185,29 @@ namespace AgroBase.Services
|
||||||
var sentenca = linha.Trim();
|
var sentenca = linha.Trim();
|
||||||
|
|
||||||
// Identifica o tipo de sentença
|
// Identifica o tipo de sentença
|
||||||
|
|
||||||
|
// Coordenadas
|
||||||
if (sentenca.StartsWith("$GNGGA"))
|
if (sentenca.StartsWith("$GNGGA"))
|
||||||
{
|
{
|
||||||
ProcessarGNGGA(sentenca);
|
ProcessarGNGGA(sentenca);
|
||||||
AtualizarCoordenadasGPS();
|
AtualizarCoordenadasGPS();
|
||||||
}
|
}
|
||||||
|
// Variação magnética
|
||||||
else if (sentenca.StartsWith("$GNRMC"))
|
else if (sentenca.StartsWith("$GNRMC"))
|
||||||
{
|
{
|
||||||
ProcessarGNRMC(sentenca);
|
ProcessarGNRMC(sentenca);
|
||||||
}
|
}
|
||||||
else if (sentenca.StartsWith("$GNVTG"))
|
// Curso verdadeiro
|
||||||
|
else if (sentenca.StartsWith("$GNVTG") || sentenca.StartsWith("$GPVTG"))
|
||||||
{
|
{
|
||||||
ProcessarGNVTG(sentenca);
|
ProcessarGNVTG(sentenca);
|
||||||
}
|
}
|
||||||
|
// Satélites em vista
|
||||||
else if (sentenca.StartsWith("$GPGSV") || sentenca.StartsWith("$GLGSV") || sentenca.StartsWith("$GBGSV") || sentenca.StartsWith("$GAGSV"))
|
else if (sentenca.StartsWith("$GPGSV") || sentenca.StartsWith("$GLGSV") || sentenca.StartsWith("$GBGSV") || sentenca.StartsWith("$GAGSV"))
|
||||||
{
|
{
|
||||||
ProcessarGSV(sentenca);
|
ProcessarGSV(sentenca);
|
||||||
}
|
}
|
||||||
else if (sentenca.StartsWith("$GPVTG"))
|
// Orientação real
|
||||||
{
|
|
||||||
ProcessarGPVTG(sentenca);
|
|
||||||
}
|
|
||||||
else if (sentenca.StartsWith("$GNTHS") || sentenca.StartsWith("$GPTHS"))
|
else if (sentenca.StartsWith("$GNTHS") || sentenca.StartsWith("$GPTHS"))
|
||||||
{
|
{
|
||||||
ProcessarGNTHS(sentenca);
|
ProcessarGNTHS(sentenca);
|
||||||
|
|
@ -245,6 +289,8 @@ namespace AgroBase.Services
|
||||||
DateTime currentDate = DateTime.UtcNow.Date;
|
DateTime currentDate = DateTime.UtcNow.Date;
|
||||||
UltimaLeitura.DataHora = currentDate.Add(timeOfDay);
|
UltimaLeitura.DataHora = currentDate.Add(timeOfDay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogTempoLeitura();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessarGNRMC(string sentenca)
|
private static void ProcessarGNRMC(string sentenca)
|
||||||
|
|
@ -370,39 +416,6 @@ namespace AgroBase.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessarGPVTG(string sentenca)
|
|
||||||
{
|
|
||||||
var campos = sentenca.Split(',');
|
|
||||||
|
|
||||||
if (campos.Length >= 9)
|
|
||||||
{
|
|
||||||
string cursoVerdadeiro = campos[1].Replace(".", ",");
|
|
||||||
string referenciaCurso = campos[2]; // T = Verdadeiro, M = Magnético
|
|
||||||
string velocidadeSobreSoloKnots = campos[5].Replace(".", ",");
|
|
||||||
string velocidadeSobreSoloKmh = campos[7].Replace(".", ",");
|
|
||||||
|
|
||||||
//Console.WriteLine($"GPVTG: Curso Verdadeiro={cursoVerdadeiro}{referenciaCurso}, " + $"Velocidade (nós)={velocidadeSobreSoloKnots}, Velocidade (km/h)={velocidadeSobreSoloKmh}");
|
|
||||||
|
|
||||||
PenultimaLeitura.Momento = UltimaLeitura.Momento;
|
|
||||||
PenultimaLeitura.CursoVerdadeiro = UltimaLeitura.CursoVerdadeiro;
|
|
||||||
PenultimaLeitura.Velocidade = UltimaLeitura.Velocidade;
|
|
||||||
|
|
||||||
UltimaLeitura.Momento = DateTime.Now;
|
|
||||||
|
|
||||||
double curso = 0;
|
|
||||||
double.TryParse(cursoVerdadeiro, out curso);
|
|
||||||
UltimaLeitura.CursoVerdadeiro = curso;
|
|
||||||
|
|
||||||
double velocidade = 0;
|
|
||||||
double.TryParse(velocidadeSobreSoloKmh, out velocidade);
|
|
||||||
UltimaLeitura.Velocidade = velocidade;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine("GPVTG: Sentença malformada ou incompleta.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void ProcessarGNTHS(string sentenca)
|
private static void ProcessarGNTHS(string sentenca)
|
||||||
{
|
{
|
||||||
// Remove o caractere de início '$' e divide os campos
|
// Remove o caractere de início '$' e divide os campos
|
||||||
|
|
@ -729,7 +742,9 @@ namespace AgroBase.Services
|
||||||
double anguloGPSMovimento = UltimaLeitura.OrientacaoMovimento;
|
double anguloGPSMovimento = UltimaLeitura.OrientacaoMovimento;
|
||||||
double distAnguloGPS = UltimaLeitura.Distancia;
|
double distAnguloGPS = UltimaLeitura.Distancia;
|
||||||
|
|
||||||
anguloFinal = CalcularAnguloUnificado(anguloGPS, UltimaLeitura.QualidadeFix, anguloGPSMovimento, distAnguloGPS);
|
//anguloFinal = CalcularAnguloUnificado(anguloGPS, UltimaLeitura.QualidadeFix, anguloGPSMovimento, distAnguloGPS);
|
||||||
|
|
||||||
|
anguloFinal = anguloGPS;
|
||||||
}
|
}
|
||||||
else if (witIniciado)
|
else if (witIniciado)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace AgroBase.Services
|
namespace AgroBase.Services
|
||||||
{
|
{
|
||||||
|
|
@ -101,6 +102,16 @@ namespace AgroBase.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CriarArquivoMapa(List<List<GPSModel>> Trajetoria, int id = 1517, string name = "Projeto", double dist1 = 0.0, double dist2 = 0.0)
|
public static void CriarArquivoMapa(List<List<GPSModel>> Trajetoria, int id = 1517, string name = "Projeto", double dist1 = 0.0, double dist2 = 0.0)
|
||||||
|
{
|
||||||
|
var featureCollection = ConverterPontosParaMapa(Trajetoria, id, name, dist1, dist2);
|
||||||
|
|
||||||
|
// Serializando o objeto para JSON
|
||||||
|
string jsonString = JsonConvert.SerializeObject(featureCollection);
|
||||||
|
|
||||||
|
File.WriteAllText(Variaveis.CaminhoMapasConvertidos + name + ".json", jsonString, Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MapaFeatureCollectionModel ConverterPontosParaMapa(List<List<GPSModel>> Trajetoria, int id = 1517, string name = "Projeto", double dist1 = 0.0, double dist2 = 0.0)
|
||||||
{
|
{
|
||||||
var featureCollection = new MapaFeatureCollectionModel
|
var featureCollection = new MapaFeatureCollectionModel
|
||||||
{
|
{
|
||||||
|
|
@ -139,10 +150,7 @@ namespace AgroBase.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Serializando o objeto para JSON
|
return featureCollection;
|
||||||
string jsonString = JsonConvert.SerializeObject(featureCollection);
|
|
||||||
|
|
||||||
File.WriteAllText(Variaveis.CaminhoMapasConvertidos + name + ".json", jsonString, Encoding.UTF8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -851,7 +851,7 @@ namespace AgroBase.Services
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(Recebido.Contains("$GPTXT") || Recebido.Contains("$GPRMC") || Recebido.Contains("$GPGGA") || Recebido.Contains("$GPGLL")) ||
|
(Recebido.Contains("$GPTXT") || Recebido.Contains("$GPRMC") || Recebido.Contains("$GPGGA") || Recebido.Contains("$GPGLL")) ||
|
||||||
(Recebido.Contains("$GNGGA") || Recebido.Contains("$GPVTG") || Recebido.Contains("$GPGSV"))
|
(Recebido.Contains("$GNGGA") || Recebido.Contains("$GPVTG") || Recebido.Contains("$GPGSV") || Recebido.Contains("$GNTHS"))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GPSService.AtualizarPortaCOM(Porta);
|
GPSService.AtualizarPortaCOM(Porta);
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
||||||
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"Id":"1","Name":"CidadeJardimFundo","Length":7.0570051737487685,"Dist1":7.0570051737487685,"Dist2":0.0},"geometry":{"id":"0","type":"LineString","coordinates":[[-47.395268038666664,-22.172154729333332],[-47.395253384833332,-22.172156474333335],[-47.395231131,-22.172159042833332]]}},{"type":"Feature","properties":{"Id":"2","Name":"CidadeJardimFundo","Length":5.3317380071092622,"Dist1":7.0570051737487685,"Dist2":0.0},"geometry":{"id":"1","type":"LineString","coordinates":[[-47.395239748666668,-22.172175429],[-47.395255433666669,-22.172173393666668],[-47.395268102333333,-22.172171744666667]]}},{"type":"Feature","properties":{"Id":"3","Name":"CidadeJardimFundo","Length":6.76453730127734,"Dist1":7.0570051737487685,"Dist2":0.0},"geometry":{"id":"2","type":"LineString","coordinates":[[-47.3952834685,-22.1721922585],[-47.395263362666668,-22.172194317],[-47.395241582666664,-22.1721965925]]}}]}
|
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"Id":"1","Name":"CidadeJardimFundo","Length":7.0570051737487685,"Dist1":7.0570051737487685,"Dist2":0.0},"geometry":{"id":null,"type":"LineString","coordinates":[[-47.395268038666664,-22.172154729333332],[-47.395253384833332,-22.172156474333335],[-47.395231131,-22.172159042833332]]}},{"type":"Feature","properties":{"Id":"2","Name":"CidadeJardimFundo","Length":5.3317380071092622,"Dist1":7.0570051737487685,"Dist2":0.0},"geometry":{"id":null,"type":"LineString","coordinates":[[-47.395239748666668,-22.172175429],[-47.395255433666669,-22.172173393666668],[-47.395268102333333,-22.172171744666667]]}},{"type":"Feature","properties":{"Id":"3","Name":"CidadeJardimFundo","Length":6.76453730127734,"Dist1":7.0570051737487685,"Dist2":0.0},"geometry":{"id":null,"type":"LineString","coordinates":[[-47.3952834685,-22.1721922585],[-47.395263362666668,-22.172194317],[-47.395241582666664,-22.1721965925]]}}]}
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
<meta name="viewport" content="width=device-width,
|
<meta name="viewport" content="width=device-width,
|
||||||
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
<style>
|
<style>
|
||||||
#map_2cc323c0dc0005093e0f8e55c3cbace4 {
|
#map_2c3b9b5a0bbe650a5f56c4603f653b08 {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100.0%;
|
width: 100.0%;
|
||||||
height: 100.0%;
|
height: 100.0%;
|
||||||
|
|
@ -39,14 +39,14 @@
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
<div class="folium-map" id="map_2cc323c0dc0005093e0f8e55c3cbace4" ></div>
|
<div class="folium-map" id="map_2c3b9b5a0bbe650a5f56c4603f653b08" ></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
var map_2cc323c0dc0005093e0f8e55c3cbace4 = L.map(
|
var map_2c3b9b5a0bbe650a5f56c4603f653b08 = L.map(
|
||||||
"map_2cc323c0dc0005093e0f8e55c3cbace4",
|
"map_2c3b9b5a0bbe650a5f56c4603f653b08",
|
||||||
{
|
{
|
||||||
center: [0.0, 0.0],
|
center: [0.0, 0.0],
|
||||||
crs: L.CRS.EPSG3857,
|
crs: L.CRS.EPSG3857,
|
||||||
|
|
@ -60,13 +60,13 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var tile_layer_72ffec9fcc7dd3bf1bc3f76bebddd71f = L.tileLayer(
|
var tile_layer_dc4c0c6fa24832018559655cf3935bb2 = L.tileLayer(
|
||||||
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
"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}
|
{"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_72ffec9fcc7dd3bf1bc3f76bebddd71f.addTo(map_2cc323c0dc0005093e0f8e55c3cbace4);
|
tile_layer_dc4c0c6fa24832018559655cf3935bb2.addTo(map_2c3b9b5a0bbe650a5f56c4603f653b08);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@
|
||||||
}
|
}
|
||||||
trajeto_json_add({"features": []});
|
trajeto_json_add({"features": []});
|
||||||
|
|
||||||
trajeto_json.addTo(map_2cc323c0dc0005093e0f8e55c3cbace4);
|
trajeto_json.addTo(map_2c3b9b5a0bbe650a5f56c4603f653b08);
|
||||||
|
|
||||||
function adicionarGeometria(novaGeometria) {
|
function adicionarGeometria(novaGeometria) {
|
||||||
trajeto_json.addData(novaGeometria);
|
trajeto_json.addData(novaGeometria);
|
||||||
|
|
@ -145,7 +145,7 @@
|
||||||
|
|
||||||
var marcadorDinamico = L.marker([0, 0], {
|
var marcadorDinamico = L.marker([0, 0], {
|
||||||
icon: customIcon
|
icon: customIcon
|
||||||
}).addTo(map_2cc323c0dc0005093e0f8e55c3cbace4);
|
}).addTo(map_2c3b9b5a0bbe650a5f56c4603f653b08);
|
||||||
|
|
||||||
// Conectar ao broker MQTT
|
// Conectar ao broker MQTT
|
||||||
const client = mqtt.connect('ws://localhost:9001'); // Use wss para conexão segura
|
const client = mqtt.connect('ws://localhost:9001'); // Use wss para conexão segura
|
||||||
|
|
@ -183,7 +183,7 @@
|
||||||
marcadorDinamico.setRotationAngle(angulo);
|
marcadorDinamico.setRotationAngle(angulo);
|
||||||
|
|
||||||
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
|
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
|
||||||
map_2cc323c0dc0005093e0f8e55c3cbace4.setView(novaPosicao, map_2cc323c0dc0005093e0f8e55c3cbace4.getZoom());
|
map_2c3b9b5a0bbe650a5f56c4603f653b08.setView(novaPosicao, map_2c3b9b5a0bbe650a5f56c4603f653b08.getZoom());
|
||||||
});
|
});
|
||||||
|
|
||||||
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {
|
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
<meta name="viewport" content="width=device-width,
|
<meta name="viewport" content="width=device-width,
|
||||||
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
<style>
|
<style>
|
||||||
#map_3eb2818c92de29fbbf19238cc5599974 {
|
#map_c80e232584f4704480643024dfc06d97 {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100.0%;
|
width: 100.0%;
|
||||||
height: 100.0%;
|
height: 100.0%;
|
||||||
|
|
@ -39,14 +39,14 @@
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
<div class="folium-map" id="map_3eb2818c92de29fbbf19238cc5599974" ></div>
|
<div class="folium-map" id="map_c80e232584f4704480643024dfc06d97" ></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
var map_3eb2818c92de29fbbf19238cc5599974 = L.map(
|
var map_c80e232584f4704480643024dfc06d97 = L.map(
|
||||||
"map_3eb2818c92de29fbbf19238cc5599974",
|
"map_c80e232584f4704480643024dfc06d97",
|
||||||
{
|
{
|
||||||
center: [-22.172175660916665, -47.39525729975],
|
center: [-22.172175660916665, -47.39525729975],
|
||||||
crs: L.CRS.EPSG3857,
|
crs: L.CRS.EPSG3857,
|
||||||
|
|
@ -60,13 +60,13 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var tile_layer_15b96830b01957661a5a880b4b5ad58e = L.tileLayer(
|
var tile_layer_1b59f524f63a79f47997f30f72ad2db1 = L.tileLayer(
|
||||||
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
"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}
|
{"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_15b96830b01957661a5a880b4b5ad58e.addTo(map_3eb2818c92de29fbbf19238cc5599974);
|
tile_layer_1b59f524f63a79f47997f30f72ad2db1.addTo(map_c80e232584f4704480643024dfc06d97);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -82,7 +82,7 @@
|
||||||
}*/
|
}*/
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function geo_json_c7967f27f3f77f95bef294a59736ac33_onEachFeature(feature, layer) {
|
function geo_json_2d0593835f9ad1bcbb3a29bf8a4a564d_onEachFeature(feature, layer) {
|
||||||
layer.on({
|
layer.on({
|
||||||
|
|
||||||
click: function(e) {
|
click: function(e) {
|
||||||
|
|
@ -118,20 +118,20 @@
|
||||||
}*/
|
}*/
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var geo_json_c7967f27f3f77f95bef294a59736ac33 = L.geoJson(null, {
|
var geo_json_2d0593835f9ad1bcbb3a29bf8a4a564d = L.geoJson(null, {
|
||||||
onEachFeature: geo_json_c7967f27f3f77f95bef294a59736ac33_onEachFeature,
|
onEachFeature: geo_json_2d0593835f9ad1bcbb3a29bf8a4a564d_onEachFeature,
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function geo_json_c7967f27f3f77f95bef294a59736ac33_add (data) {
|
function geo_json_2d0593835f9ad1bcbb3a29bf8a4a564d_add (data) {
|
||||||
geo_json_c7967f27f3f77f95bef294a59736ac33
|
geo_json_2d0593835f9ad1bcbb3a29bf8a4a564d
|
||||||
.addData(data);
|
.addData(data);
|
||||||
}
|
}
|
||||||
geo_json_c7967f27f3f77f95bef294a59736ac33_add({"features": [{"geometry": {"coordinates": [[-47.395268038666664, -22.172154729333332], [-47.39525338483333, -22.172156474333335], [-47.395231131, -22.172159042833332]], "id": "0", "type": "LineString"}, "id": 0, "properties": {"Dist1": 7.0570051737487685, "Dist2": 0.0, "Id": "1", "Length": 7.0570051737487685, "Name": "CidadeJardimFundo"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.39523974866667, -22.172175429], [-47.39525543366667, -22.172173393666668], [-47.39526810233333, -22.172171744666667]], "id": "1", "type": "LineString"}, "id": 1, "properties": {"Dist1": 7.0570051737487685, "Dist2": 0.0, "Id": "2", "Length": 5.331738007109262, "Name": "CidadeJardimFundo"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.3952834685, -22.1721922585], [-47.39526336266667, -22.172194317], [-47.395241582666664, -22.1721965925]], "id": "2", "type": "LineString"}, "id": 2, "properties": {"Dist1": 7.0570051737487685, "Dist2": 0.0, "Id": "3", "Length": 6.76453730127734, "Name": "CidadeJardimFundo"}, "type": "Feature"}], "type": "FeatureCollection"});
|
geo_json_2d0593835f9ad1bcbb3a29bf8a4a564d_add({"features": [{"geometry": {"coordinates": [[-47.395268038666664, -22.172154729333332], [-47.39525338483333, -22.172156474333335], [-47.395231131, -22.172159042833332]], "id": null, "type": "LineString"}, "id": 0, "properties": {"Dist1": 7.0570051737487685, "Dist2": 0.0, "Id": "1", "Length": 7.0570051737487685, "Name": "CidadeJardimFundo"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.39523974866667, -22.172175429], [-47.39525543366667, -22.172173393666668], [-47.39526810233333, -22.172171744666667]], "id": null, "type": "LineString"}, "id": 1, "properties": {"Dist1": 7.0570051737487685, "Dist2": 0.0, "Id": "2", "Length": 5.331738007109262, "Name": "CidadeJardimFundo"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.3952834685, -22.1721922585], [-47.39526336266667, -22.172194317], [-47.395241582666664, -22.1721965925]], "id": null, "type": "LineString"}, "id": 2, "properties": {"Dist1": 7.0570051737487685, "Dist2": 0.0, "Id": "3", "Length": 6.76453730127734, "Name": "CidadeJardimFundo"}, "type": "Feature"}], "type": "FeatureCollection"});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
geo_json_c7967f27f3f77f95bef294a59736ac33.addTo(map_3eb2818c92de29fbbf19238cc5599974);
|
geo_json_2d0593835f9ad1bcbb3a29bf8a4a564d.addTo(map_c80e232584f4704480643024dfc06d97);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -152,7 +152,7 @@
|
||||||
}
|
}
|
||||||
trajeto_json_add({"features": []});
|
trajeto_json_add({"features": []});
|
||||||
|
|
||||||
trajeto_json.addTo(map_3eb2818c92de29fbbf19238cc5599974);
|
trajeto_json.addTo(map_c80e232584f4704480643024dfc06d97);
|
||||||
|
|
||||||
function adicionarGeometria(novaGeometria) {
|
function adicionarGeometria(novaGeometria) {
|
||||||
trajeto_json.addData(novaGeometria);
|
trajeto_json.addData(novaGeometria);
|
||||||
|
|
@ -210,7 +210,7 @@
|
||||||
}
|
}
|
||||||
trajeto_dinamico_json_add({"features": []});
|
trajeto_dinamico_json_add({"features": []});
|
||||||
|
|
||||||
trajeto_dinamico_json.addTo(map_3eb2818c92de29fbbf19238cc5599974);
|
trajeto_dinamico_json.addTo(map_c80e232584f4704480643024dfc06d97);
|
||||||
|
|
||||||
function adicionarGeometriaDinamica(novaGeometria) {
|
function adicionarGeometriaDinamica(novaGeometria) {
|
||||||
trajeto_dinamico_json.addData(novaGeometria);
|
trajeto_dinamico_json.addData(novaGeometria);
|
||||||
|
|
@ -263,9 +263,9 @@
|
||||||
|
|
||||||
var marcadorEquipamento = L.marker([0, 0], {
|
var marcadorEquipamento = L.marker([0, 0], {
|
||||||
icon: customIcon
|
icon: customIcon
|
||||||
}).addTo(map_3eb2818c92de29fbbf19238cc5599974);
|
}).addTo(map_c80e232584f4704480643024dfc06d97);
|
||||||
|
|
||||||
var marcadorBase = L.marker([0, 0], {}).addTo(map_3eb2818c92de29fbbf19238cc5599974);
|
var marcadorBase = L.marker([0, 0], {}).addTo(map_c80e232584f4704480643024dfc06d97);
|
||||||
var icon = L.AwesomeMarkers.icon(
|
var icon = L.AwesomeMarkers.icon(
|
||||||
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
|
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
|
||||||
);
|
);
|
||||||
|
|
@ -347,7 +347,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foco) {
|
if (foco) {
|
||||||
map_3eb2818c92de29fbbf19238cc5599974.setView(novaPosicao, map_3eb2818c92de29fbbf19238cc5599974.getZoom());
|
map_c80e232584f4704480643024dfc06d97.setView(novaPosicao, map_c80e232584f4704480643024dfc06d97.getZoom());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -364,7 +364,7 @@
|
||||||
function atualizarSelecaoRuas(selecionadas) {
|
function atualizarSelecaoRuas(selecionadas) {
|
||||||
selecionadas = JSON.parse(selecionadas);
|
selecionadas = JSON.parse(selecionadas);
|
||||||
RuasSelecionadas = Array.isArray(selecionadas) ? [...selecionadas] : [];
|
RuasSelecionadas = Array.isArray(selecionadas) ? [...selecionadas] : [];
|
||||||
geo_json_c7967f27f3f77f95bef294a59736ac33.eachLayer(function (layer) {
|
geo_json_2d0593835f9ad1bcbb3a29bf8a4a564d.eachLayer(function (layer) {
|
||||||
if (RuasSelecionadas.includes(parseInt(layer.feature.id))) {
|
if (RuasSelecionadas.includes(parseInt(layer.feature.id))) {
|
||||||
layer.setStyle({ color: 'blue' });
|
layer.setStyle({ color: 'blue' });
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue