liberacao de operacao, pulverizador modo manual, calibragem e alerta sonoro

This commit is contained in:
Diego Freitas 2025-10-21 16:23:36 -03:00
parent e439a4e995
commit 52a627d343
71 changed files with 690 additions and 142 deletions

Binary file not shown.

View File

@ -229,6 +229,7 @@
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Speech" />
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference>
@ -558,6 +559,7 @@
<Compile Include="Models\Visualizador3DModel.cs" />
<Compile Include="Models\WT901CModel.cs" />
<Compile Include="Services\APIService.cs" />
<Compile Include="Services\AudioAlertaService.cs" />
<Compile Include="Services\BLD300RService.cs" />
<Compile Include="Services\CameraService.cs" />
<Compile Include="Services\CANService.cs" />

View File

@ -1682,7 +1682,7 @@ namespace AgroBase.Forms.IHM
private async Task EnviarComandoSinaleiro(DispositivosService<SensoriamentoModel> Dispositivo, SensorSinaleiroModel Sinaleiro, bool Ligar, int Delay)
{
var Comportamento = VariaveisEquipamento.ComportamentoPorStatus(StatusOperacao.NaoIniciado);
var Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusOperacao.NaoIniciado);
Comportamento.statusLED = Ligar ? StatusLED.Aceso : StatusLED.Apagado;
GeneralJoystick.EnviarComandoSensoriamento(S_Code.sLED, Sinaleiro.ID, Comportamento);
await Task.Delay(Delay);

View File

@ -106,7 +106,13 @@
this.lblVelocidade = new System.Windows.Forms.Label();
this.tkbVelocidade = new System.Windows.Forms.TrackBar();
this.tabMapa = new System.Windows.Forms.TabPage();
this.tabModulos = new System.Windows.Forms.TabPage();
this.txtModuloMotivo = new System.Windows.Forms.RichTextBox();
this.txtModulos = new System.Windows.Forms.RichTextBox();
this.clbModulos = new System.Windows.Forms.CheckedListBox();
this.picFechar = new System.Windows.Forms.PictureBox();
this.chbPulverizadorAutomatico = new System.Windows.Forms.CheckBox();
this.chbSonarAtivado = new System.Windows.Forms.CheckBox();
this.pnlMapa.SuspendLayout();
this.pnlMapaDinamico.SuspendLayout();
this.pnlSensores.SuspendLayout();
@ -118,6 +124,7 @@
((System.ComponentModel.ISupportInitialize)(this.tkbAnguloDirecional)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tkbVelocidade)).BeginInit();
this.tabMapa.SuspendLayout();
this.tabModulos.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picFechar)).BeginInit();
this.SuspendLayout();
//
@ -801,6 +808,7 @@
this.tabControl1.Controls.Add(this.tabSensores);
this.tabControl1.Controls.Add(this.tabControle);
this.tabControl1.Controls.Add(this.tabMapa);
this.tabControl1.Controls.Add(this.tabModulos);
this.tabControl1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabControl1.Location = new System.Drawing.Point(703, 34);
this.tabControl1.Name = "tabControl1";
@ -833,6 +841,8 @@
// pnlControle
//
this.pnlControle.AutoScroll = true;
this.pnlControle.Controls.Add(this.chbSonarAtivado);
this.pnlControle.Controls.Add(this.chbPulverizadorAutomatico);
this.pnlControle.Controls.Add(this.pnlFreio);
this.pnlControle.Controls.Add(this.lblAnguloDirecional);
this.pnlControle.Controls.Add(this.tkbAnguloDirecional);
@ -849,7 +859,7 @@
//
// pnlFreio
//
this.pnlFreio.Location = new System.Drawing.Point(134, 272);
this.pnlFreio.Location = new System.Drawing.Point(134, 305);
this.pnlFreio.Name = "pnlFreio";
this.pnlFreio.Size = new System.Drawing.Size(150, 150);
this.pnlFreio.TabIndex = 36;
@ -858,7 +868,7 @@
// lblAnguloDirecional
//
this.lblAnguloDirecional.AutoSize = true;
this.lblAnguloDirecional.Location = new System.Drawing.Point(3, 166);
this.lblAnguloDirecional.Location = new System.Drawing.Point(3, 205);
this.lblAnguloDirecional.Name = "lblAnguloDirecional";
this.lblAnguloDirecional.Size = new System.Drawing.Size(164, 20);
this.lblAnguloDirecional.TabIndex = 35;
@ -867,7 +877,7 @@
// tkbAnguloDirecional
//
this.tkbAnguloDirecional.Enabled = false;
this.tkbAnguloDirecional.Location = new System.Drawing.Point(7, 189);
this.tkbAnguloDirecional.Location = new System.Drawing.Point(7, 228);
this.tkbAnguloDirecional.Maximum = 90;
this.tkbAnguloDirecional.Name = "tkbAnguloDirecional";
this.tkbAnguloDirecional.Size = new System.Drawing.Size(277, 45);
@ -879,7 +889,7 @@
// lblVelocidade
//
this.lblVelocidade.AutoSize = true;
this.lblVelocidade.Location = new System.Drawing.Point(3, 75);
this.lblVelocidade.Location = new System.Drawing.Point(3, 114);
this.lblVelocidade.Name = "lblVelocidade";
this.lblVelocidade.Size = new System.Drawing.Size(179, 20);
this.lblVelocidade.TabIndex = 33;
@ -888,7 +898,7 @@
// tkbVelocidade
//
this.tkbVelocidade.Enabled = false;
this.tkbVelocidade.Location = new System.Drawing.Point(7, 98);
this.tkbVelocidade.Location = new System.Drawing.Point(7, 137);
this.tkbVelocidade.Maximum = 100;
this.tkbVelocidade.Name = "tkbVelocidade";
this.tkbVelocidade.Size = new System.Drawing.Size(277, 45);
@ -908,6 +918,55 @@
this.tabMapa.Text = "Mapa";
this.tabMapa.UseVisualStyleBackColor = true;
//
// tabModulos
//
this.tabModulos.BackColor = System.Drawing.SystemColors.Control;
this.tabModulos.Controls.Add(this.txtModuloMotivo);
this.tabModulos.Controls.Add(this.txtModulos);
this.tabModulos.Controls.Add(this.clbModulos);
this.tabModulos.Location = new System.Drawing.Point(4, 34);
this.tabModulos.Name = "tabModulos";
this.tabModulos.Padding = new System.Windows.Forms.Padding(3);
this.tabModulos.Size = new System.Drawing.Size(313, 503);
this.tabModulos.TabIndex = 3;
this.tabModulos.Text = "Módulos";
//
// txtModuloMotivo
//
this.txtModuloMotivo.BackColor = System.Drawing.SystemColors.Control;
this.txtModuloMotivo.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txtModuloMotivo.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtModuloMotivo.Location = new System.Drawing.Point(6, 405);
this.txtModuloMotivo.Name = "txtModuloMotivo";
this.txtModuloMotivo.ReadOnly = true;
this.txtModuloMotivo.Size = new System.Drawing.Size(299, 92);
this.txtModuloMotivo.TabIndex = 2;
this.txtModuloMotivo.Text = "";
//
// txtModulos
//
this.txtModulos.BackColor = System.Drawing.SystemColors.Control;
this.txtModulos.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txtModulos.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtModulos.Location = new System.Drawing.Point(6, 7);
this.txtModulos.Name = "txtModulos";
this.txtModulos.ReadOnly = true;
this.txtModulos.Size = new System.Drawing.Size(299, 122);
this.txtModulos.TabIndex = 1;
this.txtModulos.Text = "Status por módulo, é possível liberar a opreação caso algum módulo mandatório não" +
" esteja saudável, para fins de contingência.";
//
// clbModulos
//
this.clbModulos.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.clbModulos.FormattingEnabled = true;
this.clbModulos.Location = new System.Drawing.Point(6, 135);
this.clbModulos.Name = "clbModulos";
this.clbModulos.Size = new System.Drawing.Size(304, 264);
this.clbModulos.TabIndex = 0;
//
// picFechar
//
this.picFechar.Image = global::AgroBase.Properties.Resources.fechar;
@ -918,6 +977,28 @@
this.picFechar.TabIndex = 1;
this.picFechar.TabStop = false;
//
// chbPulverizadorAutomatico
//
this.chbPulverizadorAutomatico.AutoSize = true;
this.chbPulverizadorAutomatico.Location = new System.Drawing.Point(7, 43);
this.chbPulverizadorAutomatico.Name = "chbPulverizadorAutomatico";
this.chbPulverizadorAutomatico.Size = new System.Drawing.Size(199, 24);
this.chbPulverizadorAutomatico.TabIndex = 37;
this.chbPulverizadorAutomatico.Text = "Pulverizador Automático";
this.chbPulverizadorAutomatico.UseVisualStyleBackColor = true;
this.chbPulverizadorAutomatico.CheckedChanged += new System.EventHandler(this.chbPulverizadorAutomatico_CheckedChanged);
//
// chbSonarAtivado
//
this.chbSonarAtivado.AutoSize = true;
this.chbSonarAtivado.Location = new System.Drawing.Point(7, 73);
this.chbSonarAtivado.Name = "chbSonarAtivado";
this.chbSonarAtivado.Size = new System.Drawing.Size(156, 24);
this.chbSonarAtivado.TabIndex = 38;
this.chbSonarAtivado.Text = "Sonar Automático";
this.chbSonarAtivado.UseVisualStyleBackColor = true;
this.chbSonarAtivado.CheckedChanged += new System.EventHandler(this.chbSonarAtivado_CheckedChanged);
//
// frmDialogoMapa
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -954,6 +1035,7 @@
((System.ComponentModel.ISupportInitialize)(this.tkbAnguloDirecional)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.tkbVelocidade)).EndInit();
this.tabMapa.ResumeLayout(false);
this.tabModulos.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picFechar)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -1040,5 +1122,11 @@
private System.Windows.Forms.TextBox txtInclinacao;
private System.Windows.Forms.Label lblInclinacao;
private System.Windows.Forms.CheckBox chbAcompanharCarro;
private System.Windows.Forms.TabPage tabModulos;
private System.Windows.Forms.RichTextBox txtModulos;
private System.Windows.Forms.CheckedListBox clbModulos;
private System.Windows.Forms.RichTextBox txtModuloMotivo;
private System.Windows.Forms.CheckBox chbPulverizadorAutomatico;
private System.Windows.Forms.CheckBox chbSonarAtivado;
}
}

View File

@ -9,6 +9,7 @@ using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using static AgroBase.Models.Enums;
namespace AgroBase.Forms.IHM
{
@ -19,6 +20,8 @@ namespace AgroBase.Forms.IHM
private ulong CodigoFalha = 0;
private bool ReqFrameCam = false;
private bool ReqFrameSnr = false;
private bool _inRefresh;
private List<ModuloUIItem> _modulosUI = new List<ModuloUIItem>();
public frmDialogoMapa()
{
@ -44,6 +47,13 @@ namespace AgroBase.Forms.IHM
pnlCameraCaminho.BackgroundImageLayout = ImageLayout.Zoom;
pnlCameraCaminhoSeg.BackgroundImageLayout = ImageLayout.Zoom;
clbModulos.DrawMode = DrawMode.OwnerDrawFixed; // habilita owner-draw
clbModulos.ItemHeight = Math.Max(clbModulos.ItemHeight, 20);
clbModulos.DrawItem += clbModulos_DrawItem;
clbModulos.ItemCheck += clbModulos_ItemCheck;
clbModulos.SelectedIndexChanged += clbModulos_SelectedIndexChanged;
AtualizarElementosModoManual();
MapaDinamico = new MapaDinamicoModel(this, pnlMapaDinamico);
@ -180,7 +190,7 @@ namespace AgroBase.Forms.IHM
FuncoesGlobais.PreencheValorProgressBar(pgbOperacao, _Sensoriamento.Trajetoria.ProgressoTrajeto);
lblOperacao.Text = "Operação: " + _Sensoriamento.Trajetoria.ProgressoTrajeto.ToString("0.00") + "%";
FuncoesGlobais.PreencheValorProgressBar(pgbRuaAtual, _Sensoriamento.Trajetoria.CorredorAtual.Progresso);
lblRuaAtual.Text = "Rua Atual: " + _Sensoriamento.Trajetoria.CorredorAtual.Progresso.ToString("0.00") + "%";
@ -232,6 +242,8 @@ namespace AgroBase.Forms.IHM
if (!ReqFrameSnr)
_ = AtualizarCameraCaminho();
AtualizarListaModulos();
}
private async Task AtualizarCameraSolo()
@ -318,6 +330,9 @@ namespace AgroBase.Forms.IHM
tkbAnguloDirecional.Enabled = false;
tkbVelocidade.Enabled = false;
pnlJoystick.Visible = false;
tabControl1.TabPages.Remove(tabControle);
chbPulverizadorAutomatico.Checked = Variaveis.OperacaoEmAndamento.Controle.PulverizadorAutomatico;
chbSonarAtivado.Checked = Variaveis.OperacaoEmAndamento.Controle.SonarAtivado;
cmbModoControle.SelectedIndex = (int)Variaveis.OperacaoEmAndamento.Controle.TipoMovimento;
@ -336,6 +351,8 @@ namespace AgroBase.Forms.IHM
cmbModoControle.Enabled = true;
tkbVelocidade.Enabled = true;
tkbAnguloDirecional.Enabled = true;
tabControl1.TabPages.Insert(1, tabControle);
tabControl1.TabPages.Remove(tabMapa);
pnlJoystick.Visible = true;
pnlFreio.Visible = true;
@ -575,6 +592,16 @@ namespace AgroBase.Forms.IHM
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = (Enums.TipoMovimentoDirecional)cmbModoControle.SelectedIndex;
}
private void chbPulverizadorAutomatico_CheckedChanged(object sender, EventArgs e)
{
Variaveis.OperacaoEmAndamento.Controle.PulverizadorAutomatico = ((CheckBox)sender).Checked;
}
private void chbSonarAtivado_CheckedChanged(object sender, EventArgs e)
{
Variaveis.OperacaoEmAndamento.Controle.SonarAtivado = ((CheckBox)sender).Checked;
}
private void tkbVelocidade_Scroll(object sender, EventArgs e)
{
Variaveis.OperacaoEmAndamento.Controle.PercentualVelocidadeSP = tkbVelocidade.Value;
@ -611,5 +638,195 @@ namespace AgroBase.Forms.IHM
{
MapaDinamico.AlterarTravaRover(chbAcompanharCarro.Checked);
}
public class ModuloUIItem
{
public T_Code Disp { get; set; }
public bool Mandatorio { get; set; }
public bool Utilizar { get; set; }
public bool Conectado { get; set; }
public StatusModulo Status { get; set; }
public double Saude { get; set; }
public string Motivo { get; set; }
public override string ToString()
=> $"{Disp}: {Status} ({Saude})";
}
private void AtualizarListaModulos(bool forceRebuild = false)
{
if (_inRefresh) return;
_inRefresh = true;
try
{
// 1) Pega o estado atual do seu sistema
var src = Variaveis.OperacaoEmAndamento.ModulosMandatorios;
var saude = HealthWorkerService.ModulosSaude;
// 2) Constrói snapshot
var novos = new List<ModuloUIItem>(src.Count);
foreach (var mod in src)
{
var saudeMod = saude.FirstOrDefault(x => x.modulo.Equals(mod.Dispositivo));
var item = new ModuloUIItem
{
Disp = mod.Dispositivo,
Mandatorio = mod.Mandatorio,
Utilizar = mod.Utilizar,
Conectado = mod.Conectado,
Status = saudeMod?.status ?? StatusModulo.Desconectado,
Saude = saudeMod?.saude ?? 0,
Motivo = saudeMod != null ? string.Join(", ", saudeMod.motivos) : "Sem dados"
};
novos.Add(item);
}
// 3) Decide se precisa rebuild (qtd mudou ou forceRebuild)
bool precisaRebuild = forceRebuild || novos.Count != _modulosUI.Count ||
!novos.Select(n => n.Disp).SequenceEqual(_modulosUI.Select(o => o.Disp));
if (precisaRebuild)
{
_modulosUI.Clear();
_modulosUI.AddRange(novos);
clbModulos.BeginUpdate();
clbModulos.Items.Clear();
foreach (var it in _modulosUI)
{
clbModulos.Items.Add(it, it.Utilizar); // check = Mandatório
}
clbModulos.EndUpdate();
}
else
{
// 4) Só atualiza conteúdo/mandatório e força redraw
for (int i = 0; i < _modulosUI.Count; i++)
{
var novo = novos[i];
var cur = _modulosUI[i];
bool textoMudou =
cur.Status != novo.Status ||
Math.Abs(cur.Saude - novo.Saude) > 0.0001 ||
cur.Motivo != novo.Motivo;
cur.Mandatorio = novo.Mandatorio; // mantemos em sincronia
cur.Utilizar = novo.Utilizar; // mantemos em sincronia
cur.Conectado = novo.Conectado;
cur.Status = novo.Status;
cur.Saude = novo.Saude;
cur.Motivo = novo.Motivo;
// sincroniza o check se mudou externamente
bool checkAtual = clbModulos.GetItemChecked(i);
if (checkAtual != cur.Utilizar)
clbModulos.SetItemChecked(i, cur.Utilizar);
if (textoMudou)
clbModulos.Invalidate(clbModulos.GetItemRectangle(i));
}
}
}
finally
{
_inRefresh = false;
}
}
private (Color back, Color fore) Cores(StatusModulo st, bool conectado)
{
if (!conectado) return (Color.Black, Color.White); // Desconectado = preto
switch (st)
{
case StatusModulo.Falha: return (Color.Red, Color.White); // Falha = vermelho
case StatusModulo.Alerta: return (Color.Yellow, Color.Black); // Alerta = amarelo
case StatusModulo.Operante: return (Color.Green, Color.White); // Operante = verde
default: return (Color.Black, Color.White);
};
}
private void clbModulos_DrawItem(object sender, DrawItemEventArgs e)
{
if (e.Index < 0 || e.Index >= _modulosUI.Count)
return;
var it = _modulosUI[e.Index];
var (back, fore) = Cores(it.Status, it.Conectado);
// base
e.DrawBackground();
using (var b = new SolidBrush(back))
e.Graphics.FillRectangle(b, e.Bounds);
// checkbox (usa estilo do sistema, mas garantindo contraste de texto)
bool isChecked = clbModulos.GetItemChecked(e.Index);
CheckBoxRenderer.DrawCheckBox(
e.Graphics,
new Point(e.Bounds.Left + 4, e.Bounds.Top + (e.Bounds.Height - 14) / 2),
isChecked ? System.Windows.Forms.VisualStyles.CheckBoxState.CheckedNormal
: System.Windows.Forms.VisualStyles.CheckBoxState.UncheckedNormal
);
// texto
var texto = it.ToString();
var textRect = new Rectangle(e.Bounds.Left + 24, e.Bounds.Top, e.Bounds.Width - 24, e.Bounds.Height);
TextRenderer.DrawText(e.Graphics, texto, e.Font, textRect, fore, TextFormatFlags.VerticalCenter | TextFormatFlags.EndEllipsis);
// foco
e.DrawFocusRectangle();
}
private void clbModulos_ItemCheck(object sender, ItemCheckEventArgs e)
{
if (_inRefresh) return; // evita loop quando sincronizamos via código
var idx = e.Index;
if (idx < 0 || idx >= _modulosUI.Count) return;
// novo valor escolhido pelo usuário
bool novoUtilizar = e.NewValue == CheckState.Checked;
// atualiza UI cache
_modulosUI[idx].Utilizar = novoUtilizar;
// escreve de volta na fonte oficial
var disp = _modulosUI[idx].Disp;
var alvo = Variaveis.OperacaoEmAndamento.ModulosMandatorios.FirstOrDefault(m => m.Dispositivo.Equals(disp));
if (alvo != null)
{
if (alvo.Utilizar && alvo.Mandatorio && !novoUtilizar)
{
CustomDialog.ShowDialog(
"Confirmação",
"O módulo selecionado é um item mandatório para a operação atual, tem certeza que deseja desabilitar seu uso?",
MessageBoxIcon.Information,
new Dictionary<(string, dynamic), Action>()
{
{ ("Sim", null), () => { alvo.Utilizar = novoUtilizar; } },
{ ("Não", null), () => { _modulosUI[idx].Utilizar = alvo.Utilizar; } }
}
);
}
else
{
alvo.Utilizar = novoUtilizar;
}
}
// reavaliar liberação da operação
// (deixa para depois do evento terminar para não travar UI)
//this.BeginInvoke(new Action(ReavaliarLiberacaoOperacao));
}
private void clbModulos_SelectedIndexChanged(object sender, EventArgs e)
{
if (clbModulos.SelectedIndex < 0 || clbModulos.SelectedIndex >= _modulosUI.Count) return;
txtModuloMotivo.Text = _modulosUI[clbModulos.SelectedIndex].Motivo;
}
}
}

View File

@ -42,6 +42,8 @@ namespace AgroBase.Forms
{
await VariaveisOperacao.Operadores.IniciarProcessamento(false);
});
AudioAlertaService.SelecionarVoz(VariaveisEquipamento.VozAlerta);
}
private void frmInstancial_Shown(object sender, EventArgs e)

View File

@ -547,6 +547,8 @@ namespace AgroBase.Models.Modules
Versao = DadosLeitura.Versao.ToString(),
Mod_ID = Modulo_ID
});
Variaveis.OperacaoEmAndamento.ModsCalibragem[Dispositivo] = new Dictionary<string, bool>();
}
}
@ -803,24 +805,63 @@ namespace AgroBase.Models.Modules
public async Task<bool> RealizarTestesIniciais()
{
// Ligar bomba
bool BombaOk = false;
var calAtu = Variaveis.OperacaoEmAndamento.ModsCalibragem[T_Code.Atu];
var Bomba = BombasPressurizadoras.FirstOrDefault();
if (Bomba.Inicializado)
// Ligar bomba
foreach (var Bomba in BombasPressurizadoras.Where(x => x.Comandar))
{
calAtu.TryGetValue(Bomba.ID, out var cal);
if (cal && calAtu[Bomba.ID]) continue;
calAtu[Bomba.ID] = false;
// Sem herbicida no reservatorio, bomba nao precisa ligar
if (!Bomba.Inicializado || PercentualReservatorio < 5.0)
{
break;
}
GeneralJoystick.EnviarComandoAtuador(Bomba.Componente, true, Bomba.ID);
bool AtingiuPressao() => PressaoLinha >= Variaveis.OperacaoEmAndamento.Controle.PressaoLinha;
await FuncoesGlobais.AguardarCondicaoAsync(Bomba.AtingiuPressao, 3000, 200);
await FuncoesGlobais.AguardarCondicaoAsync(AtingiuPressao, 6000, 200);
bool BombaOk = Bomba.AtingiuPressao();
if (BombaOk)
{
calAtu[Bomba.ID] = true;
}
else
{
foreach (var Bico in BicosPulverizadores.Where(x => x.Comandar && x.Inicializado))
{
GeneralJoystick.EnviarComandoAtuador(Bico.Componente, true, Bico.ID);
}
BombaOk = AtingiuPressao();
await Task.Delay(3000);
foreach (var Bico in BicosPulverizadores.Where(x => x.Comandar && x.Inicializado))
{
GeneralJoystick.EnviarComandoAtuador(Bico.Componente, false, Bico.ID);
}
await FuncoesGlobais.AguardarCondicaoAsync(Bomba.AtingiuPressao, 4000, 200);
BombaOk = Bomba.AtingiuPressao();
if (BombaOk)
{
calAtu[Bomba.ID] = true;
}
}
}
// Testar os bicos
foreach (var Bico in BicosPulverizadores)
foreach (var Bico in BicosPulverizadores.Where(x => x.Comandar))
{
calAtu.TryGetValue(Bico.ID, out var cal);
if (cal && calAtu[Bico.ID]) continue;
calAtu[Bico.ID] = false;
if (Bico.Inicializado)
{
GeneralJoystick.EnviarComandoAtuador(Bico.Componente, true, Bico.ID);
@ -828,12 +869,16 @@ namespace AgroBase.Models.Modules
await Task.Delay(200);
GeneralJoystick.EnviarComandoAtuador(Bico.Componente, false, Bico.ID);
calAtu[Bico.ID] = true;
}
}
await Task.Delay(1000);
return BombaOk;
bool sucesso = calAtu.All(x => x.Value);
return sucesso;
}
public List<Task> RealizarCalibragemAsync()
@ -845,7 +890,11 @@ namespace AgroBase.Models.Modules
if (t.IsFaulted)
Console.WriteLine($"Erro no referenciamento do módulo {Modulo_ID}: {t.Exception?.InnerException?.Message}");
if (t.IsCompleted)
Console.WriteLine($"Referenciamento do módulo {Modulo_ID} concluído com sucesso!");
{
var calAtu = Variaveis.OperacaoEmAndamento.ModsCalibragem[T_Code.Atu];
var v = calAtu.Select(x => $"{x.Key} " + (x.Value ? "Sim" : "Não"));
Console.WriteLine($"Task de referenciamento do módulo {Modulo_ID} finalizada: " + string.Join(", ", v));
}
}));
return tasks;
@ -1047,6 +1096,8 @@ namespace AgroBase.Models.Modules
);
}
public bool AtingiuPressao() => Variaveis.OperacaoEmAndamento.DispAtu.Dados.PressaoLinha >= Variaveis.OperacaoEmAndamento.Controle.PressaoLinha;
}
public class CalibragemVazao

View File

@ -343,7 +343,7 @@ namespace AgroBase.Models.Modules
DateTime TimeoutGeral = DateTime.Now.AddMinutes(2); // Timeout geral para o processo.
Sentido _sentido = SentidoReal == Sentido.Horario ? Sentido.Antihorario : Sentido.Horario;
double _anguloSP = 360 * (_sentido == Sentido.Antihorario ? -1 : 1);
double _anguloSP = 180 * (_sentido == Sentido.Antihorario ? -1 : 1);
double _anguloSpAnterior = 0;
while (!Sucesso && TimeoutGeral > DateTime.Now && Inicializado)

View File

@ -391,25 +391,56 @@ namespace AgroBase.Models.Modules
return Modulos.All(x => x.DirMotor.Referenciado);
}
public List<Task> RealizarCalibragemAsync()
public List<Task> RealizarCalibragemMovAsync()
{
List<Task> tasks = new List<Task>();
var DispMvd = Variaveis.OperacaoEmAndamento.DispMvd;
if (DispMvd != null)
{
var calMov = Variaveis.OperacaoEmAndamento.ModsCalibragem[T_Code.Mov];
foreach (var mod in DispMvd.Dados.Modulos)
{
calMov.TryGetValue(mod.Modulo_ID, out var cal);
if (cal && calMov[mod.Modulo_ID]) continue;
calMov[mod.Modulo_ID] = mod.MovMotor.Inicializado;
}
DispMvd.Dados.MovPronto = DispMvd.Dados.Modulos.All(x => x.MovMotor.Inicializado);
}
return tasks;
}
public List<Task> RealizarCalibragemDirAsync()
{
List<Task> tasks = new List<Task>();
var DispMvd = Variaveis.OperacaoEmAndamento.DispMvd;
if (DispMvd != null)
{
var calDir = Variaveis.OperacaoEmAndamento.ModsCalibragem[T_Code.Dir];
foreach (var mod in DispMvd.Dados.Modulos)
{
calDir.TryGetValue(mod.Modulo_ID, out var cal);
if (cal && calDir[mod.Modulo_ID]) continue;
calDir[mod.Modulo_ID] = false;
}
DispMvd.Dados.DirPronto = DispMvd.Dados.Modulos.All(x => x.DirMotor.Inicializado);
if (DispMvd.Dados.Modulos.Any(x => x.DirMotor.Inicializado))
{
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = TipoMovimentoDirecional.Diagnostico;
var ModsRef = Modulos.Where(x => x.DirMotor.Comandar).ToList(); // && x.DirMotor.Inicializado
foreach (var Modulo in ModsRef)
{
if (calDir[Modulo.Modulo_ID]) continue;
tasks.Add(Modulo.DirMotor.ReferenciaMotor().ContinueWith(t => {
if (t.IsFaulted)
Console.WriteLine($"Erro no referenciamento do módulo {Modulo.Modulo_ID}: {t.Exception?.InnerException?.Message}");
if (t.IsCompleted)
{
Console.WriteLine($"Referenciamento do módulo {Modulo.Modulo_ID} concluído com sucesso!");
calDir[Modulo.Modulo_ID] = true;
}
}));
}
}

View File

@ -105,7 +105,7 @@ namespace AgroBase.Models.Modules
{
FuncoesPinout.Sinaleiro,
},
Comportamento = VariaveisEquipamento.ComportamentoPorStatus(StatusOperacao.NaoIniciado),
Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusOperacao.NaoIniciado),
ValoresLeituras = new List<SensorValoresLeituraModel>()
{
new SensorValoresLeituraModel()
@ -138,7 +138,7 @@ namespace AgroBase.Models.Modules
{
FuncoesPinout.Sinaleiro,
},
Comportamento = VariaveisEquipamento.ComportamentoPorStatus(StatusOperacao.NaoIniciado),
Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusOperacao.NaoIniciado),
ValoresLeituras = new List<SensorValoresLeituraModel>()
{
new SensorValoresLeituraModel()
@ -171,7 +171,7 @@ namespace AgroBase.Models.Modules
{
FuncoesPinout.Sinaleiro,
},
Comportamento = VariaveisEquipamento.ComportamentoPorStatus(StatusOperacao.NaoIniciado),
Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusOperacao.NaoIniciado),
ValoresLeituras = new List<SensorValoresLeituraModel>()
{
new SensorValoresLeituraModel()
@ -1785,6 +1785,8 @@ namespace AgroBase.Models.Modules
Versao = DadosLeitura.Versao.ToString(),
Mod_ID = Modulo_ID,
});
Variaveis.OperacaoEmAndamento.ModsCalibragem[Dispositivo] = new Dictionary<string, bool>();
}
}
@ -2016,7 +2018,7 @@ namespace AgroBase.Models.Modules
var ledAT = Sinaleiros.FirstOrDefault(x => x.ID == "LEDAT" && x.Inicializado);
var ledMN = Sinaleiros.FirstOrDefault(x => x.ID == "LEDMN" && x.Inicializado);
var comportamento = VariaveisEquipamento.ComportamentoPorStatus();
var comportamento = VariaveisEquipamento.ComportamentoLedPorStatus();
var valOp = (int?)(ledOP?.ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLEDComando)?.atual?.valor) ?? 0;
if (ledOP != null && (!ledOP.Comportamento.Equals(comportamento) || valOp != (int)comportamento.statusLED))
{

View File

@ -56,11 +56,13 @@ namespace AgroBase.Models
#region STATUS DE CONTEXTO
public StatusOperacao StatusAtual { get; private set; } = StatusOperacao.NaoIniciado;
public StatusOperacao StatusAnterior { get; private set; } = StatusOperacao.NaoIniciado;
public bool Emergencia { get; set; } = false;
public bool OperacaoLiberada { get; private set; } = false;
public bool OperacaoConfigurada { get; private set; } = false;
public string ErroOperacaoLiberada { get; set; }
public DateTime TempoAguardando { get; private set; } = DateTime.Now;
public double TempoAguardandoSegs => (TempoAguardando.AddSeconds(TempoIniciarOperacao) - DateTime.Now).TotalSeconds;
public bool Iniciado { get; set; }
public bool Finalizando { get; set; } = false;
public bool Calibrando { get; set; } = false;
@ -86,6 +88,13 @@ namespace AgroBase.Models
HealthWorkerService.ModulosSaude = RedisService.GetField<ManagerWorkerMessageResponseModulosPendentesModel[]>(CtxKey.DadosOperacao, "status_modulos").ToList();
Variaveis.OperacaoEmAndamento.ErroOperacaoLiberada = RedisService.GetField<string>(CtxKey.DadosOperacao, "motivo_nao_liberado");
GPSService.CorrecaoRTK_Ntrip = RedisService.GetField<bool>(RedisService.ModKey(T_Code.Gps), "correcao_ntrip", false);
if (Variaveis.OperacaoEmAndamento.StatusAtual != Variaveis.OperacaoEmAndamento.StatusAnterior)
{
AudioAlertaService.AlertaSonoroPorStatus(Variaveis.OperacaoEmAndamento.StatusAtual);
}
Variaveis.OperacaoEmAndamento.StatusAnterior = Variaveis.OperacaoEmAndamento.StatusAtual;
}
@ -97,13 +106,15 @@ namespace AgroBase.Models
public bool Simulando { get; set; } = false;
public double SimulacaoAnguloControle { get; set; } = 0;
public double SimulacaoRpmControle { get; set; } = 0;
public Dictionary<T_Code, Dictionary<string, bool>> ModsCalibragem { get; set; } = new Dictionary<T_Code, Dictionary<string, bool>>();
public List<OperacaoModulosMandatoriosModel> ModulosMandatorios { get; set; } = new List<OperacaoModulosMandatoriosModel>();
public List<OperacaoParametrosMandatoriosModel> ParametrosMandatorios { get; set; } = new List<OperacaoParametrosMandatoriosModel>();
public double CapacidadeReservatorio { get; set; } = 30;
public int QuantidadeCamerasSolo { get; set; } = 1;
public int TempoIniciarOperacao { get; set; } = 5;
public int TempoIniciarOperacao { get; set; } = 30;
public string ID { get; set; }
public double tmrLogsInterval
{
@ -681,10 +692,10 @@ namespace AgroBase.Models
if (Variaveis.OperacaoEmAndamento.DispSen.Dados.Conectado)
{
Variaveis.OperacaoEmAndamento.DispSen.Dados.Sinaleiros.ForEach(x => x.Comportamento = VariaveisEquipamento.ComportamentoPorStatus(StatusOperacao.NaoIniciado));
Variaveis.OperacaoEmAndamento.DispSen.Dados.Sinaleiros.ForEach(x => x.Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusOperacao.NaoIniciado));
Variaveis.OperacaoEmAndamento.DispSen.Dados.Sinaleiros.First(x => x.ID == (Modo == ModoOperacao.Manual ? "LEDMN" : "LEDAT")).Comportamento.statusLED = StatusLED.Aceso;
Variaveis.OperacaoEmAndamento.DispSen.Dados.Sinaleiros.First(x => x.ID == "LEDOP").Comportamento = VariaveisEquipamento.ComportamentoPorStatus();
Variaveis.OperacaoEmAndamento.DispSen.Dados.Sinaleiros.First(x => x.ID == "LEDOP").Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus();
//OperacaoCarregar.DispSen.Dados.Sinaleiros.ForEach(x => OperacaoCarregar.DispSen.AdicionarMensagemFila(OperacaoCarregar.DispSen.Dados.Modulo_ID, x.ProtocoloComando(), true, false));
foreach (var Sinaleiro in Variaveis.OperacaoEmAndamento.DispSen.Dados.Sinaleiros)
@ -725,6 +736,13 @@ namespace AgroBase.Models
DispAtu?.Dados?.ReiniciarLeituras(DispAtu?.Dados);
DispSen?.Dados?.ReiniciarLeituras(DispSen?.Dados);
ModsCalibragem = new Dictionary<T_Code, Dictionary<string, bool>>()
{
{ T_Code.Mov, new Dictionary<string, bool>() { } },
{ T_Code.Dir, new Dictionary<string, bool>() { } },
{ T_Code.Atu, new Dictionary<string, bool>() { } },
};
RedisService.AtualizarCampos(CtxKey.DadosOperacao, ("configurado", false));
WeedWorkerService.ReiniciarLeituraAnalise();
VisualWorkerService.ReiniciarLeituraAnalise();
@ -779,6 +797,9 @@ namespace AgroBase.Models
public async Task RealizarCalibragemInicialAsync()
{
bool modsCalibrados = Variaveis.OperacaoEmAndamento.ModsCalibragem.All(x => x.Value.Values.Count > 0 && x.Value.Values.All(y => y == true));
if (modsCalibrados) return;
Console.WriteLine("Calibragem inicial inciada...");
Variaveis.OperacaoEmAndamento.Calibrando = true;
RedisService.AtualizarCampos(CtxKey.DadosOperacao, ("calibrando", Variaveis.OperacaoEmAndamento.Calibrando));
@ -789,8 +810,10 @@ namespace AgroBase.Models
var DispMvd = Variaveis.OperacaoEmAndamento.DispMvd;
var tasks = new List<Task>();
if (DispAtu?.Dados != null) tasks.AddRange(DispAtu.Dados.RealizarCalibragemAsync());
if (DispMvd?.Dados != null) tasks.AddRange(DispMvd.Dados.RealizarCalibragemAsync());
if (DispAtu?.Dados != null && (Variaveis.OperacaoEmAndamento.ModsCalibragem[T_Code.Atu].Any(x => !x.Value) || !Variaveis.OperacaoEmAndamento.ModsCalibragem[T_Code.Atu].Any())) tasks.AddRange(DispAtu.Dados.RealizarCalibragemAsync());
if (DispMvd?.Dados != null && (Variaveis.OperacaoEmAndamento.ModsCalibragem[T_Code.Dir].Any(x => !x.Value) || !Variaveis.OperacaoEmAndamento.ModsCalibragem[T_Code.Dir].Any())) tasks.AddRange(DispMvd.Dados.RealizarCalibragemDirAsync());
if (DispMvd?.Dados != null && (Variaveis.OperacaoEmAndamento.ModsCalibragem[T_Code.Mov].Any(x => !x.Value) || !Variaveis.OperacaoEmAndamento.ModsCalibragem[T_Code.Mov].Any())) tasks.AddRange(DispMvd.Dados.RealizarCalibragemMovAsync());
if (tasks.Count == 0)
{
@ -808,6 +831,7 @@ namespace AgroBase.Models
if (completed == allTasks)
{
Console.WriteLine("Calibragem finalizada com sucesso!");
}
else
{
@ -1103,11 +1127,13 @@ namespace AgroBase.Models
if (enviarComando)
{
var Bomba = Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombasPressurizadoras.FirstOrDefault();
bool Ligado = Bomba.ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.Potencia)?.atual?.valor > 0;
if (Bomba != null && Bomba.ComandoAtuar && !Ligado)
foreach (var Bomba in Variaveis.OperacaoEmAndamento.DispAtu.Dados.BombasPressurizadoras)
{
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, true, Bomba.ID);
bool Ligado = Bomba.ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.Potencia)?.atual?.valor > 0;
if (!Ligado)
{
GeneralJoystick.EnviarComandoAtuador(S_Code.sBMB, true, Bomba.ID);
}
}
}
@ -1195,6 +1221,16 @@ namespace AgroBase.Models
if (Variaveis.OperacaoEmAndamento.Iniciado)
{
SalvarLogs(false);
if (idxLog % 10 == 0)
{
AudioAlertaService.AlertaSonoroPorStatus(Variaveis.OperacaoEmAndamento.StatusAtual);
}
if (idxLog % 5 == 0 && !Variaveis.OperacaoEmAndamento.Calibrando)
{
Task.Run(async () => await RealizarCalibragemInicialAsync());
}
}
}
@ -1777,6 +1813,7 @@ namespace AgroBase.Models
public VisualWorkerModel OperadorVisual { get; set; }
public WeedWorkerModel OperadorErvas { get; set; }
public List<ManagerWorkerMessageResponseModulosPendentesModel> ModulosSaude { get; set; }
public Dictionary<T_Code, Dictionary<string, bool>> ModsCalibragem { get; set; }
public bool CanSerialAtivado { get; set; }
@ -1934,6 +1971,7 @@ namespace AgroBase.Models
DadosPerformance = dadosPerformance,
DadosLoRa = dadosLora,
ModulosSaude = HealthWorkerService.ModulosSaude.ToList(),
ModsCalibragem = new Dictionary<T_Code, Dictionary<string, bool>>(Variaveis.OperacaoEmAndamento.ModsCalibragem),
};
Variaveis.OperacaoEmAndamento.Sensoriamento = dadosAtualizados;
@ -1969,6 +2007,7 @@ namespace AgroBase.Models
IMU = IMU?.Clone(),
DadosLoRa = DadosLoRa?.Clone(),
ModulosSaude = new List<ManagerWorkerMessageResponseModulosPendentesModel>(ModulosSaude),
ModsCalibragem = new Dictionary<T_Code, Dictionary<string, bool>>(ModsCalibragem),
};
}

View File

@ -18,7 +18,6 @@ using Microsoft.Web.WebView2.WinForms;
using Microsoft.Web.WebView2.Core;
using System.Text.Json;
using AgroBase.Services.Operadores;
using MathNet.Numerics.Distributions;
using System.Diagnostics;
namespace AgroBase.Models
@ -190,8 +189,9 @@ namespace AgroBase.Models
};
public static double AnguloInclinacaoRollMax { get; set; } = 30.0;
public static double AnguloInclinacaoPitchMax { get; set; } = 45.0;
public static string VozAlerta { get; set; } = "Microsoft Maria Desktop";
public static SensorSinaleiroComportamentoModel ComportamentoPorStatus(StatusOperacao? _status = null)
public static SensorSinaleiroComportamentoModel ComportamentoLedPorStatus(StatusOperacao? _status = null)
{
if (_status == null)
{
@ -214,7 +214,7 @@ namespace AgroBase.Models
{
statusLED = StatusLED.Piscando,
QtdPiscadas = 2,
TempoMs = 500,
TempoMs = 800,
PausaMs = 2000,
};
break;
@ -227,7 +227,7 @@ namespace AgroBase.Models
statusLED = StatusLED.Piscando,
QtdPiscadas = 1,
TempoMs = 1000,
PausaMs = 1000,
PausaMs = 2000,
};
break;
}
@ -236,9 +236,9 @@ namespace AgroBase.Models
comportamento = new SensorSinaleiroComportamentoModel()
{
statusLED = StatusLED.Piscando,
QtdPiscadas = 2,
TempoMs = 1000,
PausaMs = 2000,
QtdPiscadas = 3,
TempoMs = 500,
PausaMs = 800,
};
break;
}
@ -247,9 +247,9 @@ namespace AgroBase.Models
comportamento = new SensorSinaleiroComportamentoModel()
{
statusLED = StatusLED.Piscando,
QtdPiscadas = 4,
TempoMs = 200,
PausaMs = 1000,
QtdPiscadas = 5,
TempoMs = 500,
PausaMs = 2000,
};
break;
}
@ -258,9 +258,20 @@ namespace AgroBase.Models
comportamento = new SensorSinaleiroComportamentoModel()
{
statusLED = StatusLED.Piscando,
QtdPiscadas = 3,
TempoMs = 200,
PausaMs = 2000,
QtdPiscadas = 1,
TempoMs = 500,
PausaMs = 1000,
};
break;
}
case StatusOperacao.Calibrando:
{
comportamento = new SensorSinaleiroComportamentoModel()
{
statusLED = StatusLED.Piscando,
QtdPiscadas = 2,
TempoMs = 500,
PausaMs = 800,
};
break;
}

View File

@ -0,0 +1,110 @@
using AgroBase.Models;
using System;
using System.Speech.Synthesis;
using static AgroBase.Models.Enums;
namespace AgroBase.Services
{
public static class AudioAlertaService
{
private static SpeechSynthesizer synth = new SpeechSynthesizer();
private static bool _falando = false;
static AudioAlertaService()
{
// Configurações padrão
synth.SelectVoice("Microsoft Maria Desktop");
synth.Volume = 100;
synth.Rate = 0;
// Eventos de início e fim da fala
synth.SpeakStarted += (_, __) => _falando = true;
synth.SpeakCompleted += (_, __) => _falando = false;
}
public static bool EstaFalando => _falando;
public static void ListarVozes()
{
Console.WriteLine("Vozes instaladas no sistema:");
foreach (var voice in synth.GetInstalledVoices())
{
var info = voice.VoiceInfo;
Console.WriteLine($"- {info.Name} ({info.Culture})");
}
}
public static void SelecionarVoz(string Voz)
{
synth.SelectVoice(Voz); // pt-BR
Console.WriteLine($"Voz selecionada: {Voz}");
}
public static void Falar(string texto, bool forcar = false, int volume = 100, int velocidade = 0)
{
if (_falando && !forcar)
return;
synth.Volume = volume; // 0100
synth.Rate = velocidade; // -10 a +10
synth.SpeakAsyncCancelAll(); // cancela fala anterior, se houver
synth.SpeakAsync(texto); // fala em segundo plano
}
public static void Parar()
{
synth.SpeakAsyncCancelAll();
_falando = false;
}
public static void AlertaSonoroPorStatus(StatusOperacao Status)
{
string Texto = "";
switch (Status)
{
case StatusOperacao.NaoIniciado:
Texto = "Sistema pronto. Operação não iniciada.";
break;
case StatusOperacao.Parametrizando:
Texto = "Carregando parâmetros da operação.";
break;
case StatusOperacao.Calibrando:
Texto = "Calibrando módulos. Mantenha distância.";
break;
case StatusOperacao.Aguardando:
Texto = $"Atenção: início em {SegundosFmt(Variaveis.OperacaoEmAndamento.TempoAguardandoSegs)}.";
break;
case StatusOperacao.EmAndamento:
Texto = "Operação em andamento.";
break;
case StatusOperacao.Parado:
Texto = TextoParado();
break;
case StatusOperacao.Concluido:
Texto = $"Operação concluída. Aguardando instruções.";
break;
}
if (!string.IsNullOrEmpty(Texto))
{
Falar(Texto, forcar: true);
}
// ------- helpers locais -------
string SegundosFmt(double s)
{
int v = (int)Math.Round(s);
return v == 1 ? "1 segundo" : $"{v} segundos";
}
string TextoParado()
{
string motivo = Variaveis.OperacaoEmAndamento?.ErroOperacaoLiberada;
motivo = string.IsNullOrWhiteSpace(motivo) ? "motivo não informado" : motivo;
return $"Operação interrompida: {motivo}. Intervenção necessária.";
}
}
}
}

View File

@ -34,7 +34,7 @@ namespace AgroBase.Services
{
get
{
return Referenciando ? 250 : 2000;
return Referenciando ? 250 : 1000;
}
}
@ -88,6 +88,8 @@ namespace AgroBase.Services
Versao = (Leitura.FV ?? "").ToString(),
Mod_ID = Mod_ID,
});
Variaveis.OperacaoEmAndamento.ModsCalibragem[T_Code.Dir][Mod_ID] = false;
}
}
}

View File

@ -93,6 +93,8 @@ namespace AgroBase.Services
Versao = "1.0",
Mod_ID = Mod_ID,
});
Variaveis.OperacaoEmAndamento.ModsCalibragem[T_Code.Mov][Mod_ID] = false;
}
}
}

View File

@ -105,6 +105,7 @@ namespace AgroBase.Services.Operadores
AtualizarDadosContextoLocal();
AtualizarDadosModulos();
AtualizarDadosControleOperacao();
var _Sensoriamento = Variaveis.OperacaoEmAndamento.Sensoriamento;
@ -186,7 +187,6 @@ namespace AgroBase.Services.Operadores
AtualizandoRedis = true;
AtualizarDadosEquipamento();
AtualizarDadosControleOperacao();
if (Variaveis.OperacaoEmAndamento.DispMvd == null)
{
@ -248,8 +248,7 @@ namespace AgroBase.Services.Operadores
{
percentual_altura_solo = Variaveis.OperacaoEmAndamento.DispSen.Dados.CameraCaminho.PercentualAlturaSolo,
distancia_maxima = Variaveis.OperacaoEmAndamento.DispSen.Dados.CameraCaminho.DistanciaMaximaVisao,
distancia_minima = Variaveis.OperacaoEmAndamento.DispSen.Dados.CameraCaminho.DistanciaMinimaVisao,
sonar_ativado = _Controle.SonarAtivado,
distancia_minima = Variaveis.OperacaoEmAndamento.DispSen.Dados.CameraCaminho.DistanciaMinimaVisao
}
)
);
@ -272,7 +271,8 @@ namespace AgroBase.Services.Operadores
CtxKey.DadosControle,
("pulverizador_automatico", Variaveis.OperacaoEmAndamento.Controle.PulverizadorAutomatico),
("movimento_automatico", Variaveis.OperacaoEmAndamento.Controle.MovimentoAutomatico),
("frenagem_automatica", Variaveis.OperacaoEmAndamento.Controle.FrenagemAutomatica)
("frenagem_automatica", Variaveis.OperacaoEmAndamento.Controle.FrenagemAutomatica),
("sonar_ativado", Variaveis.OperacaoEmAndamento.Controle.SonarAtivado)
);
}

View File

@ -1,33 +1,26 @@
{
"epochs": [ {
"calculation_time": "13401820180888621",
"config_version": 0,
"model_version": "0",
"padded_top_topics_start_index": 0,
"taxonomy_version": 0,
"top_topics_and_observing_domains": [ ]
}, {
"calculation_time": "13402425506182172",
"config_version": 0,
"model_version": "0",
"padded_top_topics_start_index": 0,
"taxonomy_version": 0,
"top_topics_and_observing_domains": [ ]
}, {
"calculation_time": "13403032020468903",
"config_version": 0,
"model_version": "0",
"padded_top_topics_start_index": 0,
"taxonomy_version": 0,
"top_topics_and_observing_domains": [ ]
}, {
"calculation_time": "13403638998815188",
"config_version": 0,
"model_version": "0",
"padded_top_topics_start_index": 0,
"taxonomy_version": 0,
"top_topics_and_observing_domains": [ ]
}, {
"calculation_time": "13404318085229101",
"config_version": 0,
"model_version": "0",
"padded_top_topics_start_index": 0,
"taxonomy_version": 0,
"top_topics_and_observing_domains": [ ]
}, {
"calculation_time": "13405435224195095",
"config_version": 0,
"model_version": "0",
"padded_top_topics_start_index": 0,
"taxonomy_version": 0,
"top_topics_and_observing_domains": [ ]
} ],
"hex_encoded_hmac_key": "40F346D3248C3AFDF2BEE1FE496DBD32F7CED6E5AE98B881ABC421AA7E7B5642",
"next_scheduled_calculation_time": "13404243798816911"
"next_scheduled_calculation_time": "13406040024195500"
}

View File

@ -1,3 +1,3 @@
2025/10/03-16:24:55.139 454c Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
2025/10/03-16:24:55.151 454c Recovering log #3
2025/10/03-16:24:55.154 454c Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/000003.log
2025/10/21-15:55:46.193 7ba4 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
2025/10/21-15:55:46.202 7ba4 Recovering log #3
2025/10/21-15:55:46.206 7ba4 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/000003.log

View File

@ -1,3 +1,3 @@
2025/10/03-15:22:52.728 6c8c Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
2025/10/03-15:22:52.737 6c8c Recovering log #3
2025/10/03-15:22:52.740 6c8c Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/000003.log
2025/10/21-15:32:17.079 e18 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
2025/10/21-15:32:17.090 e18 Recovering log #3
2025/10/21-15:32:17.093 e18 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/000003.log

View File

@ -1 +1 @@
{"net":{"http_server_properties":{"servers":[{"alternative_service":[{"advertised_alpns":["h3"],"expiration":"13404079551047360","port":443,"protocol_str":"quic"}],"anonymization":["DAAAAAcAAABmaWxlOi8vAA==",false,0],"network_stats":{"srtt":20632},"server":"https://tile.openstreetmap.org","supports_spdy":true}],"supports_quic":{"address":"2804:d78:678:7800:849d:3e58:2f80:31ae","used_quic":true},"version":5},"network_qualities":{"CAASABiAgICA+P////8B":"4G","CAESABiAgICA+P////8B":"4G","CAISABiAgICA+P////8B":"4G","CAYSABiAgICA+P////8B":"Offline"}}}
{"net":{"http_server_properties":{"servers":[{"alternative_service":[{"advertised_alpns":["h3"],"expiration":"13405632946561751","port":443,"protocol_str":"quic"}],"anonymization":["DAAAAAcAAABmaWxlOi8vAA==",false,0],"network_stats":{"srtt":10850},"server":"https://tile.openstreetmap.org","supports_spdy":true}],"supports_quic":{"address":"2804:d78:6d1:df00:d5f9:343b:6650:d75a","used_quic":true},"version":5},"network_qualities":{"CAASABiAgICA+P////8B":"4G","CAESABiAgICA+P////8B":"4G","CAISABiAgICA+P////8B":"4G","CAYSABiAgICA+P////8B":"Offline"}}}

View File

@ -1 +1 @@
{"sts":[{"expiry":1791055495.553238,"host":"bWGAftl61rqoc0YzqPncsLvQQh/iC2Bdp3ejUeGC83w=","mode":"force-https","sts_include_subdomains":true,"sts_observed":1759519495.553241}],"version":2}
{"sts":[{"expiry":1792587142.154096,"host":"bWGAftl61rqoc0YzqPncsLvQQh/iC2Bdp3ejUeGC83w=","mode":"force-https","sts_include_subdomains":true,"sts_observed":1761051142.154101}],"version":2}

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,3 @@
2025/10/03-17:36:56.743 454c Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
2025/10/03-17:36:56.744 454c Recovering log #3
2025/10/03-17:36:56.748 454c Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/000003.log
2025/10/21-16:01:56.995 7ba4 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
2025/10/21-16:01:56.997 7ba4 Recovering log #3
2025/10/21-16:01:57.002 7ba4 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/000003.log

View File

@ -1,3 +1,3 @@
2025/10/03-15:27:23.007 6c8c Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
2025/10/03-15:27:23.008 6c8c Recovering log #3
2025/10/03-15:27:23.011 6c8c Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/000003.log
2025/10/21-15:33:00.189 e18 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
2025/10/21-15:33:00.191 e18 Recovering log #3
2025/10/21-15:33:00.195 e18 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/000003.log

View File

@ -1,3 +1,3 @@
2025/10/03-16:24:55.062 55a8 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
2025/10/03-16:24:55.064 55a8 Recovering log #7
2025/10/03-16:24:55.064 55a8 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/000007.log
2025/10/21-15:55:46.109 7a68 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
2025/10/21-15:55:46.111 7a68 Recovering log #7
2025/10/21-15:55:46.112 7a68 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/000007.log

View File

@ -1,3 +1,3 @@
2025/10/03-15:22:52.657 692c Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
2025/10/03-15:22:52.660 692c Recovering log #7
2025/10/03-15:22:52.660 692c Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/000007.log
2025/10/21-15:32:17.002 2080 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
2025/10/21-15:32:17.004 2080 Recovering log #7
2025/10/21-15:32:17.005 2080 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/000007.log

View File

@ -1 +1 @@
140.0.3485.94
141.0.3537.92

File diff suppressed because one or more lines are too long

View File

@ -1,5 +0,0 @@
{
"description" : "Microsoft PKI Metadata",
"name" : "PKIMetadata",
"version" : "24.0.0.1"
}

View File

@ -1 +1 @@
{"hashes":{"000ac7dc9366969db9d1e41810a3a27c747a7623535d856eecc2de86cfed80c7":{"appid":"eeobbhfgfagbclfofmgbdfoicabjdbkn","fp":""},"00AF3F07B5ABB71F6D30337E1EEF62FA280F06EF19485C0CF6B72171F92CCC0A":{"appid":"kpfehajjjbbcifeehjgfgnabifknmdad","fp":"1.00AF3F07B5ABB71F6D30337E1EEF62FA280F06EF19485C0CF6B72171F92CCC0A"},"4B81B4DF3AD971287E1AE02C449344FCFA5D20431DE17B2BA8854CC9CDCE4089":{"appid":"ahmaebgpfccdhgidjaidaoojjcijckba","fp":"1.4B81B4DF3AD971287E1AE02C449344FCFA5D20431DE17B2BA8854CC9CDCE4089"},"89f43cb3df807293de2772d5f01ac2fc1482b38ccc8fdaee859b80642b7a0487":{"appid":"pghocgajpebopihickglahgebcmkcekh","fp":""},"95FD9D48E4FC245A3F3A99A3A16ECD1355050BA3F4AFC555F19A97C7F9B49677":{"appid":"ohckeflnhegojcjlcpbfpciadgikcohk","fp":"1.95FD9D48E4FC245A3F3A99A3A16ECD1355050BA3F4AFC555F19A97C7F9B49677"},"A81D1959892AE4180554347DF1B97834ABBA2E1A5E6B9AEBA000ECEA26EABECC":{"appid":"fppmbhmldokgmleojlplaaodlkibgikh","fp":"1.A81D1959892AE4180554347DF1B97834ABBA2E1A5E6B9AEBA000ECEA26EABECC"},"b987bdc4f2ad2a409b964921d4a5db1cdbe07f9c98f868293b4cc32acdc42cec":{"appid":"alpjnmnfbgfkmmpcfpejmmoebdndedno","fp":""},"bcb93cba8636743d1fbd32be3bd8ce8ff602323895bf4d136c26b9bc64b0a6a4":{"appid":"ndikpojcjlepofdkaaldkinkjbeeebkl","fp":""},"fa29a6d5775ff340900a65b39b02fc8b4b77d403c048d8debf22f2f5d09c61a0":{"appid":"oankkpibpaokgecfckkdkgaoafllipag","fp":""},"fbb2c0f4fad3b34b3ac7116d98f83638cf6f55a47992026a7abf944a759aa0ea":{"appid":"fgbafbciocncjfbbonhocjaohoknlaco","fp":""},"ff87fddb54d7bdc8ab8c2697bc92337c914803fb22cd32e445389e8042159ce9":{"appid":"jbfaflocpnkhbgcijpkiafdpbjkedane","fp":""}}}
{"hashes":{"000ac7dc9366969db9d1e41810a3a27c747a7623535d856eecc2de86cfed80c7":{"appid":"eeobbhfgfagbclfofmgbdfoicabjdbkn","fp":""},"00AF3F07B5ABB71F6D30337E1EEF62FA280F06EF19485C0CF6B72171F92CCC0A":{"appid":"kpfehajjjbbcifeehjgfgnabifknmdad","fp":"1.00AF3F07B5ABB71F6D30337E1EEF62FA280F06EF19485C0CF6B72171F92CCC0A"},"4B81B4DF3AD971287E1AE02C449344FCFA5D20431DE17B2BA8854CC9CDCE4089":{"appid":"ahmaebgpfccdhgidjaidaoojjcijckba","fp":"1.4B81B4DF3AD971287E1AE02C449344FCFA5D20431DE17B2BA8854CC9CDCE4089"},"89f43cb3df807293de2772d5f01ac2fc1482b38ccc8fdaee859b80642b7a0487":{"appid":"pghocgajpebopihickglahgebcmkcekh","fp":""},"95FD9D48E4FC245A3F3A99A3A16ECD1355050BA3F4AFC555F19A97C7F9B49677":{"appid":"ohckeflnhegojcjlcpbfpciadgikcohk","fp":"1.95FD9D48E4FC245A3F3A99A3A16ECD1355050BA3F4AFC555F19A97C7F9B49677"},"A81D1959892AE4180554347DF1B97834ABBA2E1A5E6B9AEBA000ECEA26EABECC":{"appid":"fppmbhmldokgmleojlplaaodlkibgikh","fp":"1.A81D1959892AE4180554347DF1B97834ABBA2E1A5E6B9AEBA000ECEA26EABECC"},"bcb93cba8636743d1fbd32be3bd8ce8ff602323895bf4d136c26b9bc64b0a6a4":{"appid":"ndikpojcjlepofdkaaldkinkjbeeebkl","fp":""},"e899d913c256495c8952316ef2b48210ee2867659f6336478e2085d90462d294":{"appid":"alpjnmnfbgfkmmpcfpejmmoebdndedno","fp":""},"fa29a6d5775ff340900a65b39b02fc8b4b77d403c048d8debf22f2f5d09c61a0":{"appid":"oankkpibpaokgecfckkdkgaoafllipag","fp":""},"fbb2c0f4fad3b34b3ac7116d98f83638cf6f55a47992026a7abf944a759aa0ea":{"appid":"fgbafbciocncjfbbonhocjaohoknlaco","fp":""},"ff87fddb54d7bdc8ab8c2697bc92337c914803fb22cd32e445389e8042159ce9":{"appid":"jbfaflocpnkhbgcijpkiafdpbjkedane","fp":""}}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -17,7 +17,7 @@
<meta name="viewport" content="width=device-width,
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
#map_8784e4a92e0d8028478529607eb9e44b {
#map_4186306e9b7fcd80c184ec506da89a65 {
position: relative;
width: 100.0%;
height: 100.0%;
@ -54,14 +54,14 @@
<body>
<div class="folium-map" id="map_8784e4a92e0d8028478529607eb9e44b" ></div>
<div class="folium-map" id="map_4186306e9b7fcd80c184ec506da89a65" ></div>
</body>
<script>
var map_8784e4a92e0d8028478529607eb9e44b = L.map(
"map_8784e4a92e0d8028478529607eb9e44b",
var map_4186306e9b7fcd80c184ec506da89a65 = L.map(
"map_4186306e9b7fcd80c184ec506da89a65",
{
center: [0.0, 0.0],
crs: L.CRS.EPSG3857,
@ -78,7 +78,7 @@
var tile_layer_374e8a38ef77ea5641b5d0b57b400825 = L.tileLayer(
var tile_layer_ce532da5c58425eee9e9d530494caa7a = L.tileLayer(
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
{
"minZoom": 0,
@ -95,7 +95,7 @@
);
tile_layer_374e8a38ef77ea5641b5d0b57b400825.addTo(map_8784e4a92e0d8028478529607eb9e44b);
tile_layer_ce532da5c58425eee9e9d530494caa7a.addTo(map_4186306e9b7fcd80c184ec506da89a65);
</script>
@ -116,7 +116,7 @@
}
trajeto_json_add({"features": []});
trajeto_json.addTo(map_8784e4a92e0d8028478529607eb9e44b);
trajeto_json.addTo(map_4186306e9b7fcd80c184ec506da89a65);
function adicionarGeometria(novaGeometria) {
trajeto_json.addData(novaGeometria);
@ -179,9 +179,9 @@
var marcadorEquipamento = L.marker([0, 0], {
icon: customIcon
}).addTo(map_8784e4a92e0d8028478529607eb9e44b);
}).addTo(map_4186306e9b7fcd80c184ec506da89a65);
var marcadorBase = L.marker([0, 0], {}).addTo(map_8784e4a92e0d8028478529607eb9e44b);
var marcadorBase = L.marker([0, 0], {}).addTo(map_4186306e9b7fcd80c184ec506da89a65);
var icon = L.AwesomeMarkers.icon(
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
);
@ -246,7 +246,7 @@
}
if (foco) {
map_8784e4a92e0d8028478529607eb9e44b.setView(novaPosicao, map_8784e4a92e0d8028478529607eb9e44b.getZoom());
map_4186306e9b7fcd80c184ec506da89a65.setView(novaPosicao, map_4186306e9b7fcd80c184ec506da89a65.getZoom());
}
}
@ -268,7 +268,7 @@
marcadorDinamico.setRotationAngle(angulo);
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
map_8784e4a92e0d8028478529607eb9e44b.setView(novaPosicao, map_8784e4a92e0d8028478529607eb9e44b.getZoom());*/
map_4186306e9b7fcd80c184ec506da89a65.setView(novaPosicao, map_4186306e9b7fcd80c184ec506da89a65.getZoom());*/
});
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {

File diff suppressed because one or more lines are too long

View File

@ -42,6 +42,7 @@ class ModuloDirecional(ModuloDiagnosticoBase):
maior_freq = max(freqs.values() if freqs != {} else [0])
if not conectado:
saude = 0
motivos.append("Desconectado")
elif maior_freq == 0:
saude = 0
motivos.append("Sem resposta de todos os parametros (freq = 0 Hz)")

View File

@ -53,6 +53,7 @@ class ModuloMovimentacao(ModuloDiagnosticoBase):
maior_freq = max(freqs.values() if freqs != {} else [0])
if not conectado:
saude = 0
motivos.append("Desconectado")
elif maior_freq == 0:
saude = 0
motivos.append("Sem resposta de todos os parametros (freq = 0 Hz)")

View File

@ -11,13 +11,14 @@ def definir_comando(pid: PIDAdaptativo, envio_necessario: bool):
try:
_operacao = ContextoGlobalRedis.get_operacao()
_tipo_controle = TiposControladorDirecional(_operacao.get("Dir", {}).get("tipo_controle", TiposControladorDirecional.MPC.value))
_controle = ContextoGlobalRedis.get_controle()
_contexto = ContextoGlobalRedis.get_contexto()
_equipamento = ContextoGlobalRedis.get_equipamento()
_trajetoria = _contexto.get("Trajetoria", {})
_snr = ContextoGlobalRedis.get_modulo(T_Code.Snr)
visual_worker_ativado = _operacao.get("Snr", {}).get("sonar_ativado", False)
visual_worker_ativado = _controle.get("sonar_ativado", False)
visual_worker_operante = (_snr.get("saude", {}).get("status", StatusModulo.DESCONECTADO.value)) == StatusModulo.OPERANTE.value
_dados_vw = ContextoGlobalRedis.get(CtxKey.DadosVisualWorker, {})
_snapshot_vw = _dados_vw.get("matriz_confianca")
@ -130,7 +131,6 @@ def definir_comando(pid: PIDAdaptativo, envio_necessario: bool):
return _montar_comando_retorno(comando, latencia=latencia)
elif _tipo_controle == TiposControladorDirecional.PID:
_controle = ContextoGlobalRedis.get_controle()
angulo_max = _controle.get("angulo_max", 30)
velocidade_percentual = _controle.get("velocidade_sp", 0)

View File

@ -7,6 +7,7 @@ from manager_worker.filtros import FiltroVelocidade
def definir_comando(parada_necessaria: bool, erro: bool, filtro_vel: FiltroVelocidade, erro_orientacao: float = None):
try:
_operacao = ContextoGlobalRedis.get_operacao()
_controle = ContextoGlobalRedis.get_controle()
status_operacao = StatusOperacao(_operacao.get("status", StatusOperacao.NaoIniciado.value))
finalizando = _operacao.get("finalizando", False)
@ -27,7 +28,7 @@ def definir_comando(parada_necessaria: bool, erro: bool, filtro_vel: FiltroVeloc
_dados_vw = ContextoGlobalRedis.get(CtxKey.DadosVisualWorker, {})
_snr = ContextoGlobalRedis.get_modulo(T_Code.Snr)
sonar_ativado = _operacao.get("Snr", {}).get("sonar_ativado", False)
sonar_ativado = _controle.get("sonar_ativado", False)
visual_worker_operante = (_snr.get("saude", {}).get("status", StatusModulo.DESCONECTADO.value)) == StatusModulo.OPERANTE.value
analise_deteccao_atualizada = (time.perf_counter() - _dados_vw.get("matriz_confianca", {}).get("ts", 10.0) <= 1.0)
obstaculo_detectado = _dados_vw.get("matriz_confianca", {}).get("block", {}).get("decision", {}).get("parar", False) if analise_deteccao_atualizada else False
@ -38,7 +39,7 @@ def definir_comando(parada_necessaria: bool, erro: bool, filtro_vel: FiltroVeloc
op_modo = ModoOperacao(_operacao.get("modo", ModoOperacao.NaoDefinido.value))
_contexto = ContextoGlobalRedis.get_contexto()
_controle = ContextoGlobalRedis.get_controle()
pulverizador_automatico = _controle.get("pulverizador_automatico", False)
#ervas_no_radar = _contexto.get("Gerais", {}).get("ervas_no_radar", False)
#percentual_ervas_no_radar = (_contexto.get("Gerais", {}).get("percentual_ervas_no_radar", 0)) * 100.0