corrigido atuadores

This commit is contained in:
Diego Freitas 2024-03-11 17:04:48 -03:00
parent 120738582b
commit d351152f37
66 changed files with 886 additions and 321 deletions

Binary file not shown.

View File

@ -4,35 +4,19 @@ using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Management;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AgroBase.Models;
using AgroBase.Services;
using CefSharp.WinForms;
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using Newtonsoft.Json;
using static MqttService;
namespace AgroBase.Forms
{
public partial class frmAtuCamera : Form
{
private CameraService cameraService = new CameraService();
private ChromiumWebBrowser chromiumWebBrowser = null;
private CameraSoloModel cameraSolo = new CameraSoloModel();
private Timer tmrLeitura;
private int MaxLeituras = 10;
private string VideoPorta = VariaveisPortas.CameraSolo.ToString();
private string VideoUrl = "green_objects";
private string SocketPorta = VariaveisPortas.SocketSolo.ToString();
private string ArquivoLeitura = "objetos.json";
public frmAtuCamera()
{
InitializeComponent();
@ -40,6 +24,21 @@ namespace AgroBase.Forms
private void frmCamera_Load(object sender, EventArgs e)
{
cameraSolo = new CameraSoloModel()
{
Nome = "T",
Posicao = Variaveis.OperacaoEmAndamento.CamerasSolo.Count(),
ArquivoLeitura = "ervas_T.json",
browser = null,
camera = new CameraService(),
CameraSelecionada = "",
combo = cmbCameras,
MaxLeituras = 10,
VideoPorta = (VariaveisPortas.CameraSolo + Variaveis.OperacaoEmAndamento.CamerasSolo.Count()).ToString(),
VideoUrl = "green_objects_T",
MqttTopico = "green_objects_T",
panel = pnlCamera,
};
AtualizaListaCameras();
}
@ -47,8 +46,8 @@ namespace AgroBase.Forms
{
try
{
cameraService.pythonProcess.Kill();
Variaveis.MqttService.UnsubscribeAsync(cameraService._mqttTopico).GetAwaiter().GetResult();
cameraSolo.camera.pythonProcess.Kill();
Variaveis.MqttService.UnsubscribeAsync(cameraSolo.camera._mqttTopico).ConfigureAwait(false);
}
catch (Exception ex)
{
@ -77,7 +76,7 @@ namespace AgroBase.Forms
else
{
btnSalvar.Text = "Editar";
cameraService.selectedCamera = cmbCameras.SelectedIndex;
cameraSolo.camera.selectedCamera = cmbCameras.SelectedIndex;
}
btnIniciar.Enabled = btnSalvar.Text == "Editar" && cmbCameras.SelectedIndex > 0;
cmbCameras.Enabled = btnSalvar.Text == "Salvar";
@ -85,21 +84,20 @@ namespace AgroBase.Forms
private void btnIniciar_Click(object sender, EventArgs e)
{
cameraService.ArquivoLeitura = ArquivoLeitura;
cameraService.IniciarCamera(
cameraSolo.camera.IniciarCamera(
PythonService.ScriptWeedDetector,
new string[] {
MaxLeituras.ToString(),
VideoPorta,
VideoUrl,
ArquivoLeitura,
cameraSolo.MaxLeituras.ToString(),
cameraSolo.VideoPorta,
cameraSolo.VideoUrl,
cameraSolo.ArquivoLeitura,
"1",
VideoUrl
cameraSolo.MqttTopico
},
VideoPorta,
VideoUrl,
VideoUrl,
new Timer()
cameraSolo.VideoPorta,
cameraSolo.VideoUrl,
cameraSolo.MqttTopico,
cameraSolo.tmrProcesso
);
tmrLeitura = new Timer() { Interval = 200 };
@ -110,32 +108,25 @@ namespace AgroBase.Forms
private void AtualizaListaCameras()
{
cameraService.selectedCamera = cmbCameras.SelectedIndex > 0 ? cmbCameras.SelectedIndex : 0;
cameraSolo.camera.selectedCamera = cmbCameras.SelectedIndex > 0 ? cmbCameras.SelectedIndex : 0;
cmbCameras.Items.Clear();
cmbCameras.Items.AddRange(CameraService.AtualizaListaCameras().Keys.ToArray());
if (cmbCameras.Items.Count == 1)
{
cameraService.selectedCamera = 0;
cameraSolo.camera.selectedCamera = 0;
}
cmbCameras.SelectedIndex = cameraService.selectedCamera;
cmbCameras.SelectedIndex = cameraSolo.camera.selectedCamera;
}
private void ListarObjetosDetectados()
{
if (chromiumWebBrowser == null)
{
chromiumWebBrowser = new ChromiumWebBrowser(cameraService.URLcamera);
this.pnlCamera.Controls.Add(chromiumWebBrowser);
chromiumWebBrowser.Dock = DockStyle.Fill;
}
this.pnlLeituras.Controls.Clear();
int i = 0;
//var coordenadas = cameraService.AferirDadosCamera<CameraCoordenadasModel>();
var MqttTopico = Variaveis.MqttService.Topicos.FirstOrDefault(x => x.Topico == VideoUrl);
var MqttTopico = Variaveis.MqttService.Topicos.FirstOrDefault(x => x.Topico == cameraSolo.MqttTopico);
CameraCoordenadasFrameModel leitura = null;
var Mensagem = MqttTopico.Mensagens.LastOrDefault(x => x.Momento > cameraService.IniciadoEm);
var Mensagem = MqttTopico.Mensagens.LastOrDefault(x => x.Momento > cameraSolo.camera.IniciadoEm);
if (Mensagem != null)
{
try
@ -148,77 +139,82 @@ namespace AgroBase.Forms
}
}
foreach (var objeto in leitura.objetos)
if (leitura != null)
{
GroupBox gpb = new GroupBox()
foreach (var objeto in leitura.objetos)
{
Name = "gpbLeitura" + i,
Size = new Size(120, 170),
Text = "Leitura " + (i + 1),
Location = new Point(3, 3 + (i * 190))
};
Label _lblID = new Label()
{
Name = "lblLeitura" + i + "ID",
Size = new Size(100, 20),
Text = "ID: " + objeto.id,
Location = new Point(6, 20)
};
Label _lblDescricao = new Label()
{
Name = "lblLeitura" + i + "Descricao",
Size = new Size(100, 20),
Text = "Descrição: " + objeto.descricao,
Location = new Point(6, 40)
};
Label _lblConfianca = new Label()
{
Name = "lblLeitura" + i + "Confianca",
Size = new Size(100, 20),
Text = "Confiança: " + (objeto.confianca * 100).ToString("0.00") + "%",
Location = new Point(6, 60)
};
Label _lblX = new Label()
{
Name = "lblLeitura" + i + "X",
Size = new Size(100, 20),
Text = "X: " + objeto.x,
Location = new Point(6, 80)
};
Label _lblY = new Label()
{
Name = "lblLeitura" + i + "Y",
Size = new Size(100, 20),
Text = "Y: " + objeto.y,
Location = new Point(6, 100)
};
Label _lblAltura = new Label()
{
Name = "lblLeitura" + i + "Altura",
Size = new Size(100, 20),
Text = "Altura: " + objeto.altura,
Location = new Point(6, 120)
};
Label _lblLargura = new Label()
{
Name = "lblLeitura" + i + "Largura",
Size = new Size(100, 20),
Text = "Largura: " + objeto.largura,
Location = new Point(6, 140)
};
gpb.Controls.Add(_lblID);
gpb.Controls.Add(_lblDescricao);
gpb.Controls.Add(_lblConfianca);
gpb.Controls.Add(_lblX);
gpb.Controls.Add(_lblY);
gpb.Controls.Add(_lblAltura);
gpb.Controls.Add(_lblLargura);
GroupBox gpb = new GroupBox()
{
Name = "gpbLeitura" + i,
Size = new Size(120, 170),
Text = "Leitura " + (i + 1),
Location = new Point(3, 3 + (i * 190))
};
Label _lblID = new Label()
{
Name = "lblLeitura" + i + "ID",
Size = new Size(100, 20),
Text = "ID: " + objeto.id,
Location = new Point(6, 20)
};
Label _lblDescricao = new Label()
{
Name = "lblLeitura" + i + "Descricao",
Size = new Size(100, 20),
Text = "Descrição: " + objeto.descricao,
Location = new Point(6, 40)
};
Label _lblConfianca = new Label()
{
Name = "lblLeitura" + i + "Confianca",
Size = new Size(100, 20),
Text = "Confiança: " + (objeto.confianca * 100).ToString("0.00") + "%",
Location = new Point(6, 60)
};
Label _lblX = new Label()
{
Name = "lblLeitura" + i + "X",
Size = new Size(100, 20),
Text = "X: " + objeto.x,
Location = new Point(6, 80)
};
Label _lblY = new Label()
{
Name = "lblLeitura" + i + "Y",
Size = new Size(100, 20),
Text = "Y: " + objeto.y,
Location = new Point(6, 100)
};
Label _lblAltura = new Label()
{
Name = "lblLeitura" + i + "Altura",
Size = new Size(100, 20),
Text = "Altura: " + objeto.altura,
Location = new Point(6, 120)
};
Label _lblLargura = new Label()
{
Name = "lblLeitura" + i + "Largura",
Size = new Size(100, 20),
Text = "Largura: " + objeto.largura,
Location = new Point(6, 140)
};
gpb.Controls.Add(_lblID);
gpb.Controls.Add(_lblDescricao);
gpb.Controls.Add(_lblConfianca);
gpb.Controls.Add(_lblX);
gpb.Controls.Add(_lblY);
gpb.Controls.Add(_lblAltura);
gpb.Controls.Add(_lblLargura);
pnlLeituras.Controls.Add(gpb);
pnlLeituras.Controls.Add(gpb);
i++;
i++;
}
}
}
}

View File

@ -122,6 +122,7 @@ namespace AgroBase.Forms.IHM
{
if (Variaveis.OperacaoEmAndamento.ModulosConectados)
{
Variaveis.OperacaoEmAndamento.frmOperacao = (Form)Activator.CreateInstance(Variaveis.OperacaoEmAndamento.frmOperacao.GetType());
Variaveis.OperacaoEmAndamento.frmOperacao.ShowDialog();
}
else

View File

@ -85,11 +85,25 @@ namespace AgroBase.Forms.Operacoes
{
Variaveis.OperacaoEmAndamento.CamerasSolo.Where(x => x.Iniciada).ToList().ForEach(CameraSolo =>
{
AtualizaLeituraCameraSolo(CameraSolo);
try
{
AtualizaLeituraCameraSolo(CameraSolo);
}
catch
{
}
});
Variaveis.OperacaoEmAndamento.Sensoriamento.ErvasNoRadar = Variaveis.OperacaoEmAndamento.CamerasSolo.Sum(x => x.ErvasNoRadar);
AtualizaLeituraCameraCaminho();
try
{
AtualizaLeituraCameraCaminho();
}
catch
{
}
}
else
{
@ -382,16 +396,17 @@ namespace AgroBase.Forms.Operacoes
browser = null,
camera = new CameraService(),
CameraSelecionada = "",
combo = cmb,
MaxLeituras = 10,
VideoPorta = (VariaveisPortas.CameraSolo + Variaveis.OperacaoEmAndamento.CamerasSolo.Count()).ToString(),
VideoUrl = "green_objects_" + CamNome,
MqttTopico = "green_objects_" + CamNome,
panel = pnlCameraSolo.Controls.OfType<Panel>().Where(x => x.Name.Replace("pnl", "cmb") == cmb.Name).FirstOrDefault(),
};
Variaveis.OperacaoEmAndamento.CamerasSolo.Add(CameraSolo);
}
CameraSolo.combo = cmb;
CameraSolo.panel = pnlCameraSolo.Controls.OfType<Panel>().Where(x => x.Name.Replace("pnl", "cmb") == cmb.Name).FirstOrDefault();
CameraSolo.combo.Items.Clear();
CameraSolo.combo.Items.AddRange(listaCameras);
CameraSolo.combo.SelectedIndex = CameraSolo.camera.selectedCamera;

View File

@ -33,7 +33,13 @@
this.gpbModulos = new System.Windows.Forms.GroupBox();
this.gpbP_Gps = new System.Windows.Forms.GroupBox();
this.gpbP_Sen = new System.Windows.Forms.GroupBox();
this.lblTemposalvarlogU = new System.Windows.Forms.Label();
this.nudTemposalvarlog = new System.Windows.Forms.NumericUpDown();
this.lblTemposalvarlog = new System.Windows.Forms.Label();
this.gpbP_Atu = new System.Windows.Forms.GroupBox();
this.cmbScriptErvas = new System.Windows.Forms.ComboBox();
this.nudAtuarem = new System.Windows.Forms.NumericUpDown();
this.lblAtuarem = new System.Windows.Forms.Label();
this.nudQtdCameras = new System.Windows.Forms.NumericUpDown();
this.lblQtdCameras = new System.Windows.Forms.Label();
this.nudQtdBicos = new System.Windows.Forms.NumericUpDown();
@ -65,12 +71,18 @@
this.btnCarregar = new System.Windows.Forms.Button();
this.btnSalvar = new System.Windows.Forms.Button();
this.chbSalvar = new System.Windows.Forms.CheckBox();
this.nudTemposalvarlog = new System.Windows.Forms.NumericUpDown();
this.lblTemposalvarlog = new System.Windows.Forms.Label();
this.lblTemposalvarlogU = new System.Windows.Forms.Label();
this.gpbConfiguracoesgerais = new System.Windows.Forms.GroupBox();
this.txtDensidadeherbicida = new System.Windows.Forms.TextBox();
this.lblUnDensidadeherbicida = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.nudCapacidadereservatorio = new System.Windows.Forms.NumericUpDown();
this.lblUnCapcaidadereservatorio = new System.Windows.Forms.Label();
this.lblCapacidadereservatorio = new System.Windows.Forms.Label();
this.gpbModulos.SuspendLayout();
this.gpbP_Sen.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudTemposalvarlog)).BeginInit();
this.gpbP_Atu.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudAtuarem)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudQtdCameras)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudQtdBicos)).BeginInit();
this.gpbP_Dir.SuspendLayout();
@ -80,7 +92,8 @@
this.gpbP_Mov.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudVelocidadeComErvas)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudVelocidadeSemErvas)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudTemposalvarlog)).BeginInit();
this.gpbConfiguracoesgerais.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudCapacidadereservatorio)).BeginInit();
this.SuspendLayout();
//
// cmbOperacao
@ -154,8 +167,48 @@
this.gpbP_Sen.TabStop = false;
this.gpbP_Sen.Text = "Ajustes";
//
// lblTemposalvarlogU
//
this.lblTemposalvarlogU.AutoSize = true;
this.lblTemposalvarlogU.Location = new System.Drawing.Point(136, 69);
this.lblTemposalvarlogU.Name = "lblTemposalvarlogU";
this.lblTemposalvarlogU.Size = new System.Drawing.Size(41, 24);
this.lblTemposalvarlogU.TabIndex = 13;
this.lblTemposalvarlogU.Text = "seg";
//
// nudTemposalvarlog
//
this.nudTemposalvarlog.Location = new System.Drawing.Point(10, 67);
this.nudTemposalvarlog.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudTemposalvarlog.Name = "nudTemposalvarlog";
this.nudTemposalvarlog.Size = new System.Drawing.Size(120, 29);
this.nudTemposalvarlog.TabIndex = 10;
this.nudTemposalvarlog.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.nudTemposalvarlog.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// lblTemposalvarlog
//
this.lblTemposalvarlog.AutoSize = true;
this.lblTemposalvarlog.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblTemposalvarlog.Location = new System.Drawing.Point(6, 40);
this.lblTemposalvarlog.Name = "lblTemposalvarlog";
this.lblTemposalvarlog.Size = new System.Drawing.Size(145, 20);
this.lblTemposalvarlog.TabIndex = 9;
this.lblTemposalvarlog.Text = "Tempo Salvar Log";
//
// gpbP_Atu
//
this.gpbP_Atu.Controls.Add(this.cmbScriptErvas);
this.gpbP_Atu.Controls.Add(this.nudAtuarem);
this.gpbP_Atu.Controls.Add(this.lblAtuarem);
this.gpbP_Atu.Controls.Add(this.nudQtdCameras);
this.gpbP_Atu.Controls.Add(this.lblQtdCameras);
this.gpbP_Atu.Controls.Add(this.nudQtdBicos);
@ -167,11 +220,38 @@
this.gpbP_Atu.TabStop = false;
this.gpbP_Atu.Text = "Ajustes";
//
// cmbScriptErvas
//
this.cmbScriptErvas.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbScriptErvas.FormattingEnabled = true;
this.cmbScriptErvas.Location = new System.Drawing.Point(10, 129);
this.cmbScriptErvas.Name = "cmbScriptErvas";
this.cmbScriptErvas.Size = new System.Drawing.Size(174, 32);
this.cmbScriptErvas.TabIndex = 15;
//
// nudAtuarem
//
this.nudAtuarem.Location = new System.Drawing.Point(130, 94);
this.nudAtuarem.Name = "nudAtuarem";
this.nudAtuarem.Size = new System.Drawing.Size(54, 29);
this.nudAtuarem.TabIndex = 13;
this.nudAtuarem.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblAtuarem
//
this.lblAtuarem.AutoSize = true;
this.lblAtuarem.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblAtuarem.Location = new System.Drawing.Point(6, 99);
this.lblAtuarem.Name = "lblAtuarem";
this.lblAtuarem.Size = new System.Drawing.Size(109, 20);
this.lblAtuarem.TabIndex = 12;
this.lblAtuarem.Text = "Atuar em (%)";
//
// nudQtdCameras
//
this.nudQtdCameras.Location = new System.Drawing.Point(10, 126);
this.nudQtdCameras.Location = new System.Drawing.Point(130, 59);
this.nudQtdCameras.Name = "nudQtdCameras";
this.nudQtdCameras.Size = new System.Drawing.Size(120, 29);
this.nudQtdCameras.Size = new System.Drawing.Size(54, 29);
this.nudQtdCameras.TabIndex = 11;
this.nudQtdCameras.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
@ -179,17 +259,17 @@
//
this.lblQtdCameras.AutoSize = true;
this.lblQtdCameras.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblQtdCameras.Location = new System.Drawing.Point(6, 99);
this.lblQtdCameras.Location = new System.Drawing.Point(6, 64);
this.lblQtdCameras.Name = "lblQtdCameras";
this.lblQtdCameras.Size = new System.Drawing.Size(174, 20);
this.lblQtdCameras.Size = new System.Drawing.Size(77, 20);
this.lblQtdCameras.TabIndex = 9;
this.lblQtdCameras.Text = "Qtde de câmeras solo";
this.lblQtdCameras.Text = "Câmeras";
//
// nudQtdBicos
//
this.nudQtdBicos.Location = new System.Drawing.Point(10, 67);
this.nudQtdBicos.Location = new System.Drawing.Point(130, 24);
this.nudQtdBicos.Name = "nudQtdBicos";
this.nudQtdBicos.Size = new System.Drawing.Size(120, 29);
this.nudQtdBicos.Size = new System.Drawing.Size(54, 29);
this.nudQtdBicos.TabIndex = 8;
this.nudQtdBicos.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
@ -197,11 +277,11 @@
//
this.lblQtdBicos.AutoSize = true;
this.lblQtdBicos.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblQtdBicos.Location = new System.Drawing.Point(6, 40);
this.lblQtdBicos.Location = new System.Drawing.Point(6, 29);
this.lblQtdBicos.Name = "lblQtdBicos";
this.lblQtdBicos.Size = new System.Drawing.Size(113, 20);
this.lblQtdBicos.Size = new System.Drawing.Size(52, 20);
this.lblQtdBicos.TabIndex = 6;
this.lblQtdBicos.Text = "Qtde de bicos";
this.lblQtdBicos.Text = "Bicos";
//
// gpbP_Dir
//
@ -520,48 +600,82 @@
this.chbSalvar.Text = "Personalizado";
this.chbSalvar.UseVisualStyleBackColor = true;
//
// nudTemposalvarlog
// gpbConfiguracoesgerais
//
this.nudTemposalvarlog.Location = new System.Drawing.Point(10, 67);
this.nudTemposalvarlog.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudTemposalvarlog.Name = "nudTemposalvarlog";
this.nudTemposalvarlog.Size = new System.Drawing.Size(120, 29);
this.nudTemposalvarlog.TabIndex = 10;
this.nudTemposalvarlog.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.nudTemposalvarlog.Value = new decimal(new int[] {
1,
0,
0,
0});
this.gpbConfiguracoesgerais.Controls.Add(this.txtDensidadeherbicida);
this.gpbConfiguracoesgerais.Controls.Add(this.lblUnDensidadeherbicida);
this.gpbConfiguracoesgerais.Controls.Add(this.label2);
this.gpbConfiguracoesgerais.Controls.Add(this.nudCapacidadereservatorio);
this.gpbConfiguracoesgerais.Controls.Add(this.lblUnCapcaidadereservatorio);
this.gpbConfiguracoesgerais.Controls.Add(this.lblCapacidadereservatorio);
this.gpbConfiguracoesgerais.Location = new System.Drawing.Point(15, 381);
this.gpbConfiguracoesgerais.Name = "gpbConfiguracoesgerais";
this.gpbConfiguracoesgerais.Size = new System.Drawing.Size(990, 286);
this.gpbConfiguracoesgerais.TabIndex = 8;
this.gpbConfiguracoesgerais.TabStop = false;
this.gpbConfiguracoesgerais.Text = "Gerais";
//
// lblTemposalvarlog
// txtDensidadeherbicida
//
this.lblTemposalvarlog.AutoSize = true;
this.lblTemposalvarlog.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblTemposalvarlog.Location = new System.Drawing.Point(6, 40);
this.lblTemposalvarlog.Name = "lblTemposalvarlog";
this.lblTemposalvarlog.Size = new System.Drawing.Size(145, 20);
this.lblTemposalvarlog.TabIndex = 9;
this.lblTemposalvarlog.Text = "Tempo Salvar Log";
this.txtDensidadeherbicida.Location = new System.Drawing.Point(18, 118);
this.txtDensidadeherbicida.Name = "txtDensidadeherbicida";
this.txtDensidadeherbicida.Size = new System.Drawing.Size(73, 29);
this.txtDensidadeherbicida.TabIndex = 15;
this.txtDensidadeherbicida.Text = "1,1";
this.txtDensidadeherbicida.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblTemposalvarlogU
// lblUnDensidadeherbicida
//
this.lblTemposalvarlogU.AutoSize = true;
this.lblTemposalvarlogU.Location = new System.Drawing.Point(136, 69);
this.lblTemposalvarlogU.Name = "lblTemposalvarlogU";
this.lblTemposalvarlogU.Size = new System.Drawing.Size(41, 24);
this.lblTemposalvarlogU.TabIndex = 13;
this.lblTemposalvarlogU.Text = "seg";
this.lblUnDensidadeherbicida.AutoSize = true;
this.lblUnDensidadeherbicida.Location = new System.Drawing.Point(97, 121);
this.lblUnDensidadeherbicida.Name = "lblUnDensidadeherbicida";
this.lblUnDensidadeherbicida.Size = new System.Drawing.Size(57, 24);
this.lblUnDensidadeherbicida.TabIndex = 13;
this.lblUnDensidadeherbicida.Text = "g/cm³";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(14, 92);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(162, 20);
this.label2.TabIndex = 12;
this.label2.Text = "Densidade herbicida";
//
// nudCapacidadereservatorio
//
this.nudCapacidadereservatorio.Location = new System.Drawing.Point(18, 55);
this.nudCapacidadereservatorio.Name = "nudCapacidadereservatorio";
this.nudCapacidadereservatorio.Size = new System.Drawing.Size(73, 29);
this.nudCapacidadereservatorio.TabIndex = 11;
this.nudCapacidadereservatorio.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblUnCapcaidadereservatorio
//
this.lblUnCapcaidadereservatorio.AutoSize = true;
this.lblUnCapcaidadereservatorio.Location = new System.Drawing.Point(97, 57);
this.lblUnCapcaidadereservatorio.Name = "lblUnCapcaidadereservatorio";
this.lblUnCapcaidadereservatorio.Size = new System.Drawing.Size(48, 24);
this.lblUnCapcaidadereservatorio.TabIndex = 10;
this.lblUnCapcaidadereservatorio.Text = "litros";
//
// lblCapacidadereservatorio
//
this.lblCapacidadereservatorio.AutoSize = true;
this.lblCapacidadereservatorio.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblCapacidadereservatorio.Location = new System.Drawing.Point(14, 28);
this.lblCapacidadereservatorio.Name = "lblCapacidadereservatorio";
this.lblCapacidadereservatorio.Size = new System.Drawing.Size(191, 20);
this.lblCapacidadereservatorio.TabIndex = 9;
this.lblCapacidadereservatorio.Text = "Capacidade reservatório";
//
// frmParametrizacaoOperacao
//
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1020, 697);
this.ClientSize = new System.Drawing.Size(1020, 673);
this.Controls.Add(this.gpbConfiguracoesgerais);
this.Controls.Add(this.chbSalvar);
this.Controls.Add(this.btnSalvar);
this.Controls.Add(this.btnCarregar);
@ -578,8 +692,10 @@
this.gpbModulos.PerformLayout();
this.gpbP_Sen.ResumeLayout(false);
this.gpbP_Sen.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudTemposalvarlog)).EndInit();
this.gpbP_Atu.ResumeLayout(false);
this.gpbP_Atu.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudAtuarem)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudQtdCameras)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudQtdBicos)).EndInit();
this.gpbP_Dir.ResumeLayout(false);
@ -591,7 +707,9 @@
this.gpbP_Mov.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudVelocidadeComErvas)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudVelocidadeSemErvas)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudTemposalvarlog)).EndInit();
this.gpbConfiguracoesgerais.ResumeLayout(false);
this.gpbConfiguracoesgerais.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudCapacidadereservatorio)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -639,5 +757,15 @@
private System.Windows.Forms.Label lblTemposalvarlogU;
private System.Windows.Forms.NumericUpDown nudTemposalvarlog;
private System.Windows.Forms.Label lblTemposalvarlog;
private System.Windows.Forms.GroupBox gpbConfiguracoesgerais;
private System.Windows.Forms.TextBox txtDensidadeherbicida;
private System.Windows.Forms.Label lblUnDensidadeherbicida;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.NumericUpDown nudCapacidadereservatorio;
private System.Windows.Forms.Label lblUnCapcaidadereservatorio;
private System.Windows.Forms.Label lblCapacidadereservatorio;
private System.Windows.Forms.NumericUpDown nudAtuarem;
private System.Windows.Forms.Label lblAtuarem;
private System.Windows.Forms.ComboBox cmbScriptErvas;
}
}

View File

@ -1,4 +1,5 @@
using AgroBase.Models;
using AgroBase.Services;
using CefSharp.WinForms;
using System;
using System.Collections.Generic;
@ -21,6 +22,8 @@ namespace AgroBase.Forms.Operacoes
private void frmParametrizacaoOperacao_Load(object sender, EventArgs e)
{
cmbScriptErvas.Items.Clear();
cmbScriptErvas.Items.AddRange(new string[] { "weed-detector", "green-detector" });
CarregarParametros();
}
@ -60,6 +63,10 @@ namespace AgroBase.Forms.Operacoes
nudTemposalvarlog.Value = Variaveis.OperacaoEmAndamento.tmrLogs.Interval / 1000;
nudQtdBicos.Value = Variaveis.OperacaoEmAndamento.DispAtu.Dados.QuantidadeBicos;
nudQtdCameras.Value = Variaveis.OperacaoEmAndamento.QuantidadeCamerasSolo;
nudCapacidadereservatorio.Value = Convert.ToInt32(Variaveis.OperacaoEmAndamento.DispAtu.Dados.CapacidadeReservatorio);
txtDensidadeherbicida.Text = Variaveis.OperacaoEmAndamento.DispAtu.Dados.DensidadeHerbicida.ToString("0.00");
nudAtuarem.Value = Convert.ToInt32(Variaveis.OperacaoEmAndamento.DispAtu.Dados.PercentualInicioPulverizacao * 100);
cmbScriptErvas.SelectedIndex = cmbScriptErvas.Items.IndexOf(PythonService.ScriptWeedDetector.Replace(".py", ""));
}
private void chbD_CheckedChanged(object sender, EventArgs e)
@ -115,14 +122,18 @@ namespace AgroBase.Forms.Operacoes
void SalvarOperacao()
{
Variaveis.OperacaoEmAndamento.ModulosMandatorios = ModulosMandatorios.Where(x => x.Utilizar).ToList();
Variaveis.OperacaoEmAndamento.Controle.RPM_Max = Convert.ToInt32(nudVelocidadeSemErvas.Value);
Variaveis.OperacaoEmAndamento.Controle.RPM_Min = Convert.ToInt32(nudVelocidadeComErvas.Value);
Variaveis.OperacaoEmAndamento.Controle.Angulo_Max = Convert.ToInt32(nudAnguloMaximo.Value);
Variaveis.OperacaoEmAndamento.Controle.Angulo_Min = Convert.ToInt32(nudAnguloMinimo.Value);
Variaveis.OperacaoEmAndamento.Controle.VelocidadeMP = Convert.ToInt32(nudVelocidadeMP.Value);
Variaveis.OperacaoEmAndamento.tmrLogs.Interval = Convert.ToInt32(nudTemposalvarlog.Value * 1000);
Variaveis.OperacaoEmAndamento.DispAtu.Dados.QuantidadeBicos = Convert.ToInt32(nudQtdBicos.Value);
Variaveis.OperacaoEmAndamento.QuantidadeCamerasSolo = Convert.ToInt32(nudQtdCameras.Value);
Variaveis.OperacaoEmAndamento.Controle.RPM_Max = (int)(nudVelocidadeSemErvas.Value);
Variaveis.OperacaoEmAndamento.Controle.RPM_Min = (int)(nudVelocidadeComErvas.Value);
Variaveis.OperacaoEmAndamento.Controle.Angulo_Max = (int)(nudAnguloMaximo.Value);
Variaveis.OperacaoEmAndamento.Controle.Angulo_Min = (int)(nudAnguloMinimo.Value);
Variaveis.OperacaoEmAndamento.Controle.VelocidadeMP = (int)(nudVelocidadeMP.Value);
Variaveis.OperacaoEmAndamento.tmrLogs.Interval = (int)(nudTemposalvarlog.Value * 1000);
Variaveis.OperacaoEmAndamento.DispAtu.Dados.QuantidadeBicos = (int)nudQtdBicos.Value;
Variaveis.OperacaoEmAndamento.QuantidadeCamerasSolo = (int)nudQtdCameras.Value;
Variaveis.OperacaoEmAndamento.DispAtu.Dados.CapacidadeReservatorio = (double)nudCapacidadereservatorio.Value;
Variaveis.OperacaoEmAndamento.DispAtu.Dados.DensidadeHerbicida = Convert.ToDouble(txtDensidadeherbicida.Text.Replace(".", ","));
Variaveis.OperacaoEmAndamento.DispAtu.Dados.PercentualInicioPulverizacao = (double)(nudAtuarem.Value / 100);
PythonService.ScriptWeedDetector = cmbScriptErvas.Text + ".py";
if (chbSalvar.Checked)
{

View File

@ -266,6 +266,7 @@ namespace AgroBase
{
if (Variaveis.OperacaoEmAndamento.OperacaoLiberada)
{
Variaveis.OperacaoEmAndamento.frmOperacao = (Form)Activator.CreateInstance(Variaveis.OperacaoEmAndamento.frmOperacao.GetType());
Variaveis.OperacaoEmAndamento.frmOperacao.Show();
}
else

View File

@ -64,7 +64,7 @@ namespace AgroBase.Models
public string Nome { get; set; }
public int Posicao { get; set; }
public bool Iniciada { get; set; } = false;
public CameraService camera { get; set; }
public CameraService camera { get; set; } = new CameraService();
public ChromiumWebBrowser browser { get; set; }
public Panel panel { get;set; }
public ComboBox combo { get;set; }

View File

@ -121,11 +121,11 @@ namespace AgroBase.Models.Modules
List<string> Config = BicosPulverizadores.Select(x => x.ProtocoloConfiguracaoBico(Conectar)).ToList();
Config.AddRange(Sensores.Select(x => x.ProtocoloConfiguracaoSensor(Pinout, Conectar)).ToList());
string ProtocoloMOD = ((int)F_Code.Cfg).ToString() +
"MD".PadRight(5, ' ') + ";" + // 0 ~ 2
(Conectar ? "1" : "0") + ";" + // 4
_TaxaAmostragem.ToString("00000") + ";" + // 6 ~ 10
(Pinout.Any(x => x.Funcao == FuncoesPinout.Geral) ? Pinout.FirstOrDefault(x => x.Funcao == FuncoesPinout.Geral).Pino.ToString("00") : "-1") + ";" + // 12 ~ 13
(AtuacaoNivelAlto ? "1" : "0"); // 15
"MD".PadRight(5, ' ') + ";" + // 0 ~ 4
(Conectar ? "1" : "0") + ";" + // 6
_TaxaAmostragem.ToString("00000") + ";" + // 8 ~ 12
(Pinout.Any(x => x.Funcao == FuncoesPinout.Geral) ? Pinout.FirstOrDefault(x => x.Funcao == FuncoesPinout.Geral).Pino.ToString("00") : "-1") + ";" + // 14 ~ 15
(AtuacaoNivelAlto ? "1" : "0"); // 17
Config.Add(ProtocoloMOD);
return Config;
}
@ -356,5 +356,23 @@ namespace AgroBase.Models.Modules
return "";
}
public AtuadorBicoModel Clone()
{
AtuadorBicoModel clone = new AtuadorBicoModel()
{
ID = this.ID,
Posicao = this.Posicao,
Atuado = this.Atuado,
Comandar = this.Comandar,
Inicializado = this.Inicializado,
Testando = this.Testando,
Funcoes = this.Funcoes,
StatusBico = this.StatusBico,
MediaNivelFluxo = this.MediaNivelFluxo,
};
return clone;
}
}
}

View File

@ -4,6 +4,7 @@ using AgroBase.Forms.Operacoes;
using AgroBase.Models.Modules;
using AgroBase.Services;
using CefSharp.DevTools.Network;
using Emgu.CV.CvEnum;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@ -270,7 +271,7 @@ namespace AgroBase.Models
new OperacaoControleTipoModel()
{
Tipo = T_Code.Atu,
DelayEnvioComando = 100,
DelayEnvioComando = 500,
Comandos = new List<string>(),
UltimoComando = DateTime.Now
},
@ -468,14 +469,18 @@ namespace AgroBase.Models
ControleAnterior.Angulo = Controle.Angulo;
}
if (ControleAtu != null && Controle.BicosAtuados.Select(x => x.Atuado).ToList() != ControleAnterior.BicosAtuados.Select(x => x.Atuado).ToList() && (Agora - ControleAtu.UltimoComando).TotalMilliseconds > ControleAtu.DelayEnvioComando)
if (ControleAtu != null && !Controle.BicosAtuados.Select(x => x.Atuado).SequenceEqual(ControleAnterior.BicosAtuados.Select(x => x.Atuado)) && (Agora - ControleAtu.UltimoComando).TotalMilliseconds > ControleAtu.DelayEnvioComando)
{
// Enviar comando ATU
var Protocolos = EnviarProtocoloComando(DispAtu);
ControleAtu.UltimoComando = Agora;
ControleAtu.Comandos.AddRange(Protocolos);
ControleAnterior.BicosAtuados = new List<AtuadorBicoModel>(Controle.BicosAtuados);
ControleAnterior.BicosAtuados = new List<AtuadorBicoModel>();
foreach (var bico in Controle.BicosAtuados)
{
ControleAnterior.BicosAtuados.Add(bico.Clone());
}
}
AtualizarDadosOperacao();
@ -704,6 +709,7 @@ namespace AgroBase.Models
if (StatusOperacoesPararCarro.Contains(statusAtual))
{
var BicosNaoAtuados = new List<AtuadorBicoModel>(DispAtu.Dados.BicosPulverizadores);
BicosNaoAtuados.ForEach(x => x.Atuado = false);
Controle.BicosAtuados = BicosNaoAtuados.ToList();
Controle.RPM = 0;
Controle.Angulo = 0;

View File

@ -3,18 +3,22 @@ import numpy as np
from flask import Flask, Response, request
import json
import time
import socket
import threading
import sys
import os
import uuid
import paho.mqtt.client as mqtt
mqtt_client = mqtt.Client(f"client_weed_detector_{uuid.uuid4()}")
mqtt_client.connect("localhost", port=1883)
max_readings = int(sys.argv[1])
porta = sys.argv[2]
url = sys.argv[3]
arquivoSaida = sys.argv[4]
mostrar_linhas = sys.argv[5] == "1"
socket_porta = int(sys.argv[6])
mqtt_topic = sys.argv[6]
app = Flask(__name__)
@ -45,7 +49,6 @@ def detect_objects(conf_threshold, nms_threshold, _camera_index):
# Encontrar os contornos na máscara
contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
current_readings = []
idx = 0 # Índice de detecção
for contour in contours:
@ -75,6 +78,7 @@ def detect_objects(conf_threshold, nms_threshold, _camera_index):
json_data = {'timestamp': timestamp, 'x_max': width, 'y_max': height, 'objetos': current_readings}
readings.append(json_data)
mqtt_client.publish(mqtt_topic, json.dumps(json_data).encode('utf-8'))
if not os.path.exists(output_folder):
os.makedirs(output_folder)
@ -92,44 +96,9 @@ def detect_objects(conf_threshold, nms_threshold, _camera_index):
yield (b'--frame\r\n'
b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')
# Função para lidar com a conexão de cada cliente
def handle_client_connection(client_socket):
try:
while True:
# Enviar o dicionário serializado em JSON
client_socket.send(json.dumps(json_data).encode('utf-8'))
# Aguardar um pouco antes de enviar os próximos dados
time.sleep(0.2)
except socket.error:
print(f"Cliente desconectado.")
finally:
# Fechar a conexão do socket ao sair do loop
client_socket.close()
# Configuração inicial do servidor de socket
def start_server(address='localhost', port=socket_porta):
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((address, port))
server.listen()
print(f"Servidor iniciado. Aguardando conexões em {address}:{port}...")
try:
while True:
client_sock, address = server.accept()
print(f"Aceitando conexão de {address[0]}:{address[1]}")
client_handler = threading.Thread(
target=handle_client_connection,
args=(client_sock,)
)
client_handler.start()
finally:
server.close()
# Esta função é para iniciar o servidor de socket em uma thread separada
def run_socket_server():
start_server()
# Esta função é para confirmar que script está pronto para execução
def send_script_ready():
mqtt_client.publish(mqtt_topic, "OK")
# Iniciar o servidor Flask em uma thread separada
def run_flask_server():
@ -145,9 +114,9 @@ def video_feed():
# Iniciar o servidor
if __name__ == '__main__':
# Inicia o servidor de socket em uma thread separada
socket_server_thread = threading.Thread(target=run_socket_server)
socket_server_thread.start()
# Cria trhead separada para informar que o script iniciou com sucesso
mqtt_thread = threading.Thread(target=send_script_ready)
mqtt_thread.start()
# Inicia o servidor Flask na thread principal
run_flask_server()

View File

@ -47,6 +47,7 @@ def detect_objects(conf_threshold, nms_threshold, _camera_index):
while True:
ret, frame = cap.read()
#frame = cv2.flip(frame, 1)
if not ret:
break

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
[{"Latitude":-22.339442335994335,"Longitude":-47.264067138109773,"DataHora":"2024-03-11T10:18:12.8119243-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.339442335994335,"Longitude":-47.264067138109773,"DataHora":"2024-03-11T10:18:17.8102597-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.339566770425247,"Longitude":-47.263998524140789,"DataHora":"2024-03-11T10:18:22.8077452-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.339649665078522,"Longitude":-47.263954035496013,"DataHora":"2024-03-11T10:18:27.8115095-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T10:18:32.8078677-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T10:18:37.8077851-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.339979474804096,"Longitude":-47.263754241442221,"DataHora":"2024-03-11T10:18:42.9320465-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.339876852055113,"Longitude":-47.263804722781558,"DataHora":"2024-03-11T10:18:47.8100509-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.339790350419388,"Longitude":-47.263848455392754,"DataHora":"2024-03-11T10:18:52.8190482-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.339705045562265,"Longitude":-47.263892483009506,"DataHora":"2024-03-11T10:18:57.8090453-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.339620953376617,"Longitude":-47.2639368242459,"DataHora":"2024-03-11T10:19:02.8110451-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.339538088742589,"Longitude":-47.263981496828109,"DataHora":"2024-03-11T10:19:07.8600456-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.3394692684848,"Longitude":-47.264019238095237,"DataHora":"2024-03-11T10:19:12.8080447-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.3394692684848,"Longitude":-47.264019238095237,"DataHora":"2024-03-11T10:19:17.8150454-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.3394692684848,"Longitude":-47.264019238095237,"DataHora":"2024-03-11T10:19:22.809045-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.3394692684848,"Longitude":-47.264019238095237,"DataHora":"2024-03-11T10:19:27.8100446-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.3394692684848,"Longitude":-47.264019238095237,"DataHora":"2024-03-11T10:19:32.8650446-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.3394692684848,"Longitude":-47.264019238095237,"DataHora":"2024-03-11T10:19:37.808045-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.3394692684848,"Longitude":-47.264019238095237,"DataHora":"2024-03-11T10:19:42.8250438-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689},{"Latitude":-22.3394692684848,"Longitude":-47.264019238095237,"DataHora":"2024-03-11T10:20:24.8072454-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649627477730689}]

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
[{"Latitude":-22.339442335994335,"Longitude":-47.264067138109773,"DataHora":"2024-03-11T10:51:39.8887672-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339442335994335,"Longitude":-47.264067138109773,"DataHora":"2024-03-11T10:51:44.8887672-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339566770425247,"Longitude":-47.263998524140789,"DataHora":"2024-03-11T10:51:49.8857697-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339599779349204,"Longitude":-47.263980689109175,"DataHora":"2024-03-11T10:52:03.765768-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339632987002233,"Longitude":-47.26396290702327,"DataHora":"2024-03-11T10:52:04.8887663-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T10:52:09.8897689-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T10:52:14.8907652-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T10:52:17.8877678-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T10:52:19.8887655-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T10:52:24.8897648-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181}]

View File

@ -0,0 +1 @@
[{"Momento":"2024-03-11T13:21:29.5432427-03:00","ErvasNoRadar":2,"VelocidadeMedia":0.0,"HerbicidaConsumido":0.0,"HerbicidaPorErva":0.0,"PorcentagemBateria":0.0,"BateriaConsumida":0.0,"ErvasIdentificadas":2,"AtuacoesPorBico":[0,0,1,1],"DistanciaPercorrida":[],"ProgressoTrajeto":0.0,"ProgressoRua":0.0,"DistanciaEsquerda":0.0,"DistanciaDireita":0.0,"Status":2,"AnguloCarro":0.0,"AnguloCarroBussola":0.0,"AnguloRua":333.18452915675431,"AnguloRuaCamera":0.0,"AnguloDif":0.0,"Direcao":0,"DentroDaRua":false,"IdxPontoAproximadoRua":0,"IdxRuaAtual":0},{"Momento":"2024-03-11T13:21:34.6312576-03:00","ErvasNoRadar":2,"VelocidadeMedia":0.0,"HerbicidaConsumido":0.0,"HerbicidaPorErva":0.0,"PorcentagemBateria":0.0,"BateriaConsumida":0.0,"ErvasIdentificadas":2,"AtuacoesPorBico":[0,0,1,1],"DistanciaPercorrida":[],"ProgressoTrajeto":0.0,"ProgressoRua":0.0,"DistanciaEsquerda":0.0,"DistanciaDireita":0.0,"Status":3,"AnguloCarro":0.0,"AnguloCarroBussola":0.0,"AnguloRua":333.18452915675431,"AnguloRuaCamera":0.0,"AnguloDif":0.0,"Direcao":0,"DentroDaRua":false,"IdxPontoAproximadoRua":0,"IdxRuaAtual":0},{"Momento":"2024-03-11T13:21:40.0603985-03:00","ErvasNoRadar":0,"VelocidadeMedia":0.0,"HerbicidaConsumido":0.0,"HerbicidaPorErva":0.0,"PorcentagemBateria":0.0,"BateriaConsumida":0.0,"ErvasIdentificadas":4,"AtuacoesPorBico":[0,0,2,2],"DistanciaPercorrida":[0.0],"ProgressoTrajeto":0.0,"ProgressoRua":0.0,"DistanciaEsquerda":0.0,"DistanciaDireita":0.0,"Status":4,"AnguloCarro":0.0,"AnguloCarroBussola":0.0,"AnguloRua":333.28985968047516,"AnguloRuaCamera":0.0,"AnguloDif":0.0,"Direcao":0,"DentroDaRua":true,"IdxPontoAproximadoRua":1,"IdxRuaAtual":0},{"Momento":"2024-03-11T13:21:45.0976968-03:00","ErvasNoRadar":1,"VelocidadeMedia":0.0,"HerbicidaConsumido":0.0,"HerbicidaPorErva":0.0,"PorcentagemBateria":0.0,"BateriaConsumida":0.0,"ErvasIdentificadas":7,"AtuacoesPorBico":[0,0,4,3],"DistanciaPercorrida":[13.48707115148296],"ProgressoTrajeto":1.0108292305144342,"ProgressoRua":75.0,"DistanciaEsquerda":0.0,"DistanciaDireita":0.0,"Status":4,"AnguloCarro":332.9300096808405,"AnguloCarroBussola":0.0,"AnguloRua":333.80259639228933,"AnguloRuaCamera":0.0,"AnguloDif":-0.87258671144883238,"Direcao":1,"DentroDaRua":true,"IdxPontoAproximadoRua":6,"IdxRuaAtual":0},{"Momento":"2024-03-11T13:21:50.3466508-03:00","ErvasNoRadar":0,"VelocidadeMedia":0.0,"HerbicidaConsumido":0.0,"HerbicidaPorErva":0.0,"PorcentagemBateria":0.0,"BateriaConsumida":0.0,"ErvasIdentificadas":9,"AtuacoesPorBico":[0,0,5,4],"DistanciaPercorrida":[23.75605239910999],"ProgressoTrajeto":1.7804690059792978,"ProgressoRua":100.0,"DistanciaEsquerda":0.0,"DistanciaDireita":0.0,"Status":6,"AnguloCarro":333.49723623622646,"AnguloCarroBussola":0.0,"AnguloRua":333.85247665632448,"AnguloRuaCamera":0.0,"AnguloDif":-0.3552404200980277,"Direcao":1,"DentroDaRua":false,"IdxPontoAproximadoRua":8,"IdxRuaAtual":0},{"Momento":"2024-03-11T13:21:52.6201401-03:00","ErvasNoRadar":0,"VelocidadeMedia":0.0,"HerbicidaConsumido":0.0,"HerbicidaPorErva":0.0,"PorcentagemBateria":0.0,"BateriaConsumida":0.0,"ErvasIdentificadas":9,"AtuacoesPorBico":[0,0,5,4],"DistanciaPercorrida":[38.903501528505942],"ProgressoTrajeto":2.9157402724944363,"ProgressoRua":100.0,"DistanciaEsquerda":0.0,"DistanciaDireita":0.0,"Status":1,"AnguloCarro":340.9394044514255,"AnguloCarroBussola":0.0,"AnguloRua":333.85247665632448,"AnguloRuaCamera":0.0,"AnguloDif":7.086927795101019,"Direcao":1,"DentroDaRua":false,"IdxPontoAproximadoRua":8,"IdxRuaAtual":0}],{"Momento":"2024-03-11T13:21:56.4969269-03:00","ErvasNoRadar":0,"VelocidadeMedia":0.0,"HerbicidaConsumido":0.0,"HerbicidaPorErva":0.0,"PorcentagemBateria":0.0,"BateriaConsumida":0.0,"ErvasIdentificadas":9,"AtuacoesPorBico":[0,0,5,4],"DistanciaPercorrida":[43.01214660499496],"ProgressoTrajeto":3.2236750712715345,"ProgressoRua":100.0,"DistanciaEsquerda":0.0,"DistanciaDireita":0.0,"Status":1,"AnguloCarro":346.97996461589275,"AnguloCarroBussola":0.0,"AnguloRua":333.85247665632448,"AnguloRuaCamera":0.0,"AnguloDif":7.086927795101019,"Direcao":1,"DentroDaRua":false,"IdxPontoAproximadoRua":8,"IdxRuaAtual":0}]

View File

@ -0,0 +1 @@
[{"Latitude":-22.339442335994335,"Longitude":-47.264067138109773,"DataHora":"2024-03-11T13:21:28.8756051-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339442335994335,"Longitude":-47.264067138109773,"DataHora":"2024-03-11T13:21:33.8565666-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339550340751185,"Longitude":-47.264007461846653,"DataHora":"2024-03-11T13:21:39.2383954-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339632987002233,"Longitude":-47.26396290702327,"DataHora":"2024-03-11T13:21:44.5054063-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339761742622606,"Longitude":-47.263914810772093,"DataHora":"2024-03-11T13:21:48.9233839-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:21:51.0337572-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:21:55.8557602-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181}]

View File

@ -0,0 +1 @@
[{"Momento":"2024-03-11T13:31:06.1104539-03:00","ErvasNoRadar":0,"VelocidadeMedia":0.0,"HerbicidaConsumido":0.0,"HerbicidaPorErva":0.0,"PorcentagemBateria":0.0,"BateriaConsumida":0.0,"ErvasIdentificadas":3,"AtuacoesPorBico":[2,1,0,0],"DistanciaPercorrida":[],"ProgressoTrajeto":0.0,"ProgressoRua":0.0,"DistanciaEsquerda":0.0,"DistanciaDireita":0.0,"Status":2,"AnguloCarro":0.0,"AnguloCarroBussola":0.0,"AnguloRua":333.18452915675431,"AnguloRuaCamera":0.0,"AnguloDif":0.0,"Direcao":0,"DentroDaRua":false,"IdxPontoAproximadoRua":0,"IdxRuaAtual":0},{"Momento":"2024-03-11T13:31:11.0614079-03:00","ErvasNoRadar":1,"VelocidadeMedia":0.0,"HerbicidaConsumido":0.0,"HerbicidaPorErva":0.0,"PorcentagemBateria":0.0,"BateriaConsumida":0.0,"ErvasIdentificadas":6,"AtuacoesPorBico":[4,2,0,0],"DistanciaPercorrida":[],"ProgressoTrajeto":0.0,"ProgressoRua":0.0,"DistanciaEsquerda":0.0,"DistanciaDireita":0.0,"Status":2,"AnguloCarro":0.0,"AnguloCarroBussola":0.0,"AnguloRua":333.18452915675431,"AnguloRuaCamera":0.0,"AnguloDif":0.0,"Direcao":0,"DentroDaRua":false,"IdxPontoAproximadoRua":0,"IdxRuaAtual":0},{"Momento":"2024-03-11T13:31:16.4857229-03:00","ErvasNoRadar":0,"VelocidadeMedia":0.0,"HerbicidaConsumido":0.0,"HerbicidaPorErva":0.0,"PorcentagemBateria":0.0,"BateriaConsumida":0.0,"ErvasIdentificadas":9,"AtuacoesPorBico":[6,3,0,0],"DistanciaPercorrida":[0.0],"ProgressoTrajeto":0.0,"ProgressoRua":0.0,"DistanciaEsquerda":0.0,"DistanciaDireita":0.0,"Status":3,"AnguloCarro":0.0,"AnguloCarroBussola":0.0,"AnguloRua":333.18452915675431,"AnguloRuaCamera":0.0,"AnguloDif":0.0,"Direcao":0,"DentroDaRua":false,"IdxPontoAproximadoRua":0,"IdxRuaAtual":0},{"Momento":"2024-03-11T13:31:21.6096439-03:00","ErvasNoRadar":2,"VelocidadeMedia":0.0,"HerbicidaConsumido":0.0,"HerbicidaPorErva":0.0,"PorcentagemBateria":0.0,"BateriaConsumida":0.0,"ErvasIdentificadas":13,"AtuacoesPorBico":[8,5,0,0],"DistanciaPercorrida":[15.532164373823042],"ProgressoTrajeto":1.1641049109827626,"ProgressoRua":62.5,"DistanciaEsquerda":0.0,"DistanciaDireita":0.0,"Status":6,"AnguloCarro":332.97738784499131,"AnguloCarroBussola":0.0,"AnguloRua":333.70190396297835,"AnguloRuaCamera":0.0,"AnguloDif":-0.72451611798703652,"Direcao":1,"DentroDaRua":true,"IdxPontoAproximadoRua":5,"IdxRuaAtual":0},{"Momento":"2024-03-11T13:31:26.8771969-03:00","ErvasNoRadar":0,"VelocidadeMedia":0.0,"HerbicidaConsumido":0.0,"HerbicidaPorErva":0.0,"PorcentagemBateria":0.0,"BateriaConsumida":0.0,"ErvasIdentificadas":13,"AtuacoesPorBico":[8,5,0,0],"DistanciaPercorrida":[25.822843000933517],"ProgressoTrajeto":1.9353708620020584,"ProgressoRua":100.0,"DistanciaEsquerda":0.0,"DistanciaDireita":0.0,"Status":6,"AnguloCarro":333.59977895821442,"AnguloCarroBussola":0.0,"AnguloRua":333.85247665632448,"AnguloRuaCamera":0.0,"AnguloDif":-0.25269769811006881,"Direcao":1,"DentroDaRua":false,"IdxPontoAproximadoRua":8,"IdxRuaAtual":0},{"Momento":"2024-03-11T13:31:27.5429727-03:00","ErvasNoRadar":0,"VelocidadeMedia":0.0,"HerbicidaConsumido":0.0,"HerbicidaPorErva":0.0,"PorcentagemBateria":0.0,"BateriaConsumida":0.0,"ErvasIdentificadas":13,"AtuacoesPorBico":[8,5,0,0],"DistanciaPercorrida":[43.0191269239837],"ProgressoTrajeto":3.224198232333924,"ProgressoRua":100.0,"DistanciaEsquerda":0.0,"DistanciaDireita":0.0,"Status":1,"AnguloCarro":343.23615375058216,"AnguloCarroBussola":0.0,"AnguloRua":333.85247665632448,"AnguloRuaCamera":0.0,"AnguloDif":9.3836770942576777,"Direcao":1,"DentroDaRua":false,"IdxPontoAproximadoRua":8,"IdxRuaAtual":0}]

View File

@ -0,0 +1 @@
[{"Latitude":-22.339442335994335,"Longitude":-47.264067138109773,"DataHora":"2024-03-11T13:31:05.9494531-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339442335994335,"Longitude":-47.264067138109773,"DataHora":"2024-03-11T13:31:10.9967384-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339566770425247,"Longitude":-47.263998524140789,"DataHora":"2024-03-11T13:31:16.1497228-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339649665078522,"Longitude":-47.263954035496013,"DataHora":"2024-03-11T13:31:21.6086496-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:31:26.8751971-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:31:26.8751971-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181}]

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

@ -0,0 +1 @@
[{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:47:51.5765948-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:47:56.5424493-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:48:01.8100552-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:48:06.5418349-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:48:11.5416937-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:48:16.5707446-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:48:21.5445116-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:48:26.5426853-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:48:31.6023487-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:48:36.5439096-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:48:42.0669206-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:48:46.541417-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T13:48:46.9029468-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181}]

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

View File

@ -0,0 +1 @@
[{"Latitude":-22.339442335994335,"Longitude":-47.264067138109773,"DataHora":"2024-03-11T14:28:18.2613975-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339442335994335,"Longitude":-47.264067138109773,"DataHora":"2024-03-11T14:28:23.2618557-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339478335994333,"Longitude":-47.264047138109767,"DataHora":"2024-03-11T14:28:28.2681263-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339599779349204,"Longitude":-47.263980689109175,"DataHora":"2024-03-11T14:28:33.2603432-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339725742622608,"Longitude":-47.263923810772091,"DataHora":"2024-03-11T14:28:38.2632491-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T14:28:43.2658595-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T14:28:49.5417076-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T14:28:53.2640355-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T14:28:57.261243-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T14:28:58.2605893-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181}]

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
[{"Latitude":-22.339442335994335,"Longitude":-47.264067138109773,"DataHora":"2024-03-11T14:30:41.8239952-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339442335994335,"Longitude":-47.264067138109773,"DataHora":"2024-03-11T14:30:46.8356542-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339566770425247,"Longitude":-47.263998524140789,"DataHora":"2024-03-11T14:30:51.8257835-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339649665078522,"Longitude":-47.263954035496013,"DataHora":"2024-03-11T14:30:56.8234233-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T14:31:01.8264165-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T14:31:06.824916-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T14:31:11.8251428-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T14:31:16.8266843-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T14:31:21.8231112-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T14:31:26.8273181-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T14:31:26.8273181-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181},{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"2024-03-11T14:31:30.8230358-03:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":70.649306441870181}]

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

View File

@ -1 +1 @@
[{"Latitude":-22.339797742622608,"Longitude":-47.263905810772087,"DataHora":"0001-01-01T00:00:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":99.99,"Orientacao":0.0}]
[{"Latitude":0.0,"Longitude":0.0,"DataHora":"0001-01-01T00:00:00","Altitude":0.0,"Velocidade":0.0,"NumeroSatelites":0,"PrecisaoHorizontal":0.0,"Orientacao":0.0}]

View File

@ -1,60 +1,60 @@
[
{
"timestamp": 1709833298.4803495,
"timestamp": 1710180998.39519,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833298.8259332,
"timestamp": 1710180998.427191,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833299.103502,
"timestamp": 1710180998.4591894,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833299.4589717,
"timestamp": 1710180998.49119,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833299.7475274,
"timestamp": 1710180998.5231917,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833300.10481,
"timestamp": 1710180998.555189,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833300.3396745,
"timestamp": 1710180998.587189,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833300.5852246,
"timestamp": 1710180998.6361933,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833300.839123,
"timestamp": 1710180998.6671896,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833301.0551696,
"timestamp": 1710180998.70019,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []

View File

@ -1,60 +1,60 @@
[
{
"timestamp": 1709833297.0816422,
"timestamp": 1710180997.624466,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833297.3710158,
"timestamp": 1710180997.6554654,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833297.6820881,
"timestamp": 1710180997.6884649,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833298.0234702,
"timestamp": 1710180997.7194655,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833298.4008267,
"timestamp": 1710180997.752465,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833298.70839,
"timestamp": 1710180997.7834663,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833299.0429828,
"timestamp": 1710180997.8154655,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833299.3404396,
"timestamp": 1710180997.8476887,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833299.676528,
"timestamp": 1710180997.8796873,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1709833299.9792745,
"timestamp": 1710180997.9276876,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []

View File

@ -0,0 +1,215 @@
[
{
"timestamp": 1710173551.687718,
"x_max": 640.0,
"y_max": 480.0,
"objetos": [
{
"id": 0,
"descricao": "crop",
"x": 169,
"y": 143,
"largura": 234,
"altura": 172,
"confianca": 0.5374774932861328
},
{
"id": 0,
"descricao": "crop",
"x": 169,
"y": 143,
"largura": 231,
"altura": 176,
"confianca": 0.5227176547050476
}
]
},
{
"timestamp": 1710173551.8715377,
"x_max": 640.0,
"y_max": 480.0,
"objetos": [
{
"id": 0,
"descricao": "crop",
"x": 170,
"y": 144,
"largura": 232,
"altura": 169,
"confianca": 0.5341687798500061
},
{
"id": 0,
"descricao": "crop",
"x": 170,
"y": 144,
"largura": 229,
"altura": 174,
"confianca": 0.5135661959648132
}
]
},
{
"timestamp": 1710173552.0563934,
"x_max": 640.0,
"y_max": 480.0,
"objetos": [
{
"id": 0,
"descricao": "crop",
"x": 168,
"y": 144,
"largura": 233,
"altura": 169,
"confianca": 0.517839252948761
}
]
},
{
"timestamp": 1710173552.244704,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1710173552.427022,
"x_max": 640.0,
"y_max": 480.0,
"objetos": [
{
"id": 0,
"descricao": "crop",
"x": 161,
"y": 124,
"largura": 240,
"altura": 179,
"confianca": 0.5095964074134827
}
]
},
{
"timestamp": 1710173552.6098726,
"x_max": 640.0,
"y_max": 480.0,
"objetos": [
{
"id": 0,
"descricao": "crop",
"x": 159,
"y": 125,
"largura": 243,
"altura": 175,
"confianca": 0.5521326661109924
},
{
"id": 0,
"descricao": "crop",
"x": 161,
"y": 125,
"largura": 238,
"altura": 175,
"confianca": 0.5352640748023987
}
]
},
{
"timestamp": 1710173552.7977362,
"x_max": 640.0,
"y_max": 480.0,
"objetos": [
{
"id": 0,
"descricao": "crop",
"x": 157,
"y": 127,
"largura": 244,
"altura": 173,
"confianca": 0.598517894744873
},
{
"id": 0,
"descricao": "crop",
"x": 160,
"y": 126,
"largura": 237,
"altura": 174,
"confianca": 0.5805694460868835
}
]
},
{
"timestamp": 1710173552.9800768,
"x_max": 640.0,
"y_max": 480.0,
"objetos": [
{
"id": 0,
"descricao": "crop",
"x": 159,
"y": 126,
"largura": 240,
"altura": 176,
"confianca": 0.5590407848358154
},
{
"id": 0,
"descricao": "crop",
"x": 161,
"y": 124,
"largura": 235,
"altura": 177,
"confianca": 0.5433248281478882
}
]
},
{
"timestamp": 1710173553.163424,
"x_max": 640.0,
"y_max": 480.0,
"objetos": [
{
"id": 0,
"descricao": "crop",
"x": 155,
"y": 125,
"largura": 246,
"altura": 175,
"confianca": 0.6474350690841675
},
{
"id": 0,
"descricao": "crop",
"x": 159,
"y": 125,
"largura": 238,
"altura": 176,
"confianca": 0.6344596743583679
}
]
},
{
"timestamp": 1710173553.3512638,
"x_max": 640.0,
"y_max": 480.0,
"objetos": [
{
"id": 0,
"descricao": "crop",
"x": 156,
"y": 125,
"largura": 244,
"altura": 176,
"confianca": 0.6592578291893005
},
{
"id": 0,
"descricao": "crop",
"x": 159,
"y": 124,
"largura": 237,
"altura": 177,
"confianca": 0.6482002139091492
}
]
}
]

File diff suppressed because one or more lines are too long

View File

@ -1,42 +1,62 @@
[
{
"timestamp": 1702497316.221366,
"timestamp": 1710172557.8495998,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1702497316.2529476,
"timestamp": 1710172557.8816013,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1702497316.2853158,
"timestamp": 1710172557.9136014,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1702497316.3178427,
"timestamp": 1710172557.9456012,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1702497316.3489544,
"timestamp": 1710172557.9776018,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1702497316.3819983,
"timestamp": 1710172558.009603,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1702497316.4131682,
"timestamp": 1710172558.0416012,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1702497316.4452527,
"timestamp": 1710172558.0896037,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1702497316.4783282,
"timestamp": 1710172558.1226008,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1702497316.5099552,
"timestamp": 1710172558.1546042,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
}
]

View File

@ -3,18 +3,22 @@ import numpy as np
from flask import Flask, Response, request
import json
import time
import socket
import threading
import sys
import os
import uuid
import paho.mqtt.client as mqtt
mqtt_client = mqtt.Client(f"client_weed_detector_{uuid.uuid4()}")
mqtt_client.connect("localhost", port=1883)
max_readings = int(sys.argv[1])
porta = sys.argv[2]
url = sys.argv[3]
arquivoSaida = sys.argv[4]
mostrar_linhas = sys.argv[5] == "1"
socket_porta = int(sys.argv[6])
mqtt_topic = sys.argv[6]
app = Flask(__name__)
@ -45,7 +49,6 @@ def detect_objects(conf_threshold, nms_threshold, _camera_index):
# Encontrar os contornos na máscara
contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
current_readings = []
idx = 0 # Índice de detecção
for contour in contours:
@ -75,6 +78,7 @@ def detect_objects(conf_threshold, nms_threshold, _camera_index):
json_data = {'timestamp': timestamp, 'x_max': width, 'y_max': height, 'objetos': current_readings}
readings.append(json_data)
mqtt_client.publish(mqtt_topic, json.dumps(json_data).encode('utf-8'))
if not os.path.exists(output_folder):
os.makedirs(output_folder)
@ -92,44 +96,9 @@ def detect_objects(conf_threshold, nms_threshold, _camera_index):
yield (b'--frame\r\n'
b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')
# Função para lidar com a conexão de cada cliente
def handle_client_connection(client_socket):
try:
while True:
# Enviar o dicionário serializado em JSON
client_socket.send(json.dumps(json_data).encode('utf-8'))
# Aguardar um pouco antes de enviar os próximos dados
time.sleep(0.2)
except socket.error:
print(f"Cliente desconectado.")
finally:
# Fechar a conexão do socket ao sair do loop
client_socket.close()
# Configuração inicial do servidor de socket
def start_server(address='localhost', port=socket_porta):
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((address, port))
server.listen()
print(f"Servidor iniciado. Aguardando conexões em {address}:{port}...")
try:
while True:
client_sock, address = server.accept()
print(f"Aceitando conexão de {address[0]}:{address[1]}")
client_handler = threading.Thread(
target=handle_client_connection,
args=(client_sock,)
)
client_handler.start()
finally:
server.close()
# Esta função é para iniciar o servidor de socket em uma thread separada
def run_socket_server():
start_server()
# Esta função é para confirmar que script está pronto para execução
def send_script_ready():
mqtt_client.publish(mqtt_topic, "OK")
# Iniciar o servidor Flask em uma thread separada
def run_flask_server():
@ -145,9 +114,9 @@ def video_feed():
# Iniciar o servidor
if __name__ == '__main__':
# Inicia o servidor de socket em uma thread separada
socket_server_thread = threading.Thread(target=run_socket_server)
socket_server_thread.start()
# Cria trhead separada para informar que o script iniciou com sucesso
mqtt_thread = threading.Thread(target=send_script_ready)
mqtt_thread.start()
# Inicia o servidor Flask na thread principal
run_flask_server()

View File

@ -47,6 +47,7 @@ def detect_objects(conf_threshold, nms_threshold, _camera_index):
while True:
ret, frame = cap.read()
#frame = cv2.flip(frame, 1)
if not ret:
break

View File

@ -1 +1 @@
{"Conectado":true,"QuantidadeBicos":4,"DensidadeHerbicida":1.1,"CapacidadeReservatorio":30.0,"AtuacaoNivelAlto":false,"BicosPulverizadores":[{"ID":"B01","Posicao":1,"Atuado":false,"Comandar":true,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B02","Posicao":2,"Atuado":false,"Comandar":true,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B03","Posicao":3,"Atuado":false,"Comandar":true,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B04","Posicao":4,"Atuado":false,"Comandar":true,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B05","Posicao":5,"Atuado":false,"Comandar":false,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B06","Posicao":6,"Atuado":false,"Comandar":false,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B07","Posicao":7,"Atuado":false,"Comandar":false,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B08","Posicao":8,"Atuado":false,"Comandar":false,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B09","Posicao":9,"Atuado":false,"Comandar":false,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B10","Posicao":10,"Atuado":false,"Comandar":false,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0}],"Sensores":[{"LogGrafico":[],"ID":"FLXLN","Prioridade":10,"Descricao":"Fluxo na linha principal","Componente":198,"Aferir":true,"DelayAmostragem":200,"Inicializado":true,"Testando":false,"Funcoes":[25],"Parametros":[["Calibragem","00450"]],"UnidadeMedida":"L/m","Leituras":[0.0,0.0],"ValorMinimo":0.0,"ValorMaximo":26.67,"LimiteMaximo":0.0,"LimiteMinimo":0.0},{"LogGrafico":[],"ID":"MASRS","Prioridade":3,"Descricao":"Massa do reservatório de herbicida","Componente":532,"Aferir":true,"DelayAmostragem":1000,"Inicializado":true,"Testando":false,"Funcoes":[22,23],"Parametros":[],"UnidadeMedida":"Kg","Leituras":[1.0],"ValorMinimo":0.0,"ValorMaximo":1.0,"LimiteMaximo":25.0,"LimiteMinimo":3.0},{"LogGrafico":[],"ID":"PRSLN","Prioridade":3,"Descricao":"Pressão na linha principal","Componente":333,"Aferir":true,"DelayAmostragem":1000,"Inicializado":true,"Testando":false,"Funcoes":[24],"Parametros":[],"UnidadeMedida":"psi","Leituras":[0.32,277.0],"ValorMinimo":0.0,"ValorMaximo":0.77,"LimiteMaximo":0.0,"LimiteMinimo":0.0}],"PercentualInicioPulverizacao":0.3,"MassaReservatorio":1.0,"VolumeReservatorio":0.90909090909090906,"PercentualReservatorio":3.03030303030303,"MediaNivelFluxo":0.02,"PressaoLinha":0.32}
{"Conectado":false,"QuantidadeBicos":4,"DensidadeHerbicida":1.1,"CapacidadeReservatorio":30.0,"AtuacaoNivelAlto":true,"BicosPulverizadores":[{"ID":"B01","Posicao":1,"Atuado":false,"Comandar":true,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B02","Posicao":2,"Atuado":false,"Comandar":true,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B03","Posicao":3,"Atuado":false,"Comandar":true,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B04","Posicao":4,"Atuado":false,"Comandar":true,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B05","Posicao":5,"Atuado":false,"Comandar":false,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B06","Posicao":6,"Atuado":false,"Comandar":false,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B07","Posicao":7,"Atuado":false,"Comandar":false,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B08","Posicao":8,"Atuado":false,"Comandar":false,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B09","Posicao":9,"Atuado":false,"Comandar":false,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0},{"ID":"B10","Posicao":10,"Atuado":false,"Comandar":false,"Inicializado":false,"Testando":false,"Funcoes":[21],"StatusBico":false,"MediaNivelFluxo":0.0}],"Sensores":[{"LogGrafico":[],"ID":"FLXLN","Prioridade":10,"Descricao":"Fluxo na linha principal","Componente":198,"Aferir":false,"DelayAmostragem":200,"Inicializado":false,"Testando":false,"Funcoes":[25],"Parametros":[["Calibragem","00450"]],"UnidadeMedida":"L/m","Leituras":[0.0,0.0],"ValorMinimo":0.0,"ValorMaximo":26.67,"LimiteMaximo":0.0,"LimiteMinimo":0.0},{"LogGrafico":[],"ID":"MASRS","Prioridade":3,"Descricao":"Massa do reservatório de herbicida","Componente":532,"Aferir":false,"DelayAmostragem":1000,"Inicializado":false,"Testando":false,"Funcoes":[22,23],"Parametros":[],"UnidadeMedida":"Kg","Leituras":[0.0],"ValorMinimo":0.0,"ValorMaximo":1.0,"LimiteMaximo":25.0,"LimiteMinimo":3.0},{"LogGrafico":[],"ID":"PRSLN","Prioridade":3,"Descricao":"Pressão na linha principal","Componente":333,"Aferir":false,"DelayAmostragem":1000,"Inicializado":false,"Testando":false,"Funcoes":[24],"Parametros":[],"UnidadeMedida":"psi","Leituras":[0.22,190.0],"ValorMinimo":0.0,"ValorMaximo":0.77,"LimiteMaximo":0.0,"LimiteMinimo":0.0}],"PercentualInicioPulverizacao":0.35,"MassaReservatorio":0.0,"VolumeReservatorio":0.0,"PercentualReservatorio":0.0,"MediaNivelFluxo":0.01,"PressaoLinha":0.22}

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 @@
[{"Tipo":1,"Pino":99,"Descricao":"1","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":1,"Pino":98,"Descricao":"2","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":1,"Pino":36,"Descricao":"3","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":1,"Pino":39,"Descricao":"4","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":1,"Pino":34,"Descricao":"5","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":1,"Pino":35,"Descricao":"6","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":1,"Pino":32,"Descricao":"7","Funcao":21,"Habilitado":true,"ComponenteID":"B01"},{"Tipo":1,"Pino":33,"Descricao":"8","Funcao":21,"Habilitado":true,"ComponenteID":"B02"},{"Tipo":1,"Pino":25,"Descricao":"9","Funcao":21,"Habilitado":true,"ComponenteID":"B03"},{"Tipo":1,"Pino":26,"Descricao":"10","Funcao":21,"Habilitado":true,"ComponenteID":"B04"},{"Tipo":1,"Pino":27,"Descricao":"11","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":1,"Pino":14,"Descricao":"12","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":1,"Pino":12,"Descricao":"13","Funcao":24,"Habilitado":true,"ComponenteID":"PRSLN"},{"Tipo":1,"Pino":97,"Descricao":"14","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":1,"Pino":13,"Descricao":"15","Funcao":25,"Habilitado":true,"ComponenteID":"FLXLN"},{"Tipo":1,"Pino":9,"Descricao":"16","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":1,"Pino":10,"Descricao":"17","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":1,"Pino":11,"Descricao":"18","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":1,"Pino":96,"Descricao":"19","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":1,"Pino":6,"Descricao":"26","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":1,"Pino":7,"Descricao":"27","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":1,"Pino":8,"Descricao":"28","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":1,"Pino":15,"Descricao":"29","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":1,"Pino":2,"Descricao":"30","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":1,"Pino":0,"Descricao":"31","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":1,"Pino":4,"Descricao":"32","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":1,"Pino":16,"Descricao":"33","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":1,"Pino":17,"Descricao":"34","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":1,"Pino":5,"Descricao":"35","Funcao":22,"Habilitado":true,"ComponenteID":"MASRS"},{"Tipo":1,"Pino":18,"Descricao":"36","Funcao":23,"Habilitado":true,"ComponenteID":"MASRS"},{"Tipo":1,"Pino":19,"Descricao":"37","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":1,"Pino":95,"Descricao":"38","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":1,"Pino":21,"Descricao":"39","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":1,"Pino":3,"Descricao":"40","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":1,"Pino":1,"Descricao":"41","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":1,"Pino":22,"Descricao":"42","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":1,"Pino":23,"Descricao":"43","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":1,"Pino":94,"Descricao":"44","Funcao":0,"Habilitado":true,"ComponenteID":""}]
[{"Tipo":0,"Pino":99,"Descricao":"1","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":0,"Pino":98,"Descricao":"2","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":0,"Pino":97,"Descricao":"3","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":0,"Pino":4,"Descricao":"4","Funcao":21,"Habilitado":true,"ComponenteID":"B01"},{"Tipo":0,"Pino":5,"Descricao":"5","Funcao":21,"Habilitado":true,"ComponenteID":"B02"},{"Tipo":0,"Pino":6,"Descricao":"6","Funcao":21,"Habilitado":true,"ComponenteID":"B03"},{"Tipo":0,"Pino":7,"Descricao":"7","Funcao":21,"Habilitado":true,"ComponenteID":"B04"},{"Tipo":0,"Pino":15,"Descricao":"8","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":16,"Descricao":"9","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":17,"Descricao":"10","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":18,"Descricao":"11","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":8,"Descricao":"12","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":3,"Descricao":"13","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":46,"Descricao":"14","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":9,"Descricao":"15","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":10,"Descricao":"16","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":11,"Descricao":"17","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":12,"Descricao":"18","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":13,"Descricao":"19","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":14,"Descricao":"20","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":96,"Descricao":"21","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":0,"Pino":95,"Descricao":"22","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":0,"Pino":94,"Descricao":"23","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":0,"Pino":93,"Descricao":"24","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":0,"Pino":19,"Descricao":"25","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":20,"Descricao":"26","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":21,"Descricao":"27","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":47,"Descricao":"28","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":48,"Descricao":"29","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":45,"Descricao":"30","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":0,"Descricao":"31","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":35,"Descricao":"32","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":36,"Descricao":"33","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":37,"Descricao":"34","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":38,"Descricao":"35","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":39,"Descricao":"36","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":40,"Descricao":"37","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":41,"Descricao":"38","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":42,"Descricao":"39","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":2,"Descricao":"40","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":1,"Descricao":"41","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Tipo":0,"Pino":44,"Descricao":"42","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":0,"Pino":43,"Descricao":"43","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Tipo":0,"Pino":92,"Descricao":"44","Funcao":0,"Habilitado":false,"ComponenteID":""}]

View File

@ -0,0 +1,8 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
"version": "0.2.0",
"configurations": [
]
}

View File

@ -15,7 +15,7 @@ bool Conectado = false;
int _TaxaAmostragem = 500;
int BicosAtivos = 10;
bool AtuacaoNivelAlto = false;
bool AtuacaoNivelAlto = true;
class BicoPulverizador {
public:
@ -44,7 +44,7 @@ class BicoPulverizador {
EnviarDadosSerial(MontarProtocoloSensor(sCFG, _ID, Iniciado ? "1" : "0"));
return;
}
if (_pinoSolenoide > -1) {
pinMode(_pinoSolenoide, OUTPUT);
_BicoAtuado = !AtuacaoNivelAlto;
@ -498,7 +498,8 @@ SensorPressao* SPPorID(String ID) {
}
void ZerarPinos() {
const int gpios[] = {2, 4, 5, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, 33};
//const int gpios[] = {2, 4, 5, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, 33};
const int gpios[] = {4, 5, 6, 7, 15, 16, 17, 18, 8, 3, 46, 9, 10, 11, 12, 13, 14, 19, 20, 21, 47, 48, 45, 0, 35, 36, 37, 38, 39, 40, 41, 42, 2, 1};
for (int i = 0; i < sizeof(gpios) / sizeof(gpios[0]); i++) {
pinMode(gpios[i], OUTPUT);
@ -546,6 +547,9 @@ void loop() {
if (ID == "MD ") {
_TaxaAmostragem = ((String)Protocolo[8] + (String)Protocolo[9] + (String)Protocolo[10] + (String)Protocolo[11] + (String)Protocolo[12]).toInt();
int pinoReleGeral = ((String)Protocolo[14] + (String)Protocolo[15]).toInt();
bool _AtuaNivelAlto = (String)Protocolo[17] == "1";
AtuacaoNivelAlto = _AtuaNivelAlto;
if (pinoReleGeral > -1) {
pinMode(_pinoReleGeral, INPUT);
@ -565,7 +569,6 @@ void loop() {
bool bico_ativado = (String)Protocolo[8] == "1";
int posicao = ((String)Protocolo[10] + (String)Protocolo[11]).toInt();
int solenoide = ((String)Protocolo[13] + (String)Protocolo[14]).toInt();
if (bico_ativado) {
if (Conectar) {
_bico->_posicao = posicao;
@ -648,7 +651,7 @@ void loop() {
else if (_funcao == Cmd) {
//canal;potencia;sentido;rampa;precisao;rpm
//0;000;0;000;000;000
String ID = ((String)Protocolo[0] + (String)Protocolo[1] + (String)Protocolo[2]);
String ID = ((String)Protocolo[0] + (String)Protocolo[1] + (String)Protocolo[2] + " ");
BicoPulverizador* _bico = BicoPorID(ID);

View File

@ -0,0 +1,62 @@
[
{
"timestamp": 1710156769.1417994,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1710156769.591801,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1710156770.0317986,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1710156770.4707983,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1710156770.9117987,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1710156771.3448024,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1710156771.7877994,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1710156772.2297986,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1710156772.6668015,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
},
{
"timestamp": 1710156773.124801,
"x_max": 640.0,
"y_max": 480.0,
"objetos": []
}
]

117
Python/weed-detector/d1.py Normal file
View File

@ -0,0 +1,117 @@
import cv2
import numpy as np
from flask import Flask, Response, request
import json
import time
import threading
import sys
import os
import uuid
import paho.mqtt.client as mqtt
# Configurações iniciais
mqtt_client = mqtt.Client(f"client_weed_detector_{uuid.uuid4()}")
mqtt_client.connect("localhost", port=1883)
model_config = 'C:\\train\\models\\ervas\\ervas.cfg'
model_weights = 'C:\\train\\models\\ervas\\backup\\ervas_final.weights'
labels_path = 'C:\\train\\models\\ervas\\labels.txt'
with open(labels_path, 'rt') as f:
classes = f.read().rstrip('\n').split('\n')
# Utilizando a GPU com CUDA
net = cv2.dnn.readNetFromDarknet(model_config, model_weights)
net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
net.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)
# Configurações adicionais
output_folder = 'Python/Output/'
max_readings = int(sys.argv[1])
app = Flask(__name__)
def detect_objects(conf_threshold, nms_threshold, _camera_index):
cap = cv2.VideoCapture(_camera_index, cv2.CAP_DSHOW)
width = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)
readings = []
while True:
ret, frame = cap.read()
if not ret:
break
blob = cv2.dnn.blobFromImage(frame, 0.00392, (416, 416), (0, 0, 0), True, crop=False)
net.setInput(blob)
outs = net.forward(net.getUnconnectedOutLayersNames())
current_readings = process_detections(outs, width, height, conf_threshold, frame) # Passando 'frame' como argumento
global json_data
timestamp = time.time()
json_data = {'timestamp': timestamp, 'x_max': width, 'y_max': height, 'objetos': current_readings}
readings.append(json_data)
mqtt_client.publish(sys.argv[6], json.dumps(json_data).encode('utf-8'))
manage_output(readings, frame, max_readings)
ret, buffer = cv2.imencode('.jpg', frame)
frame = buffer.tobytes()
yield (b'--frame\r\n'
b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')
def process_detections(outs, width, height, conf_threshold, frame): # Recebendo 'frame' como argumento
current_readings = []
for out in outs:
for detection in out:
scores = detection[5:]
class_id = np.argmax(scores)
confidence = scores[class_id]
if confidence > conf_threshold:
x, y, w, h = calculate_box(detection, width, height)
detection_info = create_detection_info(class_id, x, y, w, h, confidence)
current_readings.append(detection_info)
if sys.argv[5] == "1":
draw_predictions(frame, class_id, confidence, x, y, w, h) # 'frame' já está disponível aqui
return current_readings
def draw_predictions(frame, class_id, confidence, x, y, w, h): # 'frame' é utilizado aqui
cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)
cv2.putText(frame, f'{classes[class_id]} {confidence:.2f}', (x, y - 5), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)
def calculate_box(detection, width, height):
center_x, center_y, w, h = detection[0:4] * np.array([width, height, width, height])
x, y = int(center_x - w / 2), int(center_y - h / 2)
return x, y, int(w), int(h)
def create_detection_info(class_id, x, y, w, h, confidence):
return {
'id': int(class_id),
'descricao': classes[class_id],
'x': x,
'y': y,
'largura': w,
'altura': h,
'confianca': float(confidence)
}
def manage_output(readings, frame, max_readings):
if len(readings) > max_readings:
readings.pop(0)
if not os.path.exists(output_folder):
os.makedirs(output_folder)
with open(output_folder + sys.argv[4], 'w') as file:
json.dump(readings, file, indent=4)
@app.route('/' + sys.argv[3], methods=['GET'])
def video_feed():
conf_threshold = float(request.args.get('conf_threshold'))
nms_threshold = float(request.args.get('nms_threshold'))
camera_index = int(request.args.get('camera_index'))
return Response(detect_objects(conf_threshold, nms_threshold, camera_index), mimetype='multipart/x-mixed-replace; boundary=frame')
if __name__ == '__main__':
threading.Thread(target=lambda: mqtt_client.publish(sys.argv[6], "OK")).start()
app.run(host='0.0.0.0', port=sys.argv[2], threaded=True, debug=False)