otimizado controle direcional MKS

This commit is contained in:
Diego Freitas 2024-12-10 10:29:11 -03:00
parent 93cc2e232f
commit 5c579bb695
41 changed files with 15113 additions and 286 deletions

Binary file not shown.

View File

@ -64,9 +64,13 @@
this.btnLigarBomba = new System.Windows.Forms.Button();
this.pnlCameraRua = new System.Windows.Forms.Panel();
this.pnlDir_EF = new System.Windows.Forms.Panel();
this.lblMov_EF = new System.Windows.Forms.Label();
this.pnlDir_ET = new System.Windows.Forms.Panel();
this.lblMov_ET = new System.Windows.Forms.Label();
this.pnlDir_DT = new System.Windows.Forms.Panel();
this.lblMov_DT = new System.Windows.Forms.Label();
this.pnlDir_DF = new System.Windows.Forms.Panel();
this.lblMov_DF = new System.Windows.Forms.Label();
this.lblDistanciaEsquerda = new System.Windows.Forms.Label();
this.lblDistanciaDireita = new System.Windows.Forms.Label();
this.chbSonar = new System.Windows.Forms.CheckBox();
@ -78,10 +82,8 @@
this.cmbTipoMovimento = new System.Windows.Forms.ComboBox();
this.lblTipoMovimento = new System.Windows.Forms.Label();
this.chbPulverizador = new System.Windows.Forms.CheckBox();
this.lblMov_EF = new System.Windows.Forms.Label();
this.lblMov_ET = new System.Windows.Forms.Label();
this.lblMov_DF = new System.Windows.Forms.Label();
this.lblMov_DT = new System.Windows.Forms.Label();
this.chbMostrarGrade = new System.Windows.Forms.CheckBox();
this.chbSonarAtivado = new System.Windows.Forms.CheckBox();
this.pnlCamerasSolo.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.chartGraficos)).BeginInit();
this.tabControl1.SuspendLayout();
@ -375,7 +377,10 @@
//
// pnlDeteccoesRua
//
this.pnlDeteccoesRua.Controls.Add(this.chbSonarAtivado);
this.pnlDeteccoesRua.Controls.Add(this.chbMostrarGrade);
this.pnlDeteccoesRua.Controls.Add(this.picSonar);
this.pnlDeteccoesRua.Controls.Add(this.chbSonar);
this.pnlDeteccoesRua.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlDeteccoesRua.Location = new System.Drawing.Point(2, 2);
this.pnlDeteccoesRua.Margin = new System.Windows.Forms.Padding(2);
@ -385,10 +390,11 @@
//
// picSonar
//
this.picSonar.Location = new System.Drawing.Point(13, 13);
this.picSonar.Location = new System.Drawing.Point(13, 3);
this.picSonar.Margin = new System.Windows.Forms.Padding(2);
this.picSonar.Name = "picSonar";
this.picSonar.Size = new System.Drawing.Size(434, 260);
this.picSonar.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picSonar.TabIndex = 0;
this.picSonar.TabStop = false;
//
@ -476,6 +482,16 @@
this.pnlDir_EF.Size = new System.Drawing.Size(150, 162);
this.pnlDir_EF.TabIndex = 23;
//
// lblMov_EF
//
this.lblMov_EF.AutoSize = true;
this.lblMov_EF.Location = new System.Drawing.Point(2, 147);
this.lblMov_EF.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblMov_EF.Name = "lblMov_EF";
this.lblMov_EF.Size = new System.Drawing.Size(66, 13);
this.lblMov_EF.TabIndex = 10;
this.lblMov_EF.Text = "EF Parado 0";
//
// pnlDir_ET
//
this.pnlDir_ET.Controls.Add(this.lblMov_ET);
@ -486,6 +502,16 @@
this.pnlDir_ET.Size = new System.Drawing.Size(150, 162);
this.pnlDir_ET.TabIndex = 24;
//
// lblMov_ET
//
this.lblMov_ET.AutoSize = true;
this.lblMov_ET.Location = new System.Drawing.Point(2, 148);
this.lblMov_ET.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblMov_ET.Name = "lblMov_ET";
this.lblMov_ET.Size = new System.Drawing.Size(67, 13);
this.lblMov_ET.TabIndex = 13;
this.lblMov_ET.Text = "ET Parado 0";
//
// pnlDir_DT
//
this.pnlDir_DT.Controls.Add(this.lblMov_DT);
@ -496,6 +522,16 @@
this.pnlDir_DT.Size = new System.Drawing.Size(150, 162);
this.pnlDir_DT.TabIndex = 24;
//
// lblMov_DT
//
this.lblMov_DT.AutoSize = true;
this.lblMov_DT.Location = new System.Drawing.Point(2, 148);
this.lblMov_DT.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblMov_DT.Name = "lblMov_DT";
this.lblMov_DT.Size = new System.Drawing.Size(68, 13);
this.lblMov_DT.TabIndex = 12;
this.lblMov_DT.Text = "DT Parado 0";
//
// pnlDir_DF
//
this.pnlDir_DF.Controls.Add(this.lblMov_DF);
@ -506,6 +542,16 @@
this.pnlDir_DF.Size = new System.Drawing.Size(150, 162);
this.pnlDir_DF.TabIndex = 24;
//
// lblMov_DF
//
this.lblMov_DF.AutoSize = true;
this.lblMov_DF.Location = new System.Drawing.Point(1, 147);
this.lblMov_DF.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblMov_DF.Name = "lblMov_DF";
this.lblMov_DF.Size = new System.Drawing.Size(67, 13);
this.lblMov_DF.TabIndex = 11;
this.lblMov_DF.Text = "DF Parado 0";
//
// lblDistanciaEsquerda
//
this.lblDistanciaEsquerda.AutoSize = true;
@ -531,7 +577,7 @@
// chbSonar
//
this.chbSonar.AutoSize = true;
this.chbSonar.Location = new System.Drawing.Point(157, 310);
this.chbSonar.Location = new System.Drawing.Point(264, 265);
this.chbSonar.Margin = new System.Windows.Forms.Padding(2);
this.chbSonar.Name = "chbSonar";
this.chbSonar.Size = new System.Drawing.Size(183, 17);
@ -630,45 +676,29 @@
this.chbPulverizador.Text = "Pulverizador automático";
this.chbPulverizador.UseVisualStyleBackColor = true;
//
// lblMov_EF
// chbMostrarGrade
//
this.lblMov_EF.AutoSize = true;
this.lblMov_EF.Location = new System.Drawing.Point(2, 147);
this.lblMov_EF.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblMov_EF.Name = "lblMov_EF";
this.lblMov_EF.Size = new System.Drawing.Size(66, 13);
this.lblMov_EF.TabIndex = 10;
this.lblMov_EF.Text = "EF Parado 0";
this.chbMostrarGrade.AutoSize = true;
this.chbMostrarGrade.Location = new System.Drawing.Point(141, 265);
this.chbMostrarGrade.Margin = new System.Windows.Forms.Padding(2);
this.chbMostrarGrade.Name = "chbMostrarGrade";
this.chbMostrarGrade.Size = new System.Drawing.Size(93, 17);
this.chbMostrarGrade.TabIndex = 36;
this.chbMostrarGrade.Text = "Mostrar Grade";
this.chbMostrarGrade.UseVisualStyleBackColor = true;
this.chbMostrarGrade.CheckedChanged += new System.EventHandler(this.chbMostrarGrade_CheckedChanged);
//
// lblMov_ET
// chbSonarAtivado
//
this.lblMov_ET.AutoSize = true;
this.lblMov_ET.Location = new System.Drawing.Point(2, 148);
this.lblMov_ET.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblMov_ET.Name = "lblMov_ET";
this.lblMov_ET.Size = new System.Drawing.Size(67, 13);
this.lblMov_ET.TabIndex = 13;
this.lblMov_ET.Text = "ET Parado 0";
//
// lblMov_DF
//
this.lblMov_DF.AutoSize = true;
this.lblMov_DF.Location = new System.Drawing.Point(1, 147);
this.lblMov_DF.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblMov_DF.Name = "lblMov_DF";
this.lblMov_DF.Size = new System.Drawing.Size(67, 13);
this.lblMov_DF.TabIndex = 11;
this.lblMov_DF.Text = "DF Parado 0";
//
// lblMov_DT
//
this.lblMov_DT.AutoSize = true;
this.lblMov_DT.Location = new System.Drawing.Point(2, 148);
this.lblMov_DT.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblMov_DT.Name = "lblMov_DT";
this.lblMov_DT.Size = new System.Drawing.Size(68, 13);
this.lblMov_DT.TabIndex = 12;
this.lblMov_DT.Text = "DT Parado 0";
this.chbSonarAtivado.AutoSize = true;
this.chbSonarAtivado.Location = new System.Drawing.Point(13, 265);
this.chbSonarAtivado.Margin = new System.Windows.Forms.Padding(2);
this.chbSonarAtivado.Name = "chbSonarAtivado";
this.chbSonarAtivado.Size = new System.Drawing.Size(93, 17);
this.chbSonarAtivado.TabIndex = 37;
this.chbSonarAtivado.Text = "Sonar Ativado";
this.chbSonarAtivado.UseVisualStyleBackColor = true;
this.chbSonarAtivado.CheckedChanged += new System.EventHandler(this.chbSonarAtivado_CheckedChanged);
//
// frmOperacaoManual
//
@ -685,7 +715,6 @@
this.Controls.Add(this.lblCorrente);
this.Controls.Add(this.lblTensao);
this.Controls.Add(this.btnIniciarOperacao);
this.Controls.Add(this.chbSonar);
this.Controls.Add(this.lblDistanciaEsquerda);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.lblDistanciaDireita);
@ -712,6 +741,7 @@
((System.ComponentModel.ISupportInitialize)(this.gridDados)).EndInit();
this.tabDeteccoes.ResumeLayout(false);
this.pnlDeteccoesRua.ResumeLayout(false);
this.pnlDeteccoesRua.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picSonar)).EndInit();
this.tabPulverizador.ResumeLayout(false);
this.tabPulverizador.PerformLayout();
@ -782,5 +812,7 @@
private System.Windows.Forms.Label lblMov_ET;
private System.Windows.Forms.Label lblMov_DT;
private System.Windows.Forms.Label lblMov_DF;
private System.Windows.Forms.CheckBox chbSonarAtivado;
private System.Windows.Forms.CheckBox chbMostrarGrade;
}
}

View File

@ -44,12 +44,15 @@ namespace AgroBase.Forms.Operacoes
Variaveis.OperacaoEmAndamento.AtualizaListaCameras(pnlCameraRua, new List<Panel>() { pnlCameraSoloE, pnlCameraSoloD }, true);
chbPulverizador.Checked = Variaveis.OperacaoEmAndamento.Controle.PulverizadorAutomatico;
chbMostrarGrade.Checked = KinectService.MostrarGrade;
chbSonarAtivado.Checked = KinectService.Parametros.SonarAtivado;
InicializarComandosDirecional();
PopularInformacoesGerais();
InicializarMapa();
PopularBicos();
Variaveis.OperacaoEmAndamento.chartGraficos = chartGraficos;
KinectService.picRGB = picSonar;
tmrLeitura = new AsyncTaskTimerModel("tmrLeitura", tmrLeitura_Tick, 500, this);
tmrLeitura.Start();
@ -60,6 +63,7 @@ namespace AgroBase.Forms.Operacoes
tmrLeitura.Dispose();
Variaveis.OperacaoEmAndamento.FinalizarOperacao();
Variaveis.OperacaoEmAndamento.DesligarCameras();
KinectService.picRGB = null;
}
private async void btnIniciarOperacao_Click(object sender, EventArgs e)
@ -251,7 +255,7 @@ namespace AgroBase.Forms.Operacoes
if (Modulo.Modulo_ID.Contains("D"))
{
Angulo *= -1;
//Angulo *= -1;
}
// Desenhe uma linha para representar a posição do eixo do motor
@ -362,7 +366,7 @@ namespace AgroBase.Forms.Operacoes
try
{
double angulo = Variaveis.OperacaoEmAndamento.Sensoriamento.AnguloCarroBussola;
FuncoesGlobais.DesenharInclinacao((Panel)sender, e, (float)angulo, -90);
FuncoesGlobais.DesenharInclinacao((Panel)sender, e, (float)angulo, -270);
}
catch { }
}
@ -555,6 +559,15 @@ namespace AgroBase.Forms.Operacoes
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = (TipoMovimentoDirecional)cmbTipoMovimento.SelectedIndex;
}
private void chbMostrarGrade_CheckedChanged(object sender, EventArgs e)
{
KinectService.MostrarGrade = ((CheckBox)sender).Checked;
}
private void chbSonarAtivado_CheckedChanged(object sender, EventArgs e)
{
KinectService.Parametros.SonarAtivado = ((CheckBox)sender).Checked;
}
}
}

View File

@ -33,6 +33,7 @@
this.gpbModulos = new System.Windows.Forms.GroupBox();
this.gpbP_Gps = new System.Windows.Forms.GroupBox();
this.gpbP_Sen = new System.Windows.Forms.GroupBox();
this.btnA05 = new System.Windows.Forms.Button();
this.lblTemposalvarlogU = new System.Windows.Forms.Label();
this.nudTemposalvarlog = new System.Windows.Forms.NumericUpDown();
this.lblTemposalvarlog = new System.Windows.Forms.Label();
@ -78,7 +79,7 @@
this.nudCapacidadereservatorio = new System.Windows.Forms.NumericUpDown();
this.lblUnCapcaidadereservatorio = new System.Windows.Forms.Label();
this.lblCapacidadereservatorio = new System.Windows.Forms.Label();
this.btnA05 = new System.Windows.Forms.Button();
this.chbSegmentacao = new System.Windows.Forms.CheckBox();
this.gpbModulos.SuspendLayout();
this.gpbP_Sen.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudTemposalvarlog)).BeginInit();
@ -171,6 +172,17 @@
this.gpbP_Sen.TabStop = false;
this.gpbP_Sen.Text = "Ajustes";
//
// btnA05
//
this.btnA05.Location = new System.Drawing.Point(10, 94);
this.btnA05.Margin = new System.Windows.Forms.Padding(6);
this.btnA05.Name = "btnA05";
this.btnA05.Size = new System.Drawing.Size(171, 28);
this.btnA05.TabIndex = 9;
this.btnA05.Text = "Ultrassom A05";
this.btnA05.UseVisualStyleBackColor = true;
this.btnA05.Click += new System.EventHandler(this.btnA05_Click);
//
// lblTemposalvarlogU
//
this.lblTemposalvarlogU.AutoSize = true;
@ -613,6 +625,7 @@
//
// gpbConfiguracoesgerais
//
this.gpbConfiguracoesgerais.Controls.Add(this.chbSegmentacao);
this.gpbConfiguracoesgerais.Controls.Add(this.txtDensidadeherbicida);
this.gpbConfiguracoesgerais.Controls.Add(this.lblUnDensidadeherbicida);
this.gpbConfiguracoesgerais.Controls.Add(this.label2);
@ -683,16 +696,16 @@
this.lblCapacidadereservatorio.TabIndex = 9;
this.lblCapacidadereservatorio.Text = "Capacidade reservatório";
//
// btnA05
// chbSegmentacao
//
this.btnA05.Location = new System.Drawing.Point(10, 94);
this.btnA05.Margin = new System.Windows.Forms.Padding(6);
this.btnA05.Name = "btnA05";
this.btnA05.Size = new System.Drawing.Size(171, 28);
this.btnA05.TabIndex = 9;
this.btnA05.Text = "Ultrassom A05";
this.btnA05.UseVisualStyleBackColor = true;
this.btnA05.Click += new System.EventHandler(this.btnA05_Click);
this.chbSegmentacao.AutoSize = true;
this.chbSegmentacao.Location = new System.Drawing.Point(18, 167);
this.chbSegmentacao.Margin = new System.Windows.Forms.Padding(6);
this.chbSegmentacao.Name = "chbSegmentacao";
this.chbSegmentacao.Size = new System.Drawing.Size(146, 28);
this.chbSegmentacao.TabIndex = 13;
this.chbSegmentacao.Text = "Segmentação";
this.chbSegmentacao.UseVisualStyleBackColor = true;
//
// frmParametrizacaoOperacao
//
@ -792,5 +805,6 @@
private System.Windows.Forms.ComboBox cmbScriptErvas;
private System.Windows.Forms.Label lblAngulomax;
private System.Windows.Forms.Button btnA05;
private System.Windows.Forms.CheckBox chbSegmentacao;
}
}

View File

@ -71,6 +71,8 @@ namespace AgroBase.Forms.Operacoes
txtDensidadeherbicida.Text = Variaveis.OperacaoEmAndamento.DispAtu.Dados.DensidadeHerbicida.ToString("0.00");
nudAtuarem.Value = Convert.ToInt32(Variaveis.OperacaoEmAndamento.Controle.PercentualInicioPulverizacao * 100);
cmbScriptErvas.SelectedIndex = cmbScriptErvas.Items.IndexOf(Variaveis.OperacaoEmAndamento.DispAtu.Dados.ScriptDeteccaoErvas.Replace(".py", ""));
chbSegmentacao.Checked = Variaveis.OperacaoEmAndamento.Controle.SegmentacaoSemantica;
}
private void chbD_CheckedChanged(object sender, EventArgs e)
@ -138,6 +140,7 @@ namespace AgroBase.Forms.Operacoes
Variaveis.OperacaoEmAndamento.DispAtu.Dados.DensidadeHerbicida = Convert.ToDouble(txtDensidadeherbicida.Text.Replace(".", ","));
Variaveis.OperacaoEmAndamento.Controle.PercentualInicioPulverizacao = (double)(nudAtuarem.Value / 100);
Variaveis.OperacaoEmAndamento.DispAtu.Dados.ScriptDeteccaoErvas = cmbScriptErvas.Text + ".py";
Variaveis.OperacaoEmAndamento.Controle.SegmentacaoSemantica = chbSegmentacao.Checked;
if (chbSalvar.Checked)
{

View File

@ -28,30 +28,30 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea3 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend3 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series3 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea4 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend4 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series4 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea5 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend5 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series5 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea6 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend6 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series6 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea7 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend7 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series7 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea8 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend8 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series8 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea9 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend9 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series9 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea10 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend10 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series10 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea11 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend11 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series11 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea12 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend12 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series12 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea13 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend13 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series13 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea14 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend14 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series14 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea15 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend15 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series15 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea16 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend16 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series16 = new System.Windows.Forms.DataVisualization.Charting.Series();
this.trbMomento = new System.Windows.Forms.TrackBar();
this.panel1 = new System.Windows.Forms.Panel();
this.tabControl4 = new System.Windows.Forms.TabControl();
@ -275,6 +275,8 @@
this.label30 = new System.Windows.Forms.Label();
this.chartMovGeral = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.tabAtuador = new System.Windows.Forms.TabPage();
this.lblATU_LatenciaLoop = new System.Windows.Forms.Label();
this.lblATU_QualidadeWifi = new System.Windows.Forms.Label();
this.chbDesenharErvas = new System.Windows.Forms.CheckBox();
this.chartAtuador = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.pnlAtuadores = new System.Windows.Forms.Panel();
@ -283,6 +285,8 @@
this.tabErvas = new System.Windows.Forms.TabPage();
this.chartErvas = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.tabSensoriamento = new System.Windows.Forms.TabPage();
this.lblSEN_LatenciaLoop = new System.Windows.Forms.Label();
this.lblSEN_QualidadeWifi = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtSen_Maximo = new System.Windows.Forms.TextBox();
this.label68 = new System.Windows.Forms.Label();
@ -416,10 +420,6 @@
this.label36 = new System.Windows.Forms.Label();
this.txtMomento = new System.Windows.Forms.TextBox();
this.btnPlay = new System.Windows.Forms.Button();
this.lblATU_QualidadeWifi = new System.Windows.Forms.Label();
this.lblATU_LatenciaLoop = new System.Windows.Forms.Label();
this.lblSEN_LatenciaLoop = new System.Windows.Forms.Label();
this.lblSEN_QualidadeWifi = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.trbMomento)).BeginInit();
this.panel1.SuspendLayout();
this.tabControl4.SuspendLayout();
@ -1641,17 +1641,17 @@
//
// chartMovVelocidade
//
chartArea1.Name = "ChartArea1";
this.chartMovVelocidade.ChartAreas.Add(chartArea1);
legend1.Name = "Legend1";
this.chartMovVelocidade.Legends.Add(legend1);
chartArea9.Name = "ChartArea1";
this.chartMovVelocidade.ChartAreas.Add(chartArea9);
legend9.Name = "Legend1";
this.chartMovVelocidade.Legends.Add(legend9);
this.chartMovVelocidade.Location = new System.Drawing.Point(4, 4);
this.chartMovVelocidade.Margin = new System.Windows.Forms.Padding(2);
this.chartMovVelocidade.Name = "chartMovVelocidade";
series1.ChartArea = "ChartArea1";
series1.Legend = "Legend1";
series1.Name = "Series1";
this.chartMovVelocidade.Series.Add(series1);
series9.ChartArea = "ChartArea1";
series9.Legend = "Legend1";
series9.Name = "Series1";
this.chartMovVelocidade.Series.Add(series9);
this.chartMovVelocidade.Size = new System.Drawing.Size(474, 356);
this.chartMovVelocidade.TabIndex = 96;
this.chartMovVelocidade.Text = "chart1";
@ -2060,17 +2060,17 @@
//
// chartMovTemperatura
//
chartArea2.Name = "ChartArea1";
this.chartMovTemperatura.ChartAreas.Add(chartArea2);
legend2.Name = "Legend1";
this.chartMovTemperatura.Legends.Add(legend2);
chartArea10.Name = "ChartArea1";
this.chartMovTemperatura.ChartAreas.Add(chartArea10);
legend10.Name = "Legend1";
this.chartMovTemperatura.Legends.Add(legend10);
this.chartMovTemperatura.Location = new System.Drawing.Point(4, 4);
this.chartMovTemperatura.Margin = new System.Windows.Forms.Padding(2);
this.chartMovTemperatura.Name = "chartMovTemperatura";
series2.ChartArea = "ChartArea1";
series2.Legend = "Legend1";
series2.Name = "Series1";
this.chartMovTemperatura.Series.Add(series2);
series10.ChartArea = "ChartArea1";
series10.Legend = "Legend1";
series10.Name = "Series1";
this.chartMovTemperatura.Series.Add(series10);
this.chartMovTemperatura.Size = new System.Drawing.Size(474, 336);
this.chartMovTemperatura.TabIndex = 95;
this.chartMovTemperatura.Text = "chart1";
@ -2478,17 +2478,17 @@
//
// chartMovTensao
//
chartArea3.Name = "ChartArea1";
this.chartMovTensao.ChartAreas.Add(chartArea3);
legend3.Name = "Legend1";
this.chartMovTensao.Legends.Add(legend3);
chartArea11.Name = "ChartArea1";
this.chartMovTensao.ChartAreas.Add(chartArea11);
legend11.Name = "Legend1";
this.chartMovTensao.Legends.Add(legend11);
this.chartMovTensao.Location = new System.Drawing.Point(4, 4);
this.chartMovTensao.Margin = new System.Windows.Forms.Padding(2);
this.chartMovTensao.Name = "chartMovTensao";
series3.ChartArea = "ChartArea1";
series3.Legend = "Legend1";
series3.Name = "Series1";
this.chartMovTensao.Series.Add(series3);
series11.ChartArea = "ChartArea1";
series11.Legend = "Legend1";
series11.Name = "Series1";
this.chartMovTensao.Series.Add(series11);
this.chartMovTensao.Size = new System.Drawing.Size(474, 336);
this.chartMovTensao.TabIndex = 131;
this.chartMovTensao.Text = "chart1";
@ -2987,17 +2987,17 @@
//
// chartMovGeral
//
chartArea4.Name = "ChartArea1";
this.chartMovGeral.ChartAreas.Add(chartArea4);
legend4.Name = "Legend1";
this.chartMovGeral.Legends.Add(legend4);
chartArea12.Name = "ChartArea1";
this.chartMovGeral.ChartAreas.Add(chartArea12);
legend12.Name = "Legend1";
this.chartMovGeral.Legends.Add(legend12);
this.chartMovGeral.Location = new System.Drawing.Point(4, 4);
this.chartMovGeral.Margin = new System.Windows.Forms.Padding(2);
this.chartMovGeral.Name = "chartMovGeral";
series4.ChartArea = "ChartArea1";
series4.Legend = "Legend1";
series4.Name = "Series1";
this.chartMovGeral.Series.Add(series4);
series12.ChartArea = "ChartArea1";
series12.Legend = "Legend1";
series12.Name = "Series1";
this.chartMovGeral.Series.Add(series12);
this.chartMovGeral.Size = new System.Drawing.Size(474, 311);
this.chartMovGeral.TabIndex = 94;
this.chartMovGeral.Text = "chart1";
@ -3020,6 +3020,24 @@
this.tabAtuador.Text = "Atuador";
this.tabAtuador.UseVisualStyleBackColor = true;
//
// lblATU_LatenciaLoop
//
this.lblATU_LatenciaLoop.AutoSize = true;
this.lblATU_LatenciaLoop.Location = new System.Drawing.Point(177, 2);
this.lblATU_LatenciaLoop.Name = "lblATU_LatenciaLoop";
this.lblATU_LatenciaLoop.Size = new System.Drawing.Size(118, 13);
this.lblATU_LatenciaLoop.TabIndex = 96;
this.lblATU_LatenciaLoop.Text = "Latência de Loop: 0 ms";
//
// lblATU_QualidadeWifi
//
this.lblATU_QualidadeWifi.AutoSize = true;
this.lblATU_QualidadeWifi.Location = new System.Drawing.Point(5, 2);
this.lblATU_QualidadeWifi.Name = "lblATU_QualidadeWifi";
this.lblATU_QualidadeWifi.Size = new System.Drawing.Size(112, 13);
this.lblATU_QualidadeWifi.TabIndex = 0;
this.lblATU_QualidadeWifi.Text = "Qualidade Wifi: 0 dBm";
//
// chbDesenharErvas
//
this.chbDesenharErvas.AutoSize = true;
@ -3034,17 +3052,17 @@
//
// chartAtuador
//
chartArea5.Name = "ChartArea1";
this.chartAtuador.ChartAreas.Add(chartArea5);
legend5.Name = "Legend1";
this.chartAtuador.Legends.Add(legend5);
chartArea13.Name = "ChartArea1";
this.chartAtuador.ChartAreas.Add(chartArea13);
legend13.Name = "Legend1";
this.chartAtuador.Legends.Add(legend13);
this.chartAtuador.Location = new System.Drawing.Point(4, 276);
this.chartAtuador.Margin = new System.Windows.Forms.Padding(2);
this.chartAtuador.Name = "chartAtuador";
series5.ChartArea = "ChartArea1";
series5.Legend = "Legend1";
series5.Name = "Series1";
this.chartAtuador.Series.Add(series5);
series13.ChartArea = "ChartArea1";
series13.Legend = "Legend1";
series13.Name = "Series1";
this.chartAtuador.Series.Add(series13);
this.chartAtuador.Size = new System.Drawing.Size(489, 241);
this.chartAtuador.TabIndex = 95;
this.chartAtuador.Text = "chart1";
@ -3091,16 +3109,16 @@
//
// chartErvas
//
chartArea6.Name = "ChartArea1";
this.chartErvas.ChartAreas.Add(chartArea6);
legend6.Name = "Legend1";
this.chartErvas.Legends.Add(legend6);
chartArea14.Name = "ChartArea1";
this.chartErvas.ChartAreas.Add(chartArea14);
legend14.Name = "Legend1";
this.chartErvas.Legends.Add(legend14);
this.chartErvas.Location = new System.Drawing.Point(6, 6);
this.chartErvas.Name = "chartErvas";
series6.ChartArea = "ChartArea1";
series6.Legend = "Legend1";
series6.Name = "Series1";
this.chartErvas.Series.Add(series6);
series14.ChartArea = "ChartArea1";
series14.Legend = "Legend1";
series14.Name = "Series1";
this.chartErvas.Series.Add(series14);
this.chartErvas.Size = new System.Drawing.Size(484, 510);
this.chartErvas.TabIndex = 0;
this.chartErvas.Text = "chart1";
@ -3121,6 +3139,24 @@
this.tabSensoriamento.Text = "Sensoriamento";
this.tabSensoriamento.UseVisualStyleBackColor = true;
//
// lblSEN_LatenciaLoop
//
this.lblSEN_LatenciaLoop.AutoSize = true;
this.lblSEN_LatenciaLoop.Location = new System.Drawing.Point(227, 420);
this.lblSEN_LatenciaLoop.Name = "lblSEN_LatenciaLoop";
this.lblSEN_LatenciaLoop.Size = new System.Drawing.Size(118, 13);
this.lblSEN_LatenciaLoop.TabIndex = 135;
this.lblSEN_LatenciaLoop.Text = "Latência de Loop: 0 ms";
//
// lblSEN_QualidadeWifi
//
this.lblSEN_QualidadeWifi.AutoSize = true;
this.lblSEN_QualidadeWifi.Location = new System.Drawing.Point(227, 404);
this.lblSEN_QualidadeWifi.Name = "lblSEN_QualidadeWifi";
this.lblSEN_QualidadeWifi.Size = new System.Drawing.Size(112, 13);
this.lblSEN_QualidadeWifi.TabIndex = 134;
this.lblSEN_QualidadeWifi.Text = "Qualidade Wifi: 0 dBm";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.txtSen_Maximo);
@ -3365,17 +3401,17 @@
//
// chartSensoriamento
//
chartArea7.Name = "ChartArea1";
this.chartSensoriamento.ChartAreas.Add(chartArea7);
legend7.Name = "Legend1";
this.chartSensoriamento.Legends.Add(legend7);
chartArea15.Name = "ChartArea1";
this.chartSensoriamento.ChartAreas.Add(chartArea15);
legend15.Name = "Legend1";
this.chartSensoriamento.Legends.Add(legend15);
this.chartSensoriamento.Location = new System.Drawing.Point(2, 4);
this.chartSensoriamento.Margin = new System.Windows.Forms.Padding(2);
this.chartSensoriamento.Name = "chartSensoriamento";
series7.ChartArea = "ChartArea1";
series7.Legend = "Legend1";
series7.Name = "Series1";
this.chartSensoriamento.Series.Add(series7);
series15.ChartArea = "ChartArea1";
series15.Legend = "Legend1";
series15.Name = "Series1";
this.chartSensoriamento.Series.Add(series15);
this.chartSensoriamento.Size = new System.Drawing.Size(491, 389);
this.chartSensoriamento.TabIndex = 95;
this.chartSensoriamento.Text = "chart1";
@ -4091,17 +4127,17 @@
//
// chartCpu
//
chartArea8.Name = "ChartArea1";
this.chartCpu.ChartAreas.Add(chartArea8);
legend8.Name = "Legend1";
this.chartCpu.Legends.Add(legend8);
chartArea16.Name = "ChartArea1";
this.chartCpu.ChartAreas.Add(chartArea16);
legend16.Name = "Legend1";
this.chartCpu.Legends.Add(legend16);
this.chartCpu.Location = new System.Drawing.Point(2, 3);
this.chartCpu.Margin = new System.Windows.Forms.Padding(2);
this.chartCpu.Name = "chartCpu";
series8.ChartArea = "ChartArea1";
series8.Legend = "Legend1";
series8.Name = "Series1";
this.chartCpu.Series.Add(series8);
series16.ChartArea = "ChartArea1";
series16.Legend = "Legend1";
series16.Name = "Series1";
this.chartCpu.Series.Add(series16);
this.chartCpu.Size = new System.Drawing.Size(491, 389);
this.chartCpu.TabIndex = 134;
this.chartCpu.Text = "chart1";
@ -4558,42 +4594,6 @@
this.btnPlay.UseVisualStyleBackColor = true;
this.btnPlay.Click += new System.EventHandler(this.btnPlay_Click);
//
// lblATU_QualidadeWifi
//
this.lblATU_QualidadeWifi.AutoSize = true;
this.lblATU_QualidadeWifi.Location = new System.Drawing.Point(5, 2);
this.lblATU_QualidadeWifi.Name = "lblATU_QualidadeWifi";
this.lblATU_QualidadeWifi.Size = new System.Drawing.Size(112, 13);
this.lblATU_QualidadeWifi.TabIndex = 0;
this.lblATU_QualidadeWifi.Text = "Qualidade Wifi: 0 dBm";
//
// lblATU_LatenciaLoop
//
this.lblATU_LatenciaLoop.AutoSize = true;
this.lblATU_LatenciaLoop.Location = new System.Drawing.Point(177, 2);
this.lblATU_LatenciaLoop.Name = "lblATU_LatenciaLoop";
this.lblATU_LatenciaLoop.Size = new System.Drawing.Size(118, 13);
this.lblATU_LatenciaLoop.TabIndex = 96;
this.lblATU_LatenciaLoop.Text = "Latência de Loop: 0 ms";
//
// lblSEN_LatenciaLoop
//
this.lblSEN_LatenciaLoop.AutoSize = true;
this.lblSEN_LatenciaLoop.Location = new System.Drawing.Point(227, 420);
this.lblSEN_LatenciaLoop.Name = "lblSEN_LatenciaLoop";
this.lblSEN_LatenciaLoop.Size = new System.Drawing.Size(118, 13);
this.lblSEN_LatenciaLoop.TabIndex = 135;
this.lblSEN_LatenciaLoop.Text = "Latência de Loop: 0 ms";
//
// lblSEN_QualidadeWifi
//
this.lblSEN_QualidadeWifi.AutoSize = true;
this.lblSEN_QualidadeWifi.Location = new System.Drawing.Point(227, 404);
this.lblSEN_QualidadeWifi.Name = "lblSEN_QualidadeWifi";
this.lblSEN_QualidadeWifi.Size = new System.Drawing.Size(112, 13);
this.lblSEN_QualidadeWifi.TabIndex = 134;
this.lblSEN_QualidadeWifi.Text = "Qualidade Wifi: 0 dBm";
//
// frmResultadosOperacao
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

View File

@ -832,7 +832,7 @@ namespace AgroBase.Forms.Operacoes
var LogKnt = LogsKinect.FirstOrDefault(x => x.Momento == MomentoAtual);
var LogOpe = LogsOperacao.FirstOrDefault(x => x.Momento == MomentoAtual);
double AnguloCarro = (LogsWt901C.FirstOrDefault(x => x.Momento == MomentoAtual).Inicializado ? LogOpe.AnguloCarroBussola : LogOpe.AnguloCarroGPS);
double AnguloCarro = (LogsWt901C.FirstOrDefault(x => x.Momento == MomentoAtual)?.Inicializado ?? false ? LogOpe.AnguloCarroBussola : LogOpe.AnguloCarroGPS);
MapaDinamico.AtualizarDados(
LogKnt.Iniciado && LogKnt.StatusDetecao ? LogKnt.ObstaculoCritico : null,

View File

@ -52,6 +52,8 @@ namespace AgroBase.Models
public string Id { get { return _id; } }
public Control _uiControl;
private int _timeout = 60000;
private long _ticks = 0;
public long Ticks { get { return _ticks; } }
private DateTime beginTask = DateTime.MinValue;
private DateTime endTask = DateTime.MinValue;
@ -237,6 +239,7 @@ namespace AgroBase.Models
// Garante que o intervalo é respeitado entre execuções
await Task.Delay(_interval, cancellationToken);
_Ticking = false;
_ticks++;
}
}

View File

@ -96,6 +96,7 @@ namespace AgroBase.Models
// Se ja passou 5 segundos sem ter enviado uma mensagem
if (UltimoEnvio.AddMilliseconds(5000) < Agora)
{
//await Variaveis.MqttService.AdicionarNovoTopico(CamerasVaraiveisModel.TopicoRecebimentoBitmap, true);
await EnviarBitmapParaProcessamento();
}
}
@ -151,22 +152,22 @@ namespace AgroBase.Models
}
}
public void AtualizarBitmapTela(Bitmap bitmap)
public async Task AtualizarBitmapTela(Bitmap bitmap)
{
//Console.WriteLine("Recebido bitmap segmentado");
bitmapSegmentado = bitmap;
if (panel != null)
await FuncoesGlobais.ExecutarMetodoComVerificacaoCrossThreadAsync(panel, async () =>
{
panel.BackgroundImage = bitmapSegmentado;
panel.Refresh();
}
Task.Run(async () =>
{
await Task.Delay(DelayEnvio);
await EnviarBitmapParaProcessamento();
bitmapSegmentado = bitmap;
if (panel != null)
{
panel.BackgroundImage = bitmapSegmentado;
panel.Refresh();
}
});
await Task.Delay(DelayEnvio);
await EnviarBitmapParaProcessamento();
}

View File

@ -622,6 +622,13 @@ namespace AgroBase
else
{
Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.ForEach(x => x.DirMotor.EnviarComandoControle(DirecaoAtual));
/*Task.Run(async () =>
{
foreach (var mod in Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos)
{
mod.DirMotor.EnviarComandoControle(DirecaoAtual);
};
});*/
}
break;
}

View File

@ -55,6 +55,7 @@ namespace AgroBase.Models
public Sentido _Sentido { get; set; } = Sentido.Parado;
public bool AguardaResposta { get; set; } = false;
public int TimeoutResposta { get; set; } = 1000;
public int TamanhoResposta { get; set; } = 4;
public bool Enviado { get; set; } = false;
public bool ErroEnvio { get; set; } = false;
public bool Respondido { get; set; } = false;

View File

@ -325,11 +325,15 @@ namespace AgroBase.Models.Modules
byte modAddr = Modulo.DirMotor.EnderecoByte;
if (!MKS057DService.Referenciando || (MKS057DService.Referenciando && MKS057DService.AddrRef == modAddr))
{
MKS057DService.AdicionarComandoNaFila(MKS057DService.MontarComandoRequisicaoPulsos(modAddr));
MKS057DService.AdicionarComandoNaFila(MKS057DService.MontarComandoRequisicaoIO(modAddr));
bool reqParametros = true; // (!MKS057DService.Referenciando && (tmrRegistradorMKS.Ticks % 5 == 0)) || MKS057DService.Referenciando;
if (reqParametros)
{
MKS057DService.AdicionarComandoNaFila(MKS057DService.MontarComandoRequisicaoPulsos(modAddr));
MKS057DService.AdicionarComandoNaFila(MKS057DService.MontarComandoRequisicaoIO(modAddr));
}
// Verifica se o angulo de set point do motor em questao e diferente do angulo atual, e se for, reenvia o comando para garantir que o motor esteja coerente com o set point
if (!MKS057DService.Referenciando)
if (!MKS057DService.Referenciando && (Modulo.DirMotor.UltimoComandoEnviado.AddMilliseconds(2000) < DateTime.Now) && !Modulo.DirMotor.AtingiuAnguloSP)
{
Modulo.DirMotor.EnviarComandoControle(Controle.UltimaDirecao);
}
@ -1033,6 +1037,30 @@ namespace AgroBase.Models.Modules
}
}
public Direcao UltimaDirecao { get; set; } = Direcao.Parado;
public DateTime UltimoComandoEnviado { get; set; } = DateTime.MinValue;
public bool RetornandoAzero
{
get
{
return (UltimaDirecao != Direcao.Esquerda && UltimaDirecao != Direcao.Direita);
}
}
public bool EmMovimento
{
get
{
return RPM != 0;
}
}
public bool AtingiuAnguloSP
{
get
{
return FuncoesMatematicas.ValorEstaEntre(Angulo, Angulo_SP, 1);
}
}
public bool PosicaoTipoMovimentoConcluido(Direcao DirecaoAtual)
{
var TipoMovimento = Variaveis.OperacaoEmAndamento.Controle.TipoMovimento;
@ -1158,16 +1186,25 @@ namespace AgroBase.Models.Modules
if (Comandar && MKS_Inicializado)
{
int AnguloTipoMovimento = VariaveisEquipamento.AnguloMovimento[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento];
if (UltimaDirecao != Direcao)
{
Sentido_SP =
Direcao == Direcao.Direita ? ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Direita :
Direcao == Direcao.Esquerda ? ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Esquerda :
Sentido_SP == Sentido.Horario ? Sentido.Antihorario :
Sentido_SP == Sentido.Antihorario ? Sentido.Horario :
Sentido.Parado;
Sentido_SP =
Direcao == Direcao.Direita ? ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Direita :
Direcao == Direcao.Esquerda ? ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Esquerda :
Sentido_SP == Sentido.Horario ? Sentido.Antihorario :
Sentido_SP == Sentido.Antihorario ? Sentido.Horario :
Sentido.Parado;
UltimaDirecao = Direcao;
}
else if (AtingiuAnguloSP && RetornandoAzero && Angulo == 0)
{
Sentido_SP = Sentido.Parado;
}
Angulo_SP =
(Direcao != Direcao.Esquerda && Direcao != Direcao.Direita) ? 0 :
RetornandoAzero ? 0 :
AnguloTipoMovimento != -1 ? AnguloTipoMovimento :
Variaveis.OperacaoEmAndamento.Controle.Angulo;
@ -1175,13 +1212,54 @@ namespace AgroBase.Models.Modules
Angulo_SP = Math.Abs(Angulo_SP) * mx;
if (!FuncoesMatematicas.ValorEstaEntre(Angulo, Angulo_SP, 3) && RPM == 0)
if (!AtingiuAnguloSP || true)
{
MKS057DService.AdicionarComandoNaFila(MKS057DService.MontarComandoMovimento(EnderecoByte, Angulo_SP, Velocidade, Sentido_SP));
UltimoComandoEnviado = DateTime.Now;
}
}
}
/*public async Task EnviarComandoControleAsync(Direcao Direcao)
{
if (Comandar && MKS_Inicializado)
{
int AnguloTipoMovimento = VariaveisEquipamento.AnguloMovimento[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento];
if (UltimaDirecao != Direcao)
{
Sentido_SP =
Direcao == Direcao.Direita ? ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Direita :
Direcao == Direcao.Esquerda ? ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Esquerda :
Sentido_SP == Sentido.Horario ? Sentido.Antihorario :
Sentido_SP == Sentido.Antihorario ? Sentido.Horario :
Sentido.Parado;
UltimaDirecao = Direcao;
}
else if (AtingiuAnguloSP && RetornandoAzero && Angulo == 0)
{
Sentido_SP = Sentido.Parado;
}
Angulo_SP =
RetornandoAzero ? 0 :
AnguloTipoMovimento != -1 ? AnguloTipoMovimento :
Variaveis.OperacaoEmAndamento.Controle.Angulo;
int mx = Sentido_SP == Sentido.Antihorario ? -1 : 1;
Angulo_SP = Math.Abs(Angulo_SP) * mx;
if (!AtingiuAnguloSP || true)
{
//await MKS057DService.EnviarComandoControle(MKS057DService.MontarComandoMovimento(EnderecoByte, Angulo_SP, Velocidade, Sentido_SP));
MKS057DService.AdicionarComandoNaFila(MKS057DService.MontarComandoMovimento(EnderecoByte, Angulo_SP, Velocidade, Sentido_SP));
UltimoComandoEnviado = DateTime.Now;
}
}
}*/
public async Task ReferenciaMotor()
{
byte Addr = EnderecoByte;

View File

@ -1021,7 +1021,7 @@ namespace AgroBase.Models
};
CameraCaminhoKinect = cameraCaminho;
CameraCaminhoKinect.camera.selectedCamera = KinectService.Iniciado ? 1 : 0;
if (CameraCaminhoKinect.camera.selectedCamera > 0 && Iniciar)
if (CameraCaminhoKinect.camera.selectedCamera > 0 && Iniciar && Variaveis.OperacaoEmAndamento.Controle.SegmentacaoSemantica)
{
CameraCaminhoKinect.panel = pnlCameraCaminho;
IniciarCameraCaminho(CameraCaminhoKinect);
@ -1128,7 +1128,7 @@ namespace AgroBase.Models
try
{
Bitmap bitmap = Variaveis.OperacaoEmAndamento.CameraCaminhoKinect.ExtraiImagemDaMensagem(Mensagem.Mensagem);
Variaveis.OperacaoEmAndamento.CameraCaminhoKinect.AtualizarBitmapTela(bitmap);
await Variaveis.OperacaoEmAndamento.CameraCaminhoKinect.AtualizarBitmapTela(bitmap);
}
catch (Exception ex)
{
@ -1419,7 +1419,7 @@ namespace AgroBase.Models
private void AtualizaLeituraCameraSolo(CameraSoloModel CameraSolo)
{
if (CameraSolo.camera._mqttTopico != null && CameraSolo.camera._mqttTopico.Mensagens.Any(x => x.Momento > CameraSolo.camera.IniciadoEm))
if (CameraSolo.camera._mqttTopico?.Mensagens?.Any(x => x.Momento > CameraSolo.camera.IniciadoEm && x.Mensagem != "OK") ?? false)
{
try
{
@ -1717,7 +1717,7 @@ namespace AgroBase.Models
private void PararCarroOperacaoInterrompida()
{
Variaveis.OperacaoEmAndamento.Controle.PercentualVelocidadeSP = 0; // Velocidade Zero (parado)
Variaveis.OperacaoEmAndamento.Controle.Angulo = 0; // Angulo Zero (direcional reto)
//Variaveis.OperacaoEmAndamento.Controle.Angulo = 0; // Angulo Zero (direcional reto)
Variaveis.OperacaoEmAndamento.Controle.BicosAtuados.ForEach(x => x.ComandoAtuar = false); // Bicos desatuados
AtualizarDadosControle(true);
AtualizarDadosControlePulverizador(true);
@ -1930,7 +1930,7 @@ namespace AgroBase.Models
CodAlarme = Modulo.MovMotor.CodigoAlarme,
EmFreio = Modulo.MovMotor.ConfigFreio.Leitura,
Ativado = Modulo.MovMotor.LeituraLigado,
UltimoComandoRespondido = Modulo.MovMotor.Leitura.UltimoComandoRecebido,
UltimoComandoRespondido = Modulo.MovMotor.Leitura?.UltimoComandoRecebido ?? DateTime.MinValue,
};
SalvarLog(T_Code.Mov.ToString(), logMov, false);
@ -1945,7 +1945,7 @@ namespace AgroBase.Models
Sentido_SP = Modulo.MovMotor.Sentido_SP,
Sentido = Modulo.MovMotor.Sentido,
Velocidade = Modulo.MovMotor.VelocidadeInstantanea,
UltimoComandoRespondido = Modulo.DirMotor.Leitura.UltimoComandoRecebido,
UltimoComandoRespondido = Modulo.DirMotor.Leitura?.UltimoComandoRecebido ?? DateTime.MinValue,
};
SalvarLog(T_Code.Dir.ToString(), logDir, false);
});
@ -2887,6 +2887,7 @@ namespace AgroBase.Models
public List<OperacaoControleTipoModel> TiposControle { get; set; }
public PIDModel PIDdirecional { get; set; } = new PIDModel();
public bool PulverizadorAutomatico { get; set; } = true;
public bool SegmentacaoSemantica { get; set; } = false;
}
public class OperacaoControleTipoModel

View File

@ -35,6 +35,10 @@ NUM_CLASSES = 4 # Pascal VOC possui 3 classes + 1 para o fundo
OUTPUT_STRIDE = 16 # Valor comum para DeepLab
MODEL_PATH = model_folder + "model-" + script_version + '.pth' # Caminho para o modelo pré-treinado
# Variáveis globais para armazenar os dados do labelmap
label_colors = None
class_names = None
# Função para carregar o modelo
def load_model(model_path):
model = deeplabv3_model(num_classes=NUM_CLASSES, output_stride=OUTPUT_STRIDE)
@ -65,19 +69,22 @@ def segment_frame(frame):
# Função para ler o mapa de rótulos
def read_labelmap(path):
label_colors = []
class_names = []
with open(path, 'r') as file:
for line in file.readlines():
if line.startswith('#'):
continue
parts = line.strip().split(':')
if len(parts) >= 2:
label = parts[0].strip()
color = tuple(map(int, parts[1].split(',')))
class_names.append(label)
label_colors.append(color)
return np.array(label_colors), class_names
global label_colors, class_names
if label_colors is None or class_names is None: # Verifica se já estão carregados
label_colors = []
class_names = []
with open(path, 'r') as file:
for line in file.readlines():
if line.startswith('#'):
continue
parts = line.strip().split(':')
if len(parts) >= 2:
label = parts[0].strip()
color = tuple(map(int, parts[1].split(',')))
class_names.append(label)
label_colors.append(color)
label_colors = np.array(label_colors)
return label_colors, class_names
# Função para gerar o JSON de saída
def generate_json(image):

View File

@ -164,6 +164,11 @@ public class EthernetService
Console.WriteLine($"Erro ao receber dados: {ex.Message}");
return null;
}
finally
{
await _networkStream.FlushAsync();
await FlushBufferAsync();
}
}
public async Task<byte[]> ReceiveDataAsync2(int bufferSize = 1024, int timeoutMilliseconds = 1000)

View File

@ -27,7 +27,6 @@ namespace AgroBase.Services
private static bool EnvioLiberado { get; set; } = true;
public static List<MKS057DModel> DadosLeitura = new List<MKS057DModel>();
public static bool FilaEmEspera = false;
public static bool Respondido = false;
public static byte AddrRef = 0x00;
public static bool Referenciando
{
@ -456,6 +455,7 @@ namespace AgroBase.Services
Comando = Convert.ToByte("1"),
Endereco = Endereco,
AguardaResposta = true,
TamanhoResposta = 8,
};
}
@ -467,6 +467,19 @@ namespace AgroBase.Services
Comando = Convert.ToByte("46"),
Endereco = Endereco,
AguardaResposta = true,
TamanhoResposta = 5,
};
}
public static MKS057ComandoModel MontarComandoRequisicaoRPM(byte Endereco)
{
return new MKS057ComandoModel()
{
Get = true,
Comando = Convert.ToByte("40"),
Endereco = Endereco,
AguardaResposta = true,
TamanhoResposta = 5,
};
}
@ -512,11 +525,19 @@ namespace AgroBase.Services
_Sentido = Sentido_SP,
ModoControle = Controle,
AguardaResposta = false,
TamanhoResposta = 5,
};
}
public static async Task EnviarComandoControle(MKS057ComandoModel Comando)
public static async Task EnviarComandoControle(MKS057ComandoModel Comando, bool resend = false)
{
while (FilaEmEspera && !resend)
{
await Task.Delay(Comando.Get ? 50 : 10);
}
FilaEmEspera = true;
try
{
byte Addr = Comando.Endereco;
@ -551,11 +572,12 @@ namespace AgroBase.Services
Comando.Enviado = true;
// Recebe a resposta via Ethernet, independentemente de precisar processá-la ou não
byte[] resposta = await _ethernetService.ReceiveDataAsync(8, Comando.TimeoutResposta); // Timeout ajustável, aqui 1 segundo
byte[] resposta = await _ethernetService.ReceiveDataAsync(Comando.TamanhoResposta, Comando.TimeoutResposta); // Timeout ajustável, aqui 1 segundo
RegisrarComandosComunicacao(Addr, $"RX: - {BitConverter.ToString(resposta ?? new byte[] { }).Replace("-", " ")}");
//SerialService.MostrarComandoResposta(T_Code.Mks, comando, resposta);
if (Comando.AguardaResposta)
if (Comando.AguardaResposta || true)
{
// Processa a resposta, pois é esperada
bool Respondido = DecifrarResposta(resposta, Addr);
@ -564,6 +586,11 @@ namespace AgroBase.Services
{
RegisrarErrosComunicacao(Addr, $"Timeout ao receber resposta. GET={Comando.Get}, Parametro={Comando.Comando}");
//Comando.Momento = DateTime.Now.AddMilliseconds(500);
if (!resend)
{
await EnviarComandoControle(Comando, true);
}
}
}
else
@ -579,6 +606,10 @@ namespace AgroBase.Services
Comando.Enviado = false;
Comando.Momento = DateTime.Now.AddMilliseconds(500);
}
finally
{
FilaEmEspera = false;
}
}
private static void DefinirDadosModulo(MKS057DModel leitura)
@ -655,22 +686,19 @@ namespace AgroBase.Services
private static bool DecifrarResposta(byte[] resposta, byte addr)
{
RegisrarComandosComunicacao(addr, $"RX: - {BitConverter.ToString(resposta ?? new byte[] { }).Replace("-", " ")}");
SerialBuffer_RX = new byte[11];
if (resposta != null && resposta.Length > 0 && resposta.Length <= SerialBuffer_RX.Length)
{
SerialBuffer_RX = resposta; // Armazena a resposta recebida
Data_Number = resposta.Length;
Text_display();
return true;
return Text_display();
}
return false;
}
private static void Text_display()
private static bool Text_display()
{
rxDisplay();
@ -678,7 +706,7 @@ namespace AgroBase.Services
if (!EnderecoValido(addr))
{
RegisrarErrosComunicacao(addr, "Dados recebidos de um endereço inválido: [" + string.Join(" ", SerialBuffer_RX) + "]");
return;
return false;
}
MKS057DModel leitura = DadosLeitura.FirstOrDefault(x => x.Endereco == addr);
@ -1307,10 +1335,16 @@ namespace AgroBase.Services
break;
}
if (_Sentido.Keys.Contains(addr))
{
leitura.Direcao = _Sentido[addr];
}
leitura.UltimoComandoRecebido = DateTime.Now;
return true;
}
Respondido = true;
return false;
}
private static void txDisplay(byte[] data)

View File

@ -1,6 +1,5 @@
using AgroBase.Forms;
using AgroBase.Models;
using Microsoft.SqlServer.Server;
using System;
using System.Collections.Generic;
using System.IO;

View File

@ -12,7 +12,7 @@ namespace AgroBase.Services
public class PZEMService
{
public static bool Iniciado { get; set; }
public static int TaxaAmostragem { get; set; } = 500;
public static byte slaveAddress = 0x01;
public static PZEMModel UltimaLeitura = new PZEMModel();

View File

@ -11,7 +11,7 @@ namespace AgroBase.Services
public class UltrasonicA05Service
{
public static bool Iniciado { get; set; }
public static int TaxaAmostragem { get; set; } = 500;
public static byte slaveAddress = 0x01;
public static UltrasonicA05Model DadosLeitura = new UltrasonicA05Model();

View File

@ -12,9 +12,7 @@ namespace AgroBase.Services
{
public class WT901CService
{
//public static SerialPort PortaWT901C = null;
public static bool Iniciado { get; set; }
public static int TaxaAmostragem { get; set; } = 500;
public static byte slaveAddress = 0x50;
private static Dictionary<string, object> DadosSensor { get; } = new Dictionary<string, object>();
@ -166,6 +164,40 @@ namespace AgroBase.Services
}
}
private static async Task CalibrarMagnetometro(bool Notificacao)
{
var ComandoLiberacaoParametro = new byte[] { slaveAddress, 0x06, 0x00, 0x69, 0xB5, 0x88, 0x22, 0xA1 };
var Comando_1 = new byte[] { slaveAddress, 0x06, 0x00, 0x0B, 0xFC, 0x65, 0x74, 0xA2 };
var Comando_2 = new byte[] { slaveAddress, 0x06, 0x00, 0x0C, 0x0F, 0x54, 0x40, 0x47 };
var Comando_3 = new byte[] { slaveAddress, 0x06, 0x00, 0x0D, 0x10, 0x07, 0x59, 0x8A };
var Comando_4 = new byte[] { slaveAddress, 0x06, 0x00, 0x1C, 0x27, 0x10, 0x5F, 0xB1 };
var Comando_5 = new byte[] { slaveAddress, 0x06, 0x00, 0x1D, 0x26, 0x67, 0x4F, 0xC7 };
var Comando_6 = new byte[] { slaveAddress, 0x06, 0x00, 0x1E, 0x27, 0xC3, 0xBF, 0xEC };
var ComandoSalvaCalibragem = new byte[] { slaveAddress, 0x06, 0x00, 0x00, 0x00, 0x00, 0x84, 0x4B };
var Comando0 = new ModbusComandoModel() { Comando = ComandoLiberacaoParametro, Dispositivo = T_Code.Wit, Endereco = slaveAddress, Verificacao = false, TamanhoEsperado = 8, TimeoutResposta = 500 };
ModbusService.AdicionarComandoNaFila(Comando0);
var Comando1 = new ModbusComandoModel() { Comando = Comando_1, Dispositivo = T_Code.Wit, Endereco = slaveAddress, Verificacao = false, TamanhoEsperado = 8, TimeoutResposta = 500 };
ModbusService.AdicionarComandoNaFila(Comando1);
var Comando2 = new ModbusComandoModel() { Comando = Comando_2, Dispositivo = T_Code.Wit, Endereco = slaveAddress, Verificacao = false, TamanhoEsperado = 8, TimeoutResposta = 500 };
ModbusService.AdicionarComandoNaFila(Comando2);
var Comando3 = new ModbusComandoModel() { Comando = Comando_3, Dispositivo = T_Code.Wit, Endereco = slaveAddress, Verificacao = false, TamanhoEsperado = 8, TimeoutResposta = 500 };
ModbusService.AdicionarComandoNaFila(Comando3);
var Comando4 = new ModbusComandoModel() { Comando = Comando_4, Dispositivo = T_Code.Wit, Endereco = slaveAddress, Verificacao = false, TamanhoEsperado = 8, TimeoutResposta = 500 };
ModbusService.AdicionarComandoNaFila(Comando4);
var Comando5 = new ModbusComandoModel() { Comando = Comando_5, Dispositivo = T_Code.Wit, Endereco = slaveAddress, Verificacao = false, TamanhoEsperado = 8, TimeoutResposta = 500 };
ModbusService.AdicionarComandoNaFila(Comando5);
var Comando6 = new ModbusComandoModel() { Comando = Comando_6, Dispositivo = T_Code.Wit, Endereco = slaveAddress, Verificacao = false, TamanhoEsperado = 8, TimeoutResposta = 500 };
ModbusService.AdicionarComandoNaFila(Comando6);
var Comando7 = new ModbusComandoModel() { Comando = ComandoSalvaCalibragem, Dispositivo = T_Code.Wit, Endereco = slaveAddress, Verificacao = false, TamanhoEsperado = 8, TimeoutResposta = 500 };
ModbusService.AdicionarComandoNaFila(Comando7);
if (Notificacao)
{
MessageBox.Show("Magnetometro calibrado com sucesso!");
}
}
public static byte[] ComandoAquisicaoDados()
{
byte[] Comando = ModbusService.ComandoGetParametro(slaveAddress, new ModbusParametrosModel() { N_Registros = 0x30, Registro = 0x30 });

File diff suppressed because it is too large Load Diff

View File

@ -24,3 +24,5 @@
06/12/2024 10:29:37:096 - Porta COM70 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
06/12/2024 15:16:43:015 - Porta COM69 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
06/12/2024 16:21:30:834 - Porta COM69 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
09/12/2024 06:56:18:006 - Porta COM20 - 0: Erro ao processar fila de comandos. Erro=The port is closed.
09/12/2024 17:24:36:567 - Porta COM69 - 0: Erro ao processar fila de comandos. Erro=The port is closed.

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
{"tmrRegistrador":{"_uiControl":null,"State":2,"IsRunning":false,"IsStopped":true,"IsCreated":false,"Interval":1000,"StackTrace":"AtuadorModel.IniciarRegistrador","Id":"tmrRegistrador_Atu","TimeTick":"00:00:00"},"Modulo_ID":"Atu","IP":"192.168.100.13","RequisitarDados":true,"Conectado":false,"QuantidadeBicos":4,"DensidadeHerbicida":1.05,"BicosPulverizadores":[{"ID":"B01","Posicao":1,"Componente":422,"AtuacaoNivelAlto":true,"ComandoAtuar":false,"Comandar":true,"Testando":false,"Funcoes":[21],"LeituraStatusBico":false,"MediaNivelFluxo":0.0,"Leitura":null,"Inicializado":false,"Atuacoes":0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0},{"ID":"B02","Posicao":2,"Componente":422,"AtuacaoNivelAlto":true,"ComandoAtuar":false,"Comandar":true,"Testando":false,"Funcoes":[21],"LeituraStatusBico":false,"MediaNivelFluxo":0.0,"Leitura":null,"Inicializado":false,"Atuacoes":0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0},{"ID":"B03","Posicao":3,"Componente":422,"AtuacaoNivelAlto":true,"ComandoAtuar":false,"Comandar":true,"Testando":false,"Funcoes":[21],"LeituraStatusBico":false,"MediaNivelFluxo":0.0,"Leitura":null,"Inicializado":false,"Atuacoes":0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0},{"ID":"B04","Posicao":4,"Componente":422,"AtuacaoNivelAlto":true,"ComandoAtuar":false,"Comandar":true,"Testando":false,"Funcoes":[21],"LeituraStatusBico":false,"MediaNivelFluxo":0.0,"Leitura":null,"Inicializado":false,"Atuacoes":0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0}],"BombasPressurizadoras":[{"ID":"BOMBA","ComandoAtuar":false,"Componente":325,"LeituraEstado":false,"Comandar":true,"Testando":false,"Funcoes":[14,35,36,37,5],"LeituraPotencia":0.0,"LeituraPressaoSP":0.0,"LeituraPressao":0.0,"Leitura":null,"Inicializado":false}],"Sensores":[{"LogGrafico":[],"ID":"FLXLN","Prioridade":23,"Descricao":"Fluxo na linha principal","Componente":198,"Aferir":true,"DelayAmostragem":300,"Leitura":null,"Inicializado":false,"Testando":false,"Funcoes":[25],"Parametros":[],"UnidadeMedida":"mL/s","LimiteMaximo":0.0,"LimiteMinimo":0.0},{"LogGrafico":[],"ID":"MASRS","Prioridade":3,"Descricao":"Massa do reservatório de herbicida","Componente":532,"Aferir":true,"DelayAmostragem":1000,"Leitura":null,"Inicializado":false,"Testando":false,"Funcoes":[22,23],"Parametros":[],"UnidadeMedida":"Kg","LimiteMaximo":50.0,"LimiteMinimo":5.0},{"LogGrafico":[],"ID":"PRSLN","Prioridade":3,"Descricao":"Pressão na linha principal","Componente":333,"Aferir":true,"DelayAmostragem":1000,"Leitura":null,"Inicializado":false,"Testando":false,"Funcoes":[24],"Parametros":[["Vmin","000.00"],["Vmax","004.50"],["Pmax","174.04"]],"UnidadeMedida":"psi","LimiteMaximo":120.0,"LimiteMinimo":60.0}],"BombaPressurizadora":{"ID":"BOMBA","ComandoAtuar":false,"Componente":325,"LeituraEstado":false,"Comandar":true,"Testando":false,"Funcoes":[14,35,36,37,5],"LeituraPotencia":0.0,"LeituraPressaoSP":0.0,"LeituraPressao":0.0,"Leitura":null,"Inicializado":false},"ScriptDeteccaoErvas":"weed_detector-1_0.py","DadosLeitura":{"Momento":"0001-01-01T00:00:00","Conectado":false,"Mod_ID":null,"QualidadeWifi":0,"LatenciaLoop":0,"BicosPulverizadores":[],"BombasPressurizadoras":[],"SensoresFluxo":[],"SensoresMassa":[],"SensoresPressao":[]},"_MassaRef":0.8,"_MassaLeituraRef":40876.37,"_MassaLeituraExtra":1895800.0,"MassaReservatorio":0.0,"VolumeReservatorio":0.0,"PercentualReservatorio":0.0,"VolumeVazaoAferido":0.0,"_FluxoMlRef":102.0,"_FluxoPulsoRef":80.0,"VazaoFluxoMLpSInstantanea":0.0,"VazaoFluxoMLpSMedia":0.0,"VolumeVazaoML":0.0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0,"_PressaoVmin":0.0,"_PressaoVmax":4.5,"_PressaoMax":174.045,"PressaoLinha":0.0,"PressaoLinhaCalc":0.0}
{"tmrRegistrador":{"_uiControl":null,"State":2,"IsRunning":false,"IsStopped":true,"IsCreated":false,"Interval":1000,"StackTrace":"AtuadorModel.IniciarRegistrador","Id":"tmrRegistrador_Atu","Ticks":615,"TimeTick":"00:00:00"},"Modulo_ID":"Atu","IP":"192.168.100.13","RequisitarDados":true,"Conectado":false,"QuantidadeBicos":4,"DensidadeHerbicida":1.05,"BicosPulverizadores":[{"ID":"B01","Posicao":1,"Componente":422,"AtuacaoNivelAlto":true,"ComandoAtuar":false,"Comandar":true,"Testando":false,"Funcoes":[21],"LeituraStatusBico":false,"MediaNivelFluxo":0.0,"Leitura":null,"Inicializado":false,"Atuacoes":0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0},{"ID":"B02","Posicao":2,"Componente":422,"AtuacaoNivelAlto":true,"ComandoAtuar":false,"Comandar":true,"Testando":false,"Funcoes":[21],"LeituraStatusBico":false,"MediaNivelFluxo":0.0,"Leitura":null,"Inicializado":false,"Atuacoes":0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0},{"ID":"B03","Posicao":3,"Componente":422,"AtuacaoNivelAlto":true,"ComandoAtuar":false,"Comandar":true,"Testando":false,"Funcoes":[21],"LeituraStatusBico":false,"MediaNivelFluxo":0.0,"Leitura":null,"Inicializado":false,"Atuacoes":0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0},{"ID":"B04","Posicao":4,"Componente":422,"AtuacaoNivelAlto":true,"ComandoAtuar":false,"Comandar":true,"Testando":false,"Funcoes":[21],"LeituraStatusBico":false,"MediaNivelFluxo":0.0,"Leitura":null,"Inicializado":false,"Atuacoes":0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0}],"BombasPressurizadoras":[{"ID":"BOMBA","ComandoAtuar":false,"Componente":325,"LeituraEstado":false,"Comandar":true,"Testando":false,"Funcoes":[14,35,36,37,5],"LeituraPotencia":0.0,"LeituraPressaoSP":0.0,"LeituraPressao":0.0,"Leitura":null,"Inicializado":false}],"Sensores":[{"LogGrafico":[],"ID":"FLXLN","Prioridade":23,"Descricao":"Fluxo na linha principal","Componente":198,"Aferir":true,"DelayAmostragem":300,"Leitura":null,"Inicializado":false,"Testando":false,"Funcoes":[25],"Parametros":[],"UnidadeMedida":"mL/s","LimiteMaximo":0.0,"LimiteMinimo":0.0},{"LogGrafico":[],"ID":"MASRS","Prioridade":3,"Descricao":"Massa do reservatório de herbicida","Componente":532,"Aferir":true,"DelayAmostragem":1000,"Leitura":null,"Inicializado":false,"Testando":false,"Funcoes":[22,23],"Parametros":[],"UnidadeMedida":"Kg","LimiteMaximo":50.0,"LimiteMinimo":5.0},{"LogGrafico":[],"ID":"PRSLN","Prioridade":3,"Descricao":"Pressão na linha principal","Componente":333,"Aferir":true,"DelayAmostragem":1000,"Leitura":null,"Inicializado":false,"Testando":false,"Funcoes":[24],"Parametros":[["Vmin","000.00"],["Vmax","004.50"],["Pmax","174.04"]],"UnidadeMedida":"psi","LimiteMaximo":120.0,"LimiteMinimo":60.0}],"BombaPressurizadora":{"ID":"BOMBA","ComandoAtuar":false,"Componente":325,"LeituraEstado":false,"Comandar":true,"Testando":false,"Funcoes":[14,35,36,37,5],"LeituraPotencia":0.0,"LeituraPressaoSP":0.0,"LeituraPressao":0.0,"Leitura":null,"Inicializado":false},"ScriptDeteccaoErvas":"weed_detector-1_0.py","DadosLeitura":{"Momento":"0001-01-01T00:00:00","Conectado":false,"Mod_ID":null,"QualidadeWifi":0,"LatenciaLoop":0,"BicosPulverizadores":[],"BombasPressurizadoras":[],"SensoresFluxo":[],"SensoresMassa":[],"SensoresPressao":[]},"_MassaRef":0.8,"_MassaLeituraRef":40876.37,"_MassaLeituraExtra":1895800.0,"MassaReservatorio":0.0,"VolumeReservatorio":0.0,"PercentualReservatorio":0.0,"VolumeVazaoAferido":0.0,"_FluxoMlRef":102.0,"_FluxoPulsoRef":80.0,"VazaoFluxoMLpSInstantanea":0.0,"VazaoFluxoMLpSMedia":0.0,"VolumeVazaoML":0.0,"InicioAtuacao":"0001-01-01T00:00:00","TempoAtuado":0.0,"_PressaoVmin":0.0,"_PressaoVmax":4.5,"_PressaoMax":174.045,"PressaoLinha":0.0,"PressaoLinhaCalc":0.0}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"Id":"1517","Name":"06_12_2024_14_34_26","Length":0.0,"Dist1":0.0,"Dist2":0.0},"geometry":{"id":null,"type":"LineString","coordinates":[[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0]]}}]}
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"Id":"1517","Name":"09_12_2024_08_30_20","Length":0.0,"Dist1":0.0,"Dist2":0.0},"geometry":{"id":null,"type":"LineString","coordinates":[[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0],[0.0,0.0]]}}]}

View File

@ -25,7 +25,7 @@
<meta name="viewport" content="width=device-width,
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
#map_ec5cd5ad6f9766b976272318d48d1918 {
#map_5bb1a7c3c46d96a0510c9eb614a01615 {
position: relative;
width: 100.0%;
height: 100.0%;
@ -39,14 +39,14 @@
<body>
<div class="folium-map" id="map_ec5cd5ad6f9766b976272318d48d1918" ></div>
<div class="folium-map" id="map_5bb1a7c3c46d96a0510c9eb614a01615" ></div>
</body>
<script>
var map_ec5cd5ad6f9766b976272318d48d1918 = L.map(
"map_ec5cd5ad6f9766b976272318d48d1918",
var map_5bb1a7c3c46d96a0510c9eb614a01615 = L.map(
"map_5bb1a7c3c46d96a0510c9eb614a01615",
{
center: [0.0, 0.0],
crs: L.CRS.EPSG3857,
@ -59,6 +59,15 @@
var tile_layer_e6ce570b6ecf60c404f180071f180c4c = 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_e6ce570b6ecf60c404f180071f180c4c.addTo(map_5bb1a7c3c46d96a0510c9eb614a01615);
</script>
<script>
@ -78,7 +87,7 @@
}
trajeto_json_add({"features": []});
trajeto_json.addTo(map_ec5cd5ad6f9766b976272318d48d1918);
trajeto_json.addTo(map_5bb1a7c3c46d96a0510c9eb614a01615);
function adicionarGeometria(novaGeometria) {
trajeto_json.addData(novaGeometria);
@ -136,7 +145,7 @@
var marcadorDinamico = L.marker([0, 0], {
icon: customIcon
}).addTo(map_ec5cd5ad6f9766b976272318d48d1918);
}).addTo(map_5bb1a7c3c46d96a0510c9eb614a01615);
// Conectar ao broker MQTT
const client = mqtt.connect('ws://localhost:9001'); // Use wss para conexão segura
@ -174,7 +183,7 @@
marcadorDinamico.setRotationAngle(angulo);
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
map_ec5cd5ad6f9766b976272318d48d1918.setView(novaPosicao, map_ec5cd5ad6f9766b976272318d48d1918.getZoom());
map_5bb1a7c3c46d96a0510c9eb614a01615.setView(novaPosicao, map_5bb1a7c3c46d96a0510c9eb614a01615.getZoom());
});
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {

View File

@ -25,7 +25,7 @@
<meta name="viewport" content="width=device-width,
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
#map_a6661c337c9b0fe61379037a1ad1c607 {
#map_df26f07c51cd23875502b0ebd50c0d42 {
position: relative;
width: 100.0%;
height: 100.0%;
@ -39,14 +39,14 @@
<body>
<div class="folium-map" id="map_a6661c337c9b0fe61379037a1ad1c607" ></div>
<div class="folium-map" id="map_df26f07c51cd23875502b0ebd50c0d42" ></div>
</body>
<script>
var map_a6661c337c9b0fe61379037a1ad1c607 = L.map(
"map_a6661c337c9b0fe61379037a1ad1c607",
var map_df26f07c51cd23875502b0ebd50c0d42 = L.map(
"map_df26f07c51cd23875502b0ebd50c0d42",
{
center: [0.0, 0.0],
crs: L.CRS.EPSG3857,
@ -60,13 +60,13 @@
var tile_layer_29e9725d6e5bbf4e16d0920b3e4ea15b = L.tileLayer(
var tile_layer_3934deb3c2cbb41543a0e145d035503a = 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_29e9725d6e5bbf4e16d0920b3e4ea15b.addTo(map_a6661c337c9b0fe61379037a1ad1c607);
tile_layer_3934deb3c2cbb41543a0e145d035503a.addTo(map_df26f07c51cd23875502b0ebd50c0d42);
@ -82,7 +82,7 @@
}*/
});
}
function geo_json_5ea8641a611a651024e5970f7c37aa2a_onEachFeature(feature, layer) {
function geo_json_eedd8a7bf5a1d46825d41622c178e166_onEachFeature(feature, layer) {
layer.on({
click: function(e) {
@ -118,20 +118,20 @@
}*/
});
};
var geo_json_5ea8641a611a651024e5970f7c37aa2a = L.geoJson(null, {
onEachFeature: geo_json_5ea8641a611a651024e5970f7c37aa2a_onEachFeature,
var geo_json_eedd8a7bf5a1d46825d41622c178e166 = L.geoJson(null, {
onEachFeature: geo_json_eedd8a7bf5a1d46825d41622c178e166_onEachFeature,
});
function geo_json_5ea8641a611a651024e5970f7c37aa2a_add (data) {
geo_json_5ea8641a611a651024e5970f7c37aa2a
function geo_json_eedd8a7bf5a1d46825d41622c178e166_add (data) {
geo_json_eedd8a7bf5a1d46825d41622c178e166
.addData(data);
}
geo_json_5ea8641a611a651024e5970f7c37aa2a_add({"features": [{"geometry": {"coordinates": [[0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]], "id": null, "type": "LineString"}, "id": 0, "properties": {"Dist1": 0.0, "Dist2": 0.0, "Id": "1517", "Length": 0.0, "Name": "06_12_2024_14_34_26"}, "type": "Feature"}], "type": "FeatureCollection"});
geo_json_eedd8a7bf5a1d46825d41622c178e166_add({"features": [{"geometry": {"coordinates": [[0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]], "id": null, "type": "LineString"}, "id": 0, "properties": {"Dist1": 0.0, "Dist2": 0.0, "Id": "1517", "Length": 0.0, "Name": "09_12_2024_08_30_20"}, "type": "Feature"}], "type": "FeatureCollection"});
geo_json_5ea8641a611a651024e5970f7c37aa2a.addTo(map_a6661c337c9b0fe61379037a1ad1c607);
geo_json_eedd8a7bf5a1d46825d41622c178e166.addTo(map_df26f07c51cd23875502b0ebd50c0d42);
</script>
@ -152,7 +152,7 @@
}
trajeto_json_add({"features": []});
trajeto_json.addTo(map_a6661c337c9b0fe61379037a1ad1c607);
trajeto_json.addTo(map_df26f07c51cd23875502b0ebd50c0d42);
function adicionarGeometria(novaGeometria) {
trajeto_json.addData(novaGeometria);
@ -210,7 +210,7 @@
}
trajeto_dinamico_json_add({"features": []});
trajeto_dinamico_json.addTo(map_a6661c337c9b0fe61379037a1ad1c607);
trajeto_dinamico_json.addTo(map_df26f07c51cd23875502b0ebd50c0d42);
function adicionarGeometriaDinamica(novaGeometria) {
trajeto_dinamico_json.addData(novaGeometria);
@ -263,9 +263,9 @@
var marcadorEquipamento = L.marker([0, 0], {
icon: customIcon
}).addTo(map_a6661c337c9b0fe61379037a1ad1c607);
}).addTo(map_df26f07c51cd23875502b0ebd50c0d42);
var marcadorBase = L.marker([0, 0], {}).addTo(map_a6661c337c9b0fe61379037a1ad1c607);
var marcadorBase = L.marker([0, 0], {}).addTo(map_df26f07c51cd23875502b0ebd50c0d42);
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_a6661c337c9b0fe61379037a1ad1c607.setView(novaPosicao, map_a6661c337c9b0fe61379037a1ad1c607.getZoom());
map_df26f07c51cd23875502b0ebd50c0d42.setView(novaPosicao, map_df26f07c51cd23875502b0ebd50c0d42.getZoom());
}
}
@ -364,7 +364,7 @@
function atualizarSelecaoRuas(selecionadas) {
selecionadas = JSON.parse(selecionadas);
RuasSelecionadas = Array.isArray(selecionadas) ? [...selecionadas] : [];
geo_json_5ea8641a611a651024e5970f7c37aa2a.eachLayer(function (layer) {
geo_json_eedd8a7bf5a1d46825d41622c178e166.eachLayer(function (layer) {
if (RuasSelecionadas.includes(parseInt(layer.feature.id))) {
layer.setStyle({ color: 'blue' });
} else {

View File

@ -35,6 +35,10 @@ NUM_CLASSES = 4 # Pascal VOC possui 3 classes + 1 para o fundo
OUTPUT_STRIDE = 16 # Valor comum para DeepLab
MODEL_PATH = model_folder + "model-" + script_version + '.pth' # Caminho para o modelo pré-treinado
# Variáveis globais para armazenar os dados do labelmap
label_colors = None
class_names = None
# Função para carregar o modelo
def load_model(model_path):
model = deeplabv3_model(num_classes=NUM_CLASSES, output_stride=OUTPUT_STRIDE)
@ -65,19 +69,22 @@ def segment_frame(frame):
# Função para ler o mapa de rótulos
def read_labelmap(path):
label_colors = []
class_names = []
with open(path, 'r') as file:
for line in file.readlines():
if line.startswith('#'):
continue
parts = line.strip().split(':')
if len(parts) >= 2:
label = parts[0].strip()
color = tuple(map(int, parts[1].split(',')))
class_names.append(label)
label_colors.append(color)
return np.array(label_colors), class_names
global label_colors, class_names
if label_colors is None or class_names is None: # Verifica se já estão carregados
label_colors = []
class_names = []
with open(path, 'r') as file:
for line in file.readlines():
if line.startswith('#'):
continue
parts = line.strip().split(':')
if len(parts) >= 2:
label = parts[0].strip()
color = tuple(map(int, parts[1].split(',')))
class_names.append(label)
label_colors.append(color)
label_colors = np.array(label_colors)
return label_colors, class_names
# Função para gerar o JSON de saída
def generate_json(image):