Ajustes para inclusao do novo imu unificado e regras de segurancao por auxilio do imu

This commit is contained in:
Diego Freitas 2026-06-11 10:01:09 -03:00
parent c1f9b88e3c
commit 9f8e11f6f4
20 changed files with 1417 additions and 421 deletions

View File

@ -543,6 +543,7 @@
<Compile Include="Models\Modules\DispositivoBaseModel.cs" />
<Compile Include="Models\Enums.cs" />
<Compile Include="Models\GeneralJoystick.cs" />
<Compile Include="Models\Modules\ModuloIMUModel.cs" />
<Compile Include="Models\Modules\MovimentacaoModel.cs" />
<Compile Include="Models\Modules\MovimentacaoUnificadoModel.cs" />
<Compile Include="Models\Modules\PinoutModel.cs" />

View File

@ -57,14 +57,30 @@
this.lblStatusCarroMapa = new System.Windows.Forms.Label();
this.pnlDeteccoesRua = new System.Windows.Forms.Panel();
this.tabPulverizador = new System.Windows.Forms.TabPage();
this.lblPotenciaSP = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.cmbModoAgitador = new System.Windows.Forms.ComboBox();
this.nudPotenciaAgitador = new System.Windows.Forms.NumericUpDown();
this.btnDeslsigarAgitador = new System.Windows.Forms.Button();
this.btnLigarAgitador = new System.Windows.Forms.Button();
this.lblPressaoSP = new System.Windows.Forms.Label();
this.nudPressaoSP = new System.Windows.Forms.NumericUpDown();
this.btnDesligarBomba = new System.Windows.Forms.Button();
this.lblPotenciaSP = new System.Windows.Forms.Label();
this.btnDeslsigarAgitador = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label7 = new System.Windows.Forms.Label();
this.nudPotenciaBombaMax = new System.Windows.Forms.NumericUpDown();
this.label6 = new System.Windows.Forms.Label();
this.txtKd = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.txtKi = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.txtKp = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.cmbModoBomba = new System.Windows.Forms.ComboBox();
this.btnLigarBomba = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.btnDesligarBomba = new System.Windows.Forms.Button();
this.nudPotenciaBombaMin = new System.Windows.Forms.NumericUpDown();
this.nudPressaoSP = new System.Windows.Forms.NumericUpDown();
this.lblPressaoSP = new System.Windows.Forms.Label();
this.pnlCameraRua = new System.Windows.Forms.Panel();
this.pnlDir_EF = new System.Windows.Forms.Panel();
this.lblMov_EF = new System.Windows.Forms.Label();
@ -87,22 +103,7 @@
this.flwCamerasSolo = new System.Windows.Forms.FlowLayoutPanel();
this.chbSonarAtivado = new System.Windows.Forms.CheckBox();
this.lblPressao = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.nudPotenciaBombaMin = new System.Windows.Forms.NumericUpDown();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.cmbModoAgitador = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.cmbModoBomba = new System.Windows.Forms.ComboBox();
this.txtKp = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.txtKi = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.txtKd = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.nudPotenciaBombaMax = new System.Windows.Forms.NumericUpDown();
this.chbImuAtivado = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.chartGraficos)).BeginInit();
this.tabControl1.SuspendLayout();
this.tabMapa.SuspendLayout();
@ -110,16 +111,16 @@
((System.ComponentModel.ISupportInitialize)(this.gridDados)).BeginInit();
this.tabDeteccoes.SuspendLayout();
this.tabPulverizador.SuspendLayout();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudPotenciaAgitador)).BeginInit();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudPotenciaBombaMax)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudPotenciaBombaMin)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudPressaoSP)).BeginInit();
this.pnlDir_EF.SuspendLayout();
this.pnlDir_ET.SuspendLayout();
this.pnlDir_DT.SuspendLayout();
this.pnlDir_DF.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudPotenciaBombaMin)).BeginInit();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudPotenciaBombaMax)).BeginInit();
this.SuspendLayout();
//
// pnlAtuadores
@ -416,16 +417,40 @@
this.tabPulverizador.Text = "Pulverizador";
this.tabPulverizador.UseVisualStyleBackColor = true;
//
// lblPotenciaSP
// groupBox3
//
this.lblPotenciaSP.AutoSize = true;
this.lblPotenciaSP.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblPotenciaSP.Location = new System.Drawing.Point(6, 56);
this.lblPotenciaSP.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblPotenciaSP.Name = "lblPotenciaSP";
this.lblPotenciaSP.Size = new System.Drawing.Size(77, 13);
this.lblPotenciaSP.TabIndex = 33;
this.lblPotenciaSP.Text = "Potencia SP";
this.groupBox3.Controls.Add(this.label2);
this.groupBox3.Controls.Add(this.cmbModoAgitador);
this.groupBox3.Controls.Add(this.nudPotenciaAgitador);
this.groupBox3.Controls.Add(this.btnLigarAgitador);
this.groupBox3.Controls.Add(this.lblPotenciaSP);
this.groupBox3.Controls.Add(this.btnDeslsigarAgitador);
this.groupBox3.Location = new System.Drawing.Point(5, 177);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(453, 106);
this.groupBox3.TabIndex = 38;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Agitador de Calda";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(6, 16);
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(107, 13);
this.label2.TabIndex = 37;
this.label2.Text = "Modo de Controle";
//
// cmbModoAgitador
//
this.cmbModoAgitador.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbModoAgitador.FormattingEnabled = true;
this.cmbModoAgitador.Location = new System.Drawing.Point(6, 32);
this.cmbModoAgitador.Name = "cmbModoAgitador";
this.cmbModoAgitador.Size = new System.Drawing.Size(121, 21);
this.cmbModoAgitador.TabIndex = 34;
//
// nudPotenciaAgitador
//
@ -438,18 +463,6 @@
this.nudPotenciaAgitador.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.nudPotenciaAgitador.ValueChanged += new System.EventHandler(this.nudPotenciaSP_ValueChanged);
//
// btnDeslsigarAgitador
//
this.btnDeslsigarAgitador.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnDeslsigarAgitador.Location = new System.Drawing.Point(312, 34);
this.btnDeslsigarAgitador.Margin = new System.Windows.Forms.Padding(2);
this.btnDeslsigarAgitador.Name = "btnDeslsigarAgitador";
this.btnDeslsigarAgitador.Size = new System.Drawing.Size(136, 28);
this.btnDeslsigarAgitador.TabIndex = 31;
this.btnDeslsigarAgitador.Text = "Desligar Agitador";
this.btnDeslsigarAgitador.UseVisualStyleBackColor = true;
this.btnDeslsigarAgitador.Click += new System.EventHandler(this.btnDeslsigarAgitador_Click);
//
// btnLigarAgitador
//
this.btnLigarAgitador.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@ -462,16 +475,206 @@
this.btnLigarAgitador.UseVisualStyleBackColor = true;
this.btnLigarAgitador.Click += new System.EventHandler(this.btnLigarAgitador_Click);
//
// lblPressaoSP
// lblPotenciaSP
//
this.lblPressaoSP.AutoSize = true;
this.lblPressaoSP.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblPressaoSP.Location = new System.Drawing.Point(6, 55);
this.lblPressaoSP.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblPressaoSP.Name = "lblPressaoSP";
this.lblPressaoSP.Size = new System.Drawing.Size(72, 13);
this.lblPressaoSP.TabIndex = 29;
this.lblPressaoSP.Text = "Pressão SP";
this.lblPotenciaSP.AutoSize = true;
this.lblPotenciaSP.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblPotenciaSP.Location = new System.Drawing.Point(6, 56);
this.lblPotenciaSP.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblPotenciaSP.Name = "lblPotenciaSP";
this.lblPotenciaSP.Size = new System.Drawing.Size(77, 13);
this.lblPotenciaSP.TabIndex = 33;
this.lblPotenciaSP.Text = "Potencia SP";
//
// btnDeslsigarAgitador
//
this.btnDeslsigarAgitador.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnDeslsigarAgitador.Location = new System.Drawing.Point(312, 34);
this.btnDeslsigarAgitador.Margin = new System.Windows.Forms.Padding(2);
this.btnDeslsigarAgitador.Name = "btnDeslsigarAgitador";
this.btnDeslsigarAgitador.Size = new System.Drawing.Size(136, 28);
this.btnDeslsigarAgitador.TabIndex = 31;
this.btnDeslsigarAgitador.Text = "Desligar Agitador";
this.btnDeslsigarAgitador.UseVisualStyleBackColor = true;
this.btnDeslsigarAgitador.Click += new System.EventHandler(this.btnDeslsigarAgitador_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.nudPotenciaBombaMax);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.txtKd);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.txtKi);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.txtKp);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.cmbModoBomba);
this.groupBox2.Controls.Add(this.btnLigarBomba);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.btnDesligarBomba);
this.groupBox2.Controls.Add(this.nudPotenciaBombaMin);
this.groupBox2.Controls.Add(this.nudPressaoSP);
this.groupBox2.Controls.Add(this.lblPressaoSP);
this.groupBox2.Location = new System.Drawing.Point(5, 6);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(453, 141);
this.groupBox2.TabIndex = 37;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Bomba Pressurizadora";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label7.Location = new System.Drawing.Point(78, 94);
this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(53, 13);
this.label7.TabIndex = 47;
this.label7.Text = "Pot Max";
//
// nudPotenciaBombaMax
//
this.nudPotenciaBombaMax.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.nudPotenciaBombaMax.Location = new System.Drawing.Point(72, 111);
this.nudPotenciaBombaMax.Margin = new System.Windows.Forms.Padding(2);
this.nudPotenciaBombaMax.Maximum = new decimal(new int[] {
200,
0,
0,
0});
this.nudPotenciaBombaMax.Name = "nudPotenciaBombaMax";
this.nudPotenciaBombaMax.Size = new System.Drawing.Size(55, 19);
this.nudPotenciaBombaMax.TabIndex = 46;
this.nudPotenciaBombaMax.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label6.Location = new System.Drawing.Point(146, 94);
this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(22, 13);
this.label6.TabIndex = 45;
this.label6.Text = "Kd";
//
// txtKd
//
this.txtKd.Location = new System.Drawing.Point(149, 110);
this.txtKd.Name = "txtKd";
this.txtKd.Size = new System.Drawing.Size(68, 20);
this.txtKd.TabIndex = 44;
this.txtKd.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.Location = new System.Drawing.Point(146, 55);
this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(18, 13);
this.label5.TabIndex = 43;
this.label5.Text = "Ki";
//
// txtKi
//
this.txtKi.Location = new System.Drawing.Point(149, 71);
this.txtKi.Name = "txtKi";
this.txtKi.Size = new System.Drawing.Size(68, 20);
this.txtKi.TabIndex = 42;
this.txtKi.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(146, 16);
this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(22, 13);
this.label4.TabIndex = 41;
this.label4.Text = "Kp";
//
// txtKp
//
this.txtKp.Location = new System.Drawing.Point(149, 32);
this.txtKp.Name = "txtKp";
this.txtKp.Size = new System.Drawing.Size(68, 20);
this.txtKp.TabIndex = 40;
this.txtKp.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(6, 16);
this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(107, 13);
this.label3.TabIndex = 39;
this.label3.Text = "Modo de Controle";
//
// cmbModoBomba
//
this.cmbModoBomba.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbModoBomba.FormattingEnabled = true;
this.cmbModoBomba.Location = new System.Drawing.Point(6, 32);
this.cmbModoBomba.Name = "cmbModoBomba";
this.cmbModoBomba.Size = new System.Drawing.Size(121, 21);
this.cmbModoBomba.TabIndex = 38;
//
// btnLigarBomba
//
this.btnLigarBomba.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnLigarBomba.Location = new System.Drawing.Point(312, 103);
this.btnLigarBomba.Margin = new System.Windows.Forms.Padding(2);
this.btnLigarBomba.Name = "btnLigarBomba";
this.btnLigarBomba.Size = new System.Drawing.Size(136, 28);
this.btnLigarBomba.TabIndex = 26;
this.btnLigarBomba.Text = "Ligar Bomba";
this.btnLigarBomba.UseVisualStyleBackColor = true;
this.btnLigarBomba.Click += new System.EventHandler(this.btnLigarBomba_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(6, 94);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(50, 13);
this.label1.TabIndex = 35;
this.label1.Text = "Pot Min";
//
// btnDesligarBomba
//
this.btnDesligarBomba.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnDesligarBomba.Location = new System.Drawing.Point(312, 71);
this.btnDesligarBomba.Margin = new System.Windows.Forms.Padding(2);
this.btnDesligarBomba.Name = "btnDesligarBomba";
this.btnDesligarBomba.Size = new System.Drawing.Size(136, 28);
this.btnDesligarBomba.TabIndex = 27;
this.btnDesligarBomba.Text = "Desligar Bomba";
this.btnDesligarBomba.UseVisualStyleBackColor = true;
this.btnDesligarBomba.Click += new System.EventHandler(this.btnDesligarBomba_Click);
//
// nudPotenciaBombaMin
//
this.nudPotenciaBombaMin.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.nudPotenciaBombaMin.Location = new System.Drawing.Point(6, 111);
this.nudPotenciaBombaMin.Margin = new System.Windows.Forms.Padding(2);
this.nudPotenciaBombaMin.Maximum = new decimal(new int[] {
200,
0,
0,
0});
this.nudPotenciaBombaMin.Name = "nudPotenciaBombaMin";
this.nudPotenciaBombaMin.Size = new System.Drawing.Size(55, 19);
this.nudPotenciaBombaMin.TabIndex = 34;
this.nudPotenciaBombaMin.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// nudPressaoSP
//
@ -489,29 +692,16 @@
this.nudPressaoSP.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.nudPressaoSP.ValueChanged += new System.EventHandler(this.nudPressaoSP_ValueChanged);
//
// btnDesligarBomba
// lblPressaoSP
//
this.btnDesligarBomba.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnDesligarBomba.Location = new System.Drawing.Point(312, 71);
this.btnDesligarBomba.Margin = new System.Windows.Forms.Padding(2);
this.btnDesligarBomba.Name = "btnDesligarBomba";
this.btnDesligarBomba.Size = new System.Drawing.Size(136, 28);
this.btnDesligarBomba.TabIndex = 27;
this.btnDesligarBomba.Text = "Desligar Bomba";
this.btnDesligarBomba.UseVisualStyleBackColor = true;
this.btnDesligarBomba.Click += new System.EventHandler(this.btnDesligarBomba_Click);
//
// btnLigarBomba
//
this.btnLigarBomba.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnLigarBomba.Location = new System.Drawing.Point(312, 103);
this.btnLigarBomba.Margin = new System.Windows.Forms.Padding(2);
this.btnLigarBomba.Name = "btnLigarBomba";
this.btnLigarBomba.Size = new System.Drawing.Size(136, 28);
this.btnLigarBomba.TabIndex = 26;
this.btnLigarBomba.Text = "Ligar Bomba";
this.btnLigarBomba.UseVisualStyleBackColor = true;
this.btnLigarBomba.Click += new System.EventHandler(this.btnLigarBomba_Click);
this.lblPressaoSP.AutoSize = true;
this.lblPressaoSP.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblPressaoSP.Location = new System.Drawing.Point(6, 55);
this.lblPressaoSP.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblPressaoSP.Name = "lblPressaoSP";
this.lblPressaoSP.Size = new System.Drawing.Size(72, 13);
this.lblPressaoSP.TabIndex = 29;
this.lblPressaoSP.Text = "Pressão SP";
//
// pnlCameraRua
//
@ -726,7 +916,7 @@
// chbSonarAtivado
//
this.chbSonarAtivado.AutoSize = true;
this.chbSonarAtivado.Location = new System.Drawing.Point(390, 310);
this.chbSonarAtivado.Location = new System.Drawing.Point(300, 310);
this.chbSonarAtivado.Margin = new System.Windows.Forms.Padding(2);
this.chbSonarAtivado.Name = "chbSonarAtivado";
this.chbSonarAtivado.Size = new System.Drawing.Size(92, 17);
@ -747,194 +937,17 @@
this.lblPressao.TabIndex = 38;
this.lblPressao.Text = "80 psi";
//
// label1
// chbImuAtivado
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(6, 94);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(50, 13);
this.label1.TabIndex = 35;
this.label1.Text = "Pot Min";
//
// nudPotenciaBombaMin
//
this.nudPotenciaBombaMin.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.nudPotenciaBombaMin.Location = new System.Drawing.Point(6, 111);
this.nudPotenciaBombaMin.Margin = new System.Windows.Forms.Padding(2);
this.nudPotenciaBombaMin.Maximum = new decimal(new int[] {
200,
0,
0,
0});
this.nudPotenciaBombaMin.Name = "nudPotenciaBombaMin";
this.nudPotenciaBombaMin.Size = new System.Drawing.Size(55, 19);
this.nudPotenciaBombaMin.TabIndex = 34;
this.nudPotenciaBombaMin.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.nudPotenciaBombaMax);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.txtKd);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.txtKi);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.txtKp);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.cmbModoBomba);
this.groupBox2.Controls.Add(this.btnLigarBomba);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.btnDesligarBomba);
this.groupBox2.Controls.Add(this.nudPotenciaBombaMin);
this.groupBox2.Controls.Add(this.nudPressaoSP);
this.groupBox2.Controls.Add(this.lblPressaoSP);
this.groupBox2.Location = new System.Drawing.Point(5, 6);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(453, 141);
this.groupBox2.TabIndex = 37;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Bomba Pressurizadora";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.label2);
this.groupBox3.Controls.Add(this.cmbModoAgitador);
this.groupBox3.Controls.Add(this.nudPotenciaAgitador);
this.groupBox3.Controls.Add(this.btnLigarAgitador);
this.groupBox3.Controls.Add(this.lblPotenciaSP);
this.groupBox3.Controls.Add(this.btnDeslsigarAgitador);
this.groupBox3.Location = new System.Drawing.Point(5, 177);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(453, 106);
this.groupBox3.TabIndex = 38;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Agitador de Calda";
//
// cmbModoAgitador
//
this.cmbModoAgitador.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbModoAgitador.FormattingEnabled = true;
this.cmbModoAgitador.Location = new System.Drawing.Point(6, 32);
this.cmbModoAgitador.Name = "cmbModoAgitador";
this.cmbModoAgitador.Size = new System.Drawing.Size(121, 21);
this.cmbModoAgitador.TabIndex = 34;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(6, 16);
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(107, 13);
this.label2.TabIndex = 37;
this.label2.Text = "Modo de Controle";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(6, 16);
this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(107, 13);
this.label3.TabIndex = 39;
this.label3.Text = "Modo de Controle";
//
// cmbModoBomba
//
this.cmbModoBomba.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbModoBomba.FormattingEnabled = true;
this.cmbModoBomba.Location = new System.Drawing.Point(6, 32);
this.cmbModoBomba.Name = "cmbModoBomba";
this.cmbModoBomba.Size = new System.Drawing.Size(121, 21);
this.cmbModoBomba.TabIndex = 38;
//
// txtKp
//
this.txtKp.Location = new System.Drawing.Point(149, 32);
this.txtKp.Name = "txtKp";
this.txtKp.Size = new System.Drawing.Size(68, 20);
this.txtKp.TabIndex = 40;
this.txtKp.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(146, 16);
this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(22, 13);
this.label4.TabIndex = 41;
this.label4.Text = "Kp";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.Location = new System.Drawing.Point(146, 55);
this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(18, 13);
this.label5.TabIndex = 43;
this.label5.Text = "Ki";
//
// txtKi
//
this.txtKi.Location = new System.Drawing.Point(149, 71);
this.txtKi.Name = "txtKi";
this.txtKi.Size = new System.Drawing.Size(68, 20);
this.txtKi.TabIndex = 42;
this.txtKi.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label6.Location = new System.Drawing.Point(146, 94);
this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(22, 13);
this.label6.TabIndex = 45;
this.label6.Text = "Kd";
//
// txtKd
//
this.txtKd.Location = new System.Drawing.Point(149, 110);
this.txtKd.Name = "txtKd";
this.txtKd.Size = new System.Drawing.Size(68, 20);
this.txtKd.TabIndex = 44;
this.txtKd.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label7.Location = new System.Drawing.Point(78, 94);
this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(53, 13);
this.label7.TabIndex = 47;
this.label7.Text = "Pot Max";
//
// nudPotenciaBombaMax
//
this.nudPotenciaBombaMax.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.nudPotenciaBombaMax.Location = new System.Drawing.Point(72, 111);
this.nudPotenciaBombaMax.Margin = new System.Windows.Forms.Padding(2);
this.nudPotenciaBombaMax.Maximum = new decimal(new int[] {
200,
0,
0,
0});
this.nudPotenciaBombaMax.Name = "nudPotenciaBombaMax";
this.nudPotenciaBombaMax.Size = new System.Drawing.Size(55, 19);
this.nudPotenciaBombaMax.TabIndex = 46;
this.nudPotenciaBombaMax.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.chbImuAtivado.AutoSize = true;
this.chbImuAtivado.Location = new System.Drawing.Point(396, 310);
this.chbImuAtivado.Margin = new System.Windows.Forms.Padding(2);
this.chbImuAtivado.Name = "chbImuAtivado";
this.chbImuAtivado.Size = new System.Drawing.Size(84, 17);
this.chbImuAtivado.TabIndex = 39;
this.chbImuAtivado.Text = "IMU ativado";
this.chbImuAtivado.UseVisualStyleBackColor = true;
this.chbImuAtivado.CheckedChanged += new System.EventHandler(this.chbImuAtivado_CheckedChanged);
//
// frmOperacaoManual
//
@ -942,6 +955,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1243, 649);
this.Controls.Add(this.chbImuAtivado);
this.Controls.Add(this.lblPressao);
this.Controls.Add(this.chbSonarAtivado);
this.Controls.Add(this.flwCamerasSolo);
@ -980,7 +994,13 @@
this.tabDeteccoes.ResumeLayout(false);
this.tabDeteccoes.PerformLayout();
this.tabPulverizador.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudPotenciaAgitador)).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudPotenciaBombaMax)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudPotenciaBombaMin)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudPressaoSP)).EndInit();
this.pnlDir_EF.ResumeLayout(false);
this.pnlDir_EF.PerformLayout();
@ -990,12 +1010,6 @@
this.pnlDir_DT.PerformLayout();
this.pnlDir_DF.ResumeLayout(false);
this.pnlDir_DF.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudPotenciaBombaMin)).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudPotenciaBombaMax)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -1073,5 +1087,6 @@
private System.Windows.Forms.TextBox txtKp;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.NumericUpDown nudPotenciaBombaMax;
private System.Windows.Forms.CheckBox chbImuAtivado;
}
}

View File

@ -464,8 +464,8 @@ namespace AgroBase.Forms.Operacoes
var imu = Variaveis.OperacaoEmAndamento.Sensoriamento.IMU;
try
{
double angulo = imu?.Rotacao ?? 0;
double anguloCorrigido = imu?.RotacaoCorrigida ?? 0;
double angulo = imu?.yaw ?? 0;
double anguloCorrigido = imu?.YawSeguro ?? 0;
FuncoesGlobais.DesenharInclinacao((Panel)sender, e, (float)angulo, -270, (float)anguloCorrigido);
}
catch { }
@ -587,9 +587,9 @@ namespace AgroBase.Forms.Operacoes
gridDados.Rows[36].Cells[1].Value = (_Atuador?.AnguloBarraDireita ?? 0).ToString("0.00");
gridDados.Rows[37].Cells[1].Value = (Variaveis.OperacaoEmAndamento.DispAtu?.Dados?.ContadorCarga?.AgitadorCalda?._Potencia ?? 0).ToString("0.00");
gridDados.Rows[38].Cells[1].Value = "";
gridDados.Rows[39].Cells[1].Value = (_IMU?.InclinacaoLateral ?? 0).ToString("0.00");
gridDados.Rows[40].Cells[1].Value = (_IMU?.InclinacaoFrontal ?? 0).ToString("0.00");
gridDados.Rows[41].Cells[1].Value = (_IMU?.Rotacao ?? 0).ToString("0.00");
gridDados.Rows[39].Cells[1].Value = (_IMU?.RollSeguro ?? 0).ToString("0.00");
gridDados.Rows[40].Cells[1].Value = (_IMU?.PitchSeguro ?? 0).ToString("0.00");
gridDados.Rows[41].Cells[1].Value = (_IMU?.YawSeguro ?? 0).ToString("0.00");
}
#endregion
@ -760,8 +760,17 @@ namespace AgroBase.Forms.Operacoes
private void chbSonarAtivado_CheckedChanged(object sender, EventArgs e)
{
Variaveis.OperacaoEmAndamento.Parametros.Controle.MovAuxilioSonar = ((CheckBox)sender).Checked;
Variaveis.OperacaoEmAndamento.Parametros.Controle.DirAuxilioSonar = ((CheckBox)sender).Checked;
var pC = Variaveis.OperacaoEmAndamento.Parametros.Controle;
pC.MovAuxilioSonar = ((CheckBox)sender).Checked;
pC.DirAuxilioSonar = ((CheckBox)sender).Checked;
}
private void chbImuAtivado_CheckedChanged(object sender, EventArgs e)
{
var pC = Variaveis.OperacaoEmAndamento.Parametros.Controle;
pC.ImuAuxilioMovimento = ((CheckBox)sender).Checked;
pC.ImuAuxilioDirecional = ((CheckBox)sender).Checked;
pC.ImuDirecionalPreferirArco = ((CheckBox)sender).Checked;
}
private void chbSonarDesvioAutomatico_CheckedChanged(object sender, EventArgs e)

View File

@ -88,13 +88,16 @@
this.btnSalvar = new System.Windows.Forms.Button();
this.chbSalvar = new System.Windows.Forms.CheckBox();
this.gpbConfiguracoesgerais = new System.Windows.Forms.GroupBox();
this.chbGravarDadosPosProcessamento = new System.Windows.Forms.CheckBox();
this.txtDensidadeherbicida = new System.Windows.Forms.TextBox();
this.lblUnDensidadeherbicida = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.nudCapacidadereservatorio = new System.Windows.Forms.NumericUpDown();
this.lblUnCapcaidadereservatorio = new System.Windows.Forms.Label();
this.lblCapacidadereservatorio = new System.Windows.Forms.Label();
this.chbGravarDadosPosProcessamento = new System.Windows.Forms.CheckBox();
this.chbImuAuxilioMov = new System.Windows.Forms.CheckBox();
this.chbImuAuxilioDir = new System.Windows.Forms.CheckBox();
this.chbImuPreferirArco = new System.Windows.Forms.CheckBox();
this.gpbModulos.SuspendLayout();
this.gpbP_Knt.SuspendLayout();
this.gpbP_Sen.SuspendLayout();
@ -162,7 +165,7 @@
this.gpbModulos.Margin = new System.Windows.Forms.Padding(6);
this.gpbModulos.Name = "gpbModulos";
this.gpbModulos.Padding = new System.Windows.Forms.Padding(6);
this.gpbModulos.Size = new System.Drawing.Size(1187, 319);
this.gpbModulos.Size = new System.Drawing.Size(1187, 386);
this.gpbModulos.TabIndex = 3;
this.gpbModulos.TabStop = false;
this.gpbModulos.Text = "Módulos necessários para executar a operação";
@ -178,7 +181,7 @@
this.gpbP_Knt.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpbP_Knt.Location = new System.Drawing.Point(988, 105);
this.gpbP_Knt.Name = "gpbP_Knt";
this.gpbP_Knt.Size = new System.Drawing.Size(190, 205);
this.gpbP_Knt.Size = new System.Drawing.Size(190, 272);
this.gpbP_Knt.TabIndex = 15;
this.gpbP_Knt.TabStop = false;
this.gpbP_Knt.Text = "Ajustes";
@ -266,7 +269,7 @@
this.gpbP_Gps.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpbP_Gps.Location = new System.Drawing.Point(792, 105);
this.gpbP_Gps.Name = "gpbP_Gps";
this.gpbP_Gps.Size = new System.Drawing.Size(190, 205);
this.gpbP_Gps.Size = new System.Drawing.Size(190, 272);
this.gpbP_Gps.TabIndex = 12;
this.gpbP_Gps.TabStop = false;
this.gpbP_Gps.Text = "Ajustes";
@ -292,7 +295,7 @@
this.gpbP_Sen.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpbP_Sen.Location = new System.Drawing.Point(596, 105);
this.gpbP_Sen.Name = "gpbP_Sen";
this.gpbP_Sen.Size = new System.Drawing.Size(190, 205);
this.gpbP_Sen.Size = new System.Drawing.Size(190, 272);
this.gpbP_Sen.TabIndex = 12;
this.gpbP_Sen.TabStop = false;
this.gpbP_Sen.Text = "Ajustes";
@ -359,7 +362,7 @@
this.gpbP_Atu.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpbP_Atu.Location = new System.Drawing.Point(400, 105);
this.gpbP_Atu.Name = "gpbP_Atu";
this.gpbP_Atu.Size = new System.Drawing.Size(190, 205);
this.gpbP_Atu.Size = new System.Drawing.Size(190, 272);
this.gpbP_Atu.TabIndex = 12;
this.gpbP_Atu.TabStop = false;
this.gpbP_Atu.Text = "Ajustes";
@ -442,6 +445,8 @@
//
// gpbP_Dir
//
this.gpbP_Dir.Controls.Add(this.chbImuPreferirArco);
this.gpbP_Dir.Controls.Add(this.chbImuAuxilioDir);
this.gpbP_Dir.Controls.Add(this.chbDirecionalAutomatico);
this.gpbP_Dir.Controls.Add(this.lblAngulomax);
this.gpbP_Dir.Controls.Add(this.nudAnguloMinimo);
@ -453,7 +458,7 @@
this.gpbP_Dir.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpbP_Dir.Location = new System.Drawing.Point(204, 105);
this.gpbP_Dir.Name = "gpbP_Dir";
this.gpbP_Dir.Size = new System.Drawing.Size(190, 205);
this.gpbP_Dir.Size = new System.Drawing.Size(190, 272);
this.gpbP_Dir.TabIndex = 12;
this.gpbP_Dir.TabStop = false;
this.gpbP_Dir.Text = "Ajustes";
@ -557,6 +562,7 @@
//
// gpbP_Mov
//
this.gpbP_Mov.Controls.Add(this.chbImuAuxilioMov);
this.gpbP_Mov.Controls.Add(this.chbMovAuxilioSonar);
this.gpbP_Mov.Controls.Add(this.chbMovimentacaoAutomatica);
this.gpbP_Mov.Controls.Add(this.nudVelocidadeComErvas);
@ -568,7 +574,7 @@
this.gpbP_Mov.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpbP_Mov.Location = new System.Drawing.Point(8, 105);
this.gpbP_Mov.Name = "gpbP_Mov";
this.gpbP_Mov.Size = new System.Drawing.Size(190, 205);
this.gpbP_Mov.Size = new System.Drawing.Size(190, 272);
this.gpbP_Mov.TabIndex = 10;
this.gpbP_Mov.TabStop = false;
this.gpbP_Mov.Text = "Ajustes";
@ -821,13 +827,24 @@
this.gpbConfiguracoesgerais.Controls.Add(this.nudCapacidadereservatorio);
this.gpbConfiguracoesgerais.Controls.Add(this.lblUnCapcaidadereservatorio);
this.gpbConfiguracoesgerais.Controls.Add(this.lblCapacidadereservatorio);
this.gpbConfiguracoesgerais.Location = new System.Drawing.Point(15, 411);
this.gpbConfiguracoesgerais.Location = new System.Drawing.Point(15, 478);
this.gpbConfiguracoesgerais.Name = "gpbConfiguracoesgerais";
this.gpbConfiguracoesgerais.Size = new System.Drawing.Size(1187, 256);
this.gpbConfiguracoesgerais.Size = new System.Drawing.Size(1187, 189);
this.gpbConfiguracoesgerais.TabIndex = 8;
this.gpbConfiguracoesgerais.TabStop = false;
this.gpbConfiguracoesgerais.Text = "Gerais";
//
// chbGravarDadosPosProcessamento
//
this.chbGravarDadosPosProcessamento.AutoSize = true;
this.chbGravarDadosPosProcessamento.Location = new System.Drawing.Point(14, 156);
this.chbGravarDadosPosProcessamento.Margin = new System.Windows.Forms.Padding(6);
this.chbGravarDadosPosProcessamento.Name = "chbGravarDadosPosProcessamento";
this.chbGravarDadosPosProcessamento.Size = new System.Drawing.Size(354, 28);
this.chbGravarDadosPosProcessamento.TabIndex = 15;
this.chbGravarDadosPosProcessamento.Text = "Gravar dados para pós processamento";
this.chbGravarDadosPosProcessamento.UseVisualStyleBackColor = true;
//
// txtDensidadeherbicida
//
this.txtDensidadeherbicida.Location = new System.Drawing.Point(18, 118);
@ -885,16 +902,41 @@
this.lblCapacidadereservatorio.TabIndex = 9;
this.lblCapacidadereservatorio.Text = "Capacidade reservatório";
//
// chbGravarDadosPosProcessamento
// chbImuAuxilioMov
//
this.chbGravarDadosPosProcessamento.AutoSize = true;
this.chbGravarDadosPosProcessamento.Location = new System.Drawing.Point(14, 219);
this.chbGravarDadosPosProcessamento.Margin = new System.Windows.Forms.Padding(6);
this.chbGravarDadosPosProcessamento.Name = "chbGravarDadosPosProcessamento";
this.chbGravarDadosPosProcessamento.Size = new System.Drawing.Size(354, 28);
this.chbGravarDadosPosProcessamento.TabIndex = 15;
this.chbGravarDadosPosProcessamento.Text = "Gravar dados para pós processamento";
this.chbGravarDadosPosProcessamento.UseVisualStyleBackColor = true;
this.chbImuAuxilioMov.AutoSize = true;
this.chbImuAuxilioMov.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F);
this.chbImuAuxilioMov.Location = new System.Drawing.Point(6, 204);
this.chbImuAuxilioMov.Margin = new System.Windows.Forms.Padding(6);
this.chbImuAuxilioMov.Name = "chbImuAuxilioMov";
this.chbImuAuxilioMov.Size = new System.Drawing.Size(100, 22);
this.chbImuAuxilioMov.TabIndex = 17;
this.chbImuAuxilioMov.Text = "Auxílio IMU";
this.chbImuAuxilioMov.UseVisualStyleBackColor = true;
//
// chbImuAuxilioDir
//
this.chbImuAuxilioDir.AutoSize = true;
this.chbImuAuxilioDir.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F);
this.chbImuAuxilioDir.Location = new System.Drawing.Point(9, 204);
this.chbImuAuxilioDir.Margin = new System.Windows.Forms.Padding(6);
this.chbImuAuxilioDir.Name = "chbImuAuxilioDir";
this.chbImuAuxilioDir.Size = new System.Drawing.Size(100, 22);
this.chbImuAuxilioDir.TabIndex = 18;
this.chbImuAuxilioDir.Text = "Auxílio IMU";
this.chbImuAuxilioDir.UseVisualStyleBackColor = true;
//
// chbImuPreferirArco
//
this.chbImuPreferirArco.AutoSize = true;
this.chbImuPreferirArco.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F);
this.chbImuPreferirArco.Location = new System.Drawing.Point(9, 228);
this.chbImuPreferirArco.Margin = new System.Windows.Forms.Padding(6);
this.chbImuPreferirArco.Name = "chbImuPreferirArco";
this.chbImuPreferirArco.Size = new System.Drawing.Size(135, 22);
this.chbImuPreferirArco.TabIndex = 19;
this.chbImuPreferirArco.Text = "Auxílio IMU Arco";
this.chbImuPreferirArco.UseVisualStyleBackColor = true;
//
// frmParametrizacaoOperacao
//
@ -1012,5 +1054,8 @@
private System.Windows.Forms.CheckBox chbMovAuxilioSonar;
private System.Windows.Forms.ComboBox cmbAgitadorModo;
private System.Windows.Forms.CheckBox chbGravarDadosPosProcessamento;
private System.Windows.Forms.CheckBox chbImuAuxilioMov;
private System.Windows.Forms.CheckBox chbImuAuxilioDir;
private System.Windows.Forms.CheckBox chbImuPreferirArco;
}
}

View File

@ -79,6 +79,9 @@ namespace AgroBase.Forms.Operacoes
nudAtuarem.Value = Convert.ToInt32(_Parametros.Controle.AtuPercentualInicioPulverizacao);
chbImuParadaInclinacao.Checked = _Parametros.Controle.ImuParadaPorInclinacao;
chbImuAuxilioMov.Checked = _Parametros.Controle.ImuAuxilioMovimento;
chbImuAuxilioDir.Checked = _Parametros.Controle.ImuAuxilioDirecional;
chbImuPreferirArco.Checked = _Parametros.Controle.ImuDirecionalPreferirArco;
chbOakParadaObstaculo.Checked = _Parametros.Controle.OakParadaPorObstaculo;
chbDirAuxilioSonar.Checked = _Parametros.Controle.DirAuxilioSonar;
@ -144,24 +147,28 @@ namespace AgroBase.Forms.Operacoes
void SalvarOperacao()
{
Variaveis.OperacaoEmAndamento.Parametros.Controle.ImuParadaPorInclinacao = chbImuParadaInclinacao.Checked;
Variaveis.OperacaoEmAndamento.Parametros.Controle.OakParadaPorObstaculo = chbOakParadaObstaculo.Checked;
Variaveis.OperacaoEmAndamento.Parametros.Controle.DirAuxilioSonar = chbDirAuxilioSonar.Checked;
Variaveis.OperacaoEmAndamento.Parametros.Controle.MovAuxilioSonar = chbMovAuxilioSonar.Checked;
Variaveis.OperacaoEmAndamento.Parametros.Controle.FrenagemAutomaticaAoParar = chbFrenagem.Checked;
Variaveis.OperacaoEmAndamento.Parametros.Controle.AtuAgitadorModo = (ModoAgitadorCalda)cmbAgitadorModo.SelectedIndex;
Variaveis.OperacaoEmAndamento.Parametros.Controle.RegistrarDadosPosProcessamento = chbGravarDadosPosProcessamento.Checked;
var pC = Variaveis.OperacaoEmAndamento.Parametros.Controle;
pC.ImuParadaPorInclinacao = chbImuParadaInclinacao.Checked;
pC.ImuAuxilioMovimento = chbImuAuxilioMov.Checked;
pC.ImuAuxilioDirecional = chbImuAuxilioDir.Checked;
pC.ImuDirecionalPreferirArco = chbImuPreferirArco.Checked;
pC.OakParadaPorObstaculo = chbOakParadaObstaculo.Checked;
pC.DirAuxilioSonar = chbDirAuxilioSonar.Checked;
pC.MovAuxilioSonar = chbMovAuxilioSonar.Checked;
pC.FrenagemAutomaticaAoParar = chbFrenagem.Checked;
pC.AtuAgitadorModo = (ModoAgitadorCalda)cmbAgitadorModo.SelectedIndex;
pC.RegistrarDadosPosProcessamento = chbGravarDadosPosProcessamento.Checked;
Variaveis.OperacaoEmAndamento.Parametros.ModulosMandatorios = ModulosMandatorios.Where(x => x.Utilizar).ToList();
Variaveis.OperacaoEmAndamento.Parametros.Controle.PulverizadorAutomatico = chbPulverizadorAutomatico.Checked;
Variaveis.OperacaoEmAndamento.Parametros.Controle.AtuPercentualInicioPulverizacao = (double)(nudAtuarem.Value / 100);
Variaveis.OperacaoEmAndamento.Parametros.Controle.MovimentoAutomatico = chbMovimentacaoAutomatica.Checked;
Variaveis.OperacaoEmAndamento.Parametros.Controle.MovVelocidadeSErvasPercent = (int)(nudVelocidadeSemErvas.Value);
Variaveis.OperacaoEmAndamento.Parametros.Controle.MovVelocidadeCErvasPercent = (int)(nudVelocidadeComErvas.Value);
Variaveis.OperacaoEmAndamento.Parametros.Controle.DirecionalAutomatico = chbDirecionalAutomatico.Checked;
Variaveis.OperacaoEmAndamento.Parametros.Controle.DirAnguloMaximo = (int)(nudAnguloMaximo.Value);
Variaveis.OperacaoEmAndamento.Parametros.Controle.DirVelocidadeMovimento = (int)(nudVelocidadeMP.Value);
Variaveis.OperacaoEmAndamento.Parametros.Controle.AnteciparManobraCorredorM = Convert.ToDouble(txtAnteciparManobraM.Text.Replace(".", ","));
pC.PulverizadorAutomatico = chbPulverizadorAutomatico.Checked;
pC.AtuPercentualInicioPulverizacao = (double)(nudAtuarem.Value / 100);
pC.MovimentoAutomatico = chbMovimentacaoAutomatica.Checked;
pC.MovVelocidadeSErvasPercent = (int)(nudVelocidadeSemErvas.Value);
pC.MovVelocidadeCErvasPercent = (int)(nudVelocidadeComErvas.Value);
pC.DirecionalAutomatico = chbDirecionalAutomatico.Checked;
pC.DirAnguloMaximo = (int)(nudAnguloMaximo.Value);
pC.DirVelocidadeMovimento = (int)(nudVelocidadeMP.Value);
pC.AnteciparManobraCorredorM = Convert.ToDouble(txtAnteciparManobraM.Text.Replace(".", ","));
Variaveis.OperacaoEmAndamento.tmrLogsInterval = (double)(nudTemposalvarlog.Value * 1000);
Variaveis.OperacaoEmAndamento.Parametros.QtdBicos = (int)nudQtdBicos.Value;
Variaveis.OperacaoEmAndamento.Parametros.QtdCamerasSolo = (int)nudQtdCameras.Value;

View File

@ -1455,7 +1455,7 @@ namespace AgroBase.Forms.Operacoes
lblMagnetometro.ForeColor = !LogImu.Iniciado ? Color.Red : Color.Black;
pnlOrientacaoMagnetometro.Invalidate();
pnlInclinacao.Invalidate();
visualizador3D.AtualizarAngulos(LogImu.InclinacaoFrontal, LogImu.InclinacaoLateral, -LogsOperacao[idxMomentoAtual].Gps.OrientacaoReal);
visualizador3D.AtualizarAngulos(LogImu.PitchSeguro, LogImu.RollSeguro, -LogsOperacao[idxMomentoAtual].Gps.OrientacaoReal);
//txtTemperatura.Text = LogImu.Temperatura.ToString("0.00");
//txtAltitude.Text = LogImu.Altitude.ToString("0.00");
//txtPressao.Text = LogImu.Pressao + " Pa (" + (LogImu.Pressao / 101300.0).ToString("0.00") + " atm)";
@ -1897,8 +1897,8 @@ namespace AgroBase.Forms.Operacoes
// Calcular a posição do círculo com base nos ângulos
var Log = LogsOperacao.FirstOrDefault(x => x.Momento == MomentoAtual).IMU;
int circlePosX = centerX + (int)((Log?.InclinacaoLateral ?? 0) * (pnlInclinacao.Width / 2 - radius) / 90);
int circlePosY = centerY - (int)((Log?.InclinacaoFrontal ?? 0) * (pnlInclinacao.Height / 2 - radius) / 90);
int circlePosX = centerX + (int)((Log?.RollSeguro ?? 0) * (pnlInclinacao.Width / 2 - radius) / 90);
int circlePosY = centerY - (int)((Log?.PitchSeguro ?? 0) * (pnlInclinacao.Height / 2 - radius) / 90);
// Desenhar o círculo
Brush brush = new SolidBrush(Color.Red);

View File

@ -411,8 +411,8 @@ namespace AgroBase.Forms
private void pnlOrientacaoMagnetometro_Paint(object sender, PaintEventArgs e)
{
var _Sensoriamento = Variaveis.OperacaoEmAndamento.Sensoriamento;
double Angulo = _Sensoriamento.IMU.Rotacao;
double AnguloCorrigido = _Sensoriamento.IMU.RotacaoCorrigida;
double Angulo = _Sensoriamento.IMU.yaw;
double AnguloCorrigido = _Sensoriamento.IMU.YawSeguro;
FuncoesGlobais.DesenharInclinacao((Panel)sender, e, (float)Angulo, -90, (float)AnguloCorrigido);
}

View File

@ -145,7 +145,7 @@ namespace AgroBase.Forms
private async void btnLeituraIMU_Click(object sender, EventArgs e)
{
pnlInclinacao.Invalidate();
lblLeituraIMU.Text = $"Leitura em: {FuncoesGlobais.TimestampToDate(VisualWorkerService.DadosLeitura.Imu?.timestamp ?? 0)}";
lblLeituraIMU.Text = $"Leitura em: {FuncoesGlobais.TimestampToDate(VisualWorkerService.DadosLeitura.Imu?.dados?.timestamp ?? 0)}";
}
private void AtualizarDadosAnalise()
@ -308,8 +308,8 @@ namespace AgroBase.Forms
private void pnlInclinacao_Paint(object sender, PaintEventArgs e)
{
Panel _pnlInclinacao = sender as Panel;
double AnguloX = VisualWorkerService.DadosLeitura.Imu?.roll ?? 0;
double AnguloY = VisualWorkerService.DadosLeitura.Imu?.pitch ?? 0;
double AnguloX = VisualWorkerService.DadosLeitura.Imu?.dados?.roll ?? 0;
double AnguloY = VisualWorkerService.DadosLeitura.Imu?.dados?.pitch ?? 0;
Graphics g = e.Graphics;
int centerX = _pnlInclinacao.Width / 2;

View File

@ -67,22 +67,37 @@ namespace AgroBase.Forms
{
if (cmbDispositivo.SelectedIndex < 0 || cmbDispositivo.SelectedIndex >= ListaCameras.Count) return;
var Camera = ListaCameras[cmbDispositivo.SelectedIndex];
if (Camera.imu == null) return;
if (Camera.mx_id == Variaveis.OperacaoEmAndamento.DispSen?.Dados?.CameraCaminho?.Id)
Camera.imu = Variaveis.OperacaoEmAndamento.DispSen.Dados?.CameraCaminho?.cam?.imu;
else if (Variaveis.OperacaoEmAndamento.DispSen.Dados?.CamerasSolo?.Any(x => x?.Id == Camera.mx_id) ?? false)
Camera.imu = Variaveis.OperacaoEmAndamento.DispSen.Dados?.CamerasSolo?.FirstOrDefault(x => x?.Id == Camera.mx_id)?.cam?.imu;
//OperacaoSensoriamentoLogImuModel Imu = Variaveis.OperacaoEmAndamento.Sensoriamento.IMU;
OperacaoSensoriamentoLogImuModel Imu = new OperacaoSensoriamentoLogImuModel()
OperacaoSensoriamentoLogImuModel Imu = new OperacaoSensoriamentoLogImuModel();
if (cmbDispositivo.SelectedIndex == 0)
{
InclinacaoFrontal = Camera.imu.pitch,
InclinacaoLateral = Camera.imu.roll,
Rotacao = Camera.imu.yaw,
RotacaoCorrigida = Camera.imu.yaw,
};
var imu = Variaveis.OperacaoEmAndamento.Sensoriamento.IMU;
Imu = new OperacaoSensoriamentoLogImuModel()
{
InclinacaoFrontal = imu.pitch,
InclinacaoLateral = imu.roll,
Rotacao = imu.yaw,
RotacaoCorrigida = imu.yaw,
};
}
else
{
var Camera = ListaCameras[cmbDispositivo.SelectedIndex];
if (Camera.imu == null) return;
if (Camera.mx_id == Variaveis.OperacaoEmAndamento.DispSen?.Dados?.CameraCaminho?.Id)
Camera.imu = Variaveis.OperacaoEmAndamento.DispSen.Dados?.CameraCaminho?.cam?.imu;
else if (Variaveis.OperacaoEmAndamento.DispSen.Dados?.CamerasSolo?.Any(x => x?.Id == Camera.mx_id) ?? false)
Camera.imu = Variaveis.OperacaoEmAndamento.DispSen.Dados?.CamerasSolo?.FirstOrDefault(x => x?.Id == Camera.mx_id)?.cam?.imu;
Imu = new OperacaoSensoriamentoLogImuModel()
{
InclinacaoFrontal = Camera.imu.pitch,
InclinacaoLateral = Camera.imu.roll,
Rotacao = Camera.imu.yaw,
RotacaoCorrigida = Camera.imu.yaw,
};
}
AnguloX = Imu.InclinacaoFrontal;
AnguloY = Imu.InclinacaoLateral;
AnguloZ = Imu.Rotacao;
@ -96,6 +111,8 @@ namespace AgroBase.Forms
ListaCameras = CameraWorkerService.GetListaCameras();
cmbDispositivo.Items.Clear();
cmbDispositivo.Items.AddRange(ListaCameras.Select(x => x.modelo).ToArray());
cmbDispositivo.SelectedIndex = 0;
}
private void PopularDadosGrid()

View File

@ -0,0 +1,452 @@
using AgroBase.Models.Operadores;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using static AgroBase.Models.Enums;
namespace AgroBase.Models.Modules
{
public class ModuloIMUModel
{
// ============================================================
// Estado geral
// ============================================================
public bool valido { get; set; }
/// <summary>
/// normal, single_source, redundante, sem_imu, inicializando...
/// </summary>
public string modo { get; set; } = "";
// ============================================================
// Atitude final do robô
// ============================================================
public double roll { get; set; }
public double pitch { get; set; }
public double yaw { get; set; }
public double roll_filtrado { get; set; }
public double pitch_filtrado { get; set; }
public double yaw_filtrado { get; set; }
/// <summary>
/// Compatibilidade com contrato antigo.
/// Normalmente espelha roll_filtrado.
/// </summary>
public double roll_seg { get; set; }
/// <summary>
/// Compatibilidade com contrato antigo.
/// Normalmente espelha pitch_filtrado.
/// </summary>
public double pitch_seg { get; set; }
// ============================================================
// Tendência angular
// ============================================================
public double roll_rate_dps { get; set; }
public double pitch_rate_dps { get; set; }
public double yaw_rate_dps { get; set; }
public double roll_rate_filtrado_dps { get; set; }
public double pitch_rate_filtrado_dps { get; set; }
// ============================================================
// Risco / segurança operacional
// ============================================================
/// <summary>
/// normal, attention, risk, critical, emergency, unknown.
/// </summary>
public string risk_level { get; set; } = "unknown";
/// <summary>
/// 0 normal, 1 attention, 2 risk, 3 critical, 4 emergency.
/// </summary>
public int risk_level_num { get; set; }
public double risk_score { get; set; }
public List<string> motivos_risco { get; set; } = new List<string>();
/// <summary>
/// normal, reduzir_velocidade_leve, reduzir_velocidade_forte,
/// parada_controlada, emergency_stop.
/// </summary>
public string acao_sugerida { get; set; } = "";
/// <summary>
/// Fator recomendado para movimentação.
/// 1.0 = normal, 0.70 = reduz leve, 0.35 = reduz forte, 0 = parar.
/// </summary>
public double velocidade_factor { get; set; } = 1.0;
public bool bloquear_avanco { get; set; }
public bool stop { get; set; }
public bool emergency_stop { get; set; }
// ============================================================
// Recuperação / intervenção humana
// ============================================================
public bool recovery_required { get; set; }
public bool recovery_mode_allowed { get; set; }
public bool auto_resume_allowed { get; set; }
public bool stable_to_resume { get; set; }
public double stable_to_resume_s { get; set; }
/// <summary>
/// aguardar_operador, operador_pode_liberar_retomada, sem_acao...
/// </summary>
public string recovery_hint { get; set; } = "";
// ============================================================
// Fusão / redundância dos sensores
// ============================================================
public double confidence { get; set; }
public string fonte_principal { get; set; } = "";
public bool single_source { get; set; }
public int sensors_count { get; set; }
public int sensors_valid_count { get; set; }
public int sensors_ignored_count { get; set; }
public bool sensors_agree { get; set; }
public double roll_disagreement_deg { get; set; }
public double pitch_disagreement_deg { get; set; }
public double max_disagreement_deg { get; set; }
public List<ModuloIMUFonteModel> fontes { get; set; } = new List<ModuloIMUFonteModel>();
public List<ModuloIMUFonteIgnoradaModel> fontes_ignoradas { get; set; } = new List<ModuloIMUFonteIgnoradaModel>();
public List<ModuloIMUFonteDivergenteModel> divergentes { get; set; } = new List<ModuloIMUFonteDivergenteModel>();
// ============================================================
// Índices diagnósticos
// ============================================================
public double estabilidade_idx { get; set; }
public double oscilacao_roll_std { get; set; }
public double oscilacao_pitch_std { get; set; }
public double oscilacao_total_std { get; set; }
// ============================================================
// Tempo / saúde de publicação
// ============================================================
/// <summary>
/// Timestamp principal. Normalmente em ms.
/// </summary>
public double timestamp { get; set; }
/// <summary>
/// Timestamp do último pacote/fusão. Normalmente em segundos.
/// </summary>
public double last_packet_ts { get; set; }
/// <summary>
/// Timestamp da última publicação. Normalmente em segundos.
/// </summary>
public double last_publish_ts { get; set; }
public double ultimo_erro_ts { get; set; }
/// <summary>
/// Latência normalmente em segundos no contrato Python.
/// </summary>
public double latencia { get; set; }
/// <summary>
/// Frequência real do loop final.
/// </summary>
public double frequencia { get; set; }
// ============================================================
// Saúde do módulo final
// ============================================================
public ManagerWorkerMessageResponseModulosPendentesModel saude { get; set; } = new ManagerWorkerMessageResponseModulosPendentesModel();
// ============================================================
// Extras
// ============================================================
[JsonExtensionData]
public IDictionary<string, JToken> Extra { get; set; } = new Dictionary<string, JToken>();
// ============================================================
// Helpers para UI / controle
// ============================================================
[JsonIgnore]
public bool Iniciado => valido;
[JsonIgnore]
public bool Operacional => valido && saude != null && (saude.status == StatusModulo.Operante || saude.status == StatusModulo.Alerta);
[JsonIgnore]
public bool DeveParar =>
emergency_stop ||
stop ||
bloquear_avanco ||
risk_level_num >= 3;
[JsonIgnore]
public bool DeveReduzir =>
!DeveParar && risk_level_num >= 1;
[JsonIgnore]
public double RollSeguro =>
roll_filtrado != 0 ? roll_filtrado :
roll_seg != 0 ? roll_seg :
roll;
[JsonIgnore]
public double PitchSeguro =>
pitch_filtrado != 0 ? pitch_filtrado :
pitch_seg != 0 ? pitch_seg :
pitch;
[JsonIgnore]
public double YawSeguro =>
yaw_filtrado != 0 ? yaw_filtrado : yaw;
[JsonIgnore]
public double LatenciaMsFinal
{
get
{
if (latencia <= 0) return 0;
// Se veio em segundos.
if (latencia < 10) return latencia * 1000.0;
// Se algum dia vier direto em ms.
return latencia;
}
}
[JsonIgnore]
public double TimestampSegundos
{
get
{
if (timestamp <= 0) return 0;
// timestamp em ms.
if (timestamp > 100000000000.0)
return timestamp / 1000.0;
return timestamp;
}
}
[JsonIgnore]
public double IdadeSegundos
{
get
{
var ts = TimestampSegundos;
if (ts <= 0) return 999.0;
var now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() / 1000.0;
return Math.Max(0, now - ts);
}
}
public ModuloIMUModel Clone()
{
return new ModuloIMUModel
{
valido = valido,
modo = modo,
roll = roll,
pitch = pitch,
yaw = yaw,
roll_filtrado = roll_filtrado,
pitch_filtrado = pitch_filtrado,
yaw_filtrado = yaw_filtrado,
roll_seg = roll_seg,
pitch_seg = pitch_seg,
roll_rate_dps = roll_rate_dps,
pitch_rate_dps = pitch_rate_dps,
yaw_rate_dps = yaw_rate_dps,
roll_rate_filtrado_dps = roll_rate_filtrado_dps,
pitch_rate_filtrado_dps = pitch_rate_filtrado_dps,
risk_level = risk_level,
risk_level_num = risk_level_num,
risk_score = risk_score,
motivos_risco = motivos_risco?.ToList() ?? new List<string>(),
acao_sugerida = acao_sugerida,
velocidade_factor = velocidade_factor,
bloquear_avanco = bloquear_avanco,
stop = stop,
emergency_stop = emergency_stop,
recovery_required = recovery_required,
recovery_mode_allowed = recovery_mode_allowed,
auto_resume_allowed = auto_resume_allowed,
stable_to_resume = stable_to_resume,
stable_to_resume_s = stable_to_resume_s,
recovery_hint = recovery_hint,
confidence = confidence,
fonte_principal = fonte_principal,
single_source = single_source,
sensors_count = sensors_count,
sensors_valid_count = sensors_valid_count,
sensors_ignored_count = sensors_ignored_count,
sensors_agree = sensors_agree,
roll_disagreement_deg = roll_disagreement_deg,
pitch_disagreement_deg = pitch_disagreement_deg,
max_disagreement_deg = max_disagreement_deg,
fontes = fontes?.Select(x => x.Clone()).ToList() ?? new List<ModuloIMUFonteModel>(),
fontes_ignoradas = fontes_ignoradas?.Select(x => x.Clone()).ToList() ?? new List<ModuloIMUFonteIgnoradaModel>(),
divergentes = divergentes?.Select(x => x.Clone()).ToList() ?? new List<ModuloIMUFonteDivergenteModel>(),
estabilidade_idx = estabilidade_idx,
oscilacao_roll_std = oscilacao_roll_std,
oscilacao_pitch_std = oscilacao_pitch_std,
oscilacao_total_std = oscilacao_total_std,
timestamp = timestamp,
last_packet_ts = last_packet_ts,
last_publish_ts = last_publish_ts,
ultimo_erro_ts = ultimo_erro_ts,
latencia = latencia,
frequencia = frequencia,
saude = saude,
Extra = Extra?.ToDictionary(
x => x.Key,
x => x.Value?.DeepClone()
) ?? new Dictionary<string, JToken>()
};
}
}
public class ModuloIMUFonteModel
{
public string mx_id { get; set; } = "";
public string modelo { get; set; } = "";
public double roll { get; set; }
public double pitch { get; set; }
public double yaw { get; set; }
public double roll_rate_dps { get; set; }
public double pitch_rate_dps { get; set; }
public double idade_s { get; set; }
public double confidence { get; set; }
public double peso_base { get; set; }
[JsonExtensionData]
public IDictionary<string, JToken> Extra { get; set; } = new Dictionary<string, JToken>();
public ModuloIMUFonteModel Clone()
{
return new ModuloIMUFonteModel
{
mx_id = mx_id,
modelo = modelo,
roll = roll,
pitch = pitch,
yaw = yaw,
roll_rate_dps = roll_rate_dps,
pitch_rate_dps = pitch_rate_dps,
idade_s = idade_s,
confidence = confidence,
peso_base = peso_base,
Extra = Extra?.ToDictionary(
x => x.Key,
x => x.Value?.DeepClone()
) ?? new Dictionary<string, JToken>()
};
}
}
public class ModuloIMUFonteIgnoradaModel
{
public string mx_id { get; set; } = "";
public string modelo { get; set; } = "";
public double idade_s { get; set; }
public List<string> motivos { get; set; } = new List<string>();
[JsonExtensionData]
public IDictionary<string, JToken> Extra { get; set; } = new Dictionary<string, JToken>();
public ModuloIMUFonteIgnoradaModel Clone()
{
return new ModuloIMUFonteIgnoradaModel
{
mx_id = mx_id,
modelo = modelo,
idade_s = idade_s,
motivos = motivos?.ToList() ?? new List<string>(),
Extra = Extra?.ToDictionary(
x => x.Key,
x => x.Value?.DeepClone()
) ?? new Dictionary<string, JToken>()
};
}
}
public class ModuloIMUFonteDivergenteModel
{
public string mx_id { get; set; } = "";
public double roll { get; set; }
public double pitch { get; set; }
public double confidence { get; set; }
[JsonExtensionData]
public IDictionary<string, JToken> Extra { get; set; } = new Dictionary<string, JToken>();
public ModuloIMUFonteDivergenteModel Clone()
{
return new ModuloIMUFonteDivergenteModel
{
mx_id = mx_id,
roll = roll,
pitch = pitch,
confidence = confidence,
Extra = Extra?.ToDictionary(
x => x.Key,
x => x.Value?.DeepClone()
) ?? new Dictionary<string, JToken>()
};
}
}
}

View File

@ -1,8 +1,11 @@
using AgroBase.Models.Operadores;
using AgroBase.Services.Operadores;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
using static AgroBase.Models.Enums;
@ -173,25 +176,249 @@ namespace AgroBase.Models
{
public OAKImuDataModel dados { get; set; }
public ManagerWorkerMessageResponseModulosPendentesModel saude { get; set; }
public OAKImuModel Clone()
{
return new OAKImuModel()
{
dados = dados?.Clone(),
saude = saude
};
}
}
public class OAKImuDataModel
{
// ============================================================
// Identificação / validade
// ============================================================
public bool valido { get; set; }
public string mx_id { get; set; } = "";
public string sensor { get; set; } = "";
public string tipo { get; set; } = "";
public bool calibrado { get; set; }
public bool calibrando { get; set; }
// ============================================================
// Timestamps
// ============================================================
/// <summary>
/// Timestamp principal. Normalmente em ms no contrato Python.
/// </summary>
public double timestamp { get; set; }
/// <summary>
/// Timestamp do último pacote recebido da OAK, geralmente em segundos.
/// </summary>
public double last_packet_ts { get; set; }
/// <summary>
/// Timestamp da última publicação no Redis, geralmente em segundos.
/// </summary>
public double last_publish_ts { get; set; }
public double ultimo_erro_ts { get; set; }
// ============================================================
// Atitude instantânea
// ============================================================
public double roll { get; set; }
public double roll_seg { get; set; }
public double pitch { get; set; }
public double pitch_seg { get; set; }
public double yaw { get; set; }
// Mantém compatibilidade com tela antiga.
public double yaw_fixed { get; set; }
public double vel_mps { get; set; }
public bool em_movimento { get; set; }
public double movimento_idx { get; set; }
public double rugosidade_idx { get; set; }
public double impacto_idx { get; set; }
public double estabilidade_idx { get; set; }
public double latencia { get; set; }
// ============================================================
// Atitude filtrada / segurança
// ============================================================
public double roll_filtrado { get; set; }
public double pitch_filtrado { get; set; }
public double yaw_filtrado { get; set; }
/// <summary>
/// Alias de segurança/compatibilidade. No contrato novo tende a espelhar roll_filtrado.
/// </summary>
public double roll_seg { get; set; }
/// <summary>
/// Alias de segurança/compatibilidade. No contrato novo tende a espelhar pitch_filtrado.
/// </summary>
public double pitch_seg { get; set; }
// ============================================================
// Tendência angular
// ============================================================
public double roll_rate_dps { get; set; }
public double pitch_rate_dps { get; set; }
public double yaw_rate_dps { get; set; }
// ============================================================
// Qualidade do quaternion / DepthAI
// ============================================================
public double? rotation_accuracy_rad { get; set; }
// Caso a gente publique futuramente qual campo foi usado:
// rotationVector, gameRotationVector, etc.
public string rotation_vector_source { get; set; } = "";
// ============================================================
// Saúde / performance do loop
// ============================================================
/// <summary>
/// Novo contrato Python pode publicar frequencia.
/// </summary>
public double frequencia { get; set; }
/// <summary>
/// Campo antigo.
/// </summary>
public double frequencia_hz { get; set; }
/// <summary>
/// Novo contrato Python pode publicar latencia em segundos.
/// </summary>
public double latencia { get; set; }
/// <summary>
/// Campo antigo, em milissegundos.
/// </summary>
public double latencia_ms { get; set; }
public int packets_lidos { get; set; }
public int packets_publicados { get; set; }
public int erros { get; set; }
// ============================================================
// Campos antigos mantidos para compatibilidade
// ============================================================
public double rugosidade { get; set; }
public double impacto { get; set; }
public double estabilidade { get; set; }
public bool movimento_detectado { get; set; }
// ============================================================
// Extras
// ============================================================
[JsonExtensionData]
public IDictionary<string, JToken> Extra { get; set; } = new Dictionary<string, JToken>();
// ============================================================
// Helpers seguros para UI
// ============================================================
[JsonIgnore]
public double RollSeguro => roll_seg != 0 ? roll_seg : roll_filtrado;
[JsonIgnore]
public double PitchSeguro => pitch_seg != 0 ? pitch_seg : pitch_filtrado;
[JsonIgnore]
public double YawSeguro => yaw_filtrado != 0 ? yaw_filtrado : yaw;
[JsonIgnore]
public double FrequenciaHzFinal
{
get
{
if (frequencia_hz > 0) return frequencia_hz;
if (frequencia > 0) return frequencia;
return 0;
}
}
[JsonIgnore]
public double LatenciaMsFinal
{
get
{
if (latencia_ms > 0) return latencia_ms;
// Se latencia vier em segundos, converte para ms.
if (latencia > 0 && latencia < 10) return latencia * 1000.0;
// Se por algum motivo já vier em ms.
if (latencia >= 10) return latencia;
return 0;
}
}
[JsonIgnore]
public bool TemLeituraAtitude =>
valido &&
(roll != 0 || pitch != 0 || yaw != 0 || roll_filtrado != 0 || pitch_filtrado != 0);
public OAKImuDataModel Clone()
{
return new OAKImuDataModel
{
valido = valido,
mx_id = mx_id,
sensor = sensor,
tipo = tipo,
calibrado = calibrado,
calibrando = calibrando,
timestamp = timestamp,
last_packet_ts = last_packet_ts,
last_publish_ts = last_publish_ts,
ultimo_erro_ts = ultimo_erro_ts,
roll = roll,
pitch = pitch,
yaw = yaw,
yaw_fixed = yaw_fixed,
roll_filtrado = roll_filtrado,
pitch_filtrado = pitch_filtrado,
yaw_filtrado = yaw_filtrado,
roll_seg = roll_seg,
pitch_seg = pitch_seg,
roll_rate_dps = roll_rate_dps,
pitch_rate_dps = pitch_rate_dps,
yaw_rate_dps = yaw_rate_dps,
rotation_accuracy_rad = rotation_accuracy_rad,
rotation_vector_source = rotation_vector_source,
frequencia = frequencia,
frequencia_hz = frequencia_hz,
latencia = latencia,
latencia_ms = latencia_ms,
packets_lidos = packets_lidos,
packets_publicados = packets_publicados,
erros = erros,
rugosidade = rugosidade,
impacto = impacto,
estabilidade = estabilidade,
movimento_detectado = movimento_detectado,
Extra = Extra?.ToDictionary(
x => x.Key,
x => x.Value?.DeepClone()
) ?? new Dictionary<string, JToken>()
};
}
}
}

View File

@ -385,6 +385,9 @@ namespace AgroBase.Models
FrenagemAutomaticaAoParar = false,
ImuParadaPorInclinacao = false,
ImuAuxilioMovimento = false,
ImuAuxilioDirecional = false,
ImuDirecionalPreferirArco = false,
OakParadaPorObstaculo = false,
DirAuxilioSonar = false,
MovAuxilioSonar = false,
@ -496,6 +499,9 @@ namespace AgroBase.Models
FrenagemAutomaticaAoParar = true,
ImuParadaPorInclinacao = true,
ImuAuxilioMovimento = true,
ImuAuxilioDirecional = true,
ImuDirecionalPreferirArco = true,
OakParadaPorObstaculo = true,
DirAuxilioSonar = true,
MovAuxilioSonar = true,
@ -637,6 +643,9 @@ namespace AgroBase.Models
FrenagemAutomaticaAoParar = false,
ImuParadaPorInclinacao = false,
ImuAuxilioMovimento = false,
ImuAuxilioDirecional = false,
ImuDirecionalPreferirArco = false,
OakParadaPorObstaculo = false,
DirAuxilioSonar = false,
MovAuxilioSonar = false,
@ -656,6 +665,7 @@ namespace AgroBase.Models
AtuPercentualInicioPulverizacao = 70,
AtuPressaoLinha = 85,
AtuAgitadorModo = ModoAgitadorCalda.SemAgitacao,
AtuModoControle = ModoControleBomba.OnOff,
};
p.ModulosMandatorios = new List<OperacaoModulosMandatoriosModel>()
{
@ -775,6 +785,9 @@ namespace AgroBase.Models
FrenagemAutomaticaAoParar = true,
ImuParadaPorInclinacao = true,
ImuAuxilioMovimento = true,
ImuAuxilioDirecional = true,
ImuDirecionalPreferirArco = true,
OakParadaPorObstaculo = true,
DirAuxilioSonar = true,
MovAuxilioSonar = true,
@ -795,6 +808,7 @@ namespace AgroBase.Models
AtuPercentualInicioPulverizacao = 70,
AtuPressaoLinha = 85,
AtuAgitadorModo = ModoAgitadorCalda.SemAgitacao,
AtuModoControle = ModoControleBomba.OnOff,
};
p.ModulosMandatorios = new List<OperacaoModulosMandatoriosModel>()
{
@ -874,6 +888,9 @@ namespace AgroBase.Models
FrenagemAutomaticaAoParar = true,
ImuParadaPorInclinacao = true,
ImuAuxilioMovimento = true,
ImuAuxilioDirecional = true,
ImuDirecionalPreferirArco = true,
OakParadaPorObstaculo = true,
DirAuxilioSonar = true,
MovAuxilioSonar = true,
@ -894,6 +911,7 @@ namespace AgroBase.Models
AtuPercentualInicioPulverizacao = 70,
AtuPressaoLinha = 85,
AtuAgitadorModo = ModoAgitadorCalda.SemAgitacao,
AtuModoControle = ModoControleBomba.OnOff,
};
p.ModulosMandatorios = new List<OperacaoModulosMandatoriosModel>()
{
@ -1654,7 +1672,7 @@ namespace AgroBase.Models
if (Variaveis.OperacaoEmAndamento.Parametros?.Modo == ModoOperacao.Manual)
{
var Sonar = Variaveis.OperacaoEmAndamento.Sensoriamento?.OperadorVisual;
Sonar?.Resumo?.AtualizarStatusBloqueio(true);
Sonar?.Resumo?.AtualizarStatusBloqueioManual(Sonar, true);
if (Sonar?.Resumo?.EnviarComandoParada ?? false)
{
Variaveis.MostrarLog("[OperacaoModel] Deve enviar o comando de parada em tmrLeituras_Tick");
@ -2647,7 +2665,7 @@ namespace AgroBase.Models
return new DateTime().AddSeconds(TempoDecorridoSeg);
}
}
public OperacaoSensoriamentoLogImuModel IMU { get; set; }
public ModuloIMUModel IMU { get; set; }
public OperacaoSensoriamentoLogAtuModel Atuador { get; set; }
public OperacaoSensoriamentoLogMovModel Movimentacao { get; set; }
public OperacaoSensoriamentoLogDirModel Direcional { get; set; }
@ -2720,23 +2738,10 @@ namespace AgroBase.Models
_Reservatorio?.AtualizarAgitadorCalda(pControle?.AtuAgitadorModo ?? ModoAgitadorCalda.SemAgitacao);
_Trajetoria?.AtualizarDadosAutonomiaCorredor();
//var sIMU = LivoxManagerProcess.DadosLeitura.imu;
string imu = RedisService.Get(RedisService.ModKey(T_Code.Imu)) ?? "";
var sIMU = JsonConvert.DeserializeObject<OAKImuDataModel>(imu);
var sIMU = JsonConvert.DeserializeObject<ModuloIMUModel>(imu);
bool imu_iniciado = sIMU?.timestamp > 0 && HealthWorkerService.ModulosSaude.FirstOrDefault(x => x.modulo == T_Code.Imu)?.status != StatusModulo.Desconectado;
var dadosIMU = sIMU != null ? new OperacaoSensoriamentoLogImuModel()
{
Iniciado = imu_iniciado,
InclinacaoLateral = imu_iniciado ? sIMU.pitch : 0,
InclinacaoFrontal = imu_iniciado ? sIMU.roll : 0,
Rotacao = imu_iniciado ? sIMU.yaw : 0,
RotacaoCorrigida = imu_iniciado ? sIMU.yaw_fixed : 0,
EmMovimento = imu_iniciado ? sIMU.em_movimento : false,
IndiceMovimento = imu_iniciado ? sIMU.movimento_idx : 0,
IndiceRugosidade = imu_iniciado ? sIMU.rugosidade_idx : 0,
IndiceEstabilidade = imu_iniciado ? sIMU.estabilidade_idx : 0,
IndiceImpacto = imu_iniciado ? sIMU.impacto_idx : 0,
} : new OperacaoSensoriamentoLogImuModel();
var dadosIMU = sIMU != null && imu_iniciado ? sIMU.Clone() : new ModuloIMUModel();
var bombaLinha = _DispAtu?.Dados?.BombasPressurizadoras?.FirstOrDefault(x => x.ID == "BMBLN");
var dadosAtuador = _DispAtu != null ? new OperacaoSensoriamentoLogAtuModel()
@ -2750,7 +2755,7 @@ namespace AgroBase.Models
PercentualErvasTerreno = _DispAtu.Dados.PercentualErvasTerreno,
HerbicidaPorErva = _Reservatorio.HerbicidaPorAtuacao_L,
ErvasNoRadar = WeedWorkerService.DadosLeitura?.Analise?.ervas_no_radar ?? false,
PercentualErvasNoRadar = WeedWorkerService.DadosLeitura?.Analise?.estatisticas?.erva?.ema_global ?? 0,
PercentualErvasNoRadar = WeedWorkerService.DadosLeitura?.Analise?.percentual_ervas_no_radar ?? 0,
PercentualReservatorio = _Reservatorio.PercentualAtual,
VolumeReservatorio = _Reservatorio.VolumeAtual_L,
MassaReservatorio = _Reservatorio.MassaAtual_Kg,

View File

@ -234,6 +234,48 @@ namespace AgroBase.Models.Operacoes
}
}
private bool _imuAuxilioMovimento;
public bool ImuAuxilioMovimento
{
get => _imuAuxilioMovimento;
set
{
if (_imuAuxilioMovimento != value)
{
_imuAuxilioMovimento = value;
OnPropertyChanged(nameof(ImuAuxilioMovimento));
}
}
}
private bool _imuAuxilioDirecional;
public bool ImuAuxilioDirecional
{
get => _imuAuxilioDirecional;
set
{
if (_imuAuxilioDirecional != value)
{
_imuAuxilioDirecional = value;
OnPropertyChanged(nameof(ImuAuxilioDirecional));
}
}
}
private bool _imuDirecionalPreferirArco;
public bool ImuDirecionalPreferirArco
{
get => _imuDirecionalPreferirArco;
set
{
if (_imuDirecionalPreferirArco != value)
{
_imuDirecionalPreferirArco = value;
OnPropertyChanged(nameof(ImuDirecionalPreferirArco));
}
}
}
private bool _frenagemAutomaticaAoParar;
public bool FrenagemAutomaticaAoParar
{
@ -617,7 +659,13 @@ namespace AgroBase.Models.Operacoes
} : new OperacaoParametrosDadosControleModel();
ModulosSaude = new List<ManagerWorkerMessageResponseModulosPendentesModel>(sen?.ModulosSaude ?? new List<ManagerWorkerMessageResponseModulosPendentesModel>());
DispositivosMapeados = new List<DispositivoDetalhesModel>(sen?.DispositivosMapeados ?? new List<DispositivoDetalhesModel>());
Imu = sen?.IMU?.Clone();
Imu = new OperacaoSensoriamentoLogImuModel()
{
Iniciado = sen?.IMU?.Iniciado ?? false,
InclinacaoFrontal = sen?.IMU?.PitchSeguro ?? 0,
InclinacaoLateral = sen?.IMU?.RollSeguro ?? 0,
Rotacao = sen?.IMU?.YawSeguro ?? 0,
};
Atuador = new OperacaoParametrosDadosAtuadorModel()
{
Iniciado = dAtu?.Conectado ?? false,
@ -809,7 +857,7 @@ namespace AgroBase.Models.Operacoes
LivoxLidar = sen?.LivoxLidar?.Clone();
CameraWorkerService.GetListaCameras();
Cameras = CameraWorkerService.ListaCameras;
OperadorVisual = VisualWorkerService.DadosLeitura?.Resumo?.UpdateClone();
OperadorVisual = VisualWorkerService.DadosLeitura?.Resumo?.Clone();
var l = sen?.Logs;
Logs = l != null ? l.Where(x => x.Momento >= UltimoEnvioLog).ToList() : new List<OperacaoSensoriamentoLogErrosModel>();
}

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using static AgroBase.Models.Enums;
using static AgroBase.Models.Operadores.OperadoresModels;
namespace AgroBase.Models.Operadores
{
@ -12,7 +9,6 @@ namespace AgroBase.Models.Operadores
public bool Pronto { get; set; }
public DateTime ProntoEm { get; set; }
public DateTime UltimaMensagem { get; set; }
//public WorkerMessageModel<HealthWorkerMessageResponseModel> Leitura { get; set; } = new WorkerMessageModel<HealthWorkerMessageResponseModel>();
public HealthWorkerModel Clone()
{
@ -22,7 +18,6 @@ namespace AgroBase.Models.Operadores
IniciadoEm = IniciadoEm,
Pronto = Pronto,
ProntoEm = ProntoEm,
//Leitura = Leitura.Clone()
};
}
@ -32,7 +27,6 @@ namespace AgroBase.Models.Operadores
IniciadoEm = DateTime.MinValue;
Pronto = false;
ProntoEm = DateTime.MinValue;
//Leitura = new WorkerMessageModel<HealthWorkerMessageResponseModel>();
}
}

View File

@ -17,7 +17,7 @@ namespace AgroBase.Models.Operadores
[JsonIgnore]
public Dictionary<TipoFrameCamera, OAKCameraFrameModel> CameraFrames { get; set; } = new Dictionary<TipoFrameCamera, OAKCameraFrameModel>();
public VisualWorkerMessageAnaliseModel Analises { get; set; } = new VisualWorkerMessageAnaliseModel();
public VisualWorkerMessageIMUModel Imu { get; set; } = new VisualWorkerMessageIMUModel();
public OAKImuModel Imu { get; set; } = new OAKImuModel();
public StatusModulo Status { get; set; }
public bool StatusValido => new List<StatusModulo>() { StatusModulo.Operante, StatusModulo.Alerta }.Contains(Status);
public VisualWorkerResumoModel Resumo { get; set; }
@ -51,7 +51,7 @@ namespace AgroBase.Models.Operadores
ProntoEm = DateTime.MinValue;
CameraFrames = new Dictionary<TipoFrameCamera, OAKCameraFrameModel>();
Analises = new VisualWorkerMessageAnaliseModel();
Imu = new VisualWorkerMessageIMUModel();
Imu = new OAKImuModel();
Resumo = new VisualWorkerResumoModel();
Status = StatusModulo.Desconectado;
Performance = new VisualWorkerPerformanceModel();
@ -75,27 +75,138 @@ namespace AgroBase.Models.Operadores
public class VisualWorkerResumoModel
{
// Operacional
public StatusCarroMapa StatusCarro { get; set; }
public double ErroLateral { get; set; }
public double ErroAngular { get; set; }
public string Modo { get; set; }
// Segurança / bloqueio
public bool ParadaDetectada { get; set; } = false;
public bool DeveParar { get; set; } = false;
public bool EnviarComandoParada { get; set; } = false;
public bool EnviarComandoRetomada { get; set; } = false;
// Novo: operador + técnico enxuto
public VisualWorkerResumoOperacionalModel Operacional { get; set; } = new VisualWorkerResumoOperacionalModel();
public VisualWorkerResumoTecnicoModel Tecnico { get; set; } = new VisualWorkerResumoTecnicoModel();
private bool _comandoParadaEnviado { get; set; } = false;
public void AtualizarStatusBloqueio(bool consideraEmMovimento)
public void AtualizarDados(VisualWorkerModel Sonar)
{
var Sonar = Variaveis.OperacaoEmAndamento.Sensoriamento.OperadorVisual;
Modo = Sonar?.Analises?.matriz_confianca?.block?.decision?.mode ?? "free";
ParadaDetectada = (Sonar?.Analises?.matriz_confianca?.block?.decision?.parar ?? false);
StatusCarro = Sonar?.Analises?.segmentacao?.status_corredor ?? StatusCarroMapa.Indefinido;
ErroLateral = Sonar?.Analises?.segmentacao?.erro_lateral_pct ?? 0;
ErroAngular = Sonar?.Analises?.segmentacao?.erro_angular ?? 0;
AtualizarResumoOperacional(Sonar);
AtualizarResumoTecnico(Sonar);
}
private void AtualizarResumoOperacional(VisualWorkerModel visual)
{
var block = visual?.Analises?.matriz_confianca?.block;
var decision = block?.decision;
var trend = block?.trend;
var debug = visual?.Analises?.segmentacao?.status_corredor_debug;
Operacional.DistanciaObstaculoM = block?.d_block_line_m;
Operacional.VelocidadeMaxSugeridaMps = decision?.v_max_sugerida_mps;
Operacional.RiscoObstaculo = decision?.risk_ema ?? trend?.risk_ema ?? 0;
Operacional.MotivoBloqueio = block?.reason;
Operacional.DetalheBloqueio = block?.reason_detail;
Operacional.OrigemStatusCorredor = debug?.origem_status;
Operacional.ConfiancaStatusCorredor = debug?.status_modelo_conf ?? 0;
}
private void AtualizarResumoTecnico(VisualWorkerModel visual)
{
var perf = visual?.Performance;
var ts = visual?.Timestamps;
Tecnico.FpsModeloIA = GetFps(perf, "segmentacao");
Tecnico.FpsDeteccao = GetFps(perf, "deteccao");
Tecnico.FpsMatrizConfianca = GetFps(perf, "matriz_confianca");
Tecnico.FpsAnalise = GetFps(perf, "analise");
Tecnico.LatenciaModeloMs = GetLatenciaMediaMs(perf, "segmentacao");
Tecnico.LatenciaDeteccaoMs = GetLatenciaMediaMs(perf, "deteccao");
var nowUnix = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() / 1000.0;
Tecnico.IdadeAnaliseMs = AgeMs(nowUnix, ts?.analise ?? 0);
Tecnico.IdadeSegmentacaoMs = AgeMs(nowUnix, ts?.segmentacao ?? 0);
Tecnico.IdadeDeteccaoMs = AgeMs(nowUnix, ts?.deteccao ?? 0);
Tecnico.IdadeMatrizConfiancaMs = AgeMs(nowUnix, ts?.matriz_confianca ?? 0);
Tecnico.TemSegmentacao = perf?.visual_cache?.tem_seg ?? false;
Tecnico.TemGrid = perf?.visual_cache?.tem_grid ?? false;
Tecnico.ModeloTravado =
Tecnico.IdadeSegmentacaoMs > 1500 ||
Tecnico.FpsModeloIA <= 0.2;
Tecnico.VisualAtrasado =
Tecnico.IdadeAnaliseMs > 1500 ||
Tecnico.IdadeMatrizConfiancaMs > 1500;
Tecnico.SaudeVisual = CalcularSaudeVisual();
}
private static double GetFps(VisualWorkerPerformanceModel perf, string loopName)
{
if (perf?.loops == null)
return 0;
return perf.loops.TryGetValue(loopName, out var loop)
? loop?.fps_real ?? 0
: 0;
}
private static double GetLatenciaMediaMs(VisualWorkerPerformanceModel perf, string loopName)
{
if (perf?.loops == null)
return 0;
if (!perf.loops.TryGetValue(loopName, out var loop) || loop?.latencia_ms == null)
return 0;
// Ajusta o nome conforme o JSON real: "avg", "mean", "media", etc.
return loop.latencia_ms["avg"]?.Value<double>()
?? loop.latencia_ms["mean"]?.Value<double>()
?? loop.latencia_ms["media"]?.Value<double>()
?? 0;
}
private static double AgeMs(double nowUnix, double tsUnix)
{
if (tsUnix <= 0)
return 999999;
return Math.Max(0, (nowUnix - tsUnix) * 1000.0);
}
private string CalcularSaudeVisual()
{
if (Tecnico.ModeloTravado)
return "travado";
if (Tecnico.VisualAtrasado)
return "atrasado";
if (Tecnico.FpsModeloIA < 2)
return "lento";
return "ok";
}
public void AtualizarStatusBloqueioManual(VisualWorkerModel Sonar, bool consideraEmMovimento)
{
if (!(Variaveis.OperacaoEmAndamento.Parametros?.Controle?.OakParadaPorObstaculo ?? false))
{
_comandoParadaEnviado = false;
@ -136,58 +247,81 @@ namespace AgroBase.Models.Operadores
EnviarComandoParada = EnviarComandoParada,
EnviarComandoRetomada = EnviarComandoRetomada,
_comandoParadaEnviado = _comandoParadaEnviado,
Operacional = Operacional?.Clone() ?? new VisualWorkerResumoOperacionalModel(),
Tecnico = Tecnico?.Clone() ?? new VisualWorkerResumoTecnicoModel(),
};
}
public VisualWorkerResumoModel UpdateClone()
}
public class VisualWorkerResumoTecnicoModel
{
public double FpsModeloIA { get; set; }
public double FpsDeteccao { get; set; }
public double FpsMatrizConfianca { get; set; }
public double FpsAnalise { get; set; }
public double LatenciaModeloMs { get; set; }
public double LatenciaDeteccaoMs { get; set; }
public double IdadeAnaliseMs { get; set; }
public double IdadeSegmentacaoMs { get; set; }
public double IdadeDeteccaoMs { get; set; }
public double IdadeMatrizConfiancaMs { get; set; }
public bool TemSegmentacao { get; set; }
public bool TemGrid { get; set; }
public bool ModeloTravado { get; set; }
public bool VisualAtrasado { get; set; }
public string SaudeVisual { get; set; } = "desconhecida";
public VisualWorkerResumoTecnicoModel Clone()
{
AtualizarStatusBloqueio(false);
return Clone();
return new VisualWorkerResumoTecnicoModel()
{
FpsAnalise = FpsAnalise,
FpsDeteccao = FpsDeteccao,
FpsMatrizConfianca = FpsMatrizConfianca,
FpsModeloIA = FpsModeloIA,
IdadeAnaliseMs = IdadeAnaliseMs,
IdadeDeteccaoMs = IdadeDeteccaoMs,
IdadeMatrizConfiancaMs = IdadeMatrizConfiancaMs,
IdadeSegmentacaoMs = IdadeSegmentacaoMs,
LatenciaDeteccaoMs = LatenciaDeteccaoMs,
LatenciaModeloMs = LatenciaModeloMs,
ModeloTravado = ModeloTravado,
SaudeVisual = SaudeVisual,
TemGrid = TemGrid,
TemSegmentacao = TemSegmentacao,
VisualAtrasado = VisualAtrasado
};
}
}
public class VisualWorkerMessageIMUModel
public class VisualWorkerResumoOperacionalModel
{
public bool valido { get; set; }
public double timestamp { get; set; }
public double? DistanciaObstaculoM { get; set; }
public double? VelocidadeMaxSugeridaMps { get; set; }
public double RiscoObstaculo { get; set; }
public double roll { get; set; }
public double pitch { get; set; }
public double yaw { get; set; }
public double yaw_fixed { get; set; }
public string MotivoBloqueio { get; set; }
public string DetalheBloqueio { get; set; }
public double frequencia_hz { get; set; }
public double latencia_ms { get; set; }
public string OrigemStatusCorredor { get; set; }
public double ConfiancaStatusCorredor { get; set; }
public double rugosidade { get; set; }
public double impacto { get; set; }
public double estabilidade { get; set; }
public bool movimento_detectado { get; set; }
[JsonExtensionData]
public IDictionary<string, JToken> Extra { get; set; } = new Dictionary<string, JToken>();
public VisualWorkerMessageIMUModel Clone()
public VisualWorkerResumoOperacionalModel Clone()
{
return new VisualWorkerMessageIMUModel
return new VisualWorkerResumoOperacionalModel()
{
valido = valido,
timestamp = timestamp,
roll = roll,
pitch = pitch,
yaw = yaw,
yaw_fixed = yaw_fixed,
frequencia_hz = frequencia_hz,
latencia_ms = latencia_ms,
rugosidade = rugosidade,
impacto = impacto,
estabilidade = estabilidade,
movimento_detectado = movimento_detectado,
Extra = Extra?.ToDictionary(
x => x.Key,
x => x.Value?.DeepClone()
) ?? new Dictionary<string, JToken>()
ConfiancaStatusCorredor = ConfiancaStatusCorredor,
DetalheBloqueio = DetalheBloqueio,
DistanciaObstaculoM = DistanciaObstaculoM,
MotivoBloqueio = MotivoBloqueio,
OrigemStatusCorredor = OrigemStatusCorredor,
RiscoObstaculo = RiscoObstaculo,
VelocidadeMaxSugeridaMps = VelocidadeMaxSugeridaMps
};
}
}

View File

@ -17,6 +17,7 @@ namespace AgroBase.Models.Operadores
[JsonIgnore]
public Dictionary<TipoFrameCamera, OAKCameraFrameModel> CameraFrames { get; set; } = new Dictionary<TipoFrameCamera, OAKCameraFrameModel>();
public WeedWorkerAnaliseModel Analise { get; set; } = new WeedWorkerAnaliseModel();
public OAKImuModel Imu { get; set; } = new OAKImuModel();
public WeedWorkerPerformanceModel Performance { get; set; } = new WeedWorkerPerformanceModel();
public WeedWorkerAnaliseMetricasModel MetricasAnalise { get; set; } = new WeedWorkerAnaliseMetricasModel();
public WeedWorkerRedisTimestampsModel Timestamps { get; set; } = new WeedWorkerRedisTimestampsModel();
@ -32,6 +33,8 @@ namespace AgroBase.Models.Operadores
ProntoEm = ProntoEm,
UltimaMensagem = UltimaMensagem,
Imu = Imu?.Clone(),
Analise = Analise?.Clone()
?? new WeedWorkerAnaliseModel(),
@ -60,6 +63,7 @@ namespace AgroBase.Models.Operadores
new Dictionary<TipoFrameCamera, OAKCameraFrameModel>();
Analise = new WeedWorkerAnaliseModel();
Imu = new OAKImuModel();
MetricasAnalise = new WeedWorkerAnaliseMetricasModel();
Performance = new WeedWorkerPerformanceModel();
Timestamps = new WeedWorkerRedisTimestampsModel();

View File

@ -1221,7 +1221,7 @@ namespace AgroBase.Services
else if (imuIniciado)
{
// Apenas o WT901C está disponível
anguloFinal = Variaveis.OperacaoEmAndamento.Sensoriamento.IMU.RotacaoCorrigida;
anguloFinal = Variaveis.OperacaoEmAndamento.Sensoriamento.IMU.YawSeguro;
}
else
{

View File

@ -361,9 +361,9 @@ namespace AgroBase.Services.Operadores
("frenagem_automatica", pControle.FrenagemAutomaticaAoParar),
("oak_parada_por_bloqueio", pControle.OakParadaPorObstaculo),
("imu_parada_por_inclinacao", pControle.ImuParadaPorInclinacao),
("imu_auxilio_movimento", false),
("imu_auxilio_direcional", false),
("imu_direcional_preferir_arco", false),
("imu_auxilio_movimento", pControle.ImuAuxilioMovimento),
("imu_auxilio_direcional", pControle.ImuAuxilioDirecional),
("imu_direcional_preferir_arco", pControle.ImuDirecionalPreferirArco),
("dir_auxilio_sonar", pControle.DirAuxilioSonar),
("mov_auxilio_sonar", pControle.MovAuxilioSonar),

View File

@ -301,13 +301,15 @@ namespace AgroBase.Services.Operadores
_lastTsPerformanceVisual = tsPerformance;
}
DadosLeitura.Resumo?.AtualizarDados(DadosLeitura);
}
private static void AtualizarImu()
{
try
{
string mxId = Variaveis.OperacaoEmAndamento?.DispSen?.Dados?.CameraCaminho?.Id;
string mxId = VariaveisEquipamento.Parametros.camera_caminhho_id;
if (string.IsNullOrWhiteSpace(mxId))
return;
@ -325,7 +327,7 @@ namespace AgroBase.Services.Operadores
imuToken.Type == JTokenType.Null)
return;
var imu = imuToken.ToObject<VisualWorkerMessageIMUModel>();
var imu = imuToken.ToObject<OAKImuModel>();
if (imu != null)
DadosLeitura.Imu = imu;

View File

@ -174,6 +174,8 @@ namespace AgroBase.Services.Operadores
public static void AtualizarAnalise()
{
AtualizarImu();
string json = RedisService.Get(CtxKey.DadosWeedWorker);
if (string.IsNullOrWhiteSpace(json))
@ -277,6 +279,40 @@ namespace AgroBase.Services.Operadores
}
}
private static void AtualizarImu()
{
try
{
string mxId = VariaveisEquipamento.Parametros.camera_ervas_id.FirstOrDefault();
if (string.IsNullOrWhiteSpace(mxId))
return;
string cameraJson = RedisService.Get(RedisService.CamKey(mxId));
if (string.IsNullOrWhiteSpace(cameraJson))
return;
JObject root = JObject.Parse(cameraJson);
JToken imuToken = root["imu"];
if (imuToken == null ||
imuToken.Type == JTokenType.Null)
return;
var imu = imuToken.ToObject<OAKImuModel>();
if (imu != null)
DadosLeitura.Imu = imu;
}
catch
{
// Mantém a última leitura válida.
}
}
public static void ReiniciarLeituraAnalise()
{
RedisService.AtualizarCampos(