ajustes no fluxo de trajetoria dinamica e registro de logs
This commit is contained in:
parent
d9fb9bed3c
commit
67e85b19e5
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -3,24 +3,24 @@
|
|||
"WorkspaceRootPath": "C:\\ZendionINC\\agrobot_base\\AgroBase\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|C:\\ZendionINC\\agrobot_base\\AgroBase\\agrobase\\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\\trajetoriamapaoperacaomodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"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\\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\\models\\operacoes\\operacaomapagpsmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\models\\operacoes\\operacaomapagpsmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|C:\\ZendionINC\\agrobot_base\\AgroBase\\agrobase\\forms\\frmsimulacaomapagps.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\forms\\frmsimulacaomapagps.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|c:\\zendioninc\\agrobot_base\\agrobase\\agrobase\\forms\\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}",
|
||||
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|c:\\zendioninc\\agrobot_base\\agrobase\\agrobase\\models\\operacoes\\operacaomodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\models\\operacoes\\operacaomodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|c:\\zendioninc\\agrobot_base\\agrobase\\agrobase\\models\\operacoes\\operacaomapagpsmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}|AgroBase\\AgroBase.csproj|solutionrelative:agrobase\\models\\operacoes\\operacaomapagpsmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
|
|
@ -34,54 +34,54 @@
|
|||
"Children": [
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "Variaveis.cs",
|
||||
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\Variaveis.cs",
|
||||
"RelativeDocumentMoniker": "AgroBase\\Models\\Variaveis.cs",
|
||||
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\Variaveis.cs",
|
||||
"RelativeToolTip": "AgroBase\\Models\\Variaveis.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAD8AAAAAAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-03-14T14:04:39.077Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "frmDialogoMapa.cs",
|
||||
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Forms\\IHM\\frmDialogoMapa.cs",
|
||||
"RelativeDocumentMoniker": "AgroBase\\Forms\\IHM\\frmDialogoMapa.cs",
|
||||
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Forms\\IHM\\frmDialogoMapa.cs",
|
||||
"RelativeToolTip": "AgroBase\\Forms\\IHM\\frmDialogoMapa.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAHoAAAAsAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-03-14T13:39:06.76Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"DocumentIndex": 4,
|
||||
"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",
|
||||
"ViewState": "AQIAAPQEAAAAAAAAAAAswEwFAACJAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-03-13T13:43:04.793Z",
|
||||
"WhenOpened": "2025-03-19T22:01:26.068Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 4,
|
||||
"DocumentIndex": 3,
|
||||
"Title": "frmDialogoMapa.cs",
|
||||
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Forms\\IHM\\frmDialogoMapa.cs",
|
||||
"RelativeDocumentMoniker": "AgroBase\\Forms\\IHM\\frmDialogoMapa.cs",
|
||||
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Forms\\IHM\\frmDialogoMapa.cs",
|
||||
"RelativeToolTip": "AgroBase\\Forms\\IHM\\frmDialogoMapa.cs",
|
||||
"ViewState": "AQIAAAwAAAAAAAAAAAAAAGcAAAAcAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-03-19T16:39:31.785Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "frmSimulacaoMapaGPS.cs",
|
||||
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Forms\\frmSimulacaoMapaGPS.cs",
|
||||
"RelativeDocumentMoniker": "AgroBase\\Forms\\frmSimulacaoMapaGPS.cs",
|
||||
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Forms\\frmSimulacaoMapaGPS.cs",
|
||||
"RelativeToolTip": "AgroBase\\Forms\\frmSimulacaoMapaGPS.cs",
|
||||
"ViewState": "AQIAABoAAAAAAAAAAAAQwJcAAABPAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-03-18T19:07:04.826Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "OperacaoMapaGPSModel.cs",
|
||||
"DocumentMoniker": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\Operacoes\\OperacaoMapaGPSModel.cs",
|
||||
"RelativeDocumentMoniker": "AgroBase\\Models\\Operacoes\\OperacaoMapaGPSModel.cs",
|
||||
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\Operacoes\\OperacaoMapaGPSModel.cs",
|
||||
"RelativeToolTip": "AgroBase\\Models\\Operacoes\\OperacaoMapaGPSModel.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAABEAAAAIAAAA",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAADsAAAArAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-03-13T13:35:57.112Z",
|
||||
"WhenOpened": "2025-03-18T11:05:46.524Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
|
|
@ -92,9 +92,9 @@
|
|||
"RelativeDocumentMoniker": "AgroBase\\Models\\TrajetoriaMapaOperacaoModel.cs",
|
||||
"ToolTip": "C:\\ZendionINC\\agrobot_base\\AgroBase\\AgroBase\\Models\\TrajetoriaMapaOperacaoModel.cs",
|
||||
"RelativeToolTip": "AgroBase\\Models\\TrajetoriaMapaOperacaoModel.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAALUAAAAtAAAA",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAANACAAAsAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-03-11T19:51:48.72Z",
|
||||
"WhenOpened": "2025-03-18T10:53:08.916Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@
|
|||
this.lblVelocidade = new System.Windows.Forms.Label();
|
||||
this.tkbVelocidade = new System.Windows.Forms.TrackBar();
|
||||
this.picFechar = new System.Windows.Forms.PictureBox();
|
||||
this.tabMapa = new System.Windows.Forms.TabPage();
|
||||
this.pnlMapa.SuspendLayout();
|
||||
this.pnlSensores.SuspendLayout();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
|
|
@ -105,11 +106,11 @@
|
|||
((System.ComponentModel.ISupportInitialize)(this.tkbAnguloDirecional)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tkbVelocidade)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picFechar)).BeginInit();
|
||||
this.tabMapa.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pnlMapa
|
||||
//
|
||||
this.pnlMapa.Controls.Add(this.pnlMapaDinamico);
|
||||
this.pnlMapa.Controls.Add(this.pnlJoystick);
|
||||
this.pnlMapa.Location = new System.Drawing.Point(0, 75);
|
||||
this.pnlMapa.Name = "pnlMapa";
|
||||
|
|
@ -118,11 +119,11 @@
|
|||
//
|
||||
// pnlMapaDinamico
|
||||
//
|
||||
this.pnlMapaDinamico.Location = new System.Drawing.Point(315, 101);
|
||||
this.pnlMapaDinamico.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pnlMapaDinamico.Location = new System.Drawing.Point(3, 3);
|
||||
this.pnlMapaDinamico.Name = "pnlMapaDinamico";
|
||||
this.pnlMapaDinamico.Size = new System.Drawing.Size(379, 392);
|
||||
this.pnlMapaDinamico.Size = new System.Drawing.Size(307, 497);
|
||||
this.pnlMapaDinamico.TabIndex = 19;
|
||||
this.pnlMapaDinamico.Visible = false;
|
||||
//
|
||||
// pnlJoystick
|
||||
//
|
||||
|
|
@ -661,6 +662,7 @@
|
|||
//
|
||||
this.tabControl1.Controls.Add(this.tabSensores);
|
||||
this.tabControl1.Controls.Add(this.tabControle);
|
||||
this.tabControl1.Controls.Add(this.tabMapa);
|
||||
this.tabControl1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.tabControl1.Location = new System.Drawing.Point(703, 34);
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
|
|
@ -767,6 +769,17 @@
|
|||
this.picFechar.TabIndex = 1;
|
||||
this.picFechar.TabStop = false;
|
||||
//
|
||||
// tabMapa
|
||||
//
|
||||
this.tabMapa.Controls.Add(this.pnlMapaDinamico);
|
||||
this.tabMapa.Location = new System.Drawing.Point(4, 34);
|
||||
this.tabMapa.Name = "tabMapa";
|
||||
this.tabMapa.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabMapa.Size = new System.Drawing.Size(313, 503);
|
||||
this.tabMapa.TabIndex = 2;
|
||||
this.tabMapa.Text = "Mapa";
|
||||
this.tabMapa.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// frmDialogoMapa
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
|
@ -801,6 +814,7 @@
|
|||
((System.ComponentModel.ISupportInitialize)(this.tkbAnguloDirecional)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tkbVelocidade)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picFechar)).EndInit();
|
||||
this.tabMapa.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
|
@ -874,5 +888,6 @@
|
|||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox txtDistanciasEsqDir;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TabPage tabMapa;
|
||||
}
|
||||
}
|
||||
|
|
@ -103,8 +103,6 @@ namespace AgroBase.Forms.IHM
|
|||
|
||||
public void AtualizarMapaDinamico()
|
||||
{
|
||||
pnlMapaDinamico.Visible = true;
|
||||
|
||||
var _Sensoriamento = Variaveis.OperacaoEmAndamento.Sensoriamento;
|
||||
var _Trajetoria = Variaveis.OperacaoEmAndamento.Trajetoria;
|
||||
|
||||
|
|
@ -112,9 +110,9 @@ namespace AgroBase.Forms.IHM
|
|||
KinectService.Iniciado && KinectService.Leitura.StatusDetecao ? KinectService.Leitura.ObstaculoCritico : null,
|
||||
(float)_Sensoriamento.Trajetoria.AnguloCaminho,
|
||||
(float)_Sensoriamento.Gps.AnguloCarroDefinido,
|
||||
_Trajetoria.CorredorAtual.Pontos[1].Posicao,
|
||||
_Trajetoria.TrajetoriaDinamica,
|
||||
_Trajetoria.Corredores[_Trajetoria.CorredorAtual.Idx],
|
||||
_Sensoriamento.Gps,
|
||||
_Trajetoria._TrajetoriaDinamica,
|
||||
_Trajetoria.CorredorAtual.Pontos,
|
||||
Variaveis.OperacaoEmAndamento.GPSTrajetoria,
|
||||
_Trajetoria.RuasPlantacao
|
||||
);
|
||||
|
|
@ -188,6 +186,11 @@ namespace AgroBase.Forms.IHM
|
|||
txtDentroCorredor.Text = _Sensoriamento.Trajetoria.CorredorAtual.Dentro ? "Sim" : "Não";
|
||||
txtMargemCorredor.Text = _Sensoriamento.Trajetoria.NaMargemDoCorredor ? "Sim" : "Não";
|
||||
txtStatusCarro.Text = _Sensoriamento.Trajetoria.StatusCarro.ToString();
|
||||
|
||||
if (frmInstancial.DebugMode)
|
||||
{
|
||||
AtualizarMapaDinamico();
|
||||
}
|
||||
}
|
||||
|
||||
private void pnlOrientacao_Paint(object sender, PaintEventArgs e)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ namespace AgroBase.Forms.Operacoes
|
|||
{
|
||||
frmDialogo.Show();
|
||||
await frmDialogo.AtualizarRuasSelecionadas(ruasSelecionadas);
|
||||
frmDialogo.AtualizarMapaDinamico();
|
||||
});
|
||||
FuncoesGlobais.DefinirEventosPicBtn(picFechar, "", async () =>
|
||||
{
|
||||
|
|
@ -54,10 +53,6 @@ namespace AgroBase.Forms.Operacoes
|
|||
{
|
||||
frmDialogo.Show();
|
||||
await frmDialogo.AtualizarRuasSelecionadas(ruasSelecionadas);
|
||||
if (frmInstancial.DebugMode)
|
||||
{
|
||||
frmDialogo.AtualizarMapaDinamico();
|
||||
}
|
||||
frmDialogo.IniciarOperacao();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1008,8 +1008,6 @@ namespace AgroBase.Forms.Operacoes
|
|||
FuncoesGlobais.PreencheValorProgressBar(pgbPercentualOperacao, Log.Trajetoria.ProgressoTrajeto);
|
||||
txtDistanciaPercorrida.Text = distanciaPercorrida.ToString("0.00") + " m / " + Log.Trajetoria.DistanciaTotal.ToString("0.00") + " m";
|
||||
|
||||
double distanciaRua = Log.Trajetoria.CorredorAtual.DistanciaTotal;
|
||||
double distanciaPercorridaRua = Log.Trajetoria.CorredorAtual.DistanciaPercorrida;
|
||||
double percentualRua = Log.Trajetoria.CorredorAtual.Progresso;
|
||||
lblPercentualRua.Text = $"Rua {percentualRua.ToString("0.00")}%";
|
||||
FuncoesGlobais.PreencheValorProgressBar(pgbPercentualRua, percentualRua);
|
||||
|
|
@ -1093,6 +1091,12 @@ namespace AgroBase.Forms.Operacoes
|
|||
|
||||
pnlOrientacaoGPS.Invalidate();
|
||||
|
||||
var _trajaetoria = LogsGPS.Select(x => new PontoTrajetoriaModel(Enums.TipoPontoRua.Indefinido)
|
||||
{
|
||||
Posicao = x
|
||||
})
|
||||
.ToList();
|
||||
|
||||
|
||||
//var LogKnt = LogsKinect.FirstOrDefault(x => x.Momento == MomentoAtual);
|
||||
var LogOpe = LogsOperacao.FirstOrDefault(x => x.Momento == MomentoAtual);
|
||||
|
|
@ -1102,7 +1106,7 @@ namespace AgroBase.Forms.Operacoes
|
|||
(float)LogOpe.Trajetoria.AnguloCaminho,
|
||||
(float)LogOpe.Gps.AnguloCarroDefinido,
|
||||
new GPSModel() { Latitude = Log.Latitude, Longitude = Log.Longitude },
|
||||
LogsGPS,
|
||||
_trajaetoria,
|
||||
null, //Variaveis.OperacaoEmAndamento.Mapa.TrajetoriaProjetada.FirstOrDefault(),
|
||||
new List<GPSModel>(LogsGPS.Take(LogsGPS.IndexOf(Log) + 1)),
|
||||
new List<List<GPSModel>>()
|
||||
|
|
|
|||
|
|
@ -631,7 +631,7 @@
|
|||
this.txtLongitude.Name = "txtLongitude";
|
||||
this.txtLongitude.Size = new System.Drawing.Size(135, 20);
|
||||
this.txtLongitude.TabIndex = 15;
|
||||
this.txtLongitude.Text = "-47,395287179";
|
||||
this.txtLongitude.Text = "-47.395203906184044";
|
||||
this.txtLongitude.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// txtLatitude
|
||||
|
|
@ -641,7 +641,7 @@
|
|||
this.txtLatitude.Name = "txtLatitude";
|
||||
this.txtLatitude.Size = new System.Drawing.Size(135, 20);
|
||||
this.txtLatitude.TabIndex = 14;
|
||||
this.txtLatitude.Text = "-22,1721627463333";
|
||||
this.txtLatitude.Text = "-22.17254631649402";
|
||||
this.txtLatitude.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// btnIniciarGPS
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ namespace AgroBase.Forms
|
|||
AsyncTaskTimerModel tmrLeitura;
|
||||
MapaDinamicoModel MapaDinamico;
|
||||
bool parar = false;
|
||||
DateTime UltimaAtualizacaoControle = DateTime.MinValue;
|
||||
double tempoGps = (1000.0 / GPSService.TaxaAmostragemHz);
|
||||
int ticksControleMax = 0;
|
||||
int ticksControle = 0;
|
||||
|
|
@ -125,24 +124,23 @@ namespace AgroBase.Forms
|
|||
txtKp.Text = _Sensoriamento.Controle.PIDdirecional.Kp.ToString();
|
||||
|
||||
|
||||
if (Variaveis.OperacaoEmAndamento.Iniciado)
|
||||
{
|
||||
pnlOrientacaoTrajeto.Invalidate();
|
||||
pnlAnguloControle.Invalidate();
|
||||
pnlOrientacaoCarro.Invalidate();
|
||||
pnlOrientacaoTrajeto.Invalidate();
|
||||
pnlAnguloControle.Invalidate();
|
||||
pnlOrientacaoCarro.Invalidate();
|
||||
|
||||
MapaDinamico.AtualizarDados(
|
||||
KinectService.Iniciado && KinectService.Leitura.StatusDetecao ? KinectService.Leitura.ObstaculoCritico : null,
|
||||
(float)_Sensoriamento.Trajetoria.AnguloCaminho,
|
||||
(float)_Sensoriamento.Gps.AnguloCarroDefinido,
|
||||
_Sensoriamento.Gps,
|
||||
_Trajetoria.TrajetoriaDinamica,
|
||||
_Trajetoria.Corredores[_Trajetoria.CorredorAtual.Idx],
|
||||
Variaveis.OperacaoEmAndamento.GPSTrajetoria,
|
||||
_Trajetoria.RuasPlantacao
|
||||
);
|
||||
}
|
||||
else
|
||||
MapaDinamico.AtualizarDados(
|
||||
KinectService.Iniciado && KinectService.Leitura.StatusDetecao ? KinectService.Leitura.ObstaculoCritico : null,
|
||||
(float)_Sensoriamento.Trajetoria.AnguloCaminho,
|
||||
(float)_Sensoriamento.Gps.AnguloCarroDefinido,
|
||||
_Sensoriamento.Gps,
|
||||
_Trajetoria._TrajetoriaDinamica,
|
||||
_Trajetoria.CorredorAtual.Pontos,
|
||||
Variaveis.OperacaoEmAndamento.GPSTrajetoria,
|
||||
_Trajetoria.RuasPlantacao
|
||||
);
|
||||
|
||||
|
||||
if (!Variaveis.OperacaoEmAndamento.Iniciado)
|
||||
{
|
||||
if (btnIniciarSimulacao.Text.Contains("Parar"))
|
||||
{
|
||||
|
|
@ -220,7 +218,7 @@ namespace AgroBase.Forms
|
|||
double.TryParse(txtErroTempoComando.Text, out double fatorErro);
|
||||
int ticksMax = (int)(ticksControleMax * Math.Max(1, fatorErro));
|
||||
|
||||
bool atualizarAnguloControle = (ticksControle >= ticksMax); // || (chbAutomatico.Checked && UltimaAtualizacaoControle < ControleDir.UltimoComando);
|
||||
bool atualizarAnguloControle = (ticksControle >= ticksMax);
|
||||
if (atualizarAnguloControle)
|
||||
{
|
||||
ticksControle = 0;
|
||||
|
|
@ -233,7 +231,6 @@ namespace AgroBase.Forms
|
|||
if (atualizarAnguloControle)
|
||||
{
|
||||
btnCalcularAngulo_Click(new object(), new EventArgs());
|
||||
UltimaAtualizacaoControle = ControleDir.UltimoComando;
|
||||
anguloControle = double.Parse(txtAnguloControle.Text);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -162,8 +162,8 @@ namespace AgroBase.Forms
|
|||
CursoVerdadeiro = _robotState.Current_State.Position.Orientation,
|
||||
Momento = DateTime.Now
|
||||
},
|
||||
Variaveis.OperacaoEmAndamento.Trajetoria.TrajetoriaDinamica,
|
||||
Variaveis.OperacaoEmAndamento.Trajetoria.Corredores.FirstOrDefault(),
|
||||
Variaveis.OperacaoEmAndamento.Trajetoria._TrajetoriaDinamica,
|
||||
Variaveis.OperacaoEmAndamento.Trajetoria.CorredorAtual.Pontos,
|
||||
Variaveis.OperacaoEmAndamento.GPSTrajetoria,
|
||||
Variaveis.OperacaoEmAndamento.Trajetoria.RuasPlantacao
|
||||
);
|
||||
|
|
|
|||
|
|
@ -247,13 +247,15 @@ namespace AgroBase.Models
|
|||
|
||||
public enum TipoPontoRua
|
||||
{
|
||||
Indefinido = -1,
|
||||
PosicaoRobo = 0,
|
||||
LigacaoEntrada = 1,
|
||||
BordaEntrada = 2,
|
||||
Rua = 3,
|
||||
BordaSaida = 4,
|
||||
LigacaoSaida = 5,
|
||||
CruvaEntreCorredores = 6
|
||||
CruvaEntreCorredores = 6,
|
||||
Desvio = 7
|
||||
}
|
||||
|
||||
public enum TiposCorrecaoGPS
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ namespace AgroBase.Models
|
|||
double lonInterpolada = pontoInicial.Longitude + t * (pontoFinal.Longitude - pontoInicial.Longitude);
|
||||
|
||||
// Interpolar orientação, se necessário
|
||||
double orientacaoInterpolada = pontoInicial.CursoVerdadeiro + t * (pontoFinal.CursoVerdadeiro - pontoInicial.CursoVerdadeiro);
|
||||
double orientacaoInterpolada = pontoInicial.OrientacaoReal + t * (pontoFinal.OrientacaoReal - pontoInicial.OrientacaoReal);
|
||||
|
||||
return new GPSModel
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AgroBase.Models
|
||||
|
|
@ -16,8 +17,8 @@ namespace AgroBase.Models
|
|||
|
||||
private GPSModel _posicaoAtual { get; set; } = new GPSModel();
|
||||
private List<List<GPSModel>> RuasPlantacao { get; set; } = new List<List<GPSModel>>();
|
||||
private List<GPSModel> TrajetoriaDinamica { get; set; } = new List<GPSModel>();
|
||||
private List<GPSModel> TrajetoriaRuaProjetada { get; set; } = new List<GPSModel>();
|
||||
private List<PontoTrajetoriaModel> TrajetoriaDinamica { get; set; } = new List<PontoTrajetoriaModel>();
|
||||
private List<PontoTrajetoriaModel> TrajetoriaRuaProjetada { get; set; } = new List<PontoTrajetoriaModel>();
|
||||
private List<GPSModel> TrajetoriaRobo { get; set; } = new List<GPSModel>();
|
||||
private Obstaculo obstaculoDetectado { get; set; }
|
||||
private float AnguloCaminho { get; set; }
|
||||
|
|
@ -41,7 +42,7 @@ namespace AgroBase.Models
|
|||
pnlZoomMapa.GetType().GetMethod("SetStyle", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).Invoke(pnlZoomMapa, new object[] { ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true });
|
||||
}
|
||||
|
||||
public void AtualizarDados(Obstaculo obstaculo, float anguloCaminho, float anguloCarro, GPSModel posicaoAtual, List<GPSModel> trajetoriaDinamica, List<GPSModel> trajetoriaRua, List<GPSModel> trajetoriaRobo, List<List<GPSModel>> ruasPlantacao)
|
||||
public void AtualizarDados(Obstaculo obstaculo, float anguloCaminho, float anguloCarro, GPSModel posicaoAtual, List<PontoTrajetoriaModel> trajetoriaDinamica, List<PontoTrajetoriaModel> trajetoriaRua, List<GPSModel> trajetoriaRobo, List<List<GPSModel>> ruasPlantacao)
|
||||
{
|
||||
obstaculoDetectado = obstaculo;
|
||||
AnguloCaminho = anguloCaminho;
|
||||
|
|
@ -125,19 +126,21 @@ namespace AgroBase.Models
|
|||
float centerY = height / 2 + _mapOffset.Y;
|
||||
|
||||
// Desenha os pontos da rua com plantacao
|
||||
foreach (var rua in RuasPlantacao)
|
||||
foreach (var _rua in RuasPlantacao)
|
||||
{
|
||||
var rua = _rua.Select(x => new PontoTrajetoriaModel(Enums.TipoPontoRua.Indefinido) { Posicao = x }).ToList();
|
||||
DrawTrajectory(g, rua, centerX, centerY, Color.Blue, Pens.Black);
|
||||
}
|
||||
|
||||
// Desenha os pontos da trajetória projetada
|
||||
DrawTrajectory(g, TrajetoriaDinamica, centerX, centerY, Color.Purple, Pens.MediumPurple);
|
||||
DrawTrajectory(g, TrajetoriaDinamica, centerX, centerY, Color.Purple, Pens.MediumPurple, true);
|
||||
|
||||
// Desenha os pontos da trajetória planejada da rua atual
|
||||
DrawTrajectory(g, TrajetoriaRuaProjetada, centerX, centerY, Color.Green, Pens.Blue);
|
||||
|
||||
// Desenha os pontos da trajetória percorrida
|
||||
DrawTrajectory(g, TrajetoriaRobo, centerX, centerY, Color.Orange, Pens.OrangeRed);
|
||||
var _trajetoriaRobo = TrajetoriaRobo.Select(x => new PontoTrajetoriaModel(Enums.TipoPontoRua.Indefinido) { Posicao = x }).ToList();
|
||||
DrawTrajectory(g, _trajetoriaRobo, centerX, centerY, Color.Orange, Pens.OrangeRed);
|
||||
|
||||
// Desenha a posição atual do robô (ponto vermelho)
|
||||
float PxToCm = DrawRobot(g, centerX, centerY, Color.Red, Color.Red, (float)VariaveisEquipamento.LarguraEsquerda, (float)VariaveisEquipamento.LarguraDireita, (float)VariaveisEquipamento.ComprimentoFrente, (float)VariaveisEquipamento.ComprimentoTras, AnguloCarro);
|
||||
|
|
@ -150,11 +153,11 @@ namespace AgroBase.Models
|
|||
|
||||
|
||||
|
||||
private void DrawTrajectory(Graphics g, List<GPSModel> trajectory, float centerX, float centerY, Color pointColor, Pen linePen)
|
||||
private void DrawTrajectory(Graphics g, List<PontoTrajetoriaModel> trajectory, float centerX, float centerY, Color pointColor, Pen linePen, bool drawMargin = false)
|
||||
{
|
||||
if (trajectory == null)
|
||||
{
|
||||
trajectory = new List<GPSModel>();
|
||||
trajectory = new List<PontoTrajetoriaModel>();
|
||||
}
|
||||
|
||||
try
|
||||
|
|
@ -163,8 +166,30 @@ namespace AgroBase.Models
|
|||
{
|
||||
var trajPoint = trajectory[i];
|
||||
// Calcule a posição no panel
|
||||
float x = centerX + (float)((trajPoint.Longitude - _posicaoAtual.Longitude) * _zoom);
|
||||
float y = centerY - (float)((trajPoint.Latitude - _posicaoAtual.Latitude) * _zoom);
|
||||
float x = centerX + (float)((trajPoint.Posicao.Longitude - _posicaoAtual.Longitude) * _zoom);
|
||||
float y = centerY - (float)((trajPoint.Posicao.Latitude - _posicaoAtual.Latitude) * _zoom);
|
||||
|
||||
if (drawMargin && trajPoint.Tipo != Enums.TipoPontoRua.Indefinido)
|
||||
{
|
||||
double margemMetros = trajPoint.DistanciaMargem * 10;
|
||||
// Converter metros para pixels usando a mesma escala do robô
|
||||
float PxToCm = (float)margemMetros * (float)_zoom / 1e7f * 1.19f;
|
||||
float diametroPixels = ((float)margemMetros * PxToCm); // Conversão correta para pixels
|
||||
|
||||
Color corBorda =
|
||||
trajPoint.Tipo == Enums.TipoPontoRua.PosicaoRobo ? Color.Red :
|
||||
trajPoint.PontoLigacao ? Color.Red :
|
||||
trajPoint.PontoBorda ? Color.Blue :
|
||||
trajPoint.Tipo == Enums.TipoPontoRua.Rua ? Color.Green :
|
||||
trajPoint.Tipo == Enums.TipoPontoRua.CruvaEntreCorredores ? Color.Orange :
|
||||
pointColor;
|
||||
|
||||
// Desenha a margem como um círculo ao redor do ponto
|
||||
using (Pen margemPen = new Pen(Color.FromArgb(150, corBorda), 1)) // Transparente
|
||||
{
|
||||
g.DrawEllipse(margemPen, x - diametroPixels / 2, y - diametroPixels / 2, diametroPixels, diametroPixels);
|
||||
}
|
||||
}
|
||||
|
||||
// Desenha o ponto da trajetória
|
||||
DrawPoint(g, x, y, pointColor);
|
||||
|
|
@ -173,8 +198,8 @@ namespace AgroBase.Models
|
|||
if (i > 0)
|
||||
{
|
||||
var prevPoint = trajectory[i - 1];
|
||||
float prevX = centerX + (float)((prevPoint.Longitude - _posicaoAtual.Longitude) * _zoom);
|
||||
float prevY = centerY - (float)((prevPoint.Latitude - _posicaoAtual.Latitude) * _zoom);
|
||||
float prevX = centerX + (float)((prevPoint.Posicao.Longitude - _posicaoAtual.Longitude) * _zoom);
|
||||
float prevY = centerY - (float)((prevPoint.Posicao.Latitude - _posicaoAtual.Latitude) * _zoom);
|
||||
|
||||
g.DrawLine(linePen, prevX, prevY, x, y);
|
||||
}
|
||||
|
|
@ -184,6 +209,7 @@ namespace AgroBase.Models
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void DrawPoint(Graphics g, float x, float y, Color color)
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ namespace AgroBase.Models.Modules
|
|||
MKS057DService.AdicionarComandoNaFila(MKS057DService.MontarComandoRequisicaoPulsos(modAddr));
|
||||
MKS057DService.AdicionarComandoNaFila(MKS057DService.MontarComandoRequisicaoIO(modAddr));
|
||||
|
||||
if (Modulo.DirMotor.SensorAnguloAuxiliar != null && Modulo.DirMotor.SensorAnguloAuxiliar.LimiteExcedido)
|
||||
if (false && Modulo.DirMotor.SensorAnguloAuxiliar != null && Modulo.DirMotor.SensorAnguloAuxiliar.LimiteExcedido)
|
||||
{
|
||||
var ReleControle = Variaveis.OperacaoEmAndamento.DispSen?.Dados?.Reles?.FirstOrDefault(x => x.ID.Contains(Modulo.DirMotor.SensorAnguloAuxiliar.ID));
|
||||
if (ReleControle != null)
|
||||
|
|
|
|||
|
|
@ -52,17 +52,23 @@ namespace AgroBase.Models.Operacoes
|
|||
|
||||
private void DefinirAnguloSP()
|
||||
{
|
||||
DefinirTipoMovimento();
|
||||
|
||||
CalcularAnguloInclinacao();
|
||||
|
||||
DefinirTipoMovimento();
|
||||
}
|
||||
|
||||
private void DefinirTipoMovimento()
|
||||
{
|
||||
var Trajetoria = Variaveis.OperacaoEmAndamento.Trajetoria;
|
||||
|
||||
bool arcoNecessario =
|
||||
Trajetoria.ManobrandoEntreRuas ||
|
||||
Trajetoria.StatusAtual == StatusCarroMapa.SaindoRua ||
|
||||
Trajetoria.StatusAtual == StatusCarroMapa.EntrandoRua ||
|
||||
Math.Abs(Variaveis.OperacaoEmAndamento.OpMapaGPS.Sensoriamento.AnguloDif) >= Variaveis.OperacaoEmAndamento.Controle.Angulo_Max;
|
||||
|
||||
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento =
|
||||
(Trajetoria.StatusAtual == StatusCarroMapa.Manobrando || Trajetoria.ManobrandoEntreRuas) ? TipoMovimentoDirecional.MovimentoArco :
|
||||
arcoNecessario ? TipoMovimentoDirecional.MovimentoArco :
|
||||
TipoMovimentoDirecional.RodasDianteiras;
|
||||
}
|
||||
|
||||
|
|
@ -100,14 +106,7 @@ namespace AgroBase.Models.Operacoes
|
|||
// Atualiza o PID com o erro combinado
|
||||
if (_Trajetoria.StatusCarro != StatusCarroMapa.Parado)
|
||||
{
|
||||
if (_Controle.TipoMovimento == TipoMovimentoDirecional.MovimentoArco)
|
||||
{
|
||||
PID.LimiteSaida = _Controle.Angulo_Max * 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
PID.LimiteSaida = _Controle.Angulo_Max;
|
||||
}
|
||||
PID.LimiteSaida = _Controle.Angulo_Max;
|
||||
PID.Atualizar(erroCombinado, 0);
|
||||
}
|
||||
|
||||
|
|
@ -270,12 +269,12 @@ namespace AgroBase.Models.Operacoes
|
|||
double anguloCorredor = Variaveis.OperacaoEmAndamento.Trajetoria.AnguloMedioCorredor;
|
||||
|
||||
// **Erro de orientação agora é a diferença real entre os ângulos**
|
||||
double erroOrientacao = Math.Abs(GPSUtils.NormalizarAngulo(anguloCarro - anguloCorredor)); // Diferenca real de ângulos
|
||||
erroOrientacao = Math.Min(erroOrientacao, 90.0); // Limita a 90° para normalização
|
||||
double erroOrientacao = Math.Abs(anguloCarro - anguloCorredor); // Diferenca real de ângulos
|
||||
erroOrientacao = Math.Min(erroOrientacao, 30.0); // Limita a 90° para normalização
|
||||
|
||||
// **Peso dinâmico baseado no desalinhamento**
|
||||
// Se o erro for grande, reduz mais a velocidade. Se for pequeno, mantém velocidade alta
|
||||
double pesoErro = erroOrientacao / 90.0; // Normaliza erro para 0 (perfeito) a 1 (erro de 90°)
|
||||
double pesoErro = erroOrientacao / 30.0; // Normaliza erro para 0 (perfeito) a 1 (erro de 90°)
|
||||
|
||||
// **Ajusta a influência do ângulo de controle na velocidade**
|
||||
double pesoAnguloControle = 1 - pesoErro; // Quanto maior o erro, menor a influência do ângulo de controle
|
||||
|
|
|
|||
|
|
@ -920,6 +920,13 @@ namespace AgroBase.Models
|
|||
Variaveis.OperacaoEmAndamento.Iniciado = false;
|
||||
Variaveis.OperacaoEmAndamento.Mapa = new MapasModel();
|
||||
Variaveis.OperacaoEmAndamento.Trajetoria = new TrajetoriaMapaOperacaoModel(new List<List<GPSModel>>());
|
||||
|
||||
var Topico = Variaveis.MqttService.Topicos.FirstOrDefault(x => x.Topico == MapasVariaveisModel.TopicoSelecaoRuasMapa);
|
||||
Topico.Mensagens.Add(new MqttService.MqttTopicosMensagensModel()
|
||||
{
|
||||
Mensagem = "[]",
|
||||
Momento = DateTime.Now
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,12 +16,14 @@ namespace AgroBase.Models
|
|||
|
||||
#region PARAMETROS
|
||||
|
||||
public double DistanciaProjecaoRua { get; set; } = 0.8;
|
||||
public static double DistanciaEntrePontos { get; set; } = 1.0;
|
||||
public static double DistanciaEntrePontosCurva { get; set; } = 0.25;
|
||||
private double DistanciaManobraEntreRuas { get; set; } = 3.0;
|
||||
private double LarguraCorredorPadrao { get; set; } = 1.5;
|
||||
private const int JanelaAtualizacaoDePontos = 20; // Define o tamanho da janela de pontos a atualizar ( 20 pontos, a 1 metro de distancia cada ponto, abre uma janela de 10 metros para trás e para frente )
|
||||
public double DistanciaProjecaoRua { get; set; } = 0.8; // Distancia para projetar o primeiro ponto para fora do corredor
|
||||
public static double DistanciaEntrePontos { get; set; } = 0.8; // Distancia entre os pontos dentro do corredor
|
||||
public static double DistanciaEntrePontosCurva { get; set; } = 0.25; // Distancia entre os pontos durante a curva entre corredores
|
||||
private double DistanciaManobraEntreRuas { get; set; } = 3.0; // Distancia máxima para gerar a curva de conexão entre os corredores
|
||||
private bool EspacamentoPrimeirosPontosProjecao { get; set; } = false; // Projetar os primeiros pontos com distancia menor entre eles
|
||||
private double DistanciaPrimeirosPontosProjecao { get; set; } = 3.0; // Distancia máxima para projetar os primeiros pontos com distancia menor
|
||||
public static double LarguraCorredorPadrao { get; set; } = 1.5; // Largura de um corredor padrão
|
||||
private int JanelaAtualizacaoDePontos { get; set; } = 20; // Define o tamanho da janela de pontos a atualizar
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -65,7 +67,7 @@ namespace AgroBase.Models
|
|||
}
|
||||
else if (CorredorAtual == null && RuasPlantacao.Count > 0)
|
||||
{
|
||||
return RuasPlantacao[0][RuasPlantacao.Count - 1];
|
||||
return RuasPlantacao[0][RuasPlantacao[0].Count - 1];
|
||||
}
|
||||
|
||||
return new GPSModel(); // Pode ser null se preferir
|
||||
|
|
@ -125,30 +127,36 @@ namespace AgroBase.Models
|
|||
}
|
||||
public List<CorredorTrajetoriaModel> _Corredores { get; set; }
|
||||
public List<GPSModel> TrajetoriaFixa => _TrajetoriaFixa.ConvertAll(x => x.Posicao);
|
||||
public List<GPSModel> TrajetoriaDinamica
|
||||
public List<PontoTrajetoriaModel> _TrajetoriaDinamica { get; private set; }
|
||||
public List<GPSModel> TrajetoriaDinamica => _TrajetoriaDinamica.ConvertAll(x => x.Posicao);
|
||||
public void AtualizarTrajetoriaDinamica()
|
||||
{
|
||||
get
|
||||
// Cria a lista com a última leitura do robô
|
||||
var trajetoria = new List<PontoTrajetoriaModel>()
|
||||
{
|
||||
// Cria a lista com a última leitura do robô
|
||||
var trajetoria = new List<GPSModel> { GPSService.UltimaLeitura };
|
||||
|
||||
// Se a trajetória fixa estiver vazia, retorna apenas a leitura atual
|
||||
if (!_TrajetoriaFixaDefinida)
|
||||
new PontoTrajetoriaModel(TipoPontoRua.PosicaoRobo)
|
||||
{
|
||||
return trajetoria;
|
||||
Posicao = GPSService.UltimaLeitura
|
||||
}
|
||||
};
|
||||
|
||||
// Adiciona os pontos não visitados, já ordenados por idxPonto
|
||||
foreach (var ponto in _TrajetoriaFixa)
|
||||
{
|
||||
if (!ponto.Visitado)
|
||||
{
|
||||
trajetoria.Add(ponto.Posicao);
|
||||
}
|
||||
}
|
||||
|
||||
return trajetoria;
|
||||
// Se a trajetória fixa estiver vazia, retorna apenas a leitura atual
|
||||
if (!_TrajetoriaFixaDefinida)
|
||||
{
|
||||
_TrajetoriaDinamica = trajetoria;
|
||||
return;
|
||||
}
|
||||
|
||||
// Adiciona os pontos não visitados, já ordenados por idxPonto
|
||||
foreach (var ponto in _TrajetoriaFixa)
|
||||
{
|
||||
if (!ponto.Visitado)
|
||||
{
|
||||
trajetoria.Add(ponto);
|
||||
}
|
||||
}
|
||||
|
||||
_TrajetoriaDinamica = trajetoria;
|
||||
}
|
||||
|
||||
[JsonProperty]
|
||||
|
|
@ -245,6 +253,7 @@ namespace AgroBase.Models
|
|||
|
||||
int qtdPontosRua = Convert.ToInt32(GPSUtils.DistanciaDoTrecho(rua));
|
||||
rua = GPSUtils.InterpolarRota(rua, qtdPontosRua);
|
||||
double d = GPSUtils.DistanciaDoTrecho(rua);
|
||||
|
||||
// Calcula a menor distância entre o robô e a rua
|
||||
double distancia = GPSUtils.CalcularMenorDistanciaAteTrecho(GPSService.UltimaLeitura, rua);
|
||||
|
|
@ -374,8 +383,10 @@ namespace AgroBase.Models
|
|||
public bool ManobrandoEntreRuas { get; private set; }
|
||||
private void AtualizarManobrandoEntreRuas()
|
||||
{
|
||||
bool proximoAentrada = (ProximoPonto.PontoBorda || ProximoPonto.PontoLigacao) && ProximoPonto.DistanciaAtual < DistanciaManobraEntreRuas;
|
||||
ManobrandoEntreRuas = (proximoAentrada && StatusAtual == StatusCarroMapa.Direcionando) || NaMargemDoCorredor;
|
||||
//bool proximoAentrada = (ProximoPonto.PontoBorda || ProximoPonto.PontoLigacao) && ProximoPonto.DistanciaAtual < DistanciaManobraEntreRuas;
|
||||
//ManobrandoEntreRuas = (proximoAentrada && StatusAtual == StatusCarroMapa.Direcionando) || NaMargemDoCorredor;
|
||||
|
||||
ManobrandoEntreRuas = StatusAtual == StatusCarroMapa.Manobrando;
|
||||
}
|
||||
[JsonProperty]
|
||||
public StatusCarroMapa StatusAtual { get; private set; }
|
||||
|
|
@ -384,18 +395,18 @@ namespace AgroBase.Models
|
|||
StatusAtual = StatusCarroMapa.Parado;
|
||||
if (ProximoPonto != null && CorredorAtual != null)
|
||||
{
|
||||
if (!CorredorAtual.Dentro && (PontoAtual.Tipo == TipoPontoRua.PosicaoRobo || PontoAtual.PontoLigacao || ProximoPonto.PontoLigacao))
|
||||
if (!CorredorAtual.Dentro && ProximoPonto.DistanciaAtual > DistanciaManobraEntreRuas)
|
||||
{
|
||||
StatusAtual = StatusCarroMapa.Direcionando;
|
||||
}
|
||||
else if (!CorredorAtual.Dentro && (PontoAtual.PontoBorda || PontoAtual.PontoLigacao || ProximoPonto.Tipo == TipoPontoRua.LigacaoEntrada || PontoAtual.Tipo == TipoPontoRua.CruvaEntreCorredores))
|
||||
{
|
||||
StatusAtual = StatusCarroMapa.Manobrando;
|
||||
}
|
||||
else if (CorredorAtual.Dentro && !NaMargemDoCorredor)
|
||||
{
|
||||
StatusAtual = StatusCarroMapa.CaminhandoRua;
|
||||
}
|
||||
else if (!CorredorAtual.Dentro && (!PontoAtual.PontoLigacao && !ProximoPonto.PontoLigacao))
|
||||
{
|
||||
StatusAtual = StatusCarroMapa.Manobrando;
|
||||
}
|
||||
else if (_TrajetoriaFixa.Any(x => x.NaMargem && x.Tipo == TipoPontoRua.BordaEntrada))
|
||||
{
|
||||
StatusAtual = StatusCarroMapa.EntrandoRua;
|
||||
|
|
@ -404,6 +415,10 @@ namespace AgroBase.Models
|
|||
{
|
||||
StatusAtual = StatusCarroMapa.SaindoRua;
|
||||
}
|
||||
else if (!CorredorAtual.Dentro)
|
||||
{
|
||||
StatusAtual = StatusCarroMapa.Direcionando;
|
||||
}
|
||||
}
|
||||
}
|
||||
[JsonProperty]
|
||||
|
|
@ -412,13 +427,14 @@ namespace AgroBase.Models
|
|||
public double DistanciaPercorrida { get; private set; }
|
||||
private void AtualizarDistanciaPercorrida()
|
||||
{
|
||||
DistanciaPercorrida = _Corredores?.Sum(x => x.DistanciaPercorrida) ?? 0;
|
||||
DistanciaPercorrida = _Corredores?.Sum(x => x.DistanciaPercorridaTotal) ?? 0;
|
||||
}
|
||||
[JsonProperty]
|
||||
public double DistanciaRestante { get; private set; }
|
||||
private void AtualizarDistanciaRestante()
|
||||
{
|
||||
DistanciaRestante = GPSUtils.DistanciaDoTrecho(TrajetoriaDinamica ?? new List<GPSModel>());
|
||||
var _trajetoria = (_TrajetoriaDinamica ?? new List<PontoTrajetoriaModel>()).Select(x => x.Posicao).ToList();
|
||||
DistanciaRestante = GPSUtils.DistanciaDoTrecho(_trajetoria);
|
||||
}
|
||||
[JsonProperty]
|
||||
public double PercentualTrajetoria { get; private set; }
|
||||
|
|
@ -531,6 +547,8 @@ namespace AgroBase.Models
|
|||
AtualizarDistanciaRestante();
|
||||
AtualizarPercentualTrajetoria();
|
||||
AtualizarTempoEstimado();
|
||||
|
||||
AtualizarTrajetoriaDinamica();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -576,6 +594,8 @@ namespace AgroBase.Models
|
|||
|
||||
var corredor = new List<GPSModel>();
|
||||
|
||||
double primeiraDistancia = 0;
|
||||
|
||||
// Calcular pontos médios entre as duas ruas e interpolar a cada 25 cm
|
||||
for (int j = 0; j < rua1.Count - 1; j++)
|
||||
{
|
||||
|
|
@ -586,24 +606,48 @@ namespace AgroBase.Models
|
|||
|
||||
//var pontoMedioInicial = GPSUtils.PontoMedio(ponto1Rua1, ponto1Rua2);
|
||||
//var pontoMedioFinal = GPSUtils.PontoMedio(ponto2Rua1, ponto2Rua2);
|
||||
|
||||
|
||||
var pontoMedioInicial = GPSUtils.PontoMedioComOffset(ponto1Rua1, ponto1Rua2, deslocamentoLateralGPS);
|
||||
var pontoMedioFinal = GPSUtils.PontoMedioComOffset(ponto2Rua1, ponto2Rua2, deslocamentoLateralGPS);
|
||||
|
||||
var distancia = GPSUtils.DistanciaEntrePontos(pontoMedioInicial, pontoMedioFinal);
|
||||
if (EspacamentoPrimeirosPontosProjecao && j == 0)
|
||||
{
|
||||
primeiraDistancia = distancia;
|
||||
}
|
||||
double distInterpolar = (EspacamentoPrimeirosPontosProjecao && j == 0) ? DistanciaEntrePontosCurva : DistanciaEntrePontos;
|
||||
|
||||
int numInterpolacoes = (int)(distancia / DistanciaEntrePontos);
|
||||
int numInterpolacoes = (int)(distancia / distInterpolar);
|
||||
|
||||
for (int k = 0; k <= numInterpolacoes; k++)
|
||||
{
|
||||
double t = k / (double)numInterpolacoes;
|
||||
double t = numInterpolacoes == 0 ? 0 : k / (double)numInterpolacoes;
|
||||
var pontoInterpolado = GPSUtils.InterpolarPonto(pontoMedioInicial, pontoMedioFinal, t);
|
||||
corredor.Add(pontoInterpolado);
|
||||
}
|
||||
}
|
||||
|
||||
// Remover pontos que estão a menos de 25 cm de distância
|
||||
corredor = RemoverPontosMuitoProximos(corredor, DistanciaEntrePontos);
|
||||
double distanciaCorredor = GPSUtils.DistanciaDoTrecho(corredor);
|
||||
double distanciaRua1 = GPSUtils.DistanciaDoTrecho(rua1);
|
||||
double distanciaRua2 = GPSUtils.DistanciaDoTrecho(rua2);
|
||||
|
||||
if ((distanciaCorredor + DistanciaEntrePontos) < distanciaRua1)
|
||||
{
|
||||
double dif = Math.Abs(distanciaRua1 - distanciaCorredor);
|
||||
double anguloCorredor = GPSUtils.CalcularOrientacao(corredor[corredor.Count - 1], corredor[corredor.Count - 2]);
|
||||
GPSModel novoPontoCorredor = GPSUtils.ProjetarPontoDeslocado(corredor[0], dif, anguloCorredor);
|
||||
corredor.Insert(0, novoPontoCorredor);
|
||||
}
|
||||
else if ((distanciaCorredor + DistanciaEntrePontos) < distanciaRua2)
|
||||
{
|
||||
double dif = Math.Abs(distanciaRua2 - distanciaCorredor);
|
||||
double anguloCorredor = GPSUtils.CalcularOrientacao(corredor[corredor.Count - 1], corredor[corredor.Count - 2]);
|
||||
GPSModel novoPontoCorredor = GPSUtils.ProjetarPontoDeslocado(corredor[0], dif, anguloCorredor);
|
||||
corredor.Insert(0, novoPontoCorredor);
|
||||
}
|
||||
|
||||
// Remover pontos que estão a menos de 1m de distância
|
||||
corredor = RemoverPontosMuitoProximos(corredor, DistanciaEntrePontos, primeiraDistancia, DistanciaEntrePontosCurva);
|
||||
|
||||
// Calcular largura média entre as duas ruas
|
||||
double larguraCorredor = CalcularLarguraMediaDoCorredor(rua1, rua2);
|
||||
|
|
@ -615,8 +659,9 @@ namespace AgroBase.Models
|
|||
return (corredores, larguras);
|
||||
}
|
||||
|
||||
|
||||
// Método auxiliar para remover pontos muito próximos de forma balanceada
|
||||
private List<GPSModel> RemoverPontosMuitoProximos(List<GPSModel> pontos, double distanciaMinima)
|
||||
private List<GPSModel> RemoverPontosMuitoProximos(List<GPSModel> pontos, double distanciaMinima, double apartirDe, double distanciaMenor)
|
||||
{
|
||||
if (pontos == null || pontos.Count == 0)
|
||||
return pontos;
|
||||
|
|
@ -624,22 +669,20 @@ namespace AgroBase.Models
|
|||
pontos = pontos.Where(x => !double.IsNaN(x.Latitude) && !double.IsNaN(x.Longitude)).ToList();
|
||||
|
||||
var resultado = new List<GPSModel> { pontos[0] }; // Sempre incluir o primeiro ponto
|
||||
int i = 1;
|
||||
double distanciaAcumulada = 0.0; // Distância total percorrida
|
||||
|
||||
while (i < pontos.Count - 1) // Evita verificar o último ponto diretamente
|
||||
for (int i = 1; i < pontos.Count - 1; i++) // Evita verificar o último ponto diretamente
|
||||
{
|
||||
var distancia = GPSUtils.DistanciaEntrePontos(resultado.Last(), pontos[i]);
|
||||
double distancia = GPSUtils.DistanciaEntrePontos(resultado.Last(), pontos[i]);
|
||||
distanciaAcumulada += distancia;
|
||||
|
||||
if (distancia >= distanciaMinima)
|
||||
// Nos primeiros 2 metros, mantemos um espaçamento mínimo de 25 cm, depois 1 metro
|
||||
double distanciaRequerida = distanciaAcumulada <= apartirDe ? distanciaMenor : distanciaMinima;
|
||||
|
||||
if (distancia >= distanciaRequerida)
|
||||
{
|
||||
resultado.Add(pontos[i]); // Mantém o ponto se a distância for suficiente
|
||||
}
|
||||
else
|
||||
{
|
||||
i++; // Pula um ponto (removendo-o implicitamente)
|
||||
}
|
||||
|
||||
i++; // Avança para o próximo ponto
|
||||
}
|
||||
|
||||
// Sempre adiciona o último ponto da lista para garantir fechamento da trajetória
|
||||
|
|
@ -681,8 +724,10 @@ namespace AgroBase.Models
|
|||
(List<List<GPSModel>> corredores, List<double> CorredoresLarguras) = ProjetarCorredores();
|
||||
Corredores = corredores;
|
||||
|
||||
//Enums.DirecaoCarroRua direcaoAtual = ExtremoMaisProximoMapa == 0 ? Enums.DirecaoCarroRua.Ida : Enums.DirecaoCarroRua.Volta;
|
||||
Enums.DirecaoCarroRua direcaoAtual = Enums.DirecaoCarroRua.Ida;
|
||||
Enums.DirecaoCarroRua direcaoAtual = ExtremoMaisProximoMapa == 0 ? Enums.DirecaoCarroRua.Ida : Enums.DirecaoCarroRua.Volta;
|
||||
//Enums.DirecaoCarroRua direcaoAtual = Enums.DirecaoCarroRua.Ida;
|
||||
|
||||
double larguraCorredorMenor = LarguraCorredorPadrao * 0.9;
|
||||
|
||||
PontoTrajetoriaModel PontoRobo = new PontoTrajetoriaModel(TipoPontoRua.PosicaoRobo)
|
||||
{
|
||||
|
|
@ -697,19 +742,43 @@ namespace AgroBase.Models
|
|||
};
|
||||
_trajetoriaFixa.Add(PontoRobo);
|
||||
|
||||
int idxEsq = 0;
|
||||
int idxDir = 0;
|
||||
|
||||
double anguloAcrescentar = idxDir % 2 == 0 && direcaoAtual == DirecaoCarroRua.Ida ? 20 : -20;
|
||||
|
||||
for (int idx = 0; idx < Corredores.Count(); idx++)
|
||||
{
|
||||
double _FatorLarguraCorredor = CorredoresLarguras[idx] / LarguraCorredorPadrao;
|
||||
bool _FatorLarguraElevado = _FatorLarguraCorredor > 1.2;
|
||||
|
||||
if (_trajetoriaFixa.Count() > 1 && idxEsq == 0 && idxDir == 0)
|
||||
{
|
||||
(List<GPSModel> ruaEsq, List<GPSModel> ruaDir) = DeterminarRuasLaterais(_trajetoriaFixa[1].Posicao, _trajetoriaFixa[2].Posicao, RuasPlantacao[0], RuasPlantacao[1]);
|
||||
idxEsq = RuasPlantacao.IndexOf(ruaEsq);
|
||||
idxDir = RuasPlantacao.IndexOf(ruaDir);
|
||||
}
|
||||
|
||||
bool ultimoCorredor = idx == Corredores.Count() - 1;
|
||||
List<GPSModel> CorredorAtual = Corredores[idx];
|
||||
|
||||
if (idx % 2 != 0)
|
||||
double dP0 = GPSUtils.DistanciaEntrePontos(_trajetoriaFixa.Last().Posicao, CorredorAtual[0]);
|
||||
double dP1 = GPSUtils.DistanciaEntrePontos(_trajetoriaFixa.Last().Posicao, CorredorAtual[CorredorAtual.Count() - 1]);
|
||||
if (dP1 < dP0)
|
||||
{
|
||||
CorredorAtual.Reverse();
|
||||
}
|
||||
|
||||
double anguloProjetar1 = GPSUtils.CalcularOrientacao(CorredorAtual.Skip(1).First(), CorredorAtual.First());
|
||||
GPSModel PrimeiroPonto = GPSUtils.ProjetarPontoDeslocado(CorredorAtual.First(), DistanciaProjecaoRua, anguloProjetar1);
|
||||
|
||||
double anguloProjetar2 = GPSUtils.CalcularOrientacao(CorredorAtual.Skip(CorredorAtual.Count() - 2).First(), CorredorAtual.Last());
|
||||
// Realiza um acréscimo no angulo à projetar, permitindo que o equipamento faça uma curva mais aberta entre corredores
|
||||
if (!ultimoCorredor && !_FatorLarguraElevado)
|
||||
{
|
||||
anguloProjetar2 += anguloAcrescentar;
|
||||
anguloAcrescentar *= -1;
|
||||
}
|
||||
GPSModel UltimoPonto = GPSUtils.ProjetarPontoDeslocado(CorredorAtual.Last(), !ultimoCorredor ? DistanciaProjecaoRua : (DistanciaProjecaoRua * 2.0), anguloProjetar2);
|
||||
|
||||
var ultimoPontoTrajetoria = _trajetoriaFixa.LastOrDefault();
|
||||
|
|
@ -717,12 +786,12 @@ namespace AgroBase.Models
|
|||
PontoTrajetoriaModel PontoInicial = new PontoTrajetoriaModel(TipoPontoRua.LigacaoEntrada)
|
||||
{
|
||||
idxCorredor = idx,
|
||||
idxPonto = _trajetoriaFixa.Count(),
|
||||
idxPonto = _trajetoriaFixa.Count(),
|
||||
idxPontoCorredor = _trajetoriaFixa.Count(x => x.idxCorredor == idx),
|
||||
Posicao = PrimeiroPonto,
|
||||
Direcao = direcaoAtual,
|
||||
Posicao = PrimeiroPonto,
|
||||
Direcao = direcaoAtual,
|
||||
Orientacao = GPSUtils.CalcularOrientacao(ultimoPontoTrajetoria.Posicao, PrimeiroPonto),
|
||||
Visitado = false,
|
||||
Visitado = false,
|
||||
LarguraCorredor = LarguraCorredorPadrao
|
||||
};
|
||||
|
||||
|
|
@ -736,26 +805,39 @@ namespace AgroBase.Models
|
|||
|
||||
if (distanciaMinima)
|
||||
{
|
||||
int pontosAdicionr = Convert.ToInt32(CorredoresLarguras[idx] / DistanciaEntrePontosCurva);
|
||||
bool CurvaParaEsquerda = (ExtremoMaisProximoMapa == 0 && direcaoAtual == DirecaoCarroRua.Volta) || (ExtremoMaisProximoMapa == 1 && direcaoAtual == DirecaoCarroRua.Ida);
|
||||
GPSModel P0 = CalcularPontoControle(_trajetoriaFixa[_trajetoriaFixa.Count() - 2].Posicao, ultimoPontoTrajetoria.Posicao, PrimeiroPonto, DistanciaProjecaoRua);
|
||||
int pontosAdicionr = Convert.ToInt32(CorredoresLarguras[idx] / (DistanciaEntrePontosCurva * _FatorLarguraCorredor));
|
||||
|
||||
var _penultimoPonto = _trajetoriaFixa[_trajetoriaFixa.Count() - 2].Posicao;
|
||||
double anguloProjecao = GPSUtils.CalcularOrientacao(Corredores[idx - 1].First(), Corredores[idx - 1].Last());
|
||||
GPSModel _ultimoPonto = GPSUtils.ProjetarPontoDeslocado(Corredores[idx - 1].Last(), DistanciaProjecaoRua, anguloProjecao);
|
||||
|
||||
GPSModel P0 = CalcularPontoControle(_penultimoPonto, _ultimoPonto, PrimeiroPonto, DistanciaProjecaoRua * 2.0);
|
||||
List<GPSModel> CurvaConexao = GerarCurvaConexao(ultimoPontoTrajetoria.Posicao, PrimeiroPonto, P0, pontosAdicionr);
|
||||
|
||||
foreach (var ponto in CurvaConexao)
|
||||
for (int i = 0; i < CurvaConexao.Count; i++)
|
||||
{
|
||||
var ponto = CurvaConexao[i];
|
||||
bool pontoCorredorAnterior = i < (pontosAdicionr / 2);
|
||||
int idxCorredorPontoCurva = pontoCorredorAnterior ? idx - 1 : idx;
|
||||
bool pontoLigacao = CurvaConexao.IndexOf(ponto) == CurvaConexao.Count() - 1;
|
||||
_trajetoriaFixa.Add(new PontoTrajetoriaModel(pontoLigacao ? TipoPontoRua.LigacaoEntrada : TipoPontoRua.CruvaEntreCorredores)
|
||||
|
||||
bool meiaCurva = false;
|
||||
|
||||
if ((meiaCurva && pontoCorredorAnterior) || !meiaCurva)
|
||||
{
|
||||
idxCorredor = idx,
|
||||
idxPonto = _trajetoriaFixa.Count(),
|
||||
idxPontoCorredor = _trajetoriaFixa.Count(x => x.idxCorredor == idx),
|
||||
Posicao = ponto,
|
||||
Direcao = pontoLigacao ? direcaoAtual : DirecaoCarroRua.Manobra,
|
||||
Orientacao = GPSUtils.CalcularOrientacao(_trajetoriaFixa.Last().Posicao, ponto),
|
||||
Visitado = false,
|
||||
LarguraCorredor = (LarguraCorredorPadrao * 0.7)
|
||||
});
|
||||
pontoLigacao = false;
|
||||
_trajetoriaFixa.Add(new PontoTrajetoriaModel(pontoLigacao ? TipoPontoRua.LigacaoEntrada : TipoPontoRua.CruvaEntreCorredores)
|
||||
{
|
||||
idxCorredor = idxCorredorPontoCurva,
|
||||
idxPonto = _trajetoriaFixa.Count(),
|
||||
idxPontoCorredor = _trajetoriaFixa.Count(x => x.idxCorredor == idx),
|
||||
Posicao = ponto,
|
||||
Direcao = pontoLigacao ? direcaoAtual : DirecaoCarroRua.Manobra,
|
||||
Orientacao = GPSUtils.CalcularOrientacao(_trajetoriaFixa.Last().Posicao, ponto),
|
||||
Visitado = false,
|
||||
LarguraCorredor = larguraCorredorMenor
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
PontoInicialAdicionado = true;
|
||||
}
|
||||
|
|
@ -771,6 +853,7 @@ namespace AgroBase.Models
|
|||
int idxPonto = CorredorAtual.IndexOf(pontoAtual);
|
||||
bool bordaEntrada = idxPonto == 0;
|
||||
bool bordaSaida = idxPonto == CorredorAtual.Count() - 1;
|
||||
double distanciaCorredor = GPSUtils.DistanciaDoTrecho(_trajetoriaFixa.Where(x => x.idxCorredor == idx).Select(x => x.Posicao).ToList());
|
||||
|
||||
PontoTrajetoriaModel PontoTrajetoria = new PontoTrajetoriaModel(bordaEntrada ? TipoPontoRua.BordaEntrada : bordaSaida ? TipoPontoRua.BordaSaida : TipoPontoRua.Rua)
|
||||
{
|
||||
|
|
@ -781,7 +864,9 @@ namespace AgroBase.Models
|
|||
Direcao = direcaoAtual,
|
||||
Orientacao = GPSUtils.CalcularOrientacao(_trajetoriaFixa.Last().Posicao, pontoAtual),
|
||||
Visitado = false,
|
||||
LarguraCorredor = CorredoresLarguras[idx]
|
||||
LarguraCorredor =
|
||||
distanciaCorredor < DistanciaPrimeirosPontosProjecao && !bordaEntrada && !bordaSaida ? larguraCorredorMenor :
|
||||
CorredoresLarguras[idx]
|
||||
};
|
||||
|
||||
_trajetoriaFixa.Add(PontoTrajetoria);
|
||||
|
|
@ -796,7 +881,7 @@ namespace AgroBase.Models
|
|||
Direcao = direcaoAtual,
|
||||
Orientacao = GPSUtils.CalcularOrientacao(_trajetoriaFixa.Last().Posicao, UltimoPonto),
|
||||
Visitado = false,
|
||||
LarguraCorredor = !ultimoCorredor ? LarguraCorredorPadrao : LarguraCorredorPadrao / 2.0
|
||||
LarguraCorredor = larguraCorredorMenor
|
||||
};
|
||||
_trajetoriaFixa.Add(PontoFinal);
|
||||
|
||||
|
|
@ -805,32 +890,21 @@ namespace AgroBase.Models
|
|||
|
||||
_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);
|
||||
if (_trajetoriaFixa.Count() > 1 && idxEsq == 0 && idxDir == 0)
|
||||
{
|
||||
(List<GPSModel> ruaEsq, List<GPSModel> ruaDir) = DeterminarRuasLaterais(_trajetoriaFixa[1].Posicao, _trajetoriaFixa[2].Posicao, RuasPlantacao[0], RuasPlantacao[1]);
|
||||
idxEsq = RuasPlantacao.IndexOf(ruaEsq);
|
||||
idxDir = RuasPlantacao.IndexOf(ruaDir);
|
||||
}
|
||||
int incEsq = 0;
|
||||
int incDir = 0;
|
||||
|
||||
_Corredores = _TrajetoriaFixa
|
||||
.GroupBy(x => x.idxCorredor)
|
||||
.Select((x, i) =>
|
||||
{
|
||||
double distanciaTotal = GPSUtils.DistanciaDoTrecho(x.Select(y => y.Posicao).ToList());
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
(incDir, incEsq) = AtualizaIndiceRuaLateralCorredor(i, idxDir, incDir, incEsq);
|
||||
|
||||
var obj = new CorredorTrajetoriaModel()
|
||||
{
|
||||
|
|
@ -839,7 +913,8 @@ namespace AgroBase.Models
|
|||
DistanciaTotal = distanciaTotal,
|
||||
Pontos = x.ToList(),
|
||||
QtdPontos = x.Count(),
|
||||
DistanciaPercorrida = 0,
|
||||
DistanciaPercorridaCorredor = 0,
|
||||
DistanciaPercorridaTotal = 0,
|
||||
idxRuaDireita = idxDir + incDir,
|
||||
idxRuaEsquerda = idxEsq + incEsq
|
||||
};
|
||||
|
|
@ -855,10 +930,35 @@ namespace AgroBase.Models
|
|||
LoopAtualizaDados();
|
||||
}
|
||||
|
||||
private (int, int) AtualizaIndiceRuaLateralCorredor(int i, int idxDir, int incDir, int incEsq)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
return (incDir, incEsq);
|
||||
}
|
||||
|
||||
public static GPSModel CalcularPontoControle(GPSModel penultimoPontoRuaAtual, GPSModel ultimoPontoRuaAtual, GPSModel primeiroPontoProximaRua, double distancia)
|
||||
{
|
||||
double anguloCurva = GPSUtils.CalcularOrientacao(penultimoPontoRuaAtual, ultimoPontoRuaAtual);
|
||||
double angulo = GPSUtils.CalcularOrientacao(ultimoPontoRuaAtual, primeiroPontoProximaRua);
|
||||
|
||||
// Calcular a diferença de ângulo corretamente no espaço de 360 graus
|
||||
double diferencaAngulo = ((angulo - anguloCurva + 540) % 360) - 180;
|
||||
|
||||
bool ParaDentro = diferencaAngulo > 0; // Agora o cálculo é confiável
|
||||
|
||||
double lat = (ultimoPontoRuaAtual.Latitude + primeiroPontoProximaRua.Latitude) / 2;
|
||||
double lon = (ultimoPontoRuaAtual.Longitude + primeiroPontoProximaRua.Longitude) / 2;
|
||||
GPSModel pontoMedio = new GPSModel()
|
||||
|
|
@ -867,10 +967,8 @@ namespace AgroBase.Models
|
|||
Longitude = lon,
|
||||
};
|
||||
|
||||
bool ParaDentro = (angulo - anguloCurva) > 0;
|
||||
|
||||
// Ajuste o ângulo com base na direção da curva
|
||||
double ajusteAngulo = (ParaDentro ? 270 : 90);
|
||||
double ajusteAngulo = ParaDentro ? -90 : 90;
|
||||
|
||||
// Projetar um ponto a uma certa distância na direção ajustada
|
||||
return GPSUtils.ProjetarPontoDeslocado(pontoMedio, distancia, angulo + ajusteAngulo);
|
||||
|
|
@ -908,16 +1006,25 @@ namespace AgroBase.Models
|
|||
GPSModel ponto1 = GPSUtils.GerarPontoDeslocado(posicaoAtual, anguloDesvioInicial, distanciaObstaculo);
|
||||
GPSModel ponto2 = GPSUtils.GerarPontoDeslocado(ponto1, anguloCaminho, larguraObstaculo);
|
||||
GPSModel ponto3 = GPSUtils.GerarPontoDeslocado(ponto2, anguloDesvioFinal, distanciaObstaculo);
|
||||
List<GPSModel> lista = new List<GPSModel>()
|
||||
List<PontoTrajetoriaModel> lista = new List<PontoTrajetoriaModel>()
|
||||
{
|
||||
ponto1,
|
||||
ponto2,
|
||||
ponto3
|
||||
new PontoTrajetoriaModel(TipoPontoRua.Desvio)
|
||||
{
|
||||
Posicao = ponto1,
|
||||
},
|
||||
new PontoTrajetoriaModel(TipoPontoRua.Desvio)
|
||||
{
|
||||
Posicao = ponto2,
|
||||
},
|
||||
new PontoTrajetoriaModel(TipoPontoRua.Desvio)
|
||||
{
|
||||
Posicao = ponto3,
|
||||
}
|
||||
};
|
||||
|
||||
var idxRemover = EncontrarIndiceFinalDesvio(TrajetoriaDinamica, ponto3, distanciaObstaculo);
|
||||
TrajetoriaDinamica.RemoveRange(1, idxRemover);
|
||||
TrajetoriaDinamica.InsertRange(1, lista);
|
||||
_TrajetoriaDinamica.RemoveRange(1, idxRemover);
|
||||
_TrajetoriaDinamica.InsertRange(1, lista);
|
||||
}
|
||||
|
||||
private int EncontrarIndiceFinalDesvio(List<GPSModel> trajetoria, GPSModel ultimoWaypointDesvio, double distanciaSeguranca)
|
||||
|
|
@ -976,7 +1083,8 @@ namespace AgroBase.Models
|
|||
public int Idx { get; set; }
|
||||
public double Largura { get; set; }
|
||||
public double DistanciaTotal { get; set; }
|
||||
public double DistanciaPercorrida { get; set; }
|
||||
public double DistanciaPercorridaCorredor { get; set; }
|
||||
public double DistanciaPercorridaTotal { get; set; }
|
||||
public List<PontoTrajetoriaModel> Pontos { get; set; }
|
||||
public int QtdPontos { get; set; }
|
||||
[JsonProperty]
|
||||
|
|
@ -989,6 +1097,7 @@ namespace AgroBase.Models
|
|||
public bool Concluido { get; private set; }
|
||||
public int idxRuaEsquerda { get; set; }
|
||||
public int idxRuaDireita { get; set; }
|
||||
public double FatorLarguraCorredor { get; private set; }
|
||||
|
||||
public void AtualizarDados()
|
||||
{
|
||||
|
|
@ -998,6 +1107,7 @@ namespace AgroBase.Models
|
|||
{
|
||||
// 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.Visitado &&
|
||||
ponto.NaMargem &&
|
||||
(ponto.Tipo == Enums.TipoPontoRua.Rua ||
|
||||
(
|
||||
|
|
@ -1012,8 +1122,9 @@ namespace AgroBase.Models
|
|||
}
|
||||
}
|
||||
|
||||
DistanciaRestante = DistanciaTotal - DistanciaPercorrida;
|
||||
Progresso = (DistanciaTotal > 0) ? FuncoesMatematicas.Clamp((DistanciaPercorrida / DistanciaTotal) * 100.0, 0, 100) : 0;
|
||||
FatorLarguraCorredor = Largura / TrajetoriaMapaOperacaoModel.LarguraCorredorPadrao;
|
||||
DistanciaRestante = DistanciaTotal - DistanciaPercorridaTotal;
|
||||
Progresso = (DistanciaTotal > 0) ? FuncoesMatematicas.Clamp((DistanciaPercorridaTotal / DistanciaTotal) * 100.0, 0, 100) : 0;
|
||||
Concluido = !Pontos.Any(x => !x.Visitado);
|
||||
}
|
||||
|
||||
|
|
@ -1024,7 +1135,8 @@ namespace AgroBase.Models
|
|||
Idx = Idx,
|
||||
Largura = Largura,
|
||||
DistanciaTotal = DistanciaTotal,
|
||||
DistanciaPercorrida = DistanciaPercorrida,
|
||||
DistanciaPercorridaCorredor = DistanciaPercorridaCorredor,
|
||||
DistanciaPercorridaTotal = DistanciaPercorridaTotal,
|
||||
QtdPontos = QtdPontos,
|
||||
Dentro = Dentro,
|
||||
Concluido = Concluido,
|
||||
|
|
@ -1053,6 +1165,7 @@ namespace AgroBase.Models
|
|||
public Enums.DirecaoCarroRua Direcao { get; set; }
|
||||
public Enums.TipoPontoRua Tipo { get; }
|
||||
public double LarguraCorredor { get; set; }
|
||||
public double DistanciaMargem { get; set; }
|
||||
public bool Visitado { get; set; } = false;
|
||||
|
||||
// ✅ Agora, propriedades podem ser atualizadas com `set; private`
|
||||
|
|
@ -1101,11 +1214,11 @@ namespace AgroBase.Models
|
|||
if (Visitado) return; // Se já foi visitado, não faz nada
|
||||
|
||||
double distanciaEntrePontos =
|
||||
Tipo == TipoPontoRua.CruvaEntreCorredores ? (TrajetoriaMapaOperacaoModel.DistanciaEntrePontosCurva * 1.0) :
|
||||
Tipo == TipoPontoRua.CruvaEntreCorredores ? TrajetoriaMapaOperacaoModel.DistanciaEntrePontosCurva :
|
||||
TrajetoriaMapaOperacaoModel.DistanciaEntrePontos;
|
||||
|
||||
// Define o limite de distância para considerar o ponto como visitado
|
||||
double fatorAjuste = Tipo == TipoPontoRua.CruvaEntreCorredores ? 1.5 : 2.0; // Curvas podem ter menos tolerância
|
||||
double fatorAjuste = Tipo == TipoPontoRua.CruvaEntreCorredores ? 3.0 : 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
|
||||
|
|
@ -1128,12 +1241,13 @@ namespace AgroBase.Models
|
|||
private void AtualizarDistanciaTrajeto()
|
||||
{
|
||||
var pontoAtual = Variaveis.OperacaoEmAndamento.Trajetoria.PontoAtual;
|
||||
int idxPontoAtual = pontoAtual.idxPonto;
|
||||
int idxPontoAtual = pontoAtual.idxPonto + 1;
|
||||
int qtdPontos = Math.Abs(idxPonto - idxPontoAtual) + 1; // Sempre positivo
|
||||
|
||||
if (qtdPontos == 1)
|
||||
{
|
||||
DistanciaTrajeto = pontoAtual.Aproximando ? pontoAtual.DistanciaAtual : -pontoAtual.DistanciaAtual;
|
||||
//DistanciaTrajeto = pontoAtual.Aproximando ? pontoAtual.DistanciaAtual : -pontoAtual.DistanciaAtual;
|
||||
DistanciaTrajeto = GPSUtils.DistanciaEntrePontos(Variaveis.OperacaoEmAndamento.Trajetoria._TrajetoriaDinamica.First().Posicao, Posicao);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1183,7 +1297,8 @@ namespace AgroBase.Models
|
|||
|
||||
private void AtualizarNaMargem()
|
||||
{
|
||||
NaMargem = DistanciaAtual < (LarguraCorredor * 0.8);
|
||||
DistanciaMargem = LarguraCorredor * 0.8;
|
||||
NaMargem = DistanciaAtual < DistanciaMargem;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ namespace AgroBase.Models
|
|||
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);
|
||||
double k = 1.35 + 0.5 * Math.Exp(-Math.Abs(anguloControle) / 15.0);
|
||||
|
||||
// Converte o ângulo de controle para radianos
|
||||
double anguloControleRad = anguloControle * (Math.PI / 180.0);
|
||||
|
|
@ -347,6 +347,42 @@ namespace AgroBase.Models
|
|||
}
|
||||
}
|
||||
public static GPSModel PosicaoBase { get; set; }
|
||||
|
||||
|
||||
public static void RegistrarLogDispositivo(List<string> Logs, string Caminho, string NomeArquivo, int MinLogs = 100)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Logs.Count() >= MinLogs)
|
||||
{
|
||||
if (!Directory.Exists(Caminho))
|
||||
{
|
||||
Directory.CreateDirectory(Caminho);
|
||||
}
|
||||
|
||||
Caminho = Path.Combine(Caminho, NomeArquivo);
|
||||
|
||||
foreach (var mensagem in Logs)
|
||||
{
|
||||
if (!File.Exists(Caminho))
|
||||
{
|
||||
File.WriteAllText(Caminho, mensagem);
|
||||
}
|
||||
else
|
||||
{
|
||||
File.AppendAllText(Caminho, mensagem);
|
||||
}
|
||||
}
|
||||
|
||||
Logs.Clear();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("Erro ao salvar log: " + NomeArquivo);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class FuncoesGlobais
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using static AgroBase.Models.Enums;
|
||||
using System.IO;
|
||||
|
||||
namespace AgroBase.Services
|
||||
{
|
||||
|
|
@ -186,6 +185,9 @@ namespace AgroBase.Services
|
|||
|
||||
private static AsyncTaskTimerModel tmrLoopComandos;
|
||||
|
||||
private static List<string> ComandosComunicacao = new List<string>();
|
||||
private static List<string> ErrosComunicacao = new List<string>();
|
||||
|
||||
private static bool EnvioLiberado { get; set; } = true;
|
||||
|
||||
public static void IniciarRotinas()
|
||||
|
|
@ -536,62 +538,28 @@ namespace AgroBase.Services
|
|||
|
||||
public static void RegisrarErrosComunicacao(byte addr, string mensagem)
|
||||
{
|
||||
try
|
||||
{
|
||||
var Caminho = Variaveis.CaminhoLogsDispositivos;
|
||||
if (!Directory.Exists(Caminho))
|
||||
{
|
||||
Directory.CreateDirectory(Caminho);
|
||||
}
|
||||
var Caminho = Variaveis.CaminhoLogsDispositivos;
|
||||
|
||||
var Arquivo = T_Code.Bld.ToString() + "_err.txt";
|
||||
Caminho += "/" + Arquivo;
|
||||
var Arquivo = T_Code.Bld.ToString() + "_err.txt";
|
||||
|
||||
mensagem = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:fff") + " - Endereço " + addr + " (" + _ethernetService._ipAddress + "): " + mensagem + Environment.NewLine;
|
||||
mensagem = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:fff") + " - Endereço " + addr + " (" + _ethernetService._ipAddress + "): " + mensagem + Environment.NewLine;
|
||||
|
||||
if (!File.Exists(Caminho))
|
||||
{
|
||||
File.WriteAllText(Caminho, mensagem);
|
||||
}
|
||||
else
|
||||
{
|
||||
File.AppendAllText(Caminho, mensagem);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("Erro ao salvar log de erro BLD");
|
||||
}
|
||||
ErrosComunicacao.Add(mensagem);
|
||||
|
||||
VariaveisOperacao.RegistrarLogDispositivo(ErrosComunicacao, Caminho, Arquivo);
|
||||
}
|
||||
|
||||
public static void RegisrarComandosComunicacao(byte addr, string mensagem)
|
||||
{
|
||||
try
|
||||
{
|
||||
var Caminho = Variaveis.CaminhoLogsDispositivos;
|
||||
if (!Directory.Exists(Caminho))
|
||||
{
|
||||
Directory.CreateDirectory(Caminho);
|
||||
}
|
||||
var Caminho = Variaveis.CaminhoLogsDispositivos;
|
||||
|
||||
var Arquivo = T_Code.Bld.ToString() + "_log.txt";
|
||||
Caminho += "/" + Arquivo;
|
||||
var Arquivo = T_Code.Bld.ToString() + "_log.txt";
|
||||
|
||||
mensagem = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:fff") + " - Endereço " + addr + " (" + _ethernetService._ipAddress + "): " + mensagem + Environment.NewLine;
|
||||
mensagem = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:fff") + " - Endereço " + addr + " (" + _ethernetService._ipAddress + "): " + mensagem + Environment.NewLine;
|
||||
|
||||
if (!File.Exists(Caminho))
|
||||
{
|
||||
File.WriteAllText(Caminho, mensagem);
|
||||
}
|
||||
else
|
||||
{
|
||||
File.AppendAllText(Caminho, mensagem);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("Erro ao salvar log de comunicacao BLD");
|
||||
}
|
||||
ComandosComunicacao.Add(mensagem);
|
||||
|
||||
VariaveisOperacao.RegistrarLogDispositivo(ComandosComunicacao, Caminho, Arquivo);
|
||||
}
|
||||
|
||||
private static async Task tmrLoopComandos_Tick()
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace AgroBase.Comum
|
|||
public TextBox txtEnvios { get; set; }
|
||||
public RichTextBox txaConsole { get; set; }
|
||||
public int _index { get; set; }
|
||||
public List<DispositivoLogModel> Logs { get; set; } = new List<DispositivoLogModel>();
|
||||
public List<string> Logs { get; set; } = new List<string>();
|
||||
public readonly object _logsLock = new object();
|
||||
public T Dados { get; set; } = new T();
|
||||
DispositivoBaseModel IDispositivosService.Dados
|
||||
|
|
@ -40,8 +40,6 @@ namespace AgroBase.Comum
|
|||
public Form frmPin { get; set; }
|
||||
private AsyncTaskTimerModel tmrLogsDispositivo;
|
||||
|
||||
public int Ticks { get; set; } = 0;
|
||||
|
||||
public int TempoConectado { get; set; } = 0;
|
||||
|
||||
public MqttTopicosModel MqttTopicoEnvioComandos;
|
||||
|
|
@ -400,51 +398,18 @@ namespace AgroBase.Comum
|
|||
|
||||
private async Task tmrLogsDispositivo_Tick()
|
||||
{
|
||||
if (Ticks >= 30)
|
||||
{
|
||||
SalvarLog();
|
||||
SalvarLog();
|
||||
|
||||
Ticks = -1;
|
||||
}
|
||||
Ticks++;
|
||||
TempoConectado++;
|
||||
}
|
||||
|
||||
private void SalvarLog()
|
||||
{
|
||||
lock (_logsLock)
|
||||
{
|
||||
if (Logs.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string Caminho = Path.Combine(Variaveis.CaminhoLogsDispositivos, Dispositivo.ToString());
|
||||
|
||||
try
|
||||
{
|
||||
string Caminho = Variaveis.CaminhoLogsDispositivos + Dispositivo;
|
||||
string NomeLog = _CriadoEm.ToString("dd_MM_yyyy_mm_ss") + ".json";
|
||||
if (!Directory.Exists(Caminho))
|
||||
{
|
||||
Directory.CreateDirectory(Caminho);
|
||||
}
|
||||
if (!File.Exists(Caminho + "/" + NomeLog))
|
||||
{
|
||||
string jsonLog = JsonConvert.SerializeObject(Logs, Formatting.None);
|
||||
File.WriteAllText(Caminho + "/" + NomeLog, jsonLog.Substring(0, jsonLog.Length - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
string jsonLog = JsonConvert.SerializeObject(Logs, Formatting.None);
|
||||
jsonLog = jsonLog.Substring(1, jsonLog.Length - 2);
|
||||
File.AppendAllText(Caminho + "/" + NomeLog, "," + jsonLog);
|
||||
}
|
||||
Logs = new List<DispositivoLogModel>();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string NomeLog = _CriadoEm.ToString("dd_MM_yyyy_HH_mm_ss") + ".json";
|
||||
|
||||
}
|
||||
}
|
||||
VariaveisOperacao.RegistrarLogDispositivo(Logs.Select(x => JsonConvert.SerializeObject(x)).ToList(), Caminho, NomeLog);
|
||||
}
|
||||
|
||||
private void clbDispositivos_ItemCheck(object sender, ItemCheckEventArgs e)
|
||||
|
|
|
|||
|
|
@ -217,6 +217,9 @@ namespace AgroBase.Services
|
|||
Console.WriteLine($"Sentença desconhecida: {sentenca}");
|
||||
}
|
||||
}
|
||||
|
||||
PenultimaLeitura.UltimoComandoRespondido = UltimaLeitura.UltimoComandoRespondido;
|
||||
UltimaLeitura.UltimoComandoRespondido = DateTime.Now;
|
||||
}
|
||||
|
||||
private static void ProcessarGNGGA(string sentenca)
|
||||
|
|
@ -559,7 +562,11 @@ namespace AgroBase.Services
|
|||
|
||||
if (CorredorAtual != null)
|
||||
{
|
||||
CorredorAtual.DistanciaPercorrida += distancia;
|
||||
CorredorAtual.DistanciaPercorridaTotal += distancia;
|
||||
if (_Trajetoria.CorredorAtual.Dentro)
|
||||
{
|
||||
CorredorAtual.DistanciaPercorridaCorredor += distancia;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -604,7 +611,7 @@ namespace AgroBase.Services
|
|||
|
||||
public static void AtualizarTrajetoriaDinamica()
|
||||
{
|
||||
if (Variaveis.OperacaoEmAndamento.Trajetoria?.TrajetoriaDinamica?.Any() ?? false)
|
||||
if (Variaveis.OperacaoEmAndamento.Trajetoria?._TrajetoriaDinamica?.Any() ?? false)
|
||||
{
|
||||
var Trajetoria = Variaveis.OperacaoEmAndamento.Trajetoria.TrajetoriaDinamica.Select(x => new
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static AgroBase.Models.Enums;
|
||||
|
||||
namespace AgroBase.Services
|
||||
|
|
@ -38,6 +36,9 @@ namespace AgroBase.Services
|
|||
public static DateTime UltimoReferenciamento = DateTime.MinValue;
|
||||
public static int AnguloOffsetSensor = 8;
|
||||
|
||||
public static List<string> ComandosComunicacao = new List<string>();
|
||||
public static List<string> ErrosComunicacao = new List<string>();
|
||||
|
||||
public static void IniciarRotinas()
|
||||
{
|
||||
PararRotinas();
|
||||
|
|
@ -130,62 +131,28 @@ namespace AgroBase.Services
|
|||
|
||||
private static void RegisrarErrosComunicacao(byte addr, string mensagem)
|
||||
{
|
||||
try
|
||||
{
|
||||
var Caminho = Variaveis.CaminhoLogsDispositivos;
|
||||
if (!Directory.Exists(Caminho))
|
||||
{
|
||||
Directory.CreateDirectory(Caminho);
|
||||
}
|
||||
var Caminho = Variaveis.CaminhoLogsDispositivos;
|
||||
|
||||
var Arquivo = T_Code.Mks.ToString() + "_err.txt";
|
||||
Caminho += "/" + Arquivo;
|
||||
var Arquivo = T_Code.Mks.ToString() + "_err.txt";
|
||||
|
||||
mensagem = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:fff") + " - Endereço " + addr + " (" + _ethernetService._ipAddress + "): " + mensagem + Environment.NewLine;
|
||||
mensagem = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:fff") + " - Endereço " + addr + " (" + _ethernetService._ipAddress + "): " + mensagem + Environment.NewLine;
|
||||
|
||||
if (!File.Exists(Caminho))
|
||||
{
|
||||
File.WriteAllText(Caminho, mensagem);
|
||||
}
|
||||
else
|
||||
{
|
||||
File.AppendAllText(Caminho, mensagem);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("Erro ao salvar log de erro MKS");
|
||||
}
|
||||
ErrosComunicacao.Add(mensagem);
|
||||
|
||||
VariaveisOperacao.RegistrarLogDispositivo(ErrosComunicacao, Caminho, Arquivo, 30);
|
||||
}
|
||||
|
||||
public static void RegisrarComandosComunicacao(byte addr, string mensagem)
|
||||
{
|
||||
try
|
||||
{
|
||||
var Caminho = Variaveis.CaminhoLogsDispositivos;
|
||||
if (!Directory.Exists(Caminho))
|
||||
{
|
||||
Directory.CreateDirectory(Caminho);
|
||||
}
|
||||
var Caminho = Variaveis.CaminhoLogsDispositivos;
|
||||
|
||||
var Arquivo = T_Code.Mks.ToString() + "_log.txt";
|
||||
Caminho += "/" + Arquivo;
|
||||
var Arquivo = T_Code.Mks.ToString() + "_log.txt";
|
||||
|
||||
mensagem = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:fff") + " - Endereço " + addr + " (" + _ethernetService._ipAddress + "): " + mensagem + Environment.NewLine;
|
||||
mensagem = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:fff") + " - Endereço " + addr + " (" + _ethernetService._ipAddress + "): " + mensagem + Environment.NewLine;
|
||||
|
||||
if (!File.Exists(Caminho))
|
||||
{
|
||||
File.WriteAllText(Caminho, mensagem);
|
||||
}
|
||||
else
|
||||
{
|
||||
File.AppendAllText(Caminho, mensagem);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("Erro ao salvar log de comunicacao MKS");
|
||||
}
|
||||
ComandosComunicacao.Add(mensagem);
|
||||
|
||||
VariaveisOperacao.RegistrarLogDispositivo(ComandosComunicacao, Caminho, Arquivo, 300);
|
||||
}
|
||||
|
||||
private static void DefinirDispositivo(List<string> Mod_IDs)
|
||||
|
|
|
|||
|
|
@ -53,6 +53,9 @@ namespace AgroBase.Services
|
|||
private static AsyncTaskTimerModel tmrLoopComandos;
|
||||
private static AsyncTaskTimerModel tmrReceberDados;
|
||||
|
||||
public static List<string> ComandosComunicacao = new List<string>();
|
||||
public static List<string> ErrosComunicacao = new List<string>();
|
||||
|
||||
|
||||
public static void IniciarRotinas()
|
||||
{
|
||||
|
|
@ -204,14 +207,9 @@ namespace AgroBase.Services
|
|||
|
||||
mensagem = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:fff") + " - Porta " + (_PortaModbus?.PortName ?? "COM") + " - " + addr + ": " + mensagem + Environment.NewLine;
|
||||
|
||||
if (!File.Exists(Caminho))
|
||||
{
|
||||
File.WriteAllText(Caminho, mensagem);
|
||||
}
|
||||
else
|
||||
{
|
||||
File.AppendAllText(Caminho, mensagem);
|
||||
}
|
||||
ErrosComunicacao.Add(mensagem);
|
||||
|
||||
VariaveisOperacao.RegistrarLogDispositivo(ErrosComunicacao, Caminho, 50);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using AgroBase.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using static AgroBase.Models.Enums;
|
||||
|
|
@ -491,6 +490,9 @@ namespace AgroBase.Services
|
|||
private static AsyncTaskTimerModel tmrLoopComandos;
|
||||
private static AsyncTaskTimerModel tmrHeartbeat;
|
||||
|
||||
public static List<string> ComandosComunicacao = new List<string>();
|
||||
public static List<string> ErrosComunicacao = new List<string>();
|
||||
|
||||
private static bool EnvioLiberado { get; set; } = true;
|
||||
|
||||
public static void IniciarRotinas()
|
||||
|
|
@ -946,62 +948,28 @@ namespace AgroBase.Services
|
|||
|
||||
public static void RegisrarErrosComunicacao(byte addr, string mensagem)
|
||||
{
|
||||
try
|
||||
{
|
||||
var Caminho = Variaveis.CaminhoLogsDispositivos;
|
||||
if (!Directory.Exists(Caminho))
|
||||
{
|
||||
Directory.CreateDirectory(Caminho);
|
||||
}
|
||||
var Caminho = Variaveis.CaminhoLogsDispositivos;
|
||||
|
||||
var Arquivo = T_Code.Oid.ToString() + "_err.txt";
|
||||
Caminho += "/" + Arquivo;
|
||||
var Arquivo = T_Code.Oid.ToString() + "_err.txt";
|
||||
|
||||
mensagem = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:fff") + " - Endereço " + addr + " (" + _ethernetService._ipAddress + "): " + mensagem + Environment.NewLine;
|
||||
mensagem = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:fff") + " - Endereço " + addr + " (" + _ethernetService._ipAddress + "): " + mensagem + Environment.NewLine;
|
||||
|
||||
if (!File.Exists(Caminho))
|
||||
{
|
||||
File.WriteAllText(Caminho, mensagem);
|
||||
}
|
||||
else
|
||||
{
|
||||
File.AppendAllText(Caminho, mensagem);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("Erro ao salvar log de erro OID");
|
||||
}
|
||||
ErrosComunicacao.Add(mensagem);
|
||||
|
||||
VariaveisOperacao.RegistrarLogDispositivo(ErrosComunicacao, Caminho, Arquivo, 30);
|
||||
}
|
||||
|
||||
public static void RegisrarComandosComunicacao(byte addr, string mensagem)
|
||||
{
|
||||
try
|
||||
{
|
||||
var Caminho = Variaveis.CaminhoLogsDispositivos;
|
||||
if (!Directory.Exists(Caminho))
|
||||
{
|
||||
Directory.CreateDirectory(Caminho);
|
||||
}
|
||||
var Caminho = Variaveis.CaminhoLogsDispositivos;
|
||||
|
||||
var Arquivo = T_Code.Oid.ToString() + "_log.txt";
|
||||
Caminho += "/" + Arquivo;
|
||||
var Arquivo = T_Code.Oid.ToString() + "_log.txt";
|
||||
|
||||
mensagem = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:fff") + " - Endereço " + addr + " (" + _ethernetService._ipAddress + "): " + mensagem + Environment.NewLine;
|
||||
mensagem = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:fff") + " - Endereço " + addr + " (" + _ethernetService._ipAddress + "): " + mensagem + Environment.NewLine;
|
||||
|
||||
if (!File.Exists(Caminho))
|
||||
{
|
||||
File.WriteAllText(Caminho, mensagem);
|
||||
}
|
||||
else
|
||||
{
|
||||
File.AppendAllText(Caminho, mensagem);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("Erro ao salvar log de comunicacao OID");
|
||||
}
|
||||
ComandosComunicacao.Add(mensagem);
|
||||
|
||||
VariaveisOperacao.RegistrarLogDispositivo(ComandosComunicacao, Caminho, Arquivo, 300);
|
||||
}
|
||||
|
||||
private static async Task tmrLoopComandos_Tick()
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -25,7 +25,7 @@
|
|||
<meta name="viewport" content="width=device-width,
|
||||
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<style>
|
||||
#map_2c3b9b5a0bbe650a5f56c4603f653b08 {
|
||||
#map_a884af1c3adf4e85c47a15fa5949a894 {
|
||||
position: relative;
|
||||
width: 100.0%;
|
||||
height: 100.0%;
|
||||
|
|
@ -39,14 +39,14 @@
|
|||
<body>
|
||||
|
||||
|
||||
<div class="folium-map" id="map_2c3b9b5a0bbe650a5f56c4603f653b08" ></div>
|
||||
<div class="folium-map" id="map_a884af1c3adf4e85c47a15fa5949a894" ></div>
|
||||
|
||||
</body>
|
||||
<script>
|
||||
|
||||
|
||||
var map_2c3b9b5a0bbe650a5f56c4603f653b08 = L.map(
|
||||
"map_2c3b9b5a0bbe650a5f56c4603f653b08",
|
||||
var map_a884af1c3adf4e85c47a15fa5949a894 = L.map(
|
||||
"map_a884af1c3adf4e85c47a15fa5949a894",
|
||||
{
|
||||
center: [0.0, 0.0],
|
||||
crs: L.CRS.EPSG3857,
|
||||
|
|
@ -60,13 +60,13 @@
|
|||
|
||||
|
||||
|
||||
var tile_layer_dc4c0c6fa24832018559655cf3935bb2 = L.tileLayer(
|
||||
var tile_layer_6130635c5242ebe8049446b60f4118fd = L.tileLayer(
|
||||
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||
{"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors", "detectRetina": false, "maxNativeZoom": 19, "maxZoom": 19, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
|
||||
);
|
||||
|
||||
|
||||
tile_layer_dc4c0c6fa24832018559655cf3935bb2.addTo(map_2c3b9b5a0bbe650a5f56c4603f653b08);
|
||||
tile_layer_6130635c5242ebe8049446b60f4118fd.addTo(map_a884af1c3adf4e85c47a15fa5949a894);
|
||||
|
||||
</script>
|
||||
|
||||
|
|
@ -87,7 +87,7 @@
|
|||
}
|
||||
trajeto_json_add({"features": []});
|
||||
|
||||
trajeto_json.addTo(map_2c3b9b5a0bbe650a5f56c4603f653b08);
|
||||
trajeto_json.addTo(map_a884af1c3adf4e85c47a15fa5949a894);
|
||||
|
||||
function adicionarGeometria(novaGeometria) {
|
||||
trajeto_json.addData(novaGeometria);
|
||||
|
|
@ -145,7 +145,7 @@
|
|||
|
||||
var marcadorDinamico = L.marker([0, 0], {
|
||||
icon: customIcon
|
||||
}).addTo(map_2c3b9b5a0bbe650a5f56c4603f653b08);
|
||||
}).addTo(map_a884af1c3adf4e85c47a15fa5949a894);
|
||||
|
||||
// Conectar ao broker MQTT
|
||||
const client = mqtt.connect('ws://localhost:9001'); // Use wss para conexão segura
|
||||
|
|
@ -183,7 +183,7 @@
|
|||
marcadorDinamico.setRotationAngle(angulo);
|
||||
|
||||
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
|
||||
map_2c3b9b5a0bbe650a5f56c4603f653b08.setView(novaPosicao, map_2c3b9b5a0bbe650a5f56c4603f653b08.getZoom());
|
||||
map_a884af1c3adf4e85c47a15fa5949a894.setView(novaPosicao, map_a884af1c3adf4e85c47a15fa5949a894.getZoom());
|
||||
});
|
||||
|
||||
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1,221 @@
|
|||
{"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],[-47.3952169005,-22.172159611333335]]}},{"type":"Feature","properties":{"Id":"2","Name":"CidadeJardimFundo","Length":5.3317380071092622,"Dist1":7.0570051737487685,"Dist2":0.0},"geometry":{"id":null,"type":"LineString","coordinates":[[-47.3952167885,-22.172177683666668],[-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],[-47.395218172833331,-22.172198181666666]]}}]}
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"Id": "1",
|
||||
"Name": "CidadeJardimTerreno2",
|
||||
"Length": 14.558011415731592,
|
||||
"Dist1": 14.558011415731592,
|
||||
"Dist2": 0.0
|
||||
},
|
||||
"geometry": {
|
||||
"id": null,
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[
|
||||
-47.395205344,
|
||||
-22.172559531333334
|
||||
],
|
||||
[
|
||||
-47.395212610166666,
|
||||
-22.172614638833334
|
||||
],
|
||||
[
|
||||
-47.395219157,
|
||||
-22.172656417833334
|
||||
],
|
||||
[
|
||||
-47.395223544833335,
|
||||
-22.1726892105
|
||||
],
|
||||
[
|
||||
-47.39522414098443,
|
||||
-22.17269369161165
|
||||
],
|
||||
[
|
||||
-47.395225326538004,
|
||||
-22.172702654611555
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"Id": "2",
|
||||
"Name": "CidadeJardimTerreno2",
|
||||
"Length": 14.771318274761821,
|
||||
"Dist1": 14.558011415731592,
|
||||
"Dist2": 0.0
|
||||
},
|
||||
"geometry": {
|
||||
"id": null,
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[
|
||||
-47.39521090233333,
|
||||
-22.172708800833334
|
||||
],
|
||||
[
|
||||
-47.395206943666665,
|
||||
-22.172679811
|
||||
],
|
||||
[
|
||||
-47.395202420666664,
|
||||
-22.1726491015
|
||||
],
|
||||
[
|
||||
-47.395198865666664,
|
||||
-22.172615782833333
|
||||
],
|
||||
[
|
||||
-47.395193255833334,
|
||||
-22.172577132833332
|
||||
],
|
||||
[
|
||||
-47.395192610024395,
|
||||
-22.17257265769541
|
||||
],
|
||||
[
|
||||
-47.395191325698136,
|
||||
-22.172563706509337
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"Id": "3",
|
||||
"Name": "CidadeJardimTerreno2",
|
||||
"Length": 14.827915524386164,
|
||||
"Dist1": 14.558011415731592,
|
||||
"Dist2": 0.0
|
||||
},
|
||||
"geometry": {
|
||||
"id": null,
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[
|
||||
-47.3951762925,
|
||||
-22.172561603
|
||||
],
|
||||
[
|
||||
-47.395180824166665,
|
||||
-22.172591686166665
|
||||
],
|
||||
[
|
||||
-47.395185745333336,
|
||||
-22.172623080166666
|
||||
],
|
||||
[
|
||||
-47.395190433,
|
||||
-22.172656367166667
|
||||
],
|
||||
[
|
||||
-47.395195199,
|
||||
-22.172693641833334
|
||||
],
|
||||
[
|
||||
-47.39519576904436,
|
||||
-22.172698125891035
|
||||
],
|
||||
[
|
||||
-47.39519690267159,
|
||||
-22.172707094716973
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"Id": "4",
|
||||
"Name": "CidadeJardimTerreno2",
|
||||
"Length": 14.785159385903514,
|
||||
"Dist1": 14.558011415731592,
|
||||
"Dist2": 0.0
|
||||
},
|
||||
"geometry": {
|
||||
"id": null,
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[
|
||||
-47.39518293216667,
|
||||
-22.1727127985
|
||||
],
|
||||
[
|
||||
-47.39517819266667,
|
||||
-22.172680514833335
|
||||
],
|
||||
[
|
||||
-47.3951732595,
|
||||
-22.172646752833334
|
||||
],
|
||||
[
|
||||
-47.39516880516667,
|
||||
-22.1726149155
|
||||
],
|
||||
[
|
||||
-47.39516381233334,
|
||||
-22.172581167166665
|
||||
],
|
||||
[
|
||||
-47.39516315429932,
|
||||
-22.172576693573966
|
||||
],
|
||||
[
|
||||
-47.39516184565584,
|
||||
-22.172567745443878
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"Id": "5",
|
||||
"Name": "CidadeJardimTerreno2",
|
||||
"Length": 14.80117692191233,
|
||||
"Dist1": 14.558011415731592,
|
||||
"Dist2": 0.0
|
||||
},
|
||||
"geometry": {
|
||||
"id": null,
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[
|
||||
-47.395147317833334,
|
||||
-22.172566031
|
||||
],
|
||||
[
|
||||
-47.395151503166666,
|
||||
-22.172595452333333
|
||||
],
|
||||
[
|
||||
-47.3951561855,
|
||||
-22.172628011166665
|
||||
],
|
||||
[
|
||||
-47.39516159866667,
|
||||
-22.172663757333332
|
||||
],
|
||||
[
|
||||
-47.39516672716667,
|
||||
-22.172697770833334
|
||||
],
|
||||
[
|
||||
-47.395167397572706,
|
||||
-22.172702242832194
|
||||
],
|
||||
[
|
||||
-47.39516873082615,
|
||||
-22.17271118781009
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
<meta name="viewport" content="width=device-width,
|
||||
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<style>
|
||||
#map_5ba7fbc36c434eca463304fe098247ae {
|
||||
#map_dc4642f05abc644ab21acf0b6365a2fe {
|
||||
position: relative;
|
||||
width: 100.0%;
|
||||
height: 100.0%;
|
||||
|
|
@ -39,16 +39,16 @@
|
|||
<body>
|
||||
|
||||
|
||||
<div class="folium-map" id="map_5ba7fbc36c434eca463304fe098247ae" ></div>
|
||||
<div class="folium-map" id="map_dc4642f05abc644ab21acf0b6365a2fe" ></div>
|
||||
|
||||
</body>
|
||||
<script>
|
||||
|
||||
|
||||
var map_5ba7fbc36c434eca463304fe098247ae = L.map(
|
||||
"map_5ba7fbc36c434eca463304fe098247ae",
|
||||
var map_dc4642f05abc644ab21acf0b6365a2fe = L.map(
|
||||
"map_dc4642f05abc644ab21acf0b6365a2fe",
|
||||
{
|
||||
center: [-22.1721764555, -47.395250128499995],
|
||||
center: [-22.172636164916668, -47.395186322185666],
|
||||
crs: L.CRS.EPSG3857,
|
||||
zoom: 12,
|
||||
zoomControl: true,
|
||||
|
|
@ -60,13 +60,13 @@
|
|||
|
||||
|
||||
|
||||
var tile_layer_d518041c286f64e24a30d7d3ced75c0e = L.tileLayer(
|
||||
var tile_layer_16bed694c84a3826427605118c4ddd62 = L.tileLayer(
|
||||
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||
{"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors", "detectRetina": false, "maxNativeZoom": 19, "maxZoom": 19, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
|
||||
);
|
||||
|
||||
|
||||
tile_layer_d518041c286f64e24a30d7d3ced75c0e.addTo(map_5ba7fbc36c434eca463304fe098247ae);
|
||||
tile_layer_16bed694c84a3826427605118c4ddd62.addTo(map_dc4642f05abc644ab21acf0b6365a2fe);
|
||||
|
||||
|
||||
|
||||
|
|
@ -82,7 +82,7 @@
|
|||
}*/
|
||||
});
|
||||
}
|
||||
function geo_json_7312c671fce6fbda0510e3942fc11b42_onEachFeature(feature, layer) {
|
||||
function geo_json_2f4b19ee9d41be52502df97a1bea5414_onEachFeature(feature, layer) {
|
||||
layer.on({
|
||||
|
||||
click: function(e) {
|
||||
|
|
@ -118,20 +118,20 @@
|
|||
}*/
|
||||
});
|
||||
};
|
||||
var geo_json_7312c671fce6fbda0510e3942fc11b42 = L.geoJson(null, {
|
||||
onEachFeature: geo_json_7312c671fce6fbda0510e3942fc11b42_onEachFeature,
|
||||
var geo_json_2f4b19ee9d41be52502df97a1bea5414 = L.geoJson(null, {
|
||||
onEachFeature: geo_json_2f4b19ee9d41be52502df97a1bea5414_onEachFeature,
|
||||
|
||||
});
|
||||
|
||||
function geo_json_7312c671fce6fbda0510e3942fc11b42_add (data) {
|
||||
geo_json_7312c671fce6fbda0510e3942fc11b42
|
||||
function geo_json_2f4b19ee9d41be52502df97a1bea5414_add (data) {
|
||||
geo_json_2f4b19ee9d41be52502df97a1bea5414
|
||||
.addData(data);
|
||||
}
|
||||
geo_json_7312c671fce6fbda0510e3942fc11b42_add({"features": [{"geometry": {"coordinates": [[-47.395268038666664, -22.172154729333332], [-47.39525338483333, -22.172156474333335], [-47.395231131, -22.172159042833332], [-47.3952169005, -22.172159611333335]], "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.3952167885, -22.172177683666668], [-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], [-47.39521817283333, -22.172198181666666]], "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_2f4b19ee9d41be52502df97a1bea5414_add({"features": [{"geometry": {"coordinates": [[-47.395205344, -22.172559531333334], [-47.395212610166666, -22.172614638833334], [-47.395219157, -22.172656417833334], [-47.395223544833335, -22.1726892105], [-47.39522414098443, -22.17269369161165], [-47.395225326538004, -22.172702654611555]], "id": null, "type": "LineString"}, "id": 0, "properties": {"Dist1": 14.558011415731592, "Dist2": 0.0, "Id": "1", "Length": 14.558011415731592, "Name": "CidadeJardimTerreno2"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.39521090233333, -22.172708800833334], [-47.395206943666665, -22.172679811], [-47.395202420666664, -22.1726491015], [-47.395198865666664, -22.172615782833333], [-47.395193255833334, -22.172577132833332], [-47.395192610024395, -22.17257265769541], [-47.395191325698136, -22.172563706509337]], "id": null, "type": "LineString"}, "id": 1, "properties": {"Dist1": 14.558011415731592, "Dist2": 0.0, "Id": "2", "Length": 14.771318274761821, "Name": "CidadeJardimTerreno2"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.3951762925, -22.172561603], [-47.395180824166665, -22.172591686166665], [-47.395185745333336, -22.172623080166666], [-47.395190433, -22.172656367166667], [-47.395195199, -22.172693641833334], [-47.39519576904436, -22.172698125891035], [-47.39519690267159, -22.172707094716973]], "id": null, "type": "LineString"}, "id": 2, "properties": {"Dist1": 14.558011415731592, "Dist2": 0.0, "Id": "3", "Length": 14.827915524386164, "Name": "CidadeJardimTerreno2"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.39518293216667, -22.1727127985], [-47.39517819266667, -22.172680514833335], [-47.3951732595, -22.172646752833334], [-47.39516880516667, -22.1726149155], [-47.39516381233334, -22.172581167166665], [-47.39516315429932, -22.172576693573966], [-47.39516184565584, -22.172567745443878]], "id": null, "type": "LineString"}, "id": 3, "properties": {"Dist1": 14.558011415731592, "Dist2": 0.0, "Id": "4", "Length": 14.785159385903514, "Name": "CidadeJardimTerreno2"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.395147317833334, -22.172566031], [-47.395151503166666, -22.172595452333333], [-47.3951561855, -22.172628011166665], [-47.39516159866667, -22.172663757333332], [-47.39516672716667, -22.172697770833334], [-47.395167397572706, -22.172702242832194], [-47.39516873082615, -22.17271118781009]], "id": null, "type": "LineString"}, "id": 4, "properties": {"Dist1": 14.558011415731592, "Dist2": 0.0, "Id": "5", "Length": 14.80117692191233, "Name": "CidadeJardimTerreno2"}, "type": "Feature"}], "type": "FeatureCollection"});
|
||||
|
||||
|
||||
|
||||
geo_json_7312c671fce6fbda0510e3942fc11b42.addTo(map_5ba7fbc36c434eca463304fe098247ae);
|
||||
geo_json_2f4b19ee9d41be52502df97a1bea5414.addTo(map_dc4642f05abc644ab21acf0b6365a2fe);
|
||||
|
||||
</script>
|
||||
|
||||
|
|
@ -152,7 +152,7 @@
|
|||
}
|
||||
trajeto_json_add({"features": []});
|
||||
|
||||
trajeto_json.addTo(map_5ba7fbc36c434eca463304fe098247ae);
|
||||
trajeto_json.addTo(map_dc4642f05abc644ab21acf0b6365a2fe);
|
||||
|
||||
function adicionarGeometria(novaGeometria) {
|
||||
trajeto_json.addData(novaGeometria);
|
||||
|
|
@ -210,7 +210,7 @@
|
|||
}
|
||||
trajeto_dinamico_json_add({"features": []});
|
||||
|
||||
trajeto_dinamico_json.addTo(map_5ba7fbc36c434eca463304fe098247ae);
|
||||
trajeto_dinamico_json.addTo(map_dc4642f05abc644ab21acf0b6365a2fe);
|
||||
|
||||
function adicionarGeometriaDinamica(novaGeometria) {
|
||||
trajeto_dinamico_json.addData(novaGeometria);
|
||||
|
|
@ -263,9 +263,9 @@
|
|||
|
||||
var marcadorEquipamento = L.marker([0, 0], {
|
||||
icon: customIcon
|
||||
}).addTo(map_5ba7fbc36c434eca463304fe098247ae);
|
||||
}).addTo(map_dc4642f05abc644ab21acf0b6365a2fe);
|
||||
|
||||
var marcadorBase = L.marker([0, 0], {}).addTo(map_5ba7fbc36c434eca463304fe098247ae);
|
||||
var marcadorBase = L.marker([0, 0], {}).addTo(map_dc4642f05abc644ab21acf0b6365a2fe);
|
||||
var icon = L.AwesomeMarkers.icon(
|
||||
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
|
||||
);
|
||||
|
|
@ -347,7 +347,7 @@
|
|||
}
|
||||
|
||||
if (foco) {
|
||||
map_5ba7fbc36c434eca463304fe098247ae.setView(novaPosicao, map_5ba7fbc36c434eca463304fe098247ae.getZoom());
|
||||
map_dc4642f05abc644ab21acf0b6365a2fe.setView(novaPosicao, map_dc4642f05abc644ab21acf0b6365a2fe.getZoom());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -364,7 +364,7 @@
|
|||
function atualizarSelecaoRuas(selecionadas) {
|
||||
selecionadas = JSON.parse(selecionadas);
|
||||
RuasSelecionadas = Array.isArray(selecionadas) ? [...selecionadas] : [];
|
||||
geo_json_7312c671fce6fbda0510e3942fc11b42.eachLayer(function (layer) {
|
||||
geo_json_2f4b19ee9d41be52502df97a1bea5414.eachLayer(function (layer) {
|
||||
if (RuasSelecionadas.includes(parseInt(layer.feature.id))) {
|
||||
layer.setStyle({ color: 'blue' });
|
||||
} else {
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue