adicionado sistema de protecao do direcional
This commit is contained in:
parent
35887ba7f1
commit
e7926a19fd
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -44,9 +44,10 @@ namespace AgroBase.Forms
|
||||||
this.pnlCamera.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
this.pnlCamera.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
| System.Windows.Forms.AnchorStyles.Left)
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.pnlCamera.Location = new System.Drawing.Point(12, 12);
|
this.pnlCamera.Location = new System.Drawing.Point(9, 10);
|
||||||
|
this.pnlCamera.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||||
this.pnlCamera.Name = "pnlCamera";
|
this.pnlCamera.Name = "pnlCamera";
|
||||||
this.pnlCamera.Size = new System.Drawing.Size(600, 600);
|
this.pnlCamera.Size = new System.Drawing.Size(450, 488);
|
||||||
this.pnlCamera.TabIndex = 0;
|
this.pnlCamera.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// pnlLeituras
|
// pnlLeituras
|
||||||
|
|
@ -54,9 +55,10 @@ namespace AgroBase.Forms
|
||||||
this.pnlLeituras.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
this.pnlLeituras.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.pnlLeituras.AutoScroll = true;
|
this.pnlLeituras.AutoScroll = true;
|
||||||
this.pnlLeituras.Location = new System.Drawing.Point(618, 147);
|
this.pnlLeituras.Location = new System.Drawing.Point(464, 119);
|
||||||
|
this.pnlLeituras.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||||
this.pnlLeituras.Name = "pnlLeituras";
|
this.pnlLeituras.Name = "pnlLeituras";
|
||||||
this.pnlLeituras.Size = new System.Drawing.Size(188, 465);
|
this.pnlLeituras.Size = new System.Drawing.Size(141, 378);
|
||||||
this.pnlLeituras.TabIndex = 6;
|
this.pnlLeituras.TabIndex = 6;
|
||||||
//
|
//
|
||||||
// gpbCameras
|
// gpbCameras
|
||||||
|
|
@ -66,19 +68,21 @@ namespace AgroBase.Forms
|
||||||
this.gpbCameras.Controls.Add(this.btnAtualizar);
|
this.gpbCameras.Controls.Add(this.btnAtualizar);
|
||||||
this.gpbCameras.Controls.Add(this.btnSalvar);
|
this.gpbCameras.Controls.Add(this.btnSalvar);
|
||||||
this.gpbCameras.Controls.Add(this.cmbCameras);
|
this.gpbCameras.Controls.Add(this.cmbCameras);
|
||||||
this.gpbCameras.Location = new System.Drawing.Point(618, 12);
|
this.gpbCameras.Location = new System.Drawing.Point(464, 10);
|
||||||
|
this.gpbCameras.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||||
this.gpbCameras.Name = "gpbCameras";
|
this.gpbCameras.Name = "gpbCameras";
|
||||||
this.gpbCameras.Size = new System.Drawing.Size(188, 129);
|
this.gpbCameras.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||||
|
this.gpbCameras.Size = new System.Drawing.Size(141, 105);
|
||||||
this.gpbCameras.TabIndex = 7;
|
this.gpbCameras.TabIndex = 7;
|
||||||
this.gpbCameras.TabStop = false;
|
this.gpbCameras.TabStop = false;
|
||||||
this.gpbCameras.Text = "Cameras";
|
this.gpbCameras.Text = "Cameras";
|
||||||
//
|
//
|
||||||
// btnIniciar
|
// btnIniciar
|
||||||
//
|
//
|
||||||
this.btnIniciar.Enabled = false;
|
this.btnIniciar.Location = new System.Drawing.Point(4, 72);
|
||||||
this.btnIniciar.Location = new System.Drawing.Point(6, 89);
|
this.btnIniciar.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||||
this.btnIniciar.Name = "btnIniciar";
|
this.btnIniciar.Name = "btnIniciar";
|
||||||
this.btnIniciar.Size = new System.Drawing.Size(176, 28);
|
this.btnIniciar.Size = new System.Drawing.Size(132, 23);
|
||||||
this.btnIniciar.TabIndex = 3;
|
this.btnIniciar.TabIndex = 3;
|
||||||
this.btnIniciar.Text = "Iniciar";
|
this.btnIniciar.Text = "Iniciar";
|
||||||
this.btnIniciar.UseVisualStyleBackColor = true;
|
this.btnIniciar.UseVisualStyleBackColor = true;
|
||||||
|
|
@ -86,9 +90,10 @@ namespace AgroBase.Forms
|
||||||
//
|
//
|
||||||
// btnAtualizar
|
// btnAtualizar
|
||||||
//
|
//
|
||||||
this.btnAtualizar.Location = new System.Drawing.Point(6, 55);
|
this.btnAtualizar.Location = new System.Drawing.Point(4, 45);
|
||||||
|
this.btnAtualizar.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||||
this.btnAtualizar.Name = "btnAtualizar";
|
this.btnAtualizar.Name = "btnAtualizar";
|
||||||
this.btnAtualizar.Size = new System.Drawing.Size(85, 28);
|
this.btnAtualizar.Size = new System.Drawing.Size(64, 23);
|
||||||
this.btnAtualizar.TabIndex = 2;
|
this.btnAtualizar.TabIndex = 2;
|
||||||
this.btnAtualizar.Text = "Atualizar";
|
this.btnAtualizar.Text = "Atualizar";
|
||||||
this.btnAtualizar.UseVisualStyleBackColor = true;
|
this.btnAtualizar.UseVisualStyleBackColor = true;
|
||||||
|
|
@ -96,9 +101,10 @@ namespace AgroBase.Forms
|
||||||
//
|
//
|
||||||
// btnSalvar
|
// btnSalvar
|
||||||
//
|
//
|
||||||
this.btnSalvar.Location = new System.Drawing.Point(97, 55);
|
this.btnSalvar.Location = new System.Drawing.Point(73, 45);
|
||||||
|
this.btnSalvar.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||||
this.btnSalvar.Name = "btnSalvar";
|
this.btnSalvar.Name = "btnSalvar";
|
||||||
this.btnSalvar.Size = new System.Drawing.Size(85, 28);
|
this.btnSalvar.Size = new System.Drawing.Size(64, 23);
|
||||||
this.btnSalvar.TabIndex = 1;
|
this.btnSalvar.TabIndex = 1;
|
||||||
this.btnSalvar.Text = "Editar";
|
this.btnSalvar.Text = "Editar";
|
||||||
this.btnSalvar.UseVisualStyleBackColor = true;
|
this.btnSalvar.UseVisualStyleBackColor = true;
|
||||||
|
|
@ -109,19 +115,21 @@ namespace AgroBase.Forms
|
||||||
this.cmbCameras.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.cmbCameras.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
this.cmbCameras.Enabled = false;
|
this.cmbCameras.Enabled = false;
|
||||||
this.cmbCameras.FormattingEnabled = true;
|
this.cmbCameras.FormattingEnabled = true;
|
||||||
this.cmbCameras.Location = new System.Drawing.Point(6, 25);
|
this.cmbCameras.Location = new System.Drawing.Point(4, 20);
|
||||||
|
this.cmbCameras.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||||
this.cmbCameras.Name = "cmbCameras";
|
this.cmbCameras.Name = "cmbCameras";
|
||||||
this.cmbCameras.Size = new System.Drawing.Size(176, 24);
|
this.cmbCameras.Size = new System.Drawing.Size(133, 21);
|
||||||
this.cmbCameras.TabIndex = 0;
|
this.cmbCameras.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// frmAtuCamera
|
// frmAtuCamera
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(818, 625);
|
this.ClientSize = new System.Drawing.Size(614, 508);
|
||||||
this.Controls.Add(this.gpbCameras);
|
this.Controls.Add(this.gpbCameras);
|
||||||
this.Controls.Add(this.pnlLeituras);
|
this.Controls.Add(this.pnlLeituras);
|
||||||
this.Controls.Add(this.pnlCamera);
|
this.Controls.Add(this.pnlCamera);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||||
this.Name = "frmAtuCamera";
|
this.Name = "frmAtuCamera";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Text = "Identificação do solo";
|
this.Text = "Identificação do solo";
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using AgroBase.Models;
|
using AgroBase.Models;
|
||||||
using AgroBase.Services;
|
using AgroBase.Services;
|
||||||
|
using CefSharp.WinForms;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using static MqttService;
|
using static MqttService;
|
||||||
|
|
||||||
|
|
@ -45,7 +46,7 @@ namespace AgroBase.Forms
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
cameraSolo.camera.pythonProcess.Kill();
|
cameraSolo.camera.pythonProcess?.Kill();
|
||||||
Variaveis.MqttService.UnsubscribeAsync(cameraSolo.camera._mqttTopico).ConfigureAwait(false);
|
Variaveis.MqttService.UnsubscribeAsync(cameraSolo.camera._mqttTopico).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
@ -85,26 +86,82 @@ namespace AgroBase.Forms
|
||||||
{
|
{
|
||||||
VersaoArquivoModel ArquivoVersao = VersionamentoService.ArquivoModeloWeedDetector;
|
VersaoArquivoModel ArquivoVersao = VersionamentoService.ArquivoModeloWeedDetector;
|
||||||
|
|
||||||
cameraSolo.camera.IniciarCamera(
|
string CamNome = "Cam_Solo_0";
|
||||||
Variaveis.OperacaoEmAndamento.DispAtu.Dados.ScriptDeteccaoErvas,
|
CameraSoloModel CameraSolo = new CameraSoloModel()
|
||||||
new string[] {
|
{
|
||||||
cameraSolo.MaxLeituras.ToString(),
|
ID = "S0",
|
||||||
cameraSolo.VideoPorta,
|
Nome = CamNome,
|
||||||
cameraSolo.VideoUrl,
|
Posicao = 0,
|
||||||
cameraSolo.ArquivoLeitura,
|
ArquivoLeitura = "ervas_" + CamNome + ".json",
|
||||||
"1",
|
browser = null,
|
||||||
cameraSolo.MqttTopico,
|
camera = new CameraService(),
|
||||||
ArquivoVersao.Diretorio,
|
CameraSelecionada = "123",
|
||||||
ArquivoVersao.Versao
|
combo = new ComboBox(),
|
||||||
},
|
MaxLeituras = 1,
|
||||||
cameraSolo.VideoPorta,
|
VideoPorta = (VariaveisPortas.CameraSolo + 0).ToString(),
|
||||||
cameraSolo.VideoUrl,
|
VideoUrl = "green_objects_" + CamNome,
|
||||||
cameraSolo.MqttTopico
|
MqttTopico = "green_objects_" + CamNome,
|
||||||
);
|
};
|
||||||
|
CameraSolo.panel = pnlCamera;
|
||||||
|
CameraSolo.camera.selectedCamera = 1;
|
||||||
|
IniciarCameraSolo(CameraSolo);
|
||||||
|
|
||||||
tmrLeitura = new AsyncTaskTimerModel("tmrLeitura", tmrLeitura_Tick, 200);
|
tmrLeitura = new AsyncTaskTimerModel("tmrLeitura", tmrLeitura_Tick, 200);
|
||||||
tmrLeitura.Start();
|
tmrLeitura.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void IniciarCameraSolo(CameraSoloModel CameraSolo)
|
||||||
|
{
|
||||||
|
CameraSolo.DesligarCamera();
|
||||||
|
|
||||||
|
if (CameraSolo.camera.selectedCamera > 0)
|
||||||
|
{
|
||||||
|
VersaoArquivoModel ArquivoVersao = VersionamentoService.ArquivoModeloWeedDetector;
|
||||||
|
|
||||||
|
//CameraSolo.IniciarRotinaProcesso();
|
||||||
|
|
||||||
|
CameraSolo.camera.IniciarCamera(
|
||||||
|
Variaveis.OperacaoEmAndamento.DispAtu.Dados.ScriptDeteccaoErvas,
|
||||||
|
new string[] {
|
||||||
|
CameraSolo.MaxLeituras.ToString(),
|
||||||
|
CameraSolo.VideoPorta,
|
||||||
|
CameraSolo.VideoUrl,
|
||||||
|
CameraSolo.ArquivoLeitura,
|
||||||
|
"0",
|
||||||
|
CameraSolo.MqttTopico,
|
||||||
|
ArquivoVersao.Diretorio,
|
||||||
|
ArquivoVersao.Versao,
|
||||||
|
},
|
||||||
|
CameraSolo.VideoPorta,
|
||||||
|
CameraSolo.VideoUrl,
|
||||||
|
CameraSolo.MqttTopico,
|
||||||
|
async (Mensagem) =>
|
||||||
|
{
|
||||||
|
if (Mensagem.Momento > CameraSolo.camera.IniciadoEm && Mensagem.Mensagem == "OK")
|
||||||
|
{
|
||||||
|
CameraSolo.camera.ProntoEm = Mensagem.Momento;
|
||||||
|
|
||||||
|
if (CameraSolo.browser == null)
|
||||||
|
{
|
||||||
|
CameraSolo.Iniciada = true;
|
||||||
|
CameraSolo.browser = new ChromiumWebBrowser(CameraSolo.camera.URLcamera);
|
||||||
|
CameraSolo.browser.Dock = DockStyle.Fill;
|
||||||
|
|
||||||
|
CameraSolo.panel.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
CameraSolo.panel.Controls.Add(CameraSolo.browser);
|
||||||
|
CameraSolo.panel.Refresh();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.Write("Camera " + CameraSolo.Nome + " não foi configurada!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void AtualizaListaCameras()
|
private void AtualizaListaCameras()
|
||||||
|
|
@ -126,6 +183,12 @@ namespace AgroBase.Forms
|
||||||
|
|
||||||
//var coordenadas = cameraService.AferirDadosCamera<CameraCoordenadasModel>();
|
//var coordenadas = cameraService.AferirDadosCamera<CameraCoordenadasModel>();
|
||||||
var MqttTopico = Variaveis.MqttService.Topicos.FirstOrDefault(x => x.Topico == cameraSolo.MqttTopico);
|
var MqttTopico = Variaveis.MqttService.Topicos.FirstOrDefault(x => x.Topico == cameraSolo.MqttTopico);
|
||||||
|
|
||||||
|
if (MqttTopico == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CameraCoordenadasFrameModel leitura = null;
|
CameraCoordenadasFrameModel leitura = null;
|
||||||
List<MqttTopicosMensagensModel> msgs = new List<MqttTopicosMensagensModel>(MqttTopico.Mensagens);
|
List<MqttTopicosMensagensModel> msgs = new List<MqttTopicosMensagensModel>(MqttTopico.Mensagens);
|
||||||
var Mensagem = msgs.LastOrDefault(x => x.Momento > cameraSolo.camera.IniciadoEm);
|
var Mensagem = msgs.LastOrDefault(x => x.Momento > cameraSolo.camera.IniciadoEm);
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ namespace AgroBase.Forms.Sensoriamento
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Variaveis.MqttService.UnsubscribeAsync(cameraService._mqttTopico).GetAwaiter().GetResult();
|
Variaveis.MqttService.UnsubscribeAsync(cameraService._mqttTopico).GetAwaiter().GetResult();
|
||||||
cameraService.pythonProcess.Kill();
|
cameraService.pythonProcess?.Kill();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -229,15 +229,17 @@ namespace AgroBase.Forms
|
||||||
PictureBox pic = (PictureBox)sender;
|
PictureBox pic = (PictureBox)sender;
|
||||||
string ID = pic.Name.Replace("pic", "");
|
string ID = pic.Name.Replace("pic", "");
|
||||||
|
|
||||||
|
var SensorPot = Variaveis.OperacaoEmAndamento.DispSen.Dados.Sensores.FirstOrDefault(s => s.ID == "POT" + ID);
|
||||||
|
|
||||||
var Modulo = Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.FirstOrDefault(m => m.Modulo_ID == ID);
|
var Modulo = Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.FirstOrDefault(m => m.Modulo_ID == ID);
|
||||||
Label lblA_SP = pnlFundo.Controls.OfType<Label>().FirstOrDefault(ctrl => ctrl.Name == "lbl" + ID + "A_SP");
|
Label lblA_SP = pnlFundo.Controls.OfType<Label>().FirstOrDefault(ctrl => ctrl.Name == "lbl" + ID + "A_SP");
|
||||||
lblA_SP.Text = "Angulo SP: " + (Modulo.DirMotor.Angulo_SP).ToString("000") + "º";
|
lblA_SP.Text = "Angulo SP: " + (Modulo.DirMotor.Angulo_SP).ToString("000") + "º";
|
||||||
Label lblA = pnlFundo.Controls.OfType<Label>().FirstOrDefault(ctrl => ctrl.Name == "lbl" + ID + "A");
|
Label lblA = pnlFundo.Controls.OfType<Label>().FirstOrDefault(ctrl => ctrl.Name == "lbl" + ID + "A");
|
||||||
lblA.Text = "Angulo: " + Modulo.DirMotor.Angulo.ToString("000") + "º";
|
lblA.Text = "Angulo: " + Modulo.DirMotor.Angulo.ToString("000") + "º" + (SensorPot != null ? " (" + (((FirmwareSensorPotenciometro)SensorPot.Leitura)?.Angulo ?? -999) + "º / " + (((FirmwareSensorPotenciometro)SensorPot.Leitura)?.Leitura ?? -1) + ")" : "");
|
||||||
Label lblA_SentidoSP = pnlFundo.Controls.OfType<Label>().FirstOrDefault(ctrl => ctrl.Name == "lbl" + ID + "A_SentidoSP");
|
Label lblA_SentidoSP = pnlFundo.Controls.OfType<Label>().FirstOrDefault(ctrl => ctrl.Name == "lbl" + ID + "A_SentidoSP");
|
||||||
lblA_SentidoSP.Text = "Sentido SP: " + Enum.GetName(typeof(Sentido), Modulo.DirMotor.Sentido_SP);
|
lblA_SentidoSP.Text = "Sentido SP: " + Enum.GetName(typeof(Sentido), Modulo.DirMotor.Sentido_SP);
|
||||||
Label lblA_Sentido = pnlFundo.Controls.OfType<Label>().FirstOrDefault(ctrl => ctrl.Name == "lbl" + ID + "A_Sentido");
|
Label lblA_Sentido = pnlFundo.Controls.OfType<Label>().FirstOrDefault(ctrl => ctrl.Name == "lbl" + ID + "A_Sentido");
|
||||||
lblA_Sentido.Text = "Sentido: " + Enum.GetName(typeof(Sentido), Modulo.DirMotor.Sentido);
|
lblA_Sentido.Text = "Sentido: " + Enum.GetName(typeof(Sentido), Modulo.DirMotor.Sentido) + (SensorPot != null ? " (" + (((FirmwareSensorPotenciometro)SensorPot.Leitura)?.Sentido ?? Sentido.Parado) + ")" : "");
|
||||||
|
|
||||||
// Use o objeto Graphics para desenhar a representação do motor
|
// Use o objeto Graphics para desenhar a representação do motor
|
||||||
Graphics g = e.Graphics;
|
Graphics g = e.Graphics;
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ namespace AgroBase.Models
|
||||||
sATU = 478,
|
sATU = 478,
|
||||||
sRLE = 479,
|
sRLE = 479,
|
||||||
sFRO = 480,
|
sFRO = 480,
|
||||||
|
sPOT = 481,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum BotoesJoystick
|
public enum BotoesJoystick
|
||||||
|
|
@ -272,5 +273,15 @@ namespace AgroBase.Models
|
||||||
IA = 3
|
IA = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum StatusSensorPotenciometro
|
||||||
|
{
|
||||||
|
Indefinido = 0,
|
||||||
|
Centro = 1,
|
||||||
|
AEsquerda = 2,
|
||||||
|
LimiteEsquerdo = 3,
|
||||||
|
ADireita = 4,
|
||||||
|
LimiteDireita = 5
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,8 @@ namespace AgroBase.Models
|
||||||
public DateTime Momento { get; set; } = DateTime.Now;
|
public DateTime Momento { get; set; } = DateTime.Now;
|
||||||
public bool Get { get; set; }
|
public bool Get { get; set; }
|
||||||
public byte Comando { get; set; }
|
public byte Comando { get; set; }
|
||||||
|
public ModosComando ModoComando { get; set; }
|
||||||
|
public byte Registro { get; set; }
|
||||||
public byte Endereco { get; set; }
|
public byte Endereco { get; set; }
|
||||||
public double Angulo { get; set; }
|
public double Angulo { get; set; }
|
||||||
public double Velocidade { get; set; }
|
public double Velocidade { get; set; }
|
||||||
|
|
@ -96,4 +98,15 @@ namespace AgroBase.Models
|
||||||
Parando = 6,
|
Parando = 6,
|
||||||
Calibrando = 7,
|
Calibrando = 7,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum ModosComando
|
||||||
|
{
|
||||||
|
GetVersao = 0,
|
||||||
|
GetPulsos = 1,
|
||||||
|
GetIO = 2,
|
||||||
|
GetRPM = 3,
|
||||||
|
SetZero = 4,
|
||||||
|
SetParada = 5,
|
||||||
|
SetMovimento = 6
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -326,23 +326,33 @@ namespace AgroBase.Models.Modules
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var Controle = Variaveis.OperacaoEmAndamento.Controle.TiposControle?.FirstOrDefault(x => x.Tipo == T_Code.Dir);
|
|
||||||
foreach (var Modulo in Modulos.Where(x => x.DirMotor.Inicializado))
|
foreach (var Modulo in Modulos.Where(x => x.DirMotor.Inicializado))
|
||||||
{
|
{
|
||||||
byte modAddr = Modulo.DirMotor.EnderecoByte;
|
byte modAddr = Modulo.DirMotor.EnderecoByte;
|
||||||
if (!MKS057DService.Referenciando || (MKS057DService.Referenciando && MKS057DService.AddrRef == modAddr))
|
if (!MKS057DService.Referenciando || (MKS057DService.Referenciando && MKS057DService.AddrRef == modAddr))
|
||||||
{
|
{
|
||||||
bool reqParametros = true; // (!MKS057DService.Referenciando && (tmrRegistradorMKS.Ticks % 5 == 0)) || MKS057DService.Referenciando;
|
MKS057DService.AdicionarComandoNaFila(MKS057DService.MontarComandoRequisicaoPulsos(modAddr));
|
||||||
if (reqParametros)
|
MKS057DService.AdicionarComandoNaFila(MKS057DService.MontarComandoRequisicaoIO(modAddr));
|
||||||
|
|
||||||
|
if (Modulo.DirMotor.SensorAnguloAuxiliar != null && Modulo.DirMotor.SensorAnguloAuxiliar.LimiteExcedido)
|
||||||
{
|
{
|
||||||
MKS057DService.AdicionarComandoNaFila(MKS057DService.MontarComandoRequisicaoPulsos(modAddr));
|
if (Modulo.DirMotor.SensorAnguloAuxiliar.ReleControle != null)
|
||||||
MKS057DService.AdicionarComandoNaFila(MKS057DService.MontarComandoRequisicaoIO(modAddr));
|
{
|
||||||
|
GeneralJoystick.EnviarComandoSensoriamento(S_Code.sRLE, Modulo.DirMotor.SensorAnguloAuxiliar.ReleControle.ID, Estado.Desligado);
|
||||||
|
await Task.Delay(2000);
|
||||||
|
}
|
||||||
|
Direcao direcaoContraria = Modulo.DirMotor.SensorAnguloAuxiliar.Sentido == Sentido.Horario ? Direcao.Esquerda : Direcao.Direita;
|
||||||
|
Modulo.DirMotor.EnviarComandoControle(direcaoContraria);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
// 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 && (Modulo.DirMotor.UltimoComandoEnviado.AddMilliseconds(2000) < DateTime.Now) && !Modulo.DirMotor.AtingiuAnguloSP && Controle != null)
|
if (!MKS057DService.Referenciando && (Modulo.DirMotor.UltimoComandoEnviado.AddMilliseconds(1000) < DateTime.Now) && !Modulo.DirMotor.AtingiuAnguloSP)
|
||||||
{
|
{
|
||||||
Modulo.DirMotor.EnviarComandoControle(Controle.UltimaDirecao);
|
var Controle = Variaveis.OperacaoEmAndamento.Controle.TiposControle?.FirstOrDefault(x => x.Tipo == T_Code.Dir);
|
||||||
|
if (Controle != null)
|
||||||
|
{
|
||||||
|
Modulo.DirMotor.EnviarComandoControle(Controle.UltimaDirecao);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -408,7 +418,8 @@ namespace AgroBase.Models.Modules
|
||||||
TipoMovimentoDirecional tipoControle = Variaveis.OperacaoEmAndamento.Controle.TipoMovimento;
|
TipoMovimentoDirecional tipoControle = Variaveis.OperacaoEmAndamento.Controle.TipoMovimento;
|
||||||
|
|
||||||
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = TipoMovimentoDirecional.Diagnostico;
|
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = TipoMovimentoDirecional.Diagnostico;
|
||||||
foreach (var Modulo in Modulos.Where(x => x.DirMotor.Comandar && x.DirMotor.Inicializado && !x.DirMotor.IN1_Atuado))
|
var ModsRef = Modulos.Where(x => x.DirMotor.Comandar && x.DirMotor.Inicializado && !x.DirMotor.IN1_Atuado).ToList();
|
||||||
|
foreach (var Modulo in ModsRef)
|
||||||
{
|
{
|
||||||
await Modulo.DirMotor.ReferenciaMotor();
|
await Modulo.DirMotor.ReferenciaMotor();
|
||||||
}
|
}
|
||||||
|
|
@ -1000,6 +1011,13 @@ namespace AgroBase.Models.Modules
|
||||||
return Convert.ToByte(Endereco.Replace("0x", ""), 16);
|
return Convert.ToByte(Endereco.Replace("0x", ""), 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public string Mod_ID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Variaveis.OperacaoEmAndamento.DispMvd?.Dados?.Modulos?.FirstOrDefault(x => x.DirMotor.EnderecoByte == EnderecoByte)?.Modulo_ID ?? "";
|
||||||
|
}
|
||||||
|
}
|
||||||
public Sentido Sentido_SP { get; set; } = Sentido.Parado;
|
public Sentido Sentido_SP { get; set; } = Sentido.Parado;
|
||||||
public double Angulo_SP { get; set; } = 0;
|
public double Angulo_SP { get; set; } = 0;
|
||||||
public double Angulo_Offset { get; set; } = 0;
|
public double Angulo_Offset { get; set; } = 0;
|
||||||
|
|
@ -1071,6 +1089,18 @@ namespace AgroBase.Models.Modules
|
||||||
_leitura = value;
|
_leitura = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public FirmwareSensorPotenciometro SensorAnguloAuxiliar
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var sensor = Variaveis.OperacaoEmAndamento.DispSen?.Dados?.Sensores?.FirstOrDefault(x => x.Componente == S_Code.sPOT && x.ID.Contains(Mod_ID));
|
||||||
|
if (sensor != null && sensor.Inicializado && sensor.Leitura != null)
|
||||||
|
{
|
||||||
|
return sensor.Leitura as FirmwareSensorPotenciometro;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Direcao UltimaDirecao { get; set; } = Direcao.Parado;
|
public Direcao UltimaDirecao { get; set; } = Direcao.Parado;
|
||||||
public DateTime UltimoComandoEnviado { get; set; } = DateTime.MinValue;
|
public DateTime UltimoComandoEnviado { get; set; } = DateTime.MinValue;
|
||||||
|
|
@ -1219,32 +1249,44 @@ namespace AgroBase.Models.Modules
|
||||||
|
|
||||||
public void EnviarComandoControle(Direcao Direcao)
|
public void EnviarComandoControle(Direcao Direcao)
|
||||||
{
|
{
|
||||||
var simulando = Variaveis.OperacaoEmAndamento.Simulando;
|
var _Simulando = Variaveis.OperacaoEmAndamento.Simulando;
|
||||||
|
|
||||||
if ((Inicializado && (Comandar || !AtingiuAnguloSP)) || simulando)
|
if ((Inicializado && (Comandar || !AtingiuAnguloSP)) || _Simulando)
|
||||||
{
|
{
|
||||||
int AnguloTipoMovimento = VariaveisEquipamento.AnguloMovimento[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento];
|
var _Controle = Variaveis.OperacaoEmAndamento.Controle;
|
||||||
|
int AnguloTipoMovimento = VariaveisEquipamento.AnguloMovimento[_Controle.TipoMovimento];
|
||||||
|
|
||||||
|
bool limiteLateralExcedido = SensorAnguloAuxiliar?.LimiteExcedido ?? false;
|
||||||
|
|
||||||
if (UltimaDirecao != Direcao)
|
if (UltimaDirecao != Direcao)
|
||||||
{
|
{
|
||||||
Sentido_SP =
|
Sentido_SP =
|
||||||
Direcao == Direcao.Direita ? ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Direita :
|
Direcao == Direcao.Direita ? ConfigSentidos[_Controle.TipoMovimento].Direita :
|
||||||
Direcao == Direcao.Esquerda ? ConfigSentidos[Variaveis.OperacaoEmAndamento.Controle.TipoMovimento].Esquerda :
|
Direcao == Direcao.Esquerda ? ConfigSentidos[_Controle.TipoMovimento].Esquerda :
|
||||||
Sentido_SP == Sentido.Horario ? Sentido.Antihorario :
|
Sentido_SP == Sentido.Horario ? Sentido.Antihorario :
|
||||||
Sentido_SP == Sentido.Antihorario ? Sentido.Horario :
|
Sentido_SP == Sentido.Antihorario ? Sentido.Horario :
|
||||||
Sentido.Parado;
|
Sentido.Parado;
|
||||||
|
|
||||||
UltimaDirecao = Direcao;
|
if (!limiteLateralExcedido)
|
||||||
}
|
{
|
||||||
else if (AtingiuAnguloSP && RetornandoAzero && Angulo == 0)
|
UltimaDirecao = Direcao;
|
||||||
{
|
}
|
||||||
Sentido_SP = Sentido.Parado;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Angulo_SP =
|
if (RetornandoAzero || !Comandar || limiteLateralExcedido)
|
||||||
RetornandoAzero || !Comandar ? 0 :
|
{
|
||||||
AnguloTipoMovimento != -1 ? AnguloTipoMovimento :
|
Angulo_SP = 0;
|
||||||
Variaveis.OperacaoEmAndamento.Controle.Angulo;
|
Sentido_SP = Sentido.Parado;
|
||||||
|
UltimaDirecao = Direcao.Parado;
|
||||||
|
}
|
||||||
|
else if (AnguloTipoMovimento != -1)
|
||||||
|
{
|
||||||
|
Angulo_SP = AnguloTipoMovimento;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Angulo_SP = _Controle.Angulo;
|
||||||
|
}
|
||||||
|
|
||||||
if (Comandar)
|
if (Comandar)
|
||||||
{
|
{
|
||||||
|
|
@ -1255,7 +1297,7 @@ namespace AgroBase.Models.Modules
|
||||||
|
|
||||||
Angulo_SP = Math.Abs(Angulo_SP) * mx;
|
Angulo_SP = Math.Abs(Angulo_SP) * mx;
|
||||||
|
|
||||||
if (simulando)
|
if (_Simulando)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1286,7 +1328,6 @@ namespace AgroBase.Models.Modules
|
||||||
double _velocidadeAnterior = 0;
|
double _velocidadeAnterior = 0;
|
||||||
int _angulo = 45;
|
int _angulo = 45;
|
||||||
int _offset = 0;
|
int _offset = 0;
|
||||||
Sentido _sentido = Sentido.Horario;
|
|
||||||
int tentativas = 0;
|
int tentativas = 0;
|
||||||
double _anguloEntrada = 9999;
|
double _anguloEntrada = 9999;
|
||||||
double _anguloSaida = 9999;
|
double _anguloSaida = 9999;
|
||||||
|
|
@ -1297,6 +1338,12 @@ namespace AgroBase.Models.Modules
|
||||||
double anguloMaxVisitado = 0;
|
double anguloMaxVisitado = 0;
|
||||||
double anguloMinVisitado = 0;
|
double anguloMinVisitado = 0;
|
||||||
|
|
||||||
|
Sentido _sentido = Sentido.Horario;
|
||||||
|
if (SensorAnguloAuxiliar != null && SensorAnguloAuxiliar.Sentido != Sentido.Parado)
|
||||||
|
{
|
||||||
|
_sentido = SensorAnguloAuxiliar.Sentido == Sentido.Horario ? Sentido.Antihorario : Sentido.Horario;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Sucesso)
|
if (!Sucesso)
|
||||||
{
|
{
|
||||||
while (!Sucesso && tentativas < MaxTentativas && DateTime.Now < TimeoutGeral && MKS057DService.Referenciando)
|
while (!Sucesso && tentativas < MaxTentativas && DateTime.Now < TimeoutGeral && MKS057DService.Referenciando)
|
||||||
|
|
@ -1312,8 +1359,6 @@ namespace AgroBase.Models.Modules
|
||||||
{
|
{
|
||||||
bool _ref = IN1_Atuado;
|
bool _ref = IN1_Atuado;
|
||||||
|
|
||||||
//Sucesso = (EstadoInicial && !_ref) || (!EstadoInicial && _ref);
|
|
||||||
|
|
||||||
// Comecou com o sensor ja atuado
|
// Comecou com o sensor ja atuado
|
||||||
if (EstadoInicial)
|
if (EstadoInicial)
|
||||||
{
|
{
|
||||||
|
|
@ -1357,6 +1402,13 @@ namespace AgroBase.Models.Modules
|
||||||
if (_anguloEntrada == 9999)
|
if (_anguloEntrada == 9999)
|
||||||
{
|
{
|
||||||
inverterGiro = (_angulo > 0 && Angulo >= (_angulo - 0.5)) || (_angulo < 0 && Angulo <= (_angulo + 0.5));
|
inverterGiro = (_angulo > 0 && Angulo >= (_angulo - 0.5)) || (_angulo < 0 && Angulo <= (_angulo + 0.5));
|
||||||
|
if (!inverterGiro && SensorAnguloAuxiliar != null)
|
||||||
|
{
|
||||||
|
if (SensorAnguloAuxiliar.Angulo < (SensorAnguloAuxiliar.LimiteMinimo / 2.0) || SensorAnguloAuxiliar.Angulo > (SensorAnguloAuxiliar.LimiteMaximo / 2.0))
|
||||||
|
{
|
||||||
|
inverterGiro = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Sucesso = _anguloEntrada != 9999 && _anguloSaida != 9999;
|
Sucesso = _anguloEntrada != 9999 && _anguloSaida != 9999;
|
||||||
|
|
|
||||||
|
|
@ -372,7 +372,8 @@ namespace AgroBase.Models.Modules
|
||||||
ModbusDI,
|
ModbusDI,
|
||||||
ModbusRO,
|
ModbusRO,
|
||||||
ModbusDE_RE,
|
ModbusDE_RE,
|
||||||
ServoFreio
|
ServoFreio,
|
||||||
|
Potenciometro
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PinoutUtils
|
public static class PinoutUtils
|
||||||
|
|
|
||||||
|
|
@ -69,14 +69,10 @@ namespace AgroBase.Models.Modules
|
||||||
|
|
||||||
public static SensoriamentoModel CarregarParametrosIniciais()
|
public static SensoriamentoModel CarregarParametrosIniciais()
|
||||||
{
|
{
|
||||||
return new SensoriamentoModel()
|
var obj = new SensoriamentoModel()
|
||||||
{
|
{
|
||||||
CameraID_Caminho = "",
|
CameraID_Caminho = "",
|
||||||
CameraID_Solo = new List<string>()
|
CameraID_Solo = new List<string>(),
|
||||||
{
|
|
||||||
"",
|
|
||||||
""
|
|
||||||
},
|
|
||||||
Sinaleiros = new List<SensorSinaleiroModel>()
|
Sinaleiros = new List<SensorSinaleiroModel>()
|
||||||
{
|
{
|
||||||
new SensorSinaleiroModel()
|
new SensorSinaleiroModel()
|
||||||
|
|
@ -87,7 +83,7 @@ namespace AgroBase.Models.Modules
|
||||||
Funcoes = new List<FuncoesPinout>()
|
Funcoes = new List<FuncoesPinout>()
|
||||||
{
|
{
|
||||||
FuncoesPinout.Sinaleiro,
|
FuncoesPinout.Sinaleiro,
|
||||||
},
|
},
|
||||||
Comportamento = VariaveisEquipamento.ComportamentoPorStatus(StatusOperacao.NaoIniciado)
|
Comportamento = VariaveisEquipamento.ComportamentoPorStatus(StatusOperacao.NaoIniciado)
|
||||||
},
|
},
|
||||||
new SensorSinaleiroModel()
|
new SensorSinaleiroModel()
|
||||||
|
|
@ -120,9 +116,9 @@ namespace AgroBase.Models.Modules
|
||||||
ID = "TMVET",
|
ID = "TMVET",
|
||||||
Descricao = "Temperatura Motor Esquerdo Trás",
|
Descricao = "Temperatura Motor Esquerdo Trás",
|
||||||
Prioridade = 0,
|
Prioridade = 0,
|
||||||
Componente = S_Code.sTMP,
|
Componente = S_Code.sTMP,
|
||||||
Aferir = true,
|
Aferir = true,
|
||||||
Testando = false,
|
Testando = false,
|
||||||
Funcoes = new List<FuncoesPinout>()
|
Funcoes = new List<FuncoesPinout>()
|
||||||
{
|
{
|
||||||
FuncoesPinout.TMP,
|
FuncoesPinout.TMP,
|
||||||
|
|
@ -288,7 +284,7 @@ namespace AgroBase.Models.Modules
|
||||||
UnidadeMedida = "ºC",
|
UnidadeMedida = "ºC",
|
||||||
Parametros = new List<string[]>()
|
Parametros = new List<string[]>()
|
||||||
{
|
{
|
||||||
new string[] { "V offset", "0.0000" },
|
new string[] { "Offset", "0" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/*new SensorModel()
|
/*new SensorModel()
|
||||||
|
|
@ -370,6 +366,102 @@ namespace AgroBase.Models.Modules
|
||||||
LimiteMinimo = 40,
|
LimiteMinimo = 40,
|
||||||
LimiteMaximo = 9999,
|
LimiteMaximo = 9999,
|
||||||
},*/
|
},*/
|
||||||
|
new SensorModel()
|
||||||
|
{
|
||||||
|
ID = "POTET",
|
||||||
|
Descricao = "Potenciometro ET",
|
||||||
|
Prioridade = 24,
|
||||||
|
Componente = S_Code.sPOT,
|
||||||
|
Aferir = true,
|
||||||
|
Testando = false,
|
||||||
|
Funcoes = new List<FuncoesPinout>()
|
||||||
|
{
|
||||||
|
FuncoesPinout.Potenciometro,
|
||||||
|
},
|
||||||
|
DelayAmostragem = 500,
|
||||||
|
UnidadeMedida = "º",
|
||||||
|
Parametros = new List<string[]>()
|
||||||
|
{
|
||||||
|
new string[] { "Minimo", "-110" },
|
||||||
|
new string[] { "Meio", "0" },
|
||||||
|
new string[] { "Maximo", "110" },
|
||||||
|
new string[] { "Margem", "10" },
|
||||||
|
},
|
||||||
|
LimiteMaximo = 68,
|
||||||
|
LimiteMinimo = -110,
|
||||||
|
},
|
||||||
|
new SensorModel()
|
||||||
|
{
|
||||||
|
ID = "POTDT",
|
||||||
|
Descricao = "Potenciometro DT",
|
||||||
|
Prioridade = 24,
|
||||||
|
Componente = S_Code.sPOT,
|
||||||
|
Aferir = true,
|
||||||
|
Testando = false,
|
||||||
|
Funcoes = new List<FuncoesPinout>()
|
||||||
|
{
|
||||||
|
FuncoesPinout.Potenciometro,
|
||||||
|
},
|
||||||
|
DelayAmostragem = 500,
|
||||||
|
UnidadeMedida = "º",
|
||||||
|
Parametros = new List<string[]>()
|
||||||
|
{
|
||||||
|
new string[] { "Minimo", "-110" },
|
||||||
|
new string[] { "Meio", "0" },
|
||||||
|
new string[] { "Maximo", "110" },
|
||||||
|
new string[] { "Margem", "10" },
|
||||||
|
},
|
||||||
|
LimiteMaximo = 68,
|
||||||
|
LimiteMinimo = -110,
|
||||||
|
},
|
||||||
|
new SensorModel()
|
||||||
|
{
|
||||||
|
ID = "POTEF",
|
||||||
|
Descricao = "Potenciometro EF",
|
||||||
|
Prioridade = 24,
|
||||||
|
Componente = S_Code.sPOT,
|
||||||
|
Aferir = true,
|
||||||
|
Testando = false,
|
||||||
|
Funcoes = new List<FuncoesPinout>()
|
||||||
|
{
|
||||||
|
FuncoesPinout.Potenciometro,
|
||||||
|
},
|
||||||
|
DelayAmostragem = 500,
|
||||||
|
UnidadeMedida = "º",
|
||||||
|
Parametros = new List<string[]>()
|
||||||
|
{
|
||||||
|
new string[] { "Minimo", "-110" },
|
||||||
|
new string[] { "Meio", "0" },
|
||||||
|
new string[] { "Maximo", "110" },
|
||||||
|
new string[] { "Margem", "10" },
|
||||||
|
},
|
||||||
|
LimiteMaximo = 68,
|
||||||
|
LimiteMinimo = -110,
|
||||||
|
},
|
||||||
|
new SensorModel()
|
||||||
|
{
|
||||||
|
ID = "POTDF",
|
||||||
|
Descricao = "Potenciometro DF",
|
||||||
|
Prioridade = 24,
|
||||||
|
Componente = S_Code.sPOT,
|
||||||
|
Aferir = true,
|
||||||
|
Testando = false,
|
||||||
|
Funcoes = new List<FuncoesPinout>()
|
||||||
|
{
|
||||||
|
FuncoesPinout.Potenciometro,
|
||||||
|
},
|
||||||
|
DelayAmostragem = 500,
|
||||||
|
UnidadeMedida = "º",
|
||||||
|
Parametros = new List<string[]>()
|
||||||
|
{
|
||||||
|
new string[] { "Minimo", "-110" },
|
||||||
|
new string[] { "Meio", "0" },
|
||||||
|
new string[] { "Maximo", "110" },
|
||||||
|
new string[] { "Margem", "10" },
|
||||||
|
},
|
||||||
|
LimiteMaximo = 68,
|
||||||
|
LimiteMinimo = -110,
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
Reles = new List<SensorReleModel>()
|
Reles = new List<SensorReleModel>()
|
||||||
|
|
@ -379,22 +471,80 @@ namespace AgroBase.Models.Modules
|
||||||
ID = "RLLRA",
|
ID = "RLLRA",
|
||||||
Descricao = "Relé modo operação LoRa",
|
Descricao = "Relé modo operação LoRa",
|
||||||
Componente = S_Code.sRLE,
|
Componente = S_Code.sRLE,
|
||||||
Controlar = true,
|
Controlar = true,
|
||||||
|
AtuacaoNivelAlto = true,
|
||||||
Funcoes = new List<FuncoesPinout>()
|
Funcoes = new List<FuncoesPinout>()
|
||||||
{
|
{
|
||||||
FuncoesPinout.Rele,
|
FuncoesPinout.Rele,
|
||||||
},
|
},
|
||||||
StatusControle = Estado.Desligado,
|
StatusControle = Estado.Desligado,
|
||||||
|
ControleExterno = false,
|
||||||
|
},
|
||||||
|
new SensorReleModel()
|
||||||
|
{
|
||||||
|
ID = "RLPOTET",
|
||||||
|
Descricao = "Relé alimentação Direcional ET",
|
||||||
|
Componente = S_Code.sRLE,
|
||||||
|
Controlar = true,
|
||||||
|
AtuacaoNivelAlto = true,
|
||||||
|
Funcoes = new List<FuncoesPinout>()
|
||||||
|
{
|
||||||
|
FuncoesPinout.Rele,
|
||||||
|
},
|
||||||
|
StatusControle = Estado.Desligado,
|
||||||
|
ControleExterno = true,
|
||||||
|
},
|
||||||
|
new SensorReleModel()
|
||||||
|
{
|
||||||
|
ID = "RPOTRDT",
|
||||||
|
Descricao = "Relé alimentação Direcional DT",
|
||||||
|
Componente = S_Code.sRLE,
|
||||||
|
Controlar = true,
|
||||||
|
AtuacaoNivelAlto = true,
|
||||||
|
Funcoes = new List<FuncoesPinout>()
|
||||||
|
{
|
||||||
|
FuncoesPinout.Rele,
|
||||||
|
},
|
||||||
|
StatusControle = Estado.Desligado,
|
||||||
|
ControleExterno = true,
|
||||||
|
},
|
||||||
|
new SensorReleModel()
|
||||||
|
{
|
||||||
|
ID = "RLPOTEF",
|
||||||
|
Descricao = "Relé alimentação Direcional EF",
|
||||||
|
Componente = S_Code.sRLE,
|
||||||
|
Controlar = true,
|
||||||
|
AtuacaoNivelAlto = true,
|
||||||
|
Funcoes = new List<FuncoesPinout>()
|
||||||
|
{
|
||||||
|
FuncoesPinout.Rele,
|
||||||
|
},
|
||||||
|
StatusControle = Estado.Desligado,
|
||||||
|
ControleExterno = true,
|
||||||
|
},
|
||||||
|
new SensorReleModel()
|
||||||
|
{
|
||||||
|
ID = "RLPOTDF",
|
||||||
|
Descricao = "Relé alimentação Direcional DF",
|
||||||
|
Componente = S_Code.sRLE,
|
||||||
|
Controlar = true,
|
||||||
|
AtuacaoNivelAlto = true,
|
||||||
|
Funcoes = new List<FuncoesPinout>()
|
||||||
|
{
|
||||||
|
FuncoesPinout.Rele,
|
||||||
|
},
|
||||||
|
StatusControle = Estado.Desligado,
|
||||||
|
ControleExterno = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Servos = new List<SensorServoModel>()
|
Servos = new List<SensorServoModel>()
|
||||||
{
|
{
|
||||||
new SensorServoModel()
|
new SensorServoModel()
|
||||||
{
|
{
|
||||||
ID = "FRO_ET",
|
ID = "FRO_ET",
|
||||||
Descricao = "Freio Motor ET",
|
Descricao = "Freio Motor ET",
|
||||||
Componente = S_Code.sFRO,
|
Componente = S_Code.sFRO,
|
||||||
Controlar = true,
|
Controlar = true,
|
||||||
Funcoes = new List<FuncoesPinout>()
|
Funcoes = new List<FuncoesPinout>()
|
||||||
{
|
{
|
||||||
FuncoesPinout.ServoFreio,
|
FuncoesPinout.ServoFreio,
|
||||||
|
|
@ -406,7 +556,7 @@ namespace AgroBase.Models.Modules
|
||||||
ID = "FRO_EF",
|
ID = "FRO_EF",
|
||||||
Descricao = "Freio Motor EF",
|
Descricao = "Freio Motor EF",
|
||||||
Componente = S_Code.sFRO,
|
Componente = S_Code.sFRO,
|
||||||
Controlar = false,
|
Controlar = false,
|
||||||
Funcoes = new List<FuncoesPinout>()
|
Funcoes = new List<FuncoesPinout>()
|
||||||
{
|
{
|
||||||
FuncoesPinout.ServoFreio,
|
FuncoesPinout.ServoFreio,
|
||||||
|
|
@ -417,8 +567,8 @@ namespace AgroBase.Models.Modules
|
||||||
{
|
{
|
||||||
ID = "FRO_DT",
|
ID = "FRO_DT",
|
||||||
Descricao = "Freio Motor DT",
|
Descricao = "Freio Motor DT",
|
||||||
Componente = S_Code.sFRO,
|
Componente = S_Code.sFRO,
|
||||||
Controlar = true,
|
Controlar = true,
|
||||||
Funcoes = new List<FuncoesPinout>()
|
Funcoes = new List<FuncoesPinout>()
|
||||||
{
|
{
|
||||||
FuncoesPinout.ServoFreio,
|
FuncoesPinout.ServoFreio,
|
||||||
|
|
@ -430,7 +580,7 @@ namespace AgroBase.Models.Modules
|
||||||
ID = "FRO_DF",
|
ID = "FRO_DF",
|
||||||
Descricao = "Freio Motor DF",
|
Descricao = "Freio Motor DF",
|
||||||
Componente = S_Code.sFRO,
|
Componente = S_Code.sFRO,
|
||||||
Controlar = false,
|
Controlar = false,
|
||||||
Funcoes = new List<FuncoesPinout>()
|
Funcoes = new List<FuncoesPinout>()
|
||||||
{
|
{
|
||||||
FuncoesPinout.ServoFreio,
|
FuncoesPinout.ServoFreio,
|
||||||
|
|
@ -439,6 +589,13 @@ namespace AgroBase.Models.Modules
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < Variaveis.OperacaoEmAndamento.QuantidadeCamerasSolo; i++)
|
||||||
|
{
|
||||||
|
obj.CameraID_Solo.Add("");
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LimparDados<T>(T _dados)
|
public void LimparDados<T>(T _dados)
|
||||||
|
|
@ -484,6 +641,10 @@ namespace AgroBase.Models.Modules
|
||||||
// Inicializar o dicionário
|
// Inicializar o dicionário
|
||||||
var configDictionary = new Dictionary<string, List<string>>() { { Modulo_ID, new List<string>() } };
|
var configDictionary = new Dictionary<string, List<string>>() { { Modulo_ID, new List<string>() } };
|
||||||
|
|
||||||
|
// Adicionar configurações dos Reles
|
||||||
|
var relesConfig = RelesConfig(Conectar);
|
||||||
|
configDictionary[Modulo_ID].AddRange(relesConfig);
|
||||||
|
|
||||||
// Adicionar configurações dos Sensores que devem ser aferidos
|
// Adicionar configurações dos Sensores que devem ser aferidos
|
||||||
var sensoresConfig = SensoresConfig(Conectar);
|
var sensoresConfig = SensoresConfig(Conectar);
|
||||||
configDictionary[Modulo_ID].AddRange(sensoresConfig);
|
configDictionary[Modulo_ID].AddRange(sensoresConfig);
|
||||||
|
|
@ -492,10 +653,6 @@ namespace AgroBase.Models.Modules
|
||||||
var sinaleirosConfig = SinaleirosConfig(Conectar);
|
var sinaleirosConfig = SinaleirosConfig(Conectar);
|
||||||
configDictionary[Modulo_ID].AddRange(sinaleirosConfig);
|
configDictionary[Modulo_ID].AddRange(sinaleirosConfig);
|
||||||
|
|
||||||
// Adicionar configurações dos Reles
|
|
||||||
var relesConfig = RelesConfig(Conectar);
|
|
||||||
configDictionary[Modulo_ID].AddRange(relesConfig);
|
|
||||||
|
|
||||||
// Adicionar configurações dos Servos
|
// Adicionar configurações dos Servos
|
||||||
var servosConfig = ServosConfig(Conectar);
|
var servosConfig = ServosConfig(Conectar);
|
||||||
configDictionary[Modulo_ID].AddRange(servosConfig);
|
configDictionary[Modulo_ID].AddRange(servosConfig);
|
||||||
|
|
@ -638,7 +795,7 @@ namespace AgroBase.Models.Modules
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Console.WriteLine($"JSON recebido: {Protocolo}");
|
Console.WriteLine($"JSON recebido: {Protocolo}");
|
||||||
|
|
||||||
// Tenta desserializar o JSON
|
// Tenta desserializar o JSON
|
||||||
var dadosLeitura = JsonConvert.DeserializeObject<SensoriamentoMensagemJsonModel>(Protocolo);
|
var dadosLeitura = JsonConvert.DeserializeObject<SensoriamentoMensagemJsonModel>(Protocolo);
|
||||||
|
|
@ -769,7 +926,6 @@ namespace AgroBase.Models.Modules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public (bool, List<string>) StatusModulosSEN()
|
public (bool, List<string>) StatusModulosSEN()
|
||||||
{
|
{
|
||||||
var _Sensores = Sensores.Where(x => x.Aferir).ToList();
|
var _Sensores = Sensores.Where(x => x.Aferir).ToList();
|
||||||
|
|
@ -827,7 +983,7 @@ namespace AgroBase.Models.Modules
|
||||||
GeneralJoystick.EnviarComandoSensoriamento(S_Code.sLED, ledMN.ID, ledMN.Comportamento);
|
GeneralJoystick.EnviarComandoSensoriamento(S_Code.sLED, ledMN.ID, ledMN.Comportamento);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var rele in Reles.Where(x => x.Controlar && x.Inicializado))
|
foreach (var rele in Reles.Where(x => x.Controlar && x.Inicializado && !x.ControleExterno))
|
||||||
{
|
{
|
||||||
if (rele.StatusControle != rele.LeituraEstado)
|
if (rele.StatusControle != rele.LeituraEstado)
|
||||||
{
|
{
|
||||||
|
|
@ -877,6 +1033,9 @@ namespace AgroBase.Models.Modules
|
||||||
case S_Code.sMAS:
|
case S_Code.sMAS:
|
||||||
_leitura = Variaveis.OperacaoEmAndamento.DispAtu?.Dados?.DadosLeitura?.SensoresMassa?.FirstOrDefault(x => x.ID == ID);
|
_leitura = Variaveis.OperacaoEmAndamento.DispAtu?.Dados?.DadosLeitura?.SensoresMassa?.FirstOrDefault(x => x.ID == ID);
|
||||||
break;
|
break;
|
||||||
|
case S_Code.sPOT:
|
||||||
|
_leitura = Variaveis.OperacaoEmAndamento.DispSen?.Dados?.DadosLeitura?.SensoresPotenciometro?.FirstOrDefault(x => x.ID == ID);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
_leitura = null;
|
_leitura = null;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1007,7 +1166,7 @@ namespace AgroBase.Models.Modules
|
||||||
public string Descricao { get; set; }
|
public string Descricao { get; set; }
|
||||||
public S_Code Componente { get; set; }
|
public S_Code Componente { get; set; }
|
||||||
public List<FuncoesPinout> Funcoes { get; set; }
|
public List<FuncoesPinout> Funcoes { get; set; }
|
||||||
|
public bool ControleExterno { get; set; }
|
||||||
public bool Controlar { get; set; }
|
public bool Controlar { get; set; }
|
||||||
public bool AtuacaoNivelAlto { get; set; }
|
public bool AtuacaoNivelAlto { get; set; }
|
||||||
public Estado StatusControle { get; set; }
|
public Estado StatusControle { get; set; }
|
||||||
|
|
@ -1022,6 +1181,11 @@ namespace AgroBase.Models.Modules
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_leitura = value;
|
_leitura = value;
|
||||||
|
|
||||||
|
if (_leitura != null && ControleExterno)
|
||||||
|
{
|
||||||
|
StatusControle = _leitura.Leitura;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public bool Inicializado
|
public bool Inicializado
|
||||||
|
|
@ -1671,6 +1835,107 @@ namespace AgroBase.Models.Modules
|
||||||
public double Pressao { get; set; }
|
public double Pressao { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class FirmwareSensorPotenciometro
|
||||||
|
{
|
||||||
|
public string ID { get; set; }
|
||||||
|
private bool _iniciado = false;
|
||||||
|
public bool Iniciado
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (Variaveis.OperacaoEmAndamento.DispSen.Dados.DadosLeitura.Momento.AddMilliseconds(SensoriamentoModel.TempoLimiteConexao) < DateTime.Now)
|
||||||
|
{
|
||||||
|
_iniciado = false;
|
||||||
|
}
|
||||||
|
return _iniciado;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_iniciado = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int Leitura { get; set; }
|
||||||
|
public double Angulo { get; set; }
|
||||||
|
public Sentido Sentido { get; set; }
|
||||||
|
public bool LimiteExcedido { get; set; }
|
||||||
|
public StatusSensorPotenciometro Status
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
// Verifica se há um sensor ativo
|
||||||
|
SensorModel Sensor = Variaveis.OperacaoEmAndamento.DispSen?.Dados?.Sensores?.FirstOrDefault(x => x.ID == ID);
|
||||||
|
if (Sensor == null)
|
||||||
|
{
|
||||||
|
return StatusSensorPotenciometro.Indefinido;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifica se os parâmetros necessários existem
|
||||||
|
if (Sensor.Parametros.Count <= 3 || Sensor.Parametros[1].Count() <= 1 || Sensor.Parametros[3].Count() <= 1)
|
||||||
|
{
|
||||||
|
return StatusSensorPotenciometro.Indefinido;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LimiteExcedido && Sentido == Sentido.Horario)
|
||||||
|
{
|
||||||
|
return StatusSensorPotenciometro.LimiteDireita;
|
||||||
|
}
|
||||||
|
if (LimiteExcedido && Sentido == Sentido.Antihorario)
|
||||||
|
{
|
||||||
|
return StatusSensorPotenciometro.LimiteEsquerdo;
|
||||||
|
}
|
||||||
|
if (Sentido == Sentido.Parado)
|
||||||
|
{
|
||||||
|
return StatusSensorPotenciometro.Centro;
|
||||||
|
}
|
||||||
|
if (Sentido == Sentido.Antihorario)
|
||||||
|
{
|
||||||
|
return StatusSensorPotenciometro.AEsquerda;
|
||||||
|
}
|
||||||
|
if (Sentido == Sentido.Horario)
|
||||||
|
{
|
||||||
|
return StatusSensorPotenciometro.ADireita;
|
||||||
|
}
|
||||||
|
|
||||||
|
return StatusSensorPotenciometro.Indefinido;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double LimiteMaximo
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var sensor = Variaveis.OperacaoEmAndamento.DispSen?.Dados?.Sensores?.FirstOrDefault(x => x.ID == ID);
|
||||||
|
if (sensor != null)
|
||||||
|
{
|
||||||
|
return sensor.LimiteMaximo;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double LimiteMinimo
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var sensor = Variaveis.OperacaoEmAndamento.DispSen?.Dados?.Sensores?.FirstOrDefault(x => x.ID == ID);
|
||||||
|
if (sensor != null)
|
||||||
|
{
|
||||||
|
return sensor.LimiteMinimo;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public SensorReleModel ReleControle
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var rele = Variaveis.OperacaoEmAndamento.DispSen?.Dados?.Reles?.FirstOrDefault(x => x.ID.Contains(ID));
|
||||||
|
return rele;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public class SensoriamentoMensagemJsonModel
|
public class SensoriamentoMensagemJsonModel
|
||||||
{
|
{
|
||||||
|
|
@ -1684,6 +1949,7 @@ namespace AgroBase.Models.Modules
|
||||||
public List<FirmwareSinaleiro> Sinaleiros { get; set; } = new List<FirmwareSinaleiro>();
|
public List<FirmwareSinaleiro> Sinaleiros { get; set; } = new List<FirmwareSinaleiro>();
|
||||||
public List<FirmwareRele> Reles { get; set; } = new List<FirmwareRele>();
|
public List<FirmwareRele> Reles { get; set; } = new List<FirmwareRele>();
|
||||||
public List<FirmwareServoFreio> ServoFreios { get; set; } = new List<FirmwareServoFreio>();
|
public List<FirmwareServoFreio> ServoFreios { get; set; } = new List<FirmwareServoFreio>();
|
||||||
|
public List<FirmwareSensorPotenciometro> SensoresPotenciometro { get; set; } = new List<FirmwareSensorPotenciometro>();
|
||||||
public DateTime UltimoComandoRespondido { get; set; }
|
public DateTime UltimoComandoRespondido { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,9 @@ namespace AgroBase.Models.Operacoes
|
||||||
{
|
{
|
||||||
var Trajetoria = Variaveis.OperacaoEmAndamento.Trajetoria;
|
var Trajetoria = Variaveis.OperacaoEmAndamento.Trajetoria;
|
||||||
|
|
||||||
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = TipoMovimentoDirecional.RodasDianteiras;
|
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento =
|
||||||
//(Trajetoria.StatusAtual == StatusCarroMapa.Manobrando || Trajetoria.ManobrandoEntreRuas) ? TipoMovimentoDirecional.MovimentoArco :
|
(Trajetoria.StatusAtual == StatusCarroMapa.Manobrando || Trajetoria.ManobrandoEntreRuas) ? TipoMovimentoDirecional.MovimentoArco :
|
||||||
//TipoMovimentoDirecional.RodasDianteiras;
|
TipoMovimentoDirecional.RodasDianteiras;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalcularAnguloInclinacao()
|
private void CalcularAnguloInclinacao()
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,7 @@ namespace AgroBase.Models
|
||||||
public List<OperacaoParametrosMandatoriosModel> ParametrosMandatorios { get; set; } = new List<OperacaoParametrosMandatoriosModel>();
|
public List<OperacaoParametrosMandatoriosModel> ParametrosMandatorios { get; set; } = new List<OperacaoParametrosMandatoriosModel>();
|
||||||
public List<GPSModel> GPSTrajetoria { get; set; } = new List<GPSModel>();
|
public List<GPSModel> GPSTrajetoria { get; set; } = new List<GPSModel>();
|
||||||
public double CapacidadeReservatorio { get; set; } = 30;
|
public double CapacidadeReservatorio { get; set; } = 30;
|
||||||
public int QuantidadeCamerasSolo { get; set; } = 2;
|
public int QuantidadeCamerasSolo { get; set; } = 1;
|
||||||
public List<CameraSoloModel> CamerasSolo { get; set; } = new List<CameraSoloModel>();
|
public List<CameraSoloModel> CamerasSolo { get; set; } = new List<CameraSoloModel>();
|
||||||
public CameraCaminhoModel CameraCaminhoKinect { get; set; }
|
public CameraCaminhoModel CameraCaminhoKinect { get; set; }
|
||||||
public int TempoIniciarOperacao { get; set; } = 25;
|
public int TempoIniciarOperacao { get; set; } = 25;
|
||||||
|
|
@ -1004,7 +1004,7 @@ namespace AgroBase.Models
|
||||||
MqttTopico = "green_objects_" + CamNome,
|
MqttTopico = "green_objects_" + CamNome,
|
||||||
};
|
};
|
||||||
CamerasSolo.Add(CameraSolo);
|
CamerasSolo.Add(CameraSolo);
|
||||||
CameraSolo.camera.selectedCamera = listaCameras.ToList().IndexOf(CameraSolo.CameraSelecionada);
|
CameraSolo.camera.selectedCamera = true ? 1 : 0;
|
||||||
if (CameraSolo.camera.selectedCamera > 0 && Iniciar)
|
if (CameraSolo.camera.selectedCamera > 0 && Iniciar)
|
||||||
{
|
{
|
||||||
CameraSolo.panel = pnlCameraSolo[i];
|
CameraSolo.panel = pnlCameraSolo[i];
|
||||||
|
|
@ -1221,8 +1221,7 @@ namespace AgroBase.Models
|
||||||
var _Controle = Variaveis.OperacaoEmAndamento.Controle;
|
var _Controle = Variaveis.OperacaoEmAndamento.Controle;
|
||||||
var _ControleAnterior = Variaveis.OperacaoEmAndamento.ControleAnterior;
|
var _ControleAnterior = Variaveis.OperacaoEmAndamento.ControleAnterior;
|
||||||
|
|
||||||
// Comando dos motores
|
if (Dispositivo.Dados is MovimentacaoUnificadaModel)
|
||||||
if (Tipo == T_Code.Mov || Tipo == T_Code.Dir)
|
|
||||||
{
|
{
|
||||||
switch (Tipo)
|
switch (Tipo)
|
||||||
{
|
{
|
||||||
|
|
@ -1232,56 +1231,62 @@ namespace AgroBase.Models
|
||||||
{
|
{
|
||||||
_Controle.Direcao = Direcao.Parado;
|
_Controle.Direcao = Direcao.Parado;
|
||||||
}
|
}
|
||||||
else
|
else if(_Controle.RPM_SP < 0)
|
||||||
{
|
{
|
||||||
if (_Controle.RPM_SP < 0)
|
_Controle.PercentualVelocidadeSP *= -1;
|
||||||
{
|
_Controle.Direcao = Direcao.Tras;
|
||||||
_Controle.PercentualVelocidadeSP *= -1;
|
}
|
||||||
_Controle.Direcao = Direcao.Tras;
|
else if (_Controle.RPM_SP > 0)
|
||||||
}
|
{
|
||||||
else
|
_Controle.Direcao = Direcao.Frente;
|
||||||
{
|
|
||||||
_Controle.Direcao = Direcao.Frente;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
((MovimentacaoUnificadaModel)Dispositivo.Dados).Modulos.ForEach(Mod => Mod.MovMotor.EnviarComandoControle(_Controle.Direcao));
|
if (_Controle.RPM_SP != _ControleAnterior.RPM_SP)
|
||||||
_Controle.TiposControle.FirstOrDefault(x => x.Tipo == Tipo).UltimaDirecao = _Controle.Direcao;
|
{
|
||||||
|
((MovimentacaoUnificadaModel)Dispositivo.Dados).Modulos.ForEach(Mod => Mod.MovMotor.EnviarComandoControle(_Controle.Direcao));
|
||||||
|
|
||||||
|
_Controle.TiposControle.FirstOrDefault(x => x.Tipo == Tipo).UltimaDirecao = _Controle.Direcao;
|
||||||
|
}
|
||||||
|
|
||||||
_ControleAnterior.PercentualVelocidadeSP = _Controle.PercentualVelocidadeSP;
|
_ControleAnterior.PercentualVelocidadeSP = _Controle.PercentualVelocidadeSP;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case T_Code.Dir:
|
case T_Code.Dir:
|
||||||
{
|
{
|
||||||
if (_Controle.Angulo < 0)
|
if (_Controle.Angulo == 0)
|
||||||
{
|
|
||||||
if (_ControleAnterior.Angulo < _Controle.Angulo)
|
|
||||||
{
|
|
||||||
_Controle.Direcao = Direcao.Direita;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_Controle.Direcao = Direcao.Esquerda;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (_Controle.Angulo > 0)
|
|
||||||
{
|
|
||||||
if (_ControleAnterior.Angulo > _Controle.Angulo)
|
|
||||||
{
|
|
||||||
_Controle.Direcao = Direcao.Esquerda;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_Controle.Direcao = Direcao.Direita;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
_Controle.Direcao = Direcao.Parado;
|
_Controle.Direcao = Direcao.Parado;
|
||||||
}
|
}
|
||||||
|
else if (_Controle.Angulo < 0) // Ângulo negativo
|
||||||
|
{
|
||||||
|
if (_ControleAnterior.Angulo < _Controle.Angulo) // Movendo-se para menos negativo (ex: -30 → -10)
|
||||||
|
{
|
||||||
|
_Controle.Direcao = Direcao.Direita;
|
||||||
|
}
|
||||||
|
else if (_ControleAnterior.Angulo > _Controle.Angulo) // Movendo-se para mais negativo (ex: -10 → -30)
|
||||||
|
{
|
||||||
|
_Controle.Direcao = Direcao.Esquerda;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (_Controle.Angulo > 0) // Ângulo positivo
|
||||||
|
{
|
||||||
|
if (_ControleAnterior.Angulo > _Controle.Angulo) // Movendo-se para menos positivo (ex: 30 → 10)
|
||||||
|
{
|
||||||
|
_Controle.Direcao = Direcao.Esquerda;
|
||||||
|
}
|
||||||
|
else if (_ControleAnterior.Angulo < _Controle.Angulo) // Movendo-se para mais positivo (ex: 10 → 30)
|
||||||
|
{
|
||||||
|
_Controle.Direcao = Direcao.Direita;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
((MovimentacaoUnificadaModel)Dispositivo.Dados).Modulos.ForEach(Mod => Mod.DirMotor.EnviarComandoControle(_Controle.Direcao));
|
// Só enviar comando se a direção realmente mudou
|
||||||
_Controle.TiposControle.FirstOrDefault(x => x.Tipo == Tipo).UltimaDirecao = _Controle.Direcao;
|
if (_ControleAnterior.Angulo != _Controle.Angulo)
|
||||||
|
{
|
||||||
|
((MovimentacaoUnificadaModel)Dispositivo.Dados).Modulos.ForEach(Mod => Mod.DirMotor.EnviarComandoControle(_Controle.Direcao));
|
||||||
|
|
||||||
|
_Controle.TiposControle.FirstOrDefault(x => x.Tipo == Tipo).UltimaDirecao = _Controle.Direcao;
|
||||||
|
}
|
||||||
|
|
||||||
_ControleAnterior.Angulo = _Controle.Angulo;
|
_ControleAnterior.Angulo = _Controle.Angulo;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1294,8 +1299,7 @@ namespace AgroBase.Models
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
// Comando dos atuadores
|
else if (Dispositivo.Dados is AtuadorModel)
|
||||||
else if (Tipo == T_Code.Atu)
|
|
||||||
{
|
{
|
||||||
_Controle.BicosAtuados = ((AtuadorModel)Dispositivo.Dados).BicosPulverizadores.Select(x => x.Clone()).ToList();
|
_Controle.BicosAtuados = ((AtuadorModel)Dispositivo.Dados).BicosPulverizadores.Select(x => x.Clone()).ToList();
|
||||||
|
|
||||||
|
|
@ -1968,8 +1972,8 @@ namespace AgroBase.Models
|
||||||
a05 = T_Code.A05.ToString(),
|
a05 = T_Code.A05.ToString(),
|
||||||
knt = T_Code.Knt.ToString(),
|
knt = T_Code.Knt.ToString(),
|
||||||
caminho = Variaveis.OperacaoEmAndamento.CameraCaminhoKinect.Nome,
|
caminho = Variaveis.OperacaoEmAndamento.CameraCaminhoKinect.Nome,
|
||||||
soloE = Variaveis.OperacaoEmAndamento.CamerasSolo[0].Nome,
|
soloE = Variaveis.OperacaoEmAndamento.CamerasSolo.FirstOrDefault()?.Nome ?? "solo0",
|
||||||
soloD = Variaveis.OperacaoEmAndamento.CamerasSolo[1].Nome
|
soloD = Variaveis.OperacaoEmAndamento.CamerasSolo.Skip(1)?.FirstOrDefault()?.Nome ?? "solo1"
|
||||||
};
|
};
|
||||||
File.WriteAllText(ArquivoOp, JsonConvert.SerializeObject(data));
|
File.WriteAllText(ArquivoOp, JsonConvert.SerializeObject(data));
|
||||||
}
|
}
|
||||||
|
|
@ -2757,17 +2761,6 @@ namespace AgroBase.Models
|
||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
case TipoMovimentoDirecional.RodasDianteiras:
|
case TipoMovimentoDirecional.RodasDianteiras:
|
||||||
/*foreach(var Mod in DispMvd.Dados.Modulos)
|
|
||||||
{
|
|
||||||
bool Comandar = Mod.Modulo_ID.Contains("F");
|
|
||||||
if (!Comandar && Mod.DirMotor.Angulo != 0)
|
|
||||||
{
|
|
||||||
MKS057DService.AdicionarComandoNaFila(MKS057DService.MontarComandoMovimento(Mod.DirMotor.EnderecoByte, 0, 50, Sentido.Parado));
|
|
||||||
Mod.DirMotor.Comandar = Comandar;
|
|
||||||
}
|
|
||||||
|
|
||||||
Mod.MovMotor.Comandar = true;
|
|
||||||
}*/
|
|
||||||
DispMvd.Dados.Modulos.ForEach(x =>
|
DispMvd.Dados.Modulos.ForEach(x =>
|
||||||
{
|
{
|
||||||
x.MovMotor.Comandar = true;
|
x.MovMotor.Comandar = true;
|
||||||
|
|
@ -2775,17 +2768,6 @@ namespace AgroBase.Models
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case TipoMovimentoDirecional.RodasTraseiras:
|
case TipoMovimentoDirecional.RodasTraseiras:
|
||||||
/*foreach (var Mod in DispMvd.Dados.Modulos)
|
|
||||||
{
|
|
||||||
bool Comandar = Mod.Modulo_ID.Contains("T");
|
|
||||||
if (!Comandar && Mod.DirMotor.Angulo != 0)
|
|
||||||
{
|
|
||||||
MKS057DService.AdicionarComandoNaFila(MKS057DService.MontarComandoMovimento(Mod.DirMotor.EnderecoByte, 0, 50, Sentido.Parado));
|
|
||||||
Mod.DirMotor.Comandar = Comandar;
|
|
||||||
}
|
|
||||||
|
|
||||||
Mod.MovMotor.Comandar = true;
|
|
||||||
}*/
|
|
||||||
DispMvd.Dados.Modulos.ForEach(x =>
|
DispMvd.Dados.Modulos.ForEach(x =>
|
||||||
{
|
{
|
||||||
x.MovMotor.Comandar = true;
|
x.MovMotor.Comandar = true;
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -80,6 +80,8 @@ namespace AgroBase.Services
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Console.WriteLine($"{ScriptPath} {Args}");
|
||||||
|
|
||||||
//pythonProcess.Exited += PythonProcess_Exited;
|
//pythonProcess.Exited += PythonProcess_Exited;
|
||||||
//pythonProcess.OutputDataReceived += PythonProcess_OutputDataReceived;
|
//pythonProcess.OutputDataReceived += PythonProcess_OutputDataReceived;
|
||||||
//pythonProcess.ErrorDataReceived += PythonProcess_ErrorDataReceived;
|
//pythonProcess.ErrorDataReceived += PythonProcess_ErrorDataReceived;
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ namespace AgroBase.Services
|
||||||
string _interface = "";
|
string _interface = "";
|
||||||
VerificaInterfaceConectada(out _interface);
|
VerificaInterfaceConectada(out _interface);
|
||||||
var ip = EthernetService.ObterIpAtual(_interface);
|
var ip = EthernetService.ObterIpAtual(_interface);
|
||||||
if (ip != Variaveis.IP_Host && false)
|
if (ip != Variaveis.IP_Host)
|
||||||
{
|
{
|
||||||
await Task.Run(async () =>
|
await Task.Run(async () =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
|
@ -1 +1 @@
|
||||||
{"tmrRegistrador":{"_uiControl":null,"State":2,"IsRunning":false,"IsStopped":true,"IsCreated":false,"Interval":500,"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,"PercentualErvasTerreno":0.0}
|
{"tmrRegistrador":{"_uiControl":null,"State":2,"IsRunning":false,"IsStopped":true,"IsCreated":false,"Interval":500,"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_oak-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,"PercentualErvasTerreno":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
|
|
@ -1 +0,0 @@
|
||||||
{"ExpansorGPIO":false,"EnderecoExpansor":"","Pinos":[{"Controlador":1,"Barramento":0,"Pino":99,"Descricao":"1","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":98,"Descricao":"2","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":36,"Descricao":"3","Funcao":12,"Habilitado":true,"ComponenteID":"TMVET"},{"Controlador":1,"Barramento":0,"Pino":39,"Descricao":"4","Funcao":12,"Habilitado":true,"ComponenteID":"TMVDT"},{"Controlador":1,"Barramento":0,"Pino":34,"Descricao":"5","Funcao":12,"Habilitado":true,"ComponenteID":"TMVEF"},{"Controlador":1,"Barramento":0,"Pino":35,"Descricao":"6","Funcao":12,"Habilitado":true,"ComponenteID":"TMVDF"},{"Controlador":1,"Barramento":0,"Pino":32,"Descricao":"7","Funcao":45,"Habilitado":true,"ComponenteID":"FRO_ET"},{"Controlador":1,"Barramento":0,"Pino":33,"Descricao":"8","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":25,"Descricao":"9","Funcao":45,"Habilitado":true,"ComponenteID":"FRO_DT"},{"Controlador":1,"Barramento":0,"Pino":26,"Descricao":"10","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":27,"Descricao":"11","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":14,"Descricao":"12","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":12,"Descricao":"13","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":97,"Descricao":"14","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":13,"Descricao":"15","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":9,"Descricao":"16","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":10,"Descricao":"17","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":11,"Descricao":"18","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":96,"Descricao":"19","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":6,"Descricao":"26","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":7,"Descricao":"27","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":8,"Descricao":"28","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":15,"Descricao":"29","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":2,"Descricao":"30","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":0,"Descricao":"31","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":4,"Descricao":"32","Funcao":38,"Habilitado":true,"ComponenteID":"LEDMN"},{"Controlador":1,"Barramento":0,"Pino":16,"Descricao":"33","Funcao":38,"Habilitado":true,"ComponenteID":"LEDAT"},{"Controlador":1,"Barramento":0,"Pino":17,"Descricao":"34","Funcao":38,"Habilitado":true,"ComponenteID":"LEDOP"},{"Controlador":1,"Barramento":0,"Pino":5,"Descricao":"35","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":18,"Descricao":"36","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":19,"Descricao":"37","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":95,"Descricao":"38","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":21,"Descricao":"39","Funcao":33,"Habilitado":true,"ComponenteID":"Sen"},{"Controlador":1,"Barramento":0,"Pino":3,"Descricao":"40","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":1,"Descricao":"41","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":22,"Descricao":"42","Funcao":34,"Habilitado":true,"ComponenteID":"Sen"},{"Controlador":1,"Barramento":0,"Pino":23,"Descricao":"43","Funcao":26,"Habilitado":true,"ComponenteID":"RLLRA"},{"Controlador":1,"Barramento":0,"Pino":94,"Descricao":"44","Funcao":0,"Habilitado":false,"ComponenteID":""}]}
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"ExpansorGPIO":false,"EnderecoExpansor":"","Pinos":[{"Controlador":1,"Barramento":0,"Pino":99,"Descricao":"1","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":98,"Descricao":"2","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":36,"Descricao":"3","Funcao":12,"Habilitado":true,"ComponenteID":"TMVET"},{"Controlador":1,"Barramento":0,"Pino":39,"Descricao":"4","Funcao":12,"Habilitado":true,"ComponenteID":"TMVDT"},{"Controlador":1,"Barramento":0,"Pino":34,"Descricao":"5","Funcao":12,"Habilitado":true,"ComponenteID":"TMVEF"},{"Controlador":1,"Barramento":0,"Pino":35,"Descricao":"6","Funcao":12,"Habilitado":true,"ComponenteID":"TMVDF"},{"Controlador":1,"Barramento":0,"Pino":32,"Descricao":"7","Funcao":46,"Habilitado":true,"ComponenteID":"POTET"},{"Controlador":1,"Barramento":0,"Pino":33,"Descricao":"8","Funcao":46,"Habilitado":true,"ComponenteID":"POTDT"},{"Controlador":1,"Barramento":0,"Pino":25,"Descricao":"9","Funcao":46,"Habilitado":true,"ComponenteID":"POTEF"},{"Controlador":1,"Barramento":0,"Pino":26,"Descricao":"10","Funcao":46,"Habilitado":true,"ComponenteID":"POTDF"},{"Controlador":1,"Barramento":0,"Pino":27,"Descricao":"11","Funcao":45,"Habilitado":true,"ComponenteID":"FRO_ET"},{"Controlador":1,"Barramento":0,"Pino":14,"Descricao":"12","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":12,"Descricao":"13","Funcao":45,"Habilitado":true,"ComponenteID":"FRO_DT"},{"Controlador":1,"Barramento":0,"Pino":97,"Descricao":"14","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":13,"Descricao":"15","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":9,"Descricao":"16","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":10,"Descricao":"17","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":11,"Descricao":"18","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":96,"Descricao":"19","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":6,"Descricao":"26","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":7,"Descricao":"27","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":8,"Descricao":"28","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":15,"Descricao":"29","Funcao":38,"Habilitado":true,"ComponenteID":"LEDMN"},{"Controlador":1,"Barramento":0,"Pino":2,"Descricao":"30","Funcao":38,"Habilitado":true,"ComponenteID":"LEDOP"},{"Controlador":1,"Barramento":0,"Pino":0,"Descricao":"31","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":4,"Descricao":"32","Funcao":38,"Habilitado":true,"ComponenteID":"LEDAT"},{"Controlador":1,"Barramento":0,"Pino":16,"Descricao":"33","Funcao":0,"Habilitado":true,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":17,"Descricao":"34","Funcao":26,"Habilitado":true,"ComponenteID":"RLPOTDF"},{"Controlador":1,"Barramento":0,"Pino":5,"Descricao":"35","Funcao":26,"Habilitado":true,"ComponenteID":"RLPOTEF"},{"Controlador":1,"Barramento":0,"Pino":18,"Descricao":"36","Funcao":26,"Habilitado":true,"ComponenteID":"RLPOTDT"},{"Controlador":1,"Barramento":0,"Pino":19,"Descricao":"37","Funcao":26,"Habilitado":true,"ComponenteID":"RLPOTET"},{"Controlador":1,"Barramento":0,"Pino":95,"Descricao":"38","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":21,"Descricao":"39","Funcao":33,"Habilitado":true,"ComponenteID":"Sen"},{"Controlador":1,"Barramento":0,"Pino":3,"Descricao":"40","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":1,"Descricao":"41","Funcao":0,"Habilitado":false,"ComponenteID":""},{"Controlador":1,"Barramento":0,"Pino":22,"Descricao":"42","Funcao":34,"Habilitado":true,"ComponenteID":"Sen"},{"Controlador":1,"Barramento":0,"Pino":23,"Descricao":"43","Funcao":26,"Habilitado":true,"ComponenteID":"RLLRA"},{"Controlador":1,"Barramento":0,"Pino":94,"Descricao":"44","Funcao":0,"Habilitado":false,"ComponenteID":""}]}
|
||||||
|
|
@ -1 +1,207 @@
|
||||||
[{"id":1,"Arquivo":"model","Diretorio":"C:\\AgroBaseModels\\Ervas\\","Extensao":".pt","Versao":"2_1","TipoArquivo":1,"ArquivoDownload":"weed_detector_model-2_1.pt"},{"id":2,"Diretorio":"C:\\AgroBaseModels\\Ruas\\","Arquivo":"model","Extensao":".pth","Versao":"1_0","ArquivoDownload":"street_detector_model-1_0.pth","NomeArquivoLocal":"model-1_0.pth","CaminhoCompleto":"C:\\AgroBaseModels\\Ruas\\model-1_0.pth","Atualizado":true,"ArquivoAtualizado":true,"TipoArquivo":0},{"id":3,"Diretorio":"C:\\AgroBaseModels\\Ruas\\","Arquivo":"labelmap","Extensao":".txt","Versao":"1_0","ArquivoDownload":"street_detector_labelmap-1_0.txt","NomeArquivoLocal":"labelmap-1_0.txt","CaminhoCompleto":"C:\\AgroBaseModels\\Ruas\\labelmap-1_0.txt","Atualizado":true,"ArquivoAtualizado":true,"TipoArquivo":0},{"id":4,"Diretorio":"Parametros/","Arquivo":"parametersAtu","Extensao":".par","Versao":"1_0","ArquivoDownload":"parametersAtu-1_0.par","NomeArquivoLocal":"parametersAtu-1_0.par","CaminhoCompleto":"Parametros/parametersAtu-1_0.par","Atualizado":true,"ArquivoAtualizado":true,"TipoArquivo":2},{"id":5,"Arquivo":"parametersMvd","Diretorio":"Parametros/","Extensao":".par","Versao":"2_0","TipoArquivo":3,"ArquivoDownload":"parametersMvd-2_0.par"},{"id":6,"Arquivo":"parametersSen","Diretorio":"Parametros/","Extensao":".par","Versao":"1_1","TipoArquivo":4,"ArquivoDownload":"parametersSen-1_1.par"},{"id":7,"Diretorio":"Parametros/","Arquivo":"parametersKnt","Extensao":".par","Versao":"1_0","ArquivoDownload":"parametersKnt-1_0.par","NomeArquivoLocal":"parametersKnt-1_0.par","CaminhoCompleto":"Parametros/parametersKnt-1_0.par","Atualizado":true,"ArquivoAtualizado":true,"TipoArquivo":5},{"id":8,"Diretorio":"Parametros/","Arquivo":"pinoutAtu","Extensao":".pin","Versao":"1_0","ArquivoDownload":"pinoutAtu-1_0.pin","NomeArquivoLocal":"pinoutAtu-1_0.pin","CaminhoCompleto":"Parametros/pinoutAtu-1_0.pin","Atualizado":true,"ArquivoAtualizado":true,"TipoArquivo":6},{"id":9,"Diretorio":"Parametros/","Arquivo":"pinoutSen","Extensao":".pin","Versao":"1_0","ArquivoDownload":"pinoutSen-1_0.pin","NomeArquivoLocal":"pinoutSen-1_0.pin","CaminhoCompleto":"Parametros/pinoutSen-1_0.pin","Atualizado":true,"ArquivoAtualizado":true,"TipoArquivo":7},{"id":10,"Diretorio":"Python\\Scripts\\","Arquivo":"weed_detector","Extensao":".py","Versao":"1_0","ArquivoDownload":"weed_detector-1_0.py","NomeArquivoLocal":"weed_detector-1_0.py","CaminhoCompleto":"Python\\Scripts\\weed_detector-1_0.py","Atualizado":true,"ArquivoAtualizado":true,"TipoArquivo":9},{"id":11,"Diretorio":"Python\\Scripts\\","Arquivo":"green_detector","Extensao":".py","Versao":"1_0","ArquivoDownload":"green_detector-1_0.py","NomeArquivoLocal":"green_detector-1_0.py","CaminhoCompleto":"Python\\Scripts\\green_detector-1_0.py","Atualizado":true,"ArquivoAtualizado":true,"TipoArquivo":10},{"id":12,"Diretorio":"Python\\Scripts\\","Arquivo":"street_detector","Extensao":".py","Versao":"1_0","ArquivoDownload":"street_detector-1_0.py","NomeArquivoLocal":"street_detector-1_0.py","CaminhoCompleto":"Python\\Scripts\\street_detector-1_0.py","Atualizado":true,"ArquivoAtualizado":true,"TipoArquivo":8},{"id":13,"Diretorio":"Python\\Scripts\\","Arquivo":"map_load","Extensao":".py","Versao":"1_0","ArquivoDownload":"map_load-1_0.py","NomeArquivoLocal":"map_load-1_0.py","CaminhoCompleto":"Python\\Scripts\\map_load-1_0.py","Atualizado":true,"ArquivoAtualizado":true,"TipoArquivo":11},{"id":14,"Diretorio":"Python\\Scripts\\","Arquivo":"map_follow","Extensao":".py","Versao":"1_0","ArquivoDownload":"map_follow-1_0.py","NomeArquivoLocal":"map_follow-1_0.py","CaminhoCompleto":"Python\\Scripts\\map_follow-1_0.py","Atualizado":true,"ArquivoAtualizado":true,"TipoArquivo":12},{"id":15,"Diretorio":"Python\\Scripts\\","Arquivo":"gps_viewer","Extensao":".py","Versao":"1_0","ArquivoDownload":"gps_viewer-1_0.py","NomeArquivoLocal":"gps_viewer-1_0.py","CaminhoCompleto":"Python\\Scripts\\gps_viewer-1_0.py","Atualizado":true,"ArquivoAtualizado":true,"TipoArquivo":13},{"id":17,"Arquivo":"modelo_3d","Diretorio":"Python\\Output\\","Extensao":".obj","Versao":"1_0","TipoArquivo":14,"ArquivoDownload":"modelo_3d-1_0.obj"},{"id":17,"Diretorio":"Python\\Output\\","Arquivo":"modelo_3d","Extensao":".mtl","Versao":"1_0","ArquivoDownload":"modelo_3d-1_0.mtl","NomeArquivoLocal":"modelo_3d-1_0.mtl","CaminhoCompleto":"Python\\Output\\modelo_3d-1_0.mtl","Atualizado":true,"ArquivoAtualizado":false,"TipoArquivo":14}]
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"Arquivo": "model",
|
||||||
|
"Diretorio": "C:\\AgroBaseModels\\Ervas\\",
|
||||||
|
"Extensao": ".blob",
|
||||||
|
"Versao": "1_0",
|
||||||
|
"TipoArquivo": 1,
|
||||||
|
"ArquivoDownload": "weed_detector_model-1_0.blob"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"Diretorio": "C:\\AgroBaseModels\\Ruas\\",
|
||||||
|
"Arquivo": "model",
|
||||||
|
"Extensao": ".pth",
|
||||||
|
"Versao": "1_0",
|
||||||
|
"ArquivoDownload": "street_detector_model-1_0.pth",
|
||||||
|
"NomeArquivoLocal": "model-1_0.pth",
|
||||||
|
"CaminhoCompleto": "C:\\AgroBaseModels\\Ruas\\model-1_0.pth",
|
||||||
|
"Atualizado": true,
|
||||||
|
"ArquivoAtualizado": true,
|
||||||
|
"TipoArquivo": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"Diretorio": "C:\\AgroBaseModels\\Ruas\\",
|
||||||
|
"Arquivo": "labelmap",
|
||||||
|
"Extensao": ".txt",
|
||||||
|
"Versao": "1_0",
|
||||||
|
"ArquivoDownload": "street_detector_labelmap-1_0.txt",
|
||||||
|
"NomeArquivoLocal": "labelmap-1_0.txt",
|
||||||
|
"CaminhoCompleto": "C:\\AgroBaseModels\\Ruas\\labelmap-1_0.txt",
|
||||||
|
"Atualizado": true,
|
||||||
|
"ArquivoAtualizado": true,
|
||||||
|
"TipoArquivo": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"Diretorio": "Parametros/",
|
||||||
|
"Arquivo": "parametersAtu",
|
||||||
|
"Extensao": ".par",
|
||||||
|
"Versao": "1_0",
|
||||||
|
"ArquivoDownload": "parametersAtu-1_0.par",
|
||||||
|
"NomeArquivoLocal": "parametersAtu-1_0.par",
|
||||||
|
"CaminhoCompleto": "Parametros/parametersAtu-1_0.par",
|
||||||
|
"Atualizado": true,
|
||||||
|
"ArquivoAtualizado": true,
|
||||||
|
"TipoArquivo": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"Arquivo": "parametersMvd",
|
||||||
|
"Diretorio": "Parametros/",
|
||||||
|
"Extensao": ".par",
|
||||||
|
"Versao": "2_0",
|
||||||
|
"TipoArquivo": 3,
|
||||||
|
"ArquivoDownload": "parametersMvd-2_0.par"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 6,
|
||||||
|
"Arquivo": "parametersSen",
|
||||||
|
"Diretorio": "Parametros/",
|
||||||
|
"Extensao": ".par",
|
||||||
|
"Versao": "1_2",
|
||||||
|
"TipoArquivo": 4,
|
||||||
|
"ArquivoDownload": "parametersSen-1_2.par"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 7,
|
||||||
|
"Diretorio": "Parametros/",
|
||||||
|
"Arquivo": "parametersKnt",
|
||||||
|
"Extensao": ".par",
|
||||||
|
"Versao": "1_0",
|
||||||
|
"ArquivoDownload": "parametersKnt-1_0.par",
|
||||||
|
"NomeArquivoLocal": "parametersKnt-1_0.par",
|
||||||
|
"CaminhoCompleto": "Parametros/parametersKnt-1_0.par",
|
||||||
|
"Atualizado": true,
|
||||||
|
"ArquivoAtualizado": true,
|
||||||
|
"TipoArquivo": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 8,
|
||||||
|
"Diretorio": "Parametros/",
|
||||||
|
"Arquivo": "pinoutAtu",
|
||||||
|
"Extensao": ".pin",
|
||||||
|
"Versao": "1_0",
|
||||||
|
"ArquivoDownload": "pinoutAtu-1_0.pin",
|
||||||
|
"NomeArquivoLocal": "pinoutAtu-1_0.pin",
|
||||||
|
"CaminhoCompleto": "Parametros/pinoutAtu-1_0.pin",
|
||||||
|
"Atualizado": true,
|
||||||
|
"ArquivoAtualizado": true,
|
||||||
|
"TipoArquivo": 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 9,
|
||||||
|
"Diretorio": "Parametros/",
|
||||||
|
"Arquivo": "pinoutSen",
|
||||||
|
"Extensao": ".pin",
|
||||||
|
"Versao": "1_1",
|
||||||
|
"ArquivoDownload": "pinoutSen-1_1.pin",
|
||||||
|
"NomeArquivoLocal": "pinoutSen-1_1.pin",
|
||||||
|
"CaminhoCompleto": "Parametros/pinoutSen-1_1.pin",
|
||||||
|
"Atualizado": true,
|
||||||
|
"ArquivoAtualizado": true,
|
||||||
|
"TipoArquivo": 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 10,
|
||||||
|
"Diretorio": "Python\\Scripts\\",
|
||||||
|
"Arquivo": "weed_detector_oak",
|
||||||
|
"Extensao": ".py",
|
||||||
|
"Versao": "1_0",
|
||||||
|
"ArquivoDownload": "weed_detector_oak-1_0.py",
|
||||||
|
"NomeArquivoLocal": "weed_detector_oak-1_0.py",
|
||||||
|
"CaminhoCompleto": "Python\\Scripts\\weed_detector_oak-1_0.py",
|
||||||
|
"Atualizado": true,
|
||||||
|
"ArquivoAtualizado": true,
|
||||||
|
"TipoArquivo": 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 11,
|
||||||
|
"Diretorio": "Python\\Scripts\\",
|
||||||
|
"Arquivo": "green_detector",
|
||||||
|
"Extensao": ".py",
|
||||||
|
"Versao": "1_0",
|
||||||
|
"ArquivoDownload": "green_detector-1_0.py",
|
||||||
|
"NomeArquivoLocal": "green_detector-1_0.py",
|
||||||
|
"CaminhoCompleto": "Python\\Scripts\\green_detector-1_0.py",
|
||||||
|
"Atualizado": true,
|
||||||
|
"ArquivoAtualizado": true,
|
||||||
|
"TipoArquivo": 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 12,
|
||||||
|
"Diretorio": "Python\\Scripts\\",
|
||||||
|
"Arquivo": "street_detector",
|
||||||
|
"Extensao": ".py",
|
||||||
|
"Versao": "1_0",
|
||||||
|
"ArquivoDownload": "street_detector-1_0.py",
|
||||||
|
"NomeArquivoLocal": "street_detector-1_0.py",
|
||||||
|
"CaminhoCompleto": "Python\\Scripts\\street_detector-1_0.py",
|
||||||
|
"Atualizado": true,
|
||||||
|
"ArquivoAtualizado": true,
|
||||||
|
"TipoArquivo": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 13,
|
||||||
|
"Diretorio": "Python\\Scripts\\",
|
||||||
|
"Arquivo": "map_load",
|
||||||
|
"Extensao": ".py",
|
||||||
|
"Versao": "1_0",
|
||||||
|
"ArquivoDownload": "map_load-1_0.py",
|
||||||
|
"NomeArquivoLocal": "map_load-1_0.py",
|
||||||
|
"CaminhoCompleto": "Python\\Scripts\\map_load-1_0.py",
|
||||||
|
"Atualizado": true,
|
||||||
|
"ArquivoAtualizado": true,
|
||||||
|
"TipoArquivo": 11
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 14,
|
||||||
|
"Diretorio": "Python\\Scripts\\",
|
||||||
|
"Arquivo": "map_follow",
|
||||||
|
"Extensao": ".py",
|
||||||
|
"Versao": "1_0",
|
||||||
|
"ArquivoDownload": "map_follow-1_0.py",
|
||||||
|
"NomeArquivoLocal": "map_follow-1_0.py",
|
||||||
|
"CaminhoCompleto": "Python\\Scripts\\map_follow-1_0.py",
|
||||||
|
"Atualizado": true,
|
||||||
|
"ArquivoAtualizado": true,
|
||||||
|
"TipoArquivo": 12
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 15,
|
||||||
|
"Diretorio": "Python\\Scripts\\",
|
||||||
|
"Arquivo": "gps_viewer",
|
||||||
|
"Extensao": ".py",
|
||||||
|
"Versao": "1_0",
|
||||||
|
"ArquivoDownload": "gps_viewer-1_0.py",
|
||||||
|
"NomeArquivoLocal": "gps_viewer-1_0.py",
|
||||||
|
"CaminhoCompleto": "Python\\Scripts\\gps_viewer-1_0.py",
|
||||||
|
"Atualizado": true,
|
||||||
|
"ArquivoAtualizado": true,
|
||||||
|
"TipoArquivo": 13
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 17,
|
||||||
|
"Arquivo": "modelo_3d",
|
||||||
|
"Diretorio": "Python\\Output\\",
|
||||||
|
"Extensao": ".obj",
|
||||||
|
"Versao": "1_0",
|
||||||
|
"TipoArquivo": 14,
|
||||||
|
"ArquivoDownload": "modelo_3d-1_0.obj"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 17,
|
||||||
|
"Diretorio": "Python\\Output\\",
|
||||||
|
"Arquivo": "modelo_3d",
|
||||||
|
"Extensao": ".mtl",
|
||||||
|
"Versao": "1_0",
|
||||||
|
"ArquivoDownload": "modelo_3d-1_0.mtl",
|
||||||
|
"NomeArquivoLocal": "modelo_3d-1_0.mtl",
|
||||||
|
"CaminhoCompleto": "Python\\Output\\modelo_3d-1_0.mtl",
|
||||||
|
"Atualizado": true,
|
||||||
|
"ArquivoAtualizado": false,
|
||||||
|
"TipoArquivo": 14
|
||||||
|
}
|
||||||
|
]
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -25,7 +25,7 @@
|
||||||
<meta name="viewport" content="width=device-width,
|
<meta name="viewport" content="width=device-width,
|
||||||
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
<style>
|
<style>
|
||||||
#map_c6a729e0933d5a993371a94671317bf9 {
|
#map_a557472d0c26c4288938132609c4ed90 {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100.0%;
|
width: 100.0%;
|
||||||
height: 100.0%;
|
height: 100.0%;
|
||||||
|
|
@ -39,14 +39,14 @@
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
<div class="folium-map" id="map_c6a729e0933d5a993371a94671317bf9" ></div>
|
<div class="folium-map" id="map_a557472d0c26c4288938132609c4ed90" ></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
var map_c6a729e0933d5a993371a94671317bf9 = L.map(
|
var map_a557472d0c26c4288938132609c4ed90 = L.map(
|
||||||
"map_c6a729e0933d5a993371a94671317bf9",
|
"map_a557472d0c26c4288938132609c4ed90",
|
||||||
{
|
{
|
||||||
center: [0.0, 0.0],
|
center: [0.0, 0.0],
|
||||||
crs: L.CRS.EPSG3857,
|
crs: L.CRS.EPSG3857,
|
||||||
|
|
@ -60,13 +60,13 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var tile_layer_1d1b48973abfcee0f975ed55428a4e1a = L.tileLayer(
|
var tile_layer_fdcada12119d5faa3c86771431d37018 = L.tileLayer(
|
||||||
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||||
{"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors", "detectRetina": false, "maxNativeZoom": 19, "maxZoom": 19, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
|
{"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors", "detectRetina": false, "maxNativeZoom": 19, "maxZoom": 19, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
tile_layer_1d1b48973abfcee0f975ed55428a4e1a.addTo(map_c6a729e0933d5a993371a94671317bf9);
|
tile_layer_fdcada12119d5faa3c86771431d37018.addTo(map_a557472d0c26c4288938132609c4ed90);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@
|
||||||
}
|
}
|
||||||
trajeto_json_add({"features": []});
|
trajeto_json_add({"features": []});
|
||||||
|
|
||||||
trajeto_json.addTo(map_c6a729e0933d5a993371a94671317bf9);
|
trajeto_json.addTo(map_a557472d0c26c4288938132609c4ed90);
|
||||||
|
|
||||||
function adicionarGeometria(novaGeometria) {
|
function adicionarGeometria(novaGeometria) {
|
||||||
trajeto_json.addData(novaGeometria);
|
trajeto_json.addData(novaGeometria);
|
||||||
|
|
@ -145,7 +145,7 @@
|
||||||
|
|
||||||
var marcadorDinamico = L.marker([0, 0], {
|
var marcadorDinamico = L.marker([0, 0], {
|
||||||
icon: customIcon
|
icon: customIcon
|
||||||
}).addTo(map_c6a729e0933d5a993371a94671317bf9);
|
}).addTo(map_a557472d0c26c4288938132609c4ed90);
|
||||||
|
|
||||||
// Conectar ao broker MQTT
|
// Conectar ao broker MQTT
|
||||||
const client = mqtt.connect('ws://localhost:9001'); // Use wss para conexão segura
|
const client = mqtt.connect('ws://localhost:9001'); // Use wss para conexão segura
|
||||||
|
|
@ -183,7 +183,7 @@
|
||||||
marcadorDinamico.setRotationAngle(angulo);
|
marcadorDinamico.setRotationAngle(angulo);
|
||||||
|
|
||||||
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
|
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
|
||||||
map_c6a729e0933d5a993371a94671317bf9.setView(novaPosicao, map_c6a729e0933d5a993371a94671317bf9.getZoom());
|
map_a557472d0c26c4288938132609c4ed90.setView(novaPosicao, map_a557472d0c26c4288938132609c4ed90.getZoom());
|
||||||
});
|
});
|
||||||
|
|
||||||
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {
|
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,151 @@
|
||||||
|
import cv2
|
||||||
|
import depthai as dai
|
||||||
|
import numpy as np
|
||||||
|
import time
|
||||||
|
import threading
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import uuid
|
||||||
|
import paho.mqtt.client as mqtt
|
||||||
|
from flask import Flask, Response, request
|
||||||
|
|
||||||
|
# Configurações gerais
|
||||||
|
mqtt_client = mqtt.Client(f"client_weed_detector_{uuid.uuid4()}")
|
||||||
|
mqtt_client.connect("localhost", port=1883)
|
||||||
|
|
||||||
|
# Parâmetros de entrada
|
||||||
|
json_data = None
|
||||||
|
output_folder = 'Python/Output/'
|
||||||
|
max_readings = int(sys.argv[1])
|
||||||
|
porta = sys.argv[2]
|
||||||
|
url = sys.argv[3]
|
||||||
|
arquivoSaida = sys.argv[4]
|
||||||
|
mostrar_linhas = sys.argv[5] == "1"
|
||||||
|
mqtt_topic = sys.argv[6]
|
||||||
|
model_folder = sys.argv[7]
|
||||||
|
script_version = sys.argv[8]
|
||||||
|
|
||||||
|
# Flask App
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
# Caminho do modelo convertido
|
||||||
|
blob_path = os.path.join(model_folder, f'model-{script_version}.blob')
|
||||||
|
|
||||||
|
def detect_oak():
|
||||||
|
print("a")
|
||||||
|
pipeline = dai.Pipeline()
|
||||||
|
|
||||||
|
# Criando um nó de câmera
|
||||||
|
cam = pipeline.create(dai.node.ColorCamera)
|
||||||
|
cam.setPreviewSize(640, 640)
|
||||||
|
cam.setInterleaved(False)
|
||||||
|
cam.setColorOrder(dai.ColorCameraProperties.ColorOrder.BGR)
|
||||||
|
cam.setFps(30)
|
||||||
|
|
||||||
|
# Criando um nó de inferência YOLO
|
||||||
|
nn = pipeline.create(dai.node.YoloDetectionNetwork)
|
||||||
|
nn.setBlobPath(blob_path)
|
||||||
|
nn.setConfidenceThreshold(0.25) # Ajuste conforme necessário
|
||||||
|
nn.setNumClasses(10)
|
||||||
|
nn.setCoordinateSize(4)
|
||||||
|
nn.setIouThreshold(0.45)
|
||||||
|
|
||||||
|
# 🔹 Define âncoras e máscaras corretamente
|
||||||
|
nn.setAnchors([
|
||||||
|
12, 16, 19, 36, 40, 28, # Pequenos
|
||||||
|
36, 75, 76, 55, 72, 146, # Médios
|
||||||
|
142, 110, 192, 243, 459, 401 # Grandes
|
||||||
|
])
|
||||||
|
nn.setAnchorMasks({
|
||||||
|
"side80": [1, 2, 3],
|
||||||
|
"side40": [3, 4, 5],
|
||||||
|
"side20": [5, 6, 7]
|
||||||
|
})
|
||||||
|
|
||||||
|
# Conectando câmera ao modelo
|
||||||
|
cam.preview.link(nn.input)
|
||||||
|
|
||||||
|
# Saída de vídeo
|
||||||
|
xout_cam = pipeline.create(dai.node.XLinkOut)
|
||||||
|
xout_cam.setStreamName("video")
|
||||||
|
cam.preview.link(xout_cam.input)
|
||||||
|
|
||||||
|
# Saída da inferência
|
||||||
|
xout_nn = pipeline.create(dai.node.XLinkOut)
|
||||||
|
xout_nn.setStreamName("detections")
|
||||||
|
nn.out.link(xout_nn.input)
|
||||||
|
|
||||||
|
labelMap = ['chenopodio', 'grama-azul', 'tiririca', 'erva-daninha', 'videira',
|
||||||
|
'mostarda-preta', 'milho', 'amaranta', 'farinha-seca', 'guanxuma']
|
||||||
|
|
||||||
|
with dai.Device(pipeline) as device:
|
||||||
|
video_queue = device.getOutputQueue("video", maxSize=1, blocking=False)
|
||||||
|
detections_queue = device.getOutputQueue("detections", maxSize=1, blocking=False)
|
||||||
|
width, height = 640, 640
|
||||||
|
readings = []
|
||||||
|
|
||||||
|
while True:
|
||||||
|
frame = video_queue.get().getCvFrame()
|
||||||
|
in_det = detections_queue.get()
|
||||||
|
detections = in_det.detections
|
||||||
|
|
||||||
|
current_readings = []
|
||||||
|
for detection in detections:
|
||||||
|
x1 = int(detection.xmin * width)
|
||||||
|
y1 = int(detection.ymin * height)
|
||||||
|
x2 = int(detection.xmax * width)
|
||||||
|
y2 = int(detection.ymax * height)
|
||||||
|
confidence = float(detection.confidence)
|
||||||
|
class_id = int(detection.label)
|
||||||
|
descricao = labelMap[class_id] if class_id < len(labelMap) else f"Classe {class_id}"
|
||||||
|
|
||||||
|
detection_info = {
|
||||||
|
'id': class_id,
|
||||||
|
'descricao': descricao,
|
||||||
|
'x': x1,
|
||||||
|
'y': y1,
|
||||||
|
'largura': x2 - x1,
|
||||||
|
'altura': y2 - y1,
|
||||||
|
'confianca': confidence
|
||||||
|
}
|
||||||
|
current_readings.append(detection_info)
|
||||||
|
|
||||||
|
if mostrar_linhas:
|
||||||
|
label = f'{descricao} {confidence:.2f}'
|
||||||
|
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
||||||
|
cv2.putText(frame, label, (x1, y1 - 10),
|
||||||
|
cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)
|
||||||
|
|
||||||
|
global json_data
|
||||||
|
timestamp = time.time()
|
||||||
|
json_data = {'timestamp': timestamp, 'x_max': width, 'y_max': height, 'objetos': current_readings}
|
||||||
|
readings.append(json_data)
|
||||||
|
|
||||||
|
if len(readings) >= max_readings:
|
||||||
|
mensagem_relevante = max(readings, key=lambda m: len(m['objetos']), default=None)
|
||||||
|
if not mensagem_relevante:
|
||||||
|
mensagem_relevante = readings[0]
|
||||||
|
mqtt_client.publish(mqtt_topic, json.dumps(mensagem_relevante).encode('utf-8'))
|
||||||
|
readings.clear()
|
||||||
|
|
||||||
|
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 send_script_ready():
|
||||||
|
mqtt_client.publish(mqtt_topic, "OK")
|
||||||
|
|
||||||
|
def run_flask_server():
|
||||||
|
app.run(host='0.0.0.0', port=porta, threaded=True, debug=True)
|
||||||
|
|
||||||
|
@app.route('/' + url, methods=['GET'])
|
||||||
|
def video_feed():
|
||||||
|
return Response(detect_oak(), mimetype='multipart/x-mixed-replace; boundary=frame')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
mqtt_thread = threading.Thread(target=send_script_ready)
|
||||||
|
mqtt_thread.start()
|
||||||
|
run_flask_server()
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"vector": "cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -55,6 +55,7 @@ enum S_Code {
|
||||||
sATU = 478,
|
sATU = 478,
|
||||||
sRLE = 479,
|
sRLE = 479,
|
||||||
sFRO = 480,
|
sFRO = 480,
|
||||||
|
sPOT = 481,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Estado {
|
enum Estado {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,200 @@
|
||||||
|
#include "SerialService.h"
|
||||||
|
#include "ReleModel.h"
|
||||||
|
#include "Pinout.h"
|
||||||
|
#include "Utils.h"
|
||||||
|
#include <SimpleKalmanFilter.h>
|
||||||
|
|
||||||
|
#ifndef SensorPotenciometroModel
|
||||||
|
#define SensorPotenciometroModel
|
||||||
|
|
||||||
|
class SensorPotenciometro {
|
||||||
|
public:
|
||||||
|
|
||||||
|
static void InicializarLista(std::vector<SensorPotenciometro*>& lista, const String& parametros, const String& Mod_ID, std::vector<Rele*>& listaReles);
|
||||||
|
|
||||||
|
SensorPotenciometro(String _modID, String _id) {
|
||||||
|
Mod_ID = _modID;
|
||||||
|
_ID = _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Definições
|
||||||
|
String Mod_ID = "";
|
||||||
|
String _ID;
|
||||||
|
PinoModel _pino;
|
||||||
|
|
||||||
|
Rele* releControle;
|
||||||
|
|
||||||
|
double _anguloPotenciometro = 270;
|
||||||
|
double _limitePotenciometro = _anguloPotenciometro / 2;
|
||||||
|
double _anguloMin = -110;
|
||||||
|
double _anguloMeio = 0;
|
||||||
|
double _anguloMax = 110;
|
||||||
|
double _margem = 10;
|
||||||
|
|
||||||
|
double leitura = 0;
|
||||||
|
double angulo = 0;
|
||||||
|
Sentido sentido = Parado;
|
||||||
|
bool limiteExcedido = false;
|
||||||
|
|
||||||
|
unsigned long millisLimite = -1;
|
||||||
|
int tempoReiniciarRele = 5000;
|
||||||
|
double anguloAtuacaoLimite = 0;
|
||||||
|
|
||||||
|
SimpleKalmanFilter filtro = SimpleKalmanFilter(5, 15, 0.01);
|
||||||
|
|
||||||
|
bool Iniciado = false;
|
||||||
|
bool Checando = false;
|
||||||
|
|
||||||
|
void Inicializar() {
|
||||||
|
if (Iniciado) {
|
||||||
|
PrintTela(_ID + " ja inicializado");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
leitura = 0;
|
||||||
|
|
||||||
|
_pino.Conectar(); // Conecta o pino antes de criar a tarefa
|
||||||
|
|
||||||
|
Iniciado = true;
|
||||||
|
|
||||||
|
PrintTela(_ID + " iniciado");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Desligar() {
|
||||||
|
if (!Iniciado) {
|
||||||
|
PrintTela(_ID + " nao esta inicializado");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_pino.Desconectar(); // Desconecta o pino
|
||||||
|
|
||||||
|
PrintTela(_ID + " Desligado");
|
||||||
|
|
||||||
|
Iniciado = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AferirAngulo() {
|
||||||
|
leitura = _pino.get();
|
||||||
|
double leituraNormalizada = filtro.updateEstimate(leitura);
|
||||||
|
|
||||||
|
angulo = map(leituraNormalizada, 0, 4095, -_limitePotenciometro, _limitePotenciometro);
|
||||||
|
|
||||||
|
sentido =
|
||||||
|
(angulo < (_anguloMeio - _margem)) ? Antihorario :
|
||||||
|
(angulo > (_anguloMeio + _margem)) ? Horario :
|
||||||
|
Parado;
|
||||||
|
|
||||||
|
limiteExcedido = angulo < (_anguloMin - _margem) || angulo > (_anguloMax + _margem);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RequisitarDados() {
|
||||||
|
AferirAngulo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Loop() {
|
||||||
|
if (releControle != nullptr) {
|
||||||
|
AferirAngulo();
|
||||||
|
|
||||||
|
releControle->AtualizarLeitura();
|
||||||
|
|
||||||
|
bool tempoResetAtingido = millis() > (millisLimite + tempoReiniciarRele);
|
||||||
|
|
||||||
|
// Determina se o ângulo continua avançando no mesmo sentido do limite
|
||||||
|
bool avancandoMesmoSentido =
|
||||||
|
tempoResetAtingido &&
|
||||||
|
((sentido == Antihorario && angulo < (anguloAtuacaoLimite - (_margem * 1.5))) ||
|
||||||
|
(sentido == Horario && angulo > (anguloAtuacaoLimite + (_margem * 1.5))));
|
||||||
|
|
||||||
|
// Reinicia limite caso:
|
||||||
|
// - O limite não está mais excedido
|
||||||
|
// - OU o motor continua no mesmo sentido após reset
|
||||||
|
bool reiniciarLimite = !limiteExcedido || avancandoMesmoSentido;
|
||||||
|
|
||||||
|
// Angulo limite excedido mas ainda nao enviou o comando para ligar o rele
|
||||||
|
if (limiteExcedido && releControle->_Status == Desligado && millisLimite == -1) {
|
||||||
|
millisLimite = millis();
|
||||||
|
anguloAtuacaoLimite = angulo;
|
||||||
|
releControle->AtualizarStatus(Ligado);
|
||||||
|
}
|
||||||
|
// Angulo limite excedido, o rele esta ligado, ja passou o tempo para reiniciar o rele
|
||||||
|
else if (releControle->_Status == Ligado && tempoResetAtingido) {
|
||||||
|
releControle->AtualizarStatus(Desligado);
|
||||||
|
}
|
||||||
|
// Reiniciar millis quando o angulo voltar para a margem segura ou se continuar a virar no sentido do limite
|
||||||
|
else if (avancandoMesmoSentido) {
|
||||||
|
millisLimite = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// Função para inicializar os sensores de potenciometros com IDs e pinos específicos
|
||||||
|
void SensorPotenciometro::InicializarLista(std::vector<SensorPotenciometro*>& lista, const String& parametros, const String& Mod_ID, std::vector<Rele*>& listaReles) {
|
||||||
|
// Verifica se há sensores já na lista
|
||||||
|
if (!lista.empty()) {
|
||||||
|
PrintTela("Limpando lista de sensores de potenciometro existente...");
|
||||||
|
|
||||||
|
for (auto* sensor : lista) {
|
||||||
|
sensor->Desligar(); // Desliga cada sensor antes de remover
|
||||||
|
PrintTela("Sensor de Potenciometro " + sensor->_ID + " desligado.");
|
||||||
|
delete sensor;
|
||||||
|
}
|
||||||
|
|
||||||
|
lista.clear(); // Limpa a lista após desligar todos os itens
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parametros.length() > 0) {
|
||||||
|
std::vector<String> _config = SplitString(parametros, SplitConfig); // Divide a configuração por vírgulas
|
||||||
|
|
||||||
|
for (const String& config : _config) {
|
||||||
|
std::vector<String> partes = SplitString(config, SplitSubParams); // Divide cada configuração pelo '-'
|
||||||
|
|
||||||
|
if (partes.size() >= 4) {
|
||||||
|
String id = partes[0];
|
||||||
|
bool conectar = partes[1] == "1";
|
||||||
|
TiposBarramentos pinoB = (TiposBarramentos)partes[2].toInt();
|
||||||
|
int pino = partes[3].toInt();
|
||||||
|
|
||||||
|
if (conectar) {
|
||||||
|
SensorPotenciometro* sensor = new SensorPotenciometro(Mod_ID, id);
|
||||||
|
sensor->_pino = PinoModel(pino, pinoB, _INPUT, ANALOGICO);
|
||||||
|
sensor->releControle = nullptr;
|
||||||
|
|
||||||
|
// Atribui um rele de controle
|
||||||
|
for (auto* _rele : listaReles) {
|
||||||
|
String idRele = _rele->_ID;
|
||||||
|
if (idRele.length() > 2 && idRele.startsWith("RL") && idRele.substring(2) == id) {
|
||||||
|
sensor->releControle = _rele;
|
||||||
|
|
||||||
|
if (partes.size() >= 8) {
|
||||||
|
double angMin = partes[4].toDouble();
|
||||||
|
double angMeio = partes[5].toDouble();
|
||||||
|
double angMax = partes[6].toDouble();
|
||||||
|
double angMargem = partes[7].toDouble();
|
||||||
|
|
||||||
|
sensor->_anguloMin = angMin;
|
||||||
|
sensor->_anguloMeio = angMeio;
|
||||||
|
sensor->_anguloMax = angMax;
|
||||||
|
sensor->_margem = angMargem;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sensor->Inicializar();
|
||||||
|
lista.push_back(sensor);
|
||||||
|
PrintTela("Sensor de potenciometro " + id + " inicializado no pino " + String(pino) + (sensor->releControle != nullptr ? (" e rele " + sensor->releControle->_ID) : ""));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PrintTela("Configuração inválida para sensor de potenciometro: " + config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PrintTela("Configuração de sensor de potenciometro não encontrada.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -47,10 +47,13 @@ void InicializarConexaoWifi(IPAddress ip, IPAddress gateway, IPAddress subnet, I
|
||||||
char ssid[MAX_SSID_LEN];
|
char ssid[MAX_SSID_LEN];
|
||||||
char password[MAX_PASS_LEN];
|
char password[MAX_PASS_LEN];
|
||||||
|
|
||||||
//saveWiFiCredentials(WIFI_SSID.c_str(), WIFI_PASSWORD.c_str());
|
|
||||||
|
|
||||||
loadWiFiCredentials(ssid, password);
|
loadWiFiCredentials(ssid, password);
|
||||||
|
|
||||||
|
if (ssid != WIFI_SSID.c_str() || password != WIFI_PASSWORD.c_str()) {
|
||||||
|
saveWiFiCredentials(WIFI_SSID.c_str(), WIFI_PASSWORD.c_str());
|
||||||
|
loadWiFiCredentials(ssid, password);
|
||||||
|
}
|
||||||
|
|
||||||
PrintTela(ssid);
|
PrintTela(ssid);
|
||||||
|
|
||||||
// Configurar IP fixo
|
// Configurar IP fixo
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,376 @@
|
||||||
|
// Dispositivo: Sensoriamento
|
||||||
|
// Versão Firmware: 14
|
||||||
|
// Ultima atualização: 13/02/2025
|
||||||
|
// Atualização: Inclusão de leitura dos potenciometros angulares
|
||||||
|
|
||||||
|
#include <ArduinoJson.h>
|
||||||
|
#include "C:\ZendionInc\agrobot_base\Firmware\Modulos\MqttService.h"
|
||||||
|
#include "C:\ZendionInc\agrobot_base\Firmware\Modulos\WifiService.h"
|
||||||
|
#include "C:\ZendionInc\agrobot_base\Firmware\Modulos\EepromService.h"
|
||||||
|
#include "C:\ZendionInc\agrobot_base\Firmware\Modulos\SerialService.h"
|
||||||
|
#include "C:\ZendionInc\agrobot_base\Firmware\Modulos\Utils.h"
|
||||||
|
#include "C:\ZendionInc\agrobot_base\Firmware\Modulos\Pinout.h"
|
||||||
|
#include "C:\ZendionInc\agrobot_base\Firmware\Modulos\SensorTemperaturaModel.h"
|
||||||
|
#include "C:\ZendionInc\agrobot_base\Firmware\Modulos\SensorCorrenteModel.h"
|
||||||
|
#include "C:\ZendionInc\agrobot_base\Firmware\Modulos\SinaleiroModel.h"
|
||||||
|
#include "C:\ZendionInc\agrobot_base\Firmware\Modulos\ReleModel.h"
|
||||||
|
#include "C:\ZendionInc\agrobot_base\Firmware\Modulos\ServoFreioModel.h"
|
||||||
|
#include "C:\ZendionInc\agrobot_base\Firmware\Modulos\SensorPotenciometroModel.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Configurações do IP estático
|
||||||
|
IPAddress local_IP(192, 168, String(WIFI_FAIXA).toInt(), 12); // IP fixo para o ESP
|
||||||
|
IPAddress gateway(192, 168, String(WIFI_FAIXA).toInt(), 1); // Gateway padrão
|
||||||
|
IPAddress subnet(255, 255, 255, 0); // Máscara de sub-rede
|
||||||
|
IPAddress primaryDNS(8, 8, 8, 8); // Servidor DNS primário (opcional)
|
||||||
|
|
||||||
|
// Instancia o serviço MQTT
|
||||||
|
MqttService mqttService;
|
||||||
|
|
||||||
|
#define D_Code Sen
|
||||||
|
#define VERSION 14
|
||||||
|
String Mod_ID = "Sen";
|
||||||
|
|
||||||
|
#define _pinoLED RGB_BUILTIN
|
||||||
|
|
||||||
|
long _baudRate = 115200;
|
||||||
|
|
||||||
|
bool Conectado = false;
|
||||||
|
bool Verificando = false;
|
||||||
|
|
||||||
|
int _TaxaAmostragem = 1000;
|
||||||
|
volatile bool RequisitarDados = false;
|
||||||
|
int latenciaLoop = 0;
|
||||||
|
|
||||||
|
PinoModel _pinoSDA = PinoModel(21, CONTROLADOR, _INPUT);
|
||||||
|
PinoModel _pinoSCL = PinoModel(22, CONTROLADOR, _INPUT);
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<SensorTemperatura*> listaSensoresTemperatura;
|
||||||
|
std::vector<SensorCorrente*> listaSensoresCorrente;
|
||||||
|
std::vector<Sinaleiro*> listaSinaleiros;
|
||||||
|
std::vector<Rele*> listaReles;
|
||||||
|
std::vector<ServoFreio*> listaServoFreios;
|
||||||
|
std::vector<SensorPotenciometro*> listaSensoresPotenciometros;
|
||||||
|
|
||||||
|
|
||||||
|
void InicializarComunicacaoMQTT(bool RenovarConexao) {
|
||||||
|
if (RenovarConexao) {
|
||||||
|
mqttService.unsubscribe(TopicoRecepcao);
|
||||||
|
delay(1000);
|
||||||
|
}
|
||||||
|
mqttService.setModID(Mod_ID);
|
||||||
|
mqttService.InicializarComunicacaoMqtt();
|
||||||
|
mqttService.setMessageCallback(ProcessarProtocolo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(_baudRate);
|
||||||
|
|
||||||
|
iniciarMCP(D_Code, Mod_ID, _pinoSDA.num, _pinoSCL.num, 0x20, false);
|
||||||
|
|
||||||
|
InicializarConexaoWifi(local_IP, gateway, subnet, primaryDNS);
|
||||||
|
|
||||||
|
if (!WifiIsConnected) {
|
||||||
|
connectToWiFi();
|
||||||
|
|
||||||
|
if (WifiIsConnected) {
|
||||||
|
PrintTela("Conectado com sucesso");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
PrintTela("Erro ao se conectar ao wifi");
|
||||||
|
ESP.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delay(100);
|
||||||
|
|
||||||
|
if (WifiIsConnected) {
|
||||||
|
InicializarComunicacaoMQTT(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
unsigned long startLoop = millis();
|
||||||
|
|
||||||
|
// Manter leitura dos angulos direcional atualizado
|
||||||
|
for (auto* sensor : listaSensoresPotenciometros) {
|
||||||
|
sensor->Loop();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!RequisitarDados) {
|
||||||
|
enviarLogsPeriodicamente();
|
||||||
|
}
|
||||||
|
|
||||||
|
mqttService.loop();
|
||||||
|
|
||||||
|
delay(1);
|
||||||
|
|
||||||
|
latenciaLoop = millis() - startLoop;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Função para enviar logs do sensor periodicamente via MQTT
|
||||||
|
unsigned long ultimoEnvioLogs = 0;
|
||||||
|
const unsigned long intervaloEnvioLogs = 1000; // 1 segundo
|
||||||
|
void enviarLogsPeriodicamente() {
|
||||||
|
unsigned long tempoAtual = millis();
|
||||||
|
// Verifica se o intervalo de 5 segundos já passou
|
||||||
|
if (tempoAtual - ultimoEnvioLogs >= intervaloEnvioLogs) {
|
||||||
|
ultimoEnvioLogs = tempoAtual; // Atualiza o tempo do último envio
|
||||||
|
|
||||||
|
enviarDadosSensores(); // Chama o método que já envia os dados do sensor via MQTT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void enviarDadosSensores() {
|
||||||
|
if (Conectado && !Verificando) {
|
||||||
|
PrintTela("Atualizando dados dos sensores...");
|
||||||
|
|
||||||
|
// Aferir dados dos sensores
|
||||||
|
for (auto* sensor : listaSensoresTemperatura) {
|
||||||
|
sensor->AferirTemperatura();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aferir dados dos sensores
|
||||||
|
for (auto* sensor : listaSensoresCorrente) {
|
||||||
|
sensor->AferirCorrente();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aferir dados dos sensores
|
||||||
|
for (auto* sensor : listaSinaleiros) {
|
||||||
|
sensor->AtualizarLeitura();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aferir dados dos sensores
|
||||||
|
for (auto* sensor : listaReles) {
|
||||||
|
sensor->AtualizarLeitura();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aferir dados dos sensores
|
||||||
|
for (auto* sensor : listaSensoresPotenciometros) {
|
||||||
|
sensor->AferirAngulo();
|
||||||
|
}
|
||||||
|
|
||||||
|
String jsonString = MontarMensagemSensores() + String(EndLine);
|
||||||
|
|
||||||
|
mqttService.EnviarDados(Mod_ID, jsonString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String MontarMensagemSensores() {
|
||||||
|
// Criação de um objeto JSON dinâmico com tamanho adequado
|
||||||
|
DynamicJsonDocument jsonDoc(2048);
|
||||||
|
|
||||||
|
// Adicionar campos gerais
|
||||||
|
jsonDoc["Conectado"] = Conectado;
|
||||||
|
jsonDoc["Mod_ID"] = Mod_ID;
|
||||||
|
jsonDoc["QualidadeWifi"] = WiFi.RSSI();
|
||||||
|
jsonDoc["LatenciaLoop"] = latenciaLoop;
|
||||||
|
|
||||||
|
// Array JSON para sensores de temperatura
|
||||||
|
JsonArray sensoresTemperaturaArray = jsonDoc.createNestedArray("SensoresTemperatura");
|
||||||
|
for (const auto* sensor : listaSensoresTemperatura) {
|
||||||
|
JsonObject sensorData = sensoresTemperaturaArray.createNestedObject();
|
||||||
|
sensorData["Id"] = sensor->_ID;
|
||||||
|
sensorData["Iniciado"] = sensor->Iniciado;
|
||||||
|
sensorData["Leitura"] = sensor->leitura;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Array JSON para sensores de corrente
|
||||||
|
JsonArray sensoresCorrenteArray = jsonDoc.createNestedArray("SensoresCorrente");
|
||||||
|
for (const auto* sensor : listaSensoresCorrente) {
|
||||||
|
JsonObject sensorData = sensoresCorrenteArray.createNestedObject();
|
||||||
|
sensorData["Id"] = sensor->_ID;
|
||||||
|
sensorData["Iniciado"] = sensor->Iniciado;
|
||||||
|
sensorData["BusVoltage"] = sensor->busVoltage;
|
||||||
|
sensorData["ShuntVoltage"] = sensor->shuntVoltage;
|
||||||
|
sensorData["Current"] = sensor->current;
|
||||||
|
sensorData["Power"] = sensor->power;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Array JSON para sinaleiros
|
||||||
|
JsonArray sinaleirosArray = jsonDoc.createNestedArray("Sinaleiros");
|
||||||
|
for (const auto* sensor : listaSinaleiros) {
|
||||||
|
JsonObject sensorData = sinaleirosArray.createNestedObject();
|
||||||
|
sensorData["Id"] = sensor->_ID;
|
||||||
|
sensorData["Iniciado"] = sensor->Iniciado;
|
||||||
|
sensorData["Leitura"] = sensor->_StatusLeitura;
|
||||||
|
sensorData["Comando"] = sensor->_Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Array JSON para reles
|
||||||
|
JsonArray relesArray = jsonDoc.createNestedArray("Reles");
|
||||||
|
for (const auto* sensor : listaReles) {
|
||||||
|
JsonObject sensorData = relesArray.createNestedObject();
|
||||||
|
sensorData["Id"] = sensor->_ID;
|
||||||
|
sensorData["Iniciado"] = sensor->Iniciado;
|
||||||
|
sensorData["Leitura"] = sensor->_Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Array JSON para servo freios
|
||||||
|
JsonArray servoFreiosArray = jsonDoc.createNestedArray("ServoFreios");
|
||||||
|
for (const auto* sensor : listaServoFreios) {
|
||||||
|
JsonObject sensorData = servoFreiosArray.createNestedObject();
|
||||||
|
sensorData["Id"] = sensor->_ID;
|
||||||
|
sensorData["Iniciado"] = sensor->Iniciado;
|
||||||
|
sensorData["Angulo"] = sensor->_Angulo;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Array JSON para sensores de potenciometro
|
||||||
|
JsonArray sensoresPotenciometroArray = jsonDoc.createNestedArray("SensoresPotenciometro");
|
||||||
|
for (const auto* sensor : listaSensoresPotenciometros) {
|
||||||
|
JsonObject sensorData = sensoresPotenciometroArray.createNestedObject();
|
||||||
|
sensorData["Id"] = sensor->_ID;
|
||||||
|
sensorData["Iniciado"] = sensor->Iniciado;
|
||||||
|
sensorData["Leitura"] = sensor->leitura;
|
||||||
|
sensorData["Angulo"] = sensor->angulo;
|
||||||
|
sensorData["Sentido"] = sensor->sentido;
|
||||||
|
sensorData["LimiteExcedido"] = sensor->limiteExcedido;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Serializa o JSON para uma string
|
||||||
|
String jsonString;
|
||||||
|
serializeJson(jsonDoc, jsonString);
|
||||||
|
|
||||||
|
int messageSize = jsonString.length();
|
||||||
|
PrintTela("Tamanho da mensagem: ", false);
|
||||||
|
PrintTela((String)messageSize);
|
||||||
|
|
||||||
|
return jsonString;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ProcessarProtocolo(ProtocoloSerial Mensagem) {
|
||||||
|
switch (Mensagem.funcao) {
|
||||||
|
case Chk:
|
||||||
|
ProcessarChk(Mensagem);
|
||||||
|
break;
|
||||||
|
case Cfg:
|
||||||
|
ProcessarCfg(Mensagem);
|
||||||
|
break;
|
||||||
|
case Cmd:
|
||||||
|
ProcessarCmd(Mensagem);
|
||||||
|
break;
|
||||||
|
case Req:
|
||||||
|
ProcessarReq(Mensagem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Mensagem.idMensagem > 0) {
|
||||||
|
mqttService.EnviarDados(Mod_ID, MontarProtocoloMensagemRecebida(Mensagem.idMensagem));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProcessarChk(ProtocoloSerial Mensagem) {
|
||||||
|
Verificando = true;
|
||||||
|
mqttService.EnviarDados(Mod_ID, MontarProtocoloVerificacao(D_Code, VERSION, Conectado));
|
||||||
|
delay(2000);
|
||||||
|
Verificando = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProcessarCfg(ProtocoloSerial Mensagem) {
|
||||||
|
std::vector<String> Partes = SplitString(Mensagem.protocolo, SplitParams);
|
||||||
|
T_Code Tipo = (T_Code)(Partes[0].toInt());
|
||||||
|
if (Tipo == Mod) {
|
||||||
|
bool Conectar = Partes[1] == "1";
|
||||||
|
_TaxaAmostragem = Partes[2].toInt();
|
||||||
|
RequisitarDados = Partes[3] == "1";
|
||||||
|
TiposBarramentos pinoSDAB = (TiposBarramentos)Partes[4].toInt();
|
||||||
|
int pinoSDA = Partes[5].toInt();
|
||||||
|
TiposBarramentos pinoSCLB = (TiposBarramentos)Partes[6].toInt();
|
||||||
|
int pinoSCL = Partes[7].toInt();
|
||||||
|
|
||||||
|
if (pinoSDA > -1 && pinoSCL > -1) {
|
||||||
|
_pinoSDA = PinoModel(pinoSDA, pinoSDAB, _INPUT);
|
||||||
|
_pinoSCL = PinoModel(pinoSCL, pinoSCLB, _INPUT);
|
||||||
|
Wire.end();
|
||||||
|
Wire.begin(_pinoSDA.num, _pinoSCL.num);
|
||||||
|
}
|
||||||
|
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(100));
|
||||||
|
Conectado = Conectar;
|
||||||
|
Verificando = false;
|
||||||
|
|
||||||
|
enviarDadosSensores();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
S_Code componente = (S_Code)Partes[1].toInt();
|
||||||
|
String config = Partes[2];
|
||||||
|
|
||||||
|
switch (componente) {
|
||||||
|
case sTMP: {
|
||||||
|
SensorTemperatura::InicializarLista(listaSensoresTemperatura, config, Mod_ID);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case sCOR: {
|
||||||
|
SensorCorrente::InicializarLista(listaSensoresCorrente, config, Mod_ID);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case sLED: {
|
||||||
|
Sinaleiro::InicializarLista(listaSinaleiros, config, Mod_ID);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case sRLE: {
|
||||||
|
Rele::InicializarLista(listaReles, config, Mod_ID);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case sFRO: {
|
||||||
|
ServoFreio::InicializarLista(listaServoFreios, config, Mod_ID);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case sPOT: {
|
||||||
|
SensorPotenciometro::InicializarLista(listaSensoresPotenciometros, config, Mod_ID, listaReles);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProcessarCmd(ProtocoloSerial Mensagem) {
|
||||||
|
std::vector<String> Partes = SplitString(Mensagem.protocolo, SplitParams);
|
||||||
|
String ID = Partes[0];
|
||||||
|
S_Code componente = (S_Code)Partes[1].toInt();
|
||||||
|
|
||||||
|
switch (componente) {
|
||||||
|
case sLED: {
|
||||||
|
for (auto* _led : listaSinaleiros) {
|
||||||
|
if (_led->_ID == ID) {
|
||||||
|
_led->_Status = (StatusLED)Partes[2].toInt();
|
||||||
|
_led->_Qtd = Partes[3].toInt();
|
||||||
|
_led->_TempoMs = Partes[4].toInt();
|
||||||
|
_led->_PausaMs = Partes[5].toInt();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case sRLE: {
|
||||||
|
for (auto* _rele : listaReles) {
|
||||||
|
if (_rele->_ID == ID) {
|
||||||
|
Estado novoEstado = (Estado)Partes[2].toInt();
|
||||||
|
_rele->AtualizarStatus(novoEstado);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case sFRO: {
|
||||||
|
for (auto* _freio : listaServoFreios) {
|
||||||
|
if (_freio->_ID == ID) {
|
||||||
|
int novoAngulo = Partes[2].toInt();
|
||||||
|
_freio->AtualizarAngulo(novoAngulo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProcessarReq(ProtocoloSerial Mensagem) {
|
||||||
|
enviarDadosSensores();
|
||||||
|
}
|
||||||
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,29 @@
|
||||||
|
import depthai as dai
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
# Cria um pipeline para capturar imagens da câmera
|
||||||
|
pipeline = dai.Pipeline()
|
||||||
|
|
||||||
|
# Configuração do nó da câmera
|
||||||
|
cam_rgb = pipeline.create(dai.node.ColorCamera)
|
||||||
|
cam_rgb.setPreviewSize(1280, 720) # Resolução HD
|
||||||
|
cam_rgb.setBoardSocket(dai.CameraBoardSocket.RGB)
|
||||||
|
cam_rgb.setInterleaved(False)
|
||||||
|
|
||||||
|
# Criar um XLinkOut para exibir o vídeo no PC
|
||||||
|
xout = pipeline.create(dai.node.XLinkOut)
|
||||||
|
xout.setStreamName("video")
|
||||||
|
cam_rgb.preview.link(xout.input)
|
||||||
|
|
||||||
|
# Inicia o pipeline
|
||||||
|
with dai.Device(pipeline) as device:
|
||||||
|
video_queue = device.getOutputQueue(name="video", maxSize=4, blocking=False)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
frame = video_queue.get().getCvFrame() # Obtém o frame da câmera
|
||||||
|
cv2.imshow("OAK-1 Lite W - Preview", frame)
|
||||||
|
|
||||||
|
if cv2.waitKey(1) == ord('q'): # Pressione 'q' para sair
|
||||||
|
break
|
||||||
|
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
import depthai as dai
|
||||||
|
import cv2
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
# Caminho para o modelo YOLOv7 convertido
|
||||||
|
MODEL_PATH = "seu_modelo_yolov7.blob"
|
||||||
|
|
||||||
|
# Criar pipeline
|
||||||
|
pipeline = dai.Pipeline()
|
||||||
|
|
||||||
|
# Criar um nó para a câmera
|
||||||
|
cam_rgb = pipeline.create(dai.node.ColorCamera)
|
||||||
|
cam_rgb.setPreviewSize(640, 640)
|
||||||
|
cam_rgb.setInterleaved(False)
|
||||||
|
cam_rgb.setBoardSocket(dai.CameraBoardSocket.RGB)
|
||||||
|
|
||||||
|
# Criar um nó de Neural Network (NN) para executar o YOLOv7
|
||||||
|
nn = pipeline.create(dai.node.NeuralNetwork)
|
||||||
|
nn.setBlobPath(MODEL_PATH)
|
||||||
|
cam_rgb.preview.link(nn.input)
|
||||||
|
|
||||||
|
# Criar XLinkOut para visualizar os resultados
|
||||||
|
xout_video = pipeline.create(dai.node.XLinkOut)
|
||||||
|
xout_video.setStreamName("video")
|
||||||
|
cam_rgb.preview.link(xout_video.input)
|
||||||
|
|
||||||
|
xout_nn = pipeline.create(dai.node.XLinkOut)
|
||||||
|
xout_nn.setStreamName("detections")
|
||||||
|
nn.out.link(xout_nn.input)
|
||||||
|
|
||||||
|
# Rodar pipeline na OAK
|
||||||
|
with dai.Device(pipeline) as device:
|
||||||
|
video_queue = device.getOutputQueue("video", maxSize=4, blocking=False)
|
||||||
|
detection_queue = device.getOutputQueue("detections", maxSize=4, blocking=False)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
frame = video_queue.get().getCvFrame()
|
||||||
|
detections = detection_queue.tryGet()
|
||||||
|
|
||||||
|
if detections is not None:
|
||||||
|
for detection in detections.detections:
|
||||||
|
x1, y1, x2, y2 = int(detection.xmin * 640), int(detection.ymin * 640), int(detection.xmax * 640), int(detection.ymax * 640)
|
||||||
|
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
||||||
|
cv2.putText(frame, f"Erva Daninha", (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)
|
||||||
|
|
||||||
|
cv2.imshow("YOLOv7 OAK-1 Lite W", frame)
|
||||||
|
|
||||||
|
if cv2.waitKey(1) == ord('q'):
|
||||||
|
break
|
||||||
|
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
import depthai as dai
|
||||||
|
import cv2
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
# Criação do pipeline
|
||||||
|
pipeline = dai.Pipeline()
|
||||||
|
|
||||||
|
# Câmera RGB
|
||||||
|
cam_rgb = pipeline.create(dai.node.ColorCamera)
|
||||||
|
cam_rgb.setPreviewSize(1280, 720) # Resolução HD
|
||||||
|
cam_rgb.setBoardSocket(dai.CameraBoardSocket.RGB)
|
||||||
|
cam_rgb.setInterleaved(False)
|
||||||
|
|
||||||
|
# Criar XLinkOut para a imagem RGB
|
||||||
|
xout_rgb = pipeline.create(dai.node.XLinkOut)
|
||||||
|
xout_rgb.setStreamName("rgb")
|
||||||
|
cam_rgb.preview.link(xout_rgb.input)
|
||||||
|
|
||||||
|
# Câmera de Profundidade
|
||||||
|
mono_left = pipeline.create(dai.node.MonoCamera)
|
||||||
|
mono_right = pipeline.create(dai.node.MonoCamera)
|
||||||
|
stereo = pipeline.create(dai.node.StereoDepth)
|
||||||
|
|
||||||
|
mono_left.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
|
||||||
|
mono_right.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
|
||||||
|
|
||||||
|
mono_left.setBoardSocket(dai.CameraBoardSocket.LEFT)
|
||||||
|
mono_right.setBoardSocket(dai.CameraBoardSocket.RIGHT)
|
||||||
|
|
||||||
|
# Configuração do StereoDepth
|
||||||
|
stereo.setDefaultProfilePreset(dai.node.StereoDepth.PresetMode.HIGH_DENSITY)
|
||||||
|
stereo.setLeftRightCheck(True)
|
||||||
|
stereo.setSubpixel(True)
|
||||||
|
|
||||||
|
mono_left.out.link(stereo.left)
|
||||||
|
mono_right.out.link(stereo.right)
|
||||||
|
|
||||||
|
# Criar XLinkOut para profundidade
|
||||||
|
xout_depth = pipeline.create(dai.node.XLinkOut)
|
||||||
|
xout_depth.setStreamName("depth")
|
||||||
|
stereo.depth.link(xout_depth.input)
|
||||||
|
|
||||||
|
# Inicia o pipeline
|
||||||
|
with dai.Device(pipeline) as device:
|
||||||
|
rgb_queue = device.getOutputQueue(name="rgb", maxSize=4, blocking=False)
|
||||||
|
depth_queue = device.getOutputQueue(name="depth", maxSize=4, blocking=False)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
# Captura RGB
|
||||||
|
rgb_frame = rgb_queue.get().getCvFrame()
|
||||||
|
|
||||||
|
# Captura Profundidade
|
||||||
|
depth_frame = depth_queue.get().getFrame()
|
||||||
|
depth_frame = cv2.normalize(depth_frame, None, 0, 255, cv2.NORM_MINMAX, dtype=cv2.CV_8U)
|
||||||
|
depth_frame = cv2.applyColorMap(depth_frame, cv2.COLORMAP_JET)
|
||||||
|
|
||||||
|
# Exibir os frames
|
||||||
|
cv2.imshow("OAK-D Lite - RGB", rgb_frame)
|
||||||
|
cv2.imshow("OAK-D Lite - Profundidade", depth_frame)
|
||||||
|
|
||||||
|
if cv2.waitKey(1) == ord('q'): # Pressione 'q' para sair
|
||||||
|
break
|
||||||
|
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
from openvino.tools.mo import convert_model
|
||||||
|
|
||||||
|
convert_model(
|
||||||
|
input_model="C:/AgroBaseModels/Ervas/model-2_1.onnx",
|
||||||
|
output_dir="C:/AgroBaseModels/Ervas/openvino_model",
|
||||||
|
data_type="FP16"
|
||||||
|
)
|
||||||
|
print("Conversão concluída!")
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
import cv2
|
||||||
|
import depthai as dai
|
||||||
|
import numpy as np
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
# Configuração dos argumentos
|
||||||
|
parser = argparse.ArgumentParser(description="Rodar inferência na OAK-1 Lite W com YOLOv7")
|
||||||
|
parser.add_argument("--model", type=str, required=True, help="Caminho do modelo .blob")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
# Caminho do modelo
|
||||||
|
blob_path = args.model
|
||||||
|
|
||||||
|
# Criando pipeline
|
||||||
|
pipeline = dai.Pipeline()
|
||||||
|
|
||||||
|
# Criando um nó de câmera
|
||||||
|
cam = pipeline.create(dai.node.ColorCamera)
|
||||||
|
cam.setPreviewSize(640, 640)
|
||||||
|
cam.setInterleaved(False)
|
||||||
|
cam.setColorOrder(dai.ColorCameraProperties.ColorOrder.BGR)
|
||||||
|
cam.setFps(30)
|
||||||
|
|
||||||
|
# Criando um nó de detecção YOLO
|
||||||
|
nn = pipeline.create(dai.node.YoloDetectionNetwork)
|
||||||
|
nn.setBlobPath(blob_path)
|
||||||
|
nn.setConfidenceThreshold(0.5) # Ajuste conforme necessário
|
||||||
|
nn.setNumClasses(10) # Número de classes do modelo (atualize conforme necessário)
|
||||||
|
nn.setCoordinateSize(4)
|
||||||
|
|
||||||
|
# 🔹 Define âncoras e máscaras corretamente
|
||||||
|
nn.setAnchors([
|
||||||
|
12, 16, 19, 36, 40, 28, # Pequenos
|
||||||
|
36, 75, 76, 55, 72, 146, # Médios
|
||||||
|
142, 110, 192, 243, 459, 401 # Grandes
|
||||||
|
])
|
||||||
|
nn.setAnchorMasks({
|
||||||
|
"side80": [1, 2, 3],
|
||||||
|
"side40": [3, 4, 5],
|
||||||
|
"side20": [5, 6, 7]
|
||||||
|
})
|
||||||
|
nn.setIouThreshold(0.5)
|
||||||
|
|
||||||
|
# Conectando a câmera à rede neural
|
||||||
|
cam.preview.link(nn.input)
|
||||||
|
|
||||||
|
# Saída de vídeo para visualização
|
||||||
|
xout_cam = pipeline.create(dai.node.XLinkOut)
|
||||||
|
xout_cam.setStreamName("video")
|
||||||
|
cam.preview.link(xout_cam.input)
|
||||||
|
|
||||||
|
# Saída da inferência
|
||||||
|
xout_nn = pipeline.create(dai.node.XLinkOut)
|
||||||
|
xout_nn.setStreamName("detections")
|
||||||
|
nn.out.link(xout_nn.input)
|
||||||
|
|
||||||
|
# 🔹 Definição dos nomes das classes (ajuste conforme seu modelo)
|
||||||
|
labelMap = ['chenopodio', 'grama-azul', 'tiririca', 'erva-daninha', 'videira', 'mostarda-preta', 'milho', 'amaranta', 'farinha-seca', 'guanxuma'] # Substitua pelas classes corretas do seu modelo
|
||||||
|
|
||||||
|
# Iniciando dispositivo
|
||||||
|
with dai.Device(pipeline) as device:
|
||||||
|
video_queue = device.getOutputQueue("video", maxSize=1, blocking=False)
|
||||||
|
detections_queue = device.getOutputQueue("detections", maxSize=1, blocking=False)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
# Captura a imagem
|
||||||
|
frame = video_queue.get().getCvFrame()
|
||||||
|
|
||||||
|
# Captura os resultados da inferência
|
||||||
|
in_det = detections_queue.get()
|
||||||
|
detections = in_det.detections
|
||||||
|
|
||||||
|
print(f"Número de detecções: {len(detections)}")
|
||||||
|
|
||||||
|
# Processando as detecções
|
||||||
|
for detection in detections:
|
||||||
|
x_min = int(detection.xmin * 640)
|
||||||
|
y_min = int(detection.ymin * 640)
|
||||||
|
x_max = int(detection.xmax * 640)
|
||||||
|
y_max = int(detection.ymax * 640)
|
||||||
|
conf = detection.confidence
|
||||||
|
label_id = int(detection.label) # ID da classe detectada
|
||||||
|
|
||||||
|
if conf > 0.5: # Ajuste o threshold de confiança conforme necessário
|
||||||
|
label = labelMap[label_id] if label_id < len(labelMap) else f"Classe {label_id}"
|
||||||
|
text = f"{label} ({conf:.2f})"
|
||||||
|
|
||||||
|
cv2.rectangle(frame, (x_min, y_min), (x_max, y_max), (0, 255, 0), 2)
|
||||||
|
cv2.putText(frame, text, (x_min, y_min - 10),
|
||||||
|
cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)
|
||||||
|
|
||||||
|
# Exibir a imagem
|
||||||
|
cv2.imshow("Deteccao OAK", frame)
|
||||||
|
if cv2.waitKey(1) == ord("q"):
|
||||||
|
break
|
||||||
|
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
|
@ -0,0 +1,161 @@
|
||||||
|
import cv2
|
||||||
|
import depthai as dai
|
||||||
|
import numpy as np
|
||||||
|
import time
|
||||||
|
import threading
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import uuid
|
||||||
|
import paho.mqtt.client as mqtt
|
||||||
|
from flask import Flask, Response, request
|
||||||
|
|
||||||
|
# Configurações gerais
|
||||||
|
mqtt_client = mqtt.Client(f"client_weed_detector_{uuid.uuid4()}")
|
||||||
|
mqtt_client.connect("localhost", port=1883)
|
||||||
|
|
||||||
|
# Parâmetros de entrada
|
||||||
|
json_data = None
|
||||||
|
output_folder = 'Python/Output/'
|
||||||
|
max_readings = int(sys.argv[1])
|
||||||
|
porta = sys.argv[2]
|
||||||
|
url = sys.argv[3]
|
||||||
|
arquivoSaida = sys.argv[4]
|
||||||
|
mostrar_linhas = sys.argv[5] == "1"
|
||||||
|
mqtt_topic = sys.argv[6]
|
||||||
|
model_folder = sys.argv[7]
|
||||||
|
script_version = sys.argv[8]
|
||||||
|
|
||||||
|
# Flask App
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
# Caminho do modelo convertido
|
||||||
|
blob_path = os.path.join(model_folder, f'model-{script_version}.blob')
|
||||||
|
|
||||||
|
def detect_oak():
|
||||||
|
width, height, model_resolution = 1280, 720, 640
|
||||||
|
labelMap = ['chenopodio', 'grama-azul', 'tiririca', 'erva-daninha', 'videira', 'mostarda-preta', 'milho', 'amaranta', 'farinha-seca', 'guanxuma']
|
||||||
|
|
||||||
|
pipeline = dai.Pipeline()
|
||||||
|
|
||||||
|
# Criando um nó de câmera otimizado
|
||||||
|
cam = pipeline.create(dai.node.ColorCamera)
|
||||||
|
cam.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
|
||||||
|
cam.setVideoSize(width, height)
|
||||||
|
cam.setInterleaved(False)
|
||||||
|
cam.setColorOrder(dai.ColorCameraProperties.ColorOrder.BGR)
|
||||||
|
cam.setFps(35) # FPS aumentado
|
||||||
|
cam.setIspScale(2, 3) # Reduz carga no pipeline
|
||||||
|
|
||||||
|
# Criando um nó de manipulação de imagem otimizado
|
||||||
|
manip = pipeline.create(dai.node.ImageManip)
|
||||||
|
manip.initialConfig.setResize(model_resolution, model_resolution)
|
||||||
|
manip.initialConfig.setKeepAspectRatio(True)
|
||||||
|
manip.initialConfig.setFrameType(dai.RawImgFrame.Type.RGB888p) # Força formato RGB correto
|
||||||
|
manip.setMaxOutputFrameSize(1228800)
|
||||||
|
cam.video.link(manip.inputImage)
|
||||||
|
|
||||||
|
# Criando um nó de inferência YOLO otimizado
|
||||||
|
nn = pipeline.create(dai.node.YoloDetectionNetwork)
|
||||||
|
nn.setBlobPath(blob_path)
|
||||||
|
nn.setConfidenceThreshold(0.25)
|
||||||
|
nn.setNumClasses(len(labelMap))
|
||||||
|
nn.setCoordinateSize(4)
|
||||||
|
nn.setIouThreshold(0.45)
|
||||||
|
# 🔹 Define âncoras e máscaras corretamente
|
||||||
|
nn.setAnchors([
|
||||||
|
12, 16, 19, 36, 40, 28,
|
||||||
|
36, 75, 76, 55, 72, 146,
|
||||||
|
142, 110, 192, 243, 459, 401
|
||||||
|
])
|
||||||
|
|
||||||
|
nn.setAnchorMasks({
|
||||||
|
"side52": [0, 1, 2],
|
||||||
|
"side26": [3, 4, 5],
|
||||||
|
"side13": [6, 7, 8]
|
||||||
|
})
|
||||||
|
nn.setNumInferenceThreads(2) # Usa 2 threads para inferência
|
||||||
|
nn.input.setBlocking(False) # Não bloqueia a entrada de frames
|
||||||
|
#nn.setReusePreviousInferenceResults(True) # Reutiliza inferências para não travar o pipeline
|
||||||
|
manip.out.link(nn.input)
|
||||||
|
|
||||||
|
# Saída de vídeo otimizada
|
||||||
|
xout_cam = pipeline.create(dai.node.XLinkOut)
|
||||||
|
xout_cam.setStreamName("video")
|
||||||
|
#xout_cam.setMetadataOnly(True) # Reduz tráfego de vídeo
|
||||||
|
cam.video.link(xout_cam.input)
|
||||||
|
|
||||||
|
# Saída da inferência
|
||||||
|
xout_nn = pipeline.create(dai.node.XLinkOut)
|
||||||
|
xout_nn.setStreamName("detections")
|
||||||
|
nn.out.link(xout_nn.input)
|
||||||
|
|
||||||
|
with dai.Device(pipeline) as device:
|
||||||
|
video_queue = device.getOutputQueue("video", maxSize=1, blocking=False)
|
||||||
|
detections_queue = device.getOutputQueue("detections", maxSize=1, blocking=False)
|
||||||
|
readings = []
|
||||||
|
|
||||||
|
while True:
|
||||||
|
frame = video_queue.get().getCvFrame()
|
||||||
|
in_det = detections_queue.get()
|
||||||
|
detections = in_det.detections
|
||||||
|
|
||||||
|
current_readings = []
|
||||||
|
for detection in detections:
|
||||||
|
x1 = int(detection.xmin * width)
|
||||||
|
y1 = int(detection.ymin * height)
|
||||||
|
x2 = int(detection.xmax * width)
|
||||||
|
y2 = int(detection.ymax * height)
|
||||||
|
confidence = float(detection.confidence)
|
||||||
|
class_id = int(detection.label)
|
||||||
|
descricao = labelMap[class_id] if class_id < len(labelMap) else f"Classe {class_id}"
|
||||||
|
|
||||||
|
detection_info = {
|
||||||
|
'id': class_id,
|
||||||
|
'descricao': descricao,
|
||||||
|
'x': x1,
|
||||||
|
'y': y1,
|
||||||
|
'largura': x2 - x1,
|
||||||
|
'altura': y2 - y1,
|
||||||
|
'confianca': confidence
|
||||||
|
}
|
||||||
|
current_readings.append(detection_info)
|
||||||
|
|
||||||
|
if mostrar_linhas:
|
||||||
|
label = f'{descricao} {confidence:.2f}'
|
||||||
|
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
||||||
|
cv2.putText(frame, label, (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)
|
||||||
|
|
||||||
|
global json_data
|
||||||
|
timestamp = time.time()
|
||||||
|
json_data = {'timestamp': timestamp, 'x_max': width, 'y_max': height, 'objetos': current_readings}
|
||||||
|
print(json_data)
|
||||||
|
readings.append(json_data)
|
||||||
|
|
||||||
|
if len(readings) >= max_readings:
|
||||||
|
mensagem_relevante = max(readings, key=lambda m: len(m['objetos']), default=None)
|
||||||
|
if not mensagem_relevante:
|
||||||
|
mensagem_relevante = readings[0]
|
||||||
|
mqtt_client.publish(mqtt_topic, json.dumps(mensagem_relevante).encode('utf-8'))
|
||||||
|
readings.clear()
|
||||||
|
|
||||||
|
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 send_script_ready():
|
||||||
|
mqtt_client.publish(mqtt_topic, "OK")
|
||||||
|
|
||||||
|
def run_flask_server():
|
||||||
|
app.run(host='0.0.0.0', port=porta, threaded=True, debug=False)
|
||||||
|
|
||||||
|
@app.route('/' + url, methods=['GET'])
|
||||||
|
def video_feed():
|
||||||
|
return Response(detect_oak(), mimetype='multipart/x-mixed-replace; boundary=frame')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
mqtt_thread = threading.Thread(target=send_script_ready)
|
||||||
|
mqtt_thread.start()
|
||||||
|
run_flask_server()
|
||||||
Loading…
Reference in New Issue