acrescentado movimento diagonal

This commit is contained in:
Diego Freitas 2025-10-02 12:49:43 -03:00
parent 5ad682f7fe
commit 46cb1497dc
57 changed files with 628 additions and 339 deletions

Binary file not shown.

View File

@ -100,20 +100,20 @@
this.tabDirecional = new System.Windows.Forms.TabPage();
this.txtDIR_Status_DT = new System.Windows.Forms.TextBox();
this.label126 = new System.Windows.Forms.Label();
this.txtDIR_AgPot_DT = new System.Windows.Forms.TextBox();
this.lblDIR_AgPot_DT = new System.Windows.Forms.Label();
this.txtDIR_Folga_DT = new System.Windows.Forms.TextBox();
this.lblDIR_Folga_DT = new System.Windows.Forms.Label();
this.txtDIR_Status_ET = new System.Windows.Forms.TextBox();
this.label124 = new System.Windows.Forms.Label();
this.txtDIR_AgPot_ET = new System.Windows.Forms.TextBox();
this.lblDIR_AgPot_ET = new System.Windows.Forms.Label();
this.txtDIR_Folga_ET = new System.Windows.Forms.TextBox();
this.lblDIR_Folga_ET = new System.Windows.Forms.Label();
this.txtDIR_Status_DF = new System.Windows.Forms.TextBox();
this.label122 = new System.Windows.Forms.Label();
this.txtDIR_AgPot_DF = new System.Windows.Forms.TextBox();
this.lblDIR_AgPot_DF = new System.Windows.Forms.Label();
this.txtDIR_Folga_DF = new System.Windows.Forms.TextBox();
this.lblDIR_Folga_DF = new System.Windows.Forms.Label();
this.txtDIR_Status_EF = new System.Windows.Forms.TextBox();
this.label78 = new System.Windows.Forms.Label();
this.txtDIR_AgPot_EF = new System.Windows.Forms.TextBox();
this.lblDIR_AgPot_EF = new System.Windows.Forms.Label();
this.txtDIR_Folga_EF = new System.Windows.Forms.TextBox();
this.lblDIR_Folga_EF = new System.Windows.Forms.Label();
this.txtDIR_Controlar_ET = new System.Windows.Forms.TextBox();
this.label39 = new System.Windows.Forms.Label();
this.txtDIR_Velocidade_ET = new System.Windows.Forms.TextBox();
@ -383,6 +383,18 @@
this.txtSonarDistanciaObstaculo = new System.Windows.Forms.TextBox();
this.label97 = new System.Windows.Forms.Label();
this.tabSegmentacao = new System.Windows.Forms.TabPage();
this.txtTempoManobrando = new System.Windows.Forms.TextBox();
this.label142 = new System.Windows.Forms.Label();
this.txtTempoDirecionando = new System.Windows.Forms.TextBox();
this.label143 = new System.Windows.Forms.Label();
this.txtTempoParado = new System.Windows.Forms.TextBox();
this.label144 = new System.Windows.Forms.Label();
this.txtTempoSaindoRua = new System.Windows.Forms.TextBox();
this.label139 = new System.Windows.Forms.Label();
this.txtTempoCaminhandoRua = new System.Windows.Forms.TextBox();
this.label140 = new System.Windows.Forms.Label();
this.txtTempoEntrandoRua = new System.Windows.Forms.TextBox();
this.label141 = new System.Windows.Forms.Label();
this.chbDesenharCorredor = new System.Windows.Forms.CheckBox();
this.txtCamCaminhoStatusCarro = new System.Windows.Forms.TextBox();
this.label103 = new System.Windows.Forms.Label();
@ -446,6 +458,8 @@
this.dtComandosDir = new System.Windows.Forms.DataGridView();
this.label100 = new System.Windows.Forms.Label();
this.dtComandosMov = new System.Windows.Forms.DataGridView();
this.tabMPC = new System.Windows.Forms.TabPage();
this.tvwMPC = new System.Windows.Forms.TreeView();
this.panel6 = new System.Windows.Forms.Panel();
this.pnlInformacoesOperacao = new System.Windows.Forms.Panel();
this.label134 = new System.Windows.Forms.Label();
@ -507,8 +521,6 @@
this.label36 = new System.Windows.Forms.Label();
this.txtMomento = new System.Windows.Forms.TextBox();
this.btnPlay = new System.Windows.Forms.Button();
this.tabMPC = new System.Windows.Forms.TabPage();
this.tvwMPC = new System.Windows.Forms.TreeView();
((System.ComponentModel.ISupportInitialize)(this.trbMomento)).BeginInit();
this.panel1.SuspendLayout();
this.tabControl4.SuspendLayout();
@ -580,10 +592,10 @@
((System.ComponentModel.ISupportInitialize)(this.dtComandosAtu)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dtComandosDir)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dtComandosMov)).BeginInit();
this.tabMPC.SuspendLayout();
this.panel6.SuspendLayout();
this.pnlInformacoesOperacao.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picCameraCaminho)).BeginInit();
this.tabMPC.SuspendLayout();
this.SuspendLayout();
//
// trbMomento
@ -1076,20 +1088,20 @@
//
this.tabDirecional.Controls.Add(this.txtDIR_Status_DT);
this.tabDirecional.Controls.Add(this.label126);
this.tabDirecional.Controls.Add(this.txtDIR_AgPot_DT);
this.tabDirecional.Controls.Add(this.lblDIR_AgPot_DT);
this.tabDirecional.Controls.Add(this.txtDIR_Folga_DT);
this.tabDirecional.Controls.Add(this.lblDIR_Folga_DT);
this.tabDirecional.Controls.Add(this.txtDIR_Status_ET);
this.tabDirecional.Controls.Add(this.label124);
this.tabDirecional.Controls.Add(this.txtDIR_AgPot_ET);
this.tabDirecional.Controls.Add(this.lblDIR_AgPot_ET);
this.tabDirecional.Controls.Add(this.txtDIR_Folga_ET);
this.tabDirecional.Controls.Add(this.lblDIR_Folga_ET);
this.tabDirecional.Controls.Add(this.txtDIR_Status_DF);
this.tabDirecional.Controls.Add(this.label122);
this.tabDirecional.Controls.Add(this.txtDIR_AgPot_DF);
this.tabDirecional.Controls.Add(this.lblDIR_AgPot_DF);
this.tabDirecional.Controls.Add(this.txtDIR_Folga_DF);
this.tabDirecional.Controls.Add(this.lblDIR_Folga_DF);
this.tabDirecional.Controls.Add(this.txtDIR_Status_EF);
this.tabDirecional.Controls.Add(this.label78);
this.tabDirecional.Controls.Add(this.txtDIR_AgPot_EF);
this.tabDirecional.Controls.Add(this.lblDIR_AgPot_EF);
this.tabDirecional.Controls.Add(this.txtDIR_Folga_EF);
this.tabDirecional.Controls.Add(this.lblDIR_Folga_EF);
this.tabDirecional.Controls.Add(this.txtDIR_Controlar_ET);
this.tabDirecional.Controls.Add(this.label39);
this.tabDirecional.Controls.Add(this.txtDIR_Velocidade_ET);
@ -1175,25 +1187,25 @@
this.label126.TabIndex = 209;
this.label126.Text = "Status";
//
// txtDIR_AgPot_DT
// txtDIR_Folga_DT
//
this.txtDIR_AgPot_DT.Location = new System.Drawing.Point(438, 466);
this.txtDIR_AgPot_DT.Margin = new System.Windows.Forms.Padding(2);
this.txtDIR_AgPot_DT.Name = "txtDIR_AgPot_DT";
this.txtDIR_AgPot_DT.ReadOnly = true;
this.txtDIR_AgPot_DT.Size = new System.Drawing.Size(54, 20);
this.txtDIR_AgPot_DT.TabIndex = 208;
this.txtDIR_AgPot_DT.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtDIR_Folga_DT.Location = new System.Drawing.Point(438, 466);
this.txtDIR_Folga_DT.Margin = new System.Windows.Forms.Padding(2);
this.txtDIR_Folga_DT.Name = "txtDIR_Folga_DT";
this.txtDIR_Folga_DT.ReadOnly = true;
this.txtDIR_Folga_DT.Size = new System.Drawing.Size(54, 20);
this.txtDIR_Folga_DT.TabIndex = 208;
this.txtDIR_Folga_DT.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblDIR_AgPot_DT
// lblDIR_Folga_DT
//
this.lblDIR_AgPot_DT.AutoSize = true;
this.lblDIR_AgPot_DT.Location = new System.Drawing.Point(436, 450);
this.lblDIR_AgPot_DT.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDIR_AgPot_DT.Name = "lblDIR_AgPot_DT";
this.lblDIR_AgPot_DT.Size = new System.Drawing.Size(39, 13);
this.lblDIR_AgPot_DT.TabIndex = 207;
this.lblDIR_AgPot_DT.Text = "Ag Pot";
this.lblDIR_Folga_DT.AutoSize = true;
this.lblDIR_Folga_DT.Location = new System.Drawing.Point(436, 450);
this.lblDIR_Folga_DT.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDIR_Folga_DT.Name = "lblDIR_Folga_DT";
this.lblDIR_Folga_DT.Size = new System.Drawing.Size(33, 13);
this.lblDIR_Folga_DT.TabIndex = 207;
this.lblDIR_Folga_DT.Text = "Folga";
//
// txtDIR_Status_ET
//
@ -1215,25 +1227,25 @@
this.label124.TabIndex = 205;
this.label124.Text = "Status";
//
// txtDIR_AgPot_ET
// txtDIR_Folga_ET
//
this.txtDIR_AgPot_ET.Location = new System.Drawing.Point(180, 466);
this.txtDIR_AgPot_ET.Margin = new System.Windows.Forms.Padding(2);
this.txtDIR_AgPot_ET.Name = "txtDIR_AgPot_ET";
this.txtDIR_AgPot_ET.ReadOnly = true;
this.txtDIR_AgPot_ET.Size = new System.Drawing.Size(54, 20);
this.txtDIR_AgPot_ET.TabIndex = 204;
this.txtDIR_AgPot_ET.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtDIR_Folga_ET.Location = new System.Drawing.Point(180, 466);
this.txtDIR_Folga_ET.Margin = new System.Windows.Forms.Padding(2);
this.txtDIR_Folga_ET.Name = "txtDIR_Folga_ET";
this.txtDIR_Folga_ET.ReadOnly = true;
this.txtDIR_Folga_ET.Size = new System.Drawing.Size(54, 20);
this.txtDIR_Folga_ET.TabIndex = 204;
this.txtDIR_Folga_ET.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblDIR_AgPot_ET
// lblDIR_Folga_ET
//
this.lblDIR_AgPot_ET.AutoSize = true;
this.lblDIR_AgPot_ET.Location = new System.Drawing.Point(178, 450);
this.lblDIR_AgPot_ET.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDIR_AgPot_ET.Name = "lblDIR_AgPot_ET";
this.lblDIR_AgPot_ET.Size = new System.Drawing.Size(39, 13);
this.lblDIR_AgPot_ET.TabIndex = 203;
this.lblDIR_AgPot_ET.Text = "Ag Pot";
this.lblDIR_Folga_ET.AutoSize = true;
this.lblDIR_Folga_ET.Location = new System.Drawing.Point(178, 450);
this.lblDIR_Folga_ET.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDIR_Folga_ET.Name = "lblDIR_Folga_ET";
this.lblDIR_Folga_ET.Size = new System.Drawing.Size(33, 13);
this.lblDIR_Folga_ET.TabIndex = 203;
this.lblDIR_Folga_ET.Text = "Folga";
//
// txtDIR_Status_DF
//
@ -1255,25 +1267,25 @@
this.label122.TabIndex = 201;
this.label122.Text = "Status";
//
// txtDIR_AgPot_DF
// txtDIR_Folga_DF
//
this.txtDIR_AgPot_DF.Location = new System.Drawing.Point(438, 206);
this.txtDIR_AgPot_DF.Margin = new System.Windows.Forms.Padding(2);
this.txtDIR_AgPot_DF.Name = "txtDIR_AgPot_DF";
this.txtDIR_AgPot_DF.ReadOnly = true;
this.txtDIR_AgPot_DF.Size = new System.Drawing.Size(54, 20);
this.txtDIR_AgPot_DF.TabIndex = 200;
this.txtDIR_AgPot_DF.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtDIR_Folga_DF.Location = new System.Drawing.Point(438, 206);
this.txtDIR_Folga_DF.Margin = new System.Windows.Forms.Padding(2);
this.txtDIR_Folga_DF.Name = "txtDIR_Folga_DF";
this.txtDIR_Folga_DF.ReadOnly = true;
this.txtDIR_Folga_DF.Size = new System.Drawing.Size(54, 20);
this.txtDIR_Folga_DF.TabIndex = 200;
this.txtDIR_Folga_DF.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblDIR_AgPot_DF
// lblDIR_Folga_DF
//
this.lblDIR_AgPot_DF.AutoSize = true;
this.lblDIR_AgPot_DF.Location = new System.Drawing.Point(436, 190);
this.lblDIR_AgPot_DF.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDIR_AgPot_DF.Name = "lblDIR_AgPot_DF";
this.lblDIR_AgPot_DF.Size = new System.Drawing.Size(39, 13);
this.lblDIR_AgPot_DF.TabIndex = 199;
this.lblDIR_AgPot_DF.Text = "Ag Pot";
this.lblDIR_Folga_DF.AutoSize = true;
this.lblDIR_Folga_DF.Location = new System.Drawing.Point(436, 190);
this.lblDIR_Folga_DF.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDIR_Folga_DF.Name = "lblDIR_Folga_DF";
this.lblDIR_Folga_DF.Size = new System.Drawing.Size(33, 13);
this.lblDIR_Folga_DF.TabIndex = 199;
this.lblDIR_Folga_DF.Text = "Folga";
//
// txtDIR_Status_EF
//
@ -1295,25 +1307,25 @@
this.label78.TabIndex = 197;
this.label78.Text = "Status";
//
// txtDIR_AgPot_EF
// txtDIR_Folga_EF
//
this.txtDIR_AgPot_EF.Location = new System.Drawing.Point(180, 206);
this.txtDIR_AgPot_EF.Margin = new System.Windows.Forms.Padding(2);
this.txtDIR_AgPot_EF.Name = "txtDIR_AgPot_EF";
this.txtDIR_AgPot_EF.ReadOnly = true;
this.txtDIR_AgPot_EF.Size = new System.Drawing.Size(54, 20);
this.txtDIR_AgPot_EF.TabIndex = 196;
this.txtDIR_AgPot_EF.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtDIR_Folga_EF.Location = new System.Drawing.Point(180, 206);
this.txtDIR_Folga_EF.Margin = new System.Windows.Forms.Padding(2);
this.txtDIR_Folga_EF.Name = "txtDIR_Folga_EF";
this.txtDIR_Folga_EF.ReadOnly = true;
this.txtDIR_Folga_EF.Size = new System.Drawing.Size(54, 20);
this.txtDIR_Folga_EF.TabIndex = 196;
this.txtDIR_Folga_EF.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblDIR_AgPot_EF
// lblDIR_Folga_EF
//
this.lblDIR_AgPot_EF.AutoSize = true;
this.lblDIR_AgPot_EF.Location = new System.Drawing.Point(178, 190);
this.lblDIR_AgPot_EF.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDIR_AgPot_EF.Name = "lblDIR_AgPot_EF";
this.lblDIR_AgPot_EF.Size = new System.Drawing.Size(39, 13);
this.lblDIR_AgPot_EF.TabIndex = 195;
this.lblDIR_AgPot_EF.Text = "Ag Pot";
this.lblDIR_Folga_EF.AutoSize = true;
this.lblDIR_Folga_EF.Location = new System.Drawing.Point(178, 190);
this.lblDIR_Folga_EF.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDIR_Folga_EF.Name = "lblDIR_Folga_EF";
this.lblDIR_Folga_EF.Size = new System.Drawing.Size(33, 13);
this.lblDIR_Folga_EF.TabIndex = 195;
this.lblDIR_Folga_EF.Text = "Folga";
//
// txtDIR_Controlar_ET
//
@ -4262,6 +4274,18 @@
//
// tabSegmentacao
//
this.tabSegmentacao.Controls.Add(this.txtTempoManobrando);
this.tabSegmentacao.Controls.Add(this.label142);
this.tabSegmentacao.Controls.Add(this.txtTempoDirecionando);
this.tabSegmentacao.Controls.Add(this.label143);
this.tabSegmentacao.Controls.Add(this.txtTempoParado);
this.tabSegmentacao.Controls.Add(this.label144);
this.tabSegmentacao.Controls.Add(this.txtTempoSaindoRua);
this.tabSegmentacao.Controls.Add(this.label139);
this.tabSegmentacao.Controls.Add(this.txtTempoCaminhandoRua);
this.tabSegmentacao.Controls.Add(this.label140);
this.tabSegmentacao.Controls.Add(this.txtTempoEntrandoRua);
this.tabSegmentacao.Controls.Add(this.label141);
this.tabSegmentacao.Controls.Add(this.chbDesenharCorredor);
this.tabSegmentacao.Controls.Add(this.txtCamCaminhoStatusCarro);
this.tabSegmentacao.Controls.Add(this.label103);
@ -4278,6 +4302,126 @@
this.tabSegmentacao.Text = "Segmentação";
this.tabSegmentacao.UseVisualStyleBackColor = true;
//
// txtTempoManobrando
//
this.txtTempoManobrando.Location = new System.Drawing.Point(253, 498);
this.txtTempoManobrando.Margin = new System.Windows.Forms.Padding(2);
this.txtTempoManobrando.Name = "txtTempoManobrando";
this.txtTempoManobrando.ReadOnly = true;
this.txtTempoManobrando.Size = new System.Drawing.Size(101, 20);
this.txtTempoManobrando.TabIndex = 59;
this.txtTempoManobrando.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label142
//
this.label142.AutoSize = true;
this.label142.Location = new System.Drawing.Point(250, 482);
this.label142.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label142.Name = "label142";
this.label142.Size = new System.Drawing.Size(103, 13);
this.label142.TabIndex = 58;
this.label142.Text = "Tempo Manobrando";
//
// txtTempoDirecionando
//
this.txtTempoDirecionando.Location = new System.Drawing.Point(253, 460);
this.txtTempoDirecionando.Margin = new System.Windows.Forms.Padding(2);
this.txtTempoDirecionando.Name = "txtTempoDirecionando";
this.txtTempoDirecionando.ReadOnly = true;
this.txtTempoDirecionando.Size = new System.Drawing.Size(101, 20);
this.txtTempoDirecionando.TabIndex = 57;
this.txtTempoDirecionando.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label143
//
this.label143.AutoSize = true;
this.label143.Location = new System.Drawing.Point(250, 444);
this.label143.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label143.Name = "label143";
this.label143.Size = new System.Drawing.Size(106, 13);
this.label143.TabIndex = 56;
this.label143.Text = "Tempo Direcionando";
//
// txtTempoParado
//
this.txtTempoParado.Location = new System.Drawing.Point(253, 422);
this.txtTempoParado.Margin = new System.Windows.Forms.Padding(2);
this.txtTempoParado.Name = "txtTempoParado";
this.txtTempoParado.ReadOnly = true;
this.txtTempoParado.Size = new System.Drawing.Size(101, 20);
this.txtTempoParado.TabIndex = 55;
this.txtTempoParado.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label144
//
this.label144.AutoSize = true;
this.label144.Location = new System.Drawing.Point(250, 406);
this.label144.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label144.Name = "label144";
this.label144.Size = new System.Drawing.Size(77, 13);
this.label144.TabIndex = 54;
this.label144.Text = "Tempo Parado";
//
// txtTempoSaindoRua
//
this.txtTempoSaindoRua.Location = new System.Drawing.Point(126, 497);
this.txtTempoSaindoRua.Margin = new System.Windows.Forms.Padding(2);
this.txtTempoSaindoRua.Name = "txtTempoSaindoRua";
this.txtTempoSaindoRua.ReadOnly = true;
this.txtTempoSaindoRua.Size = new System.Drawing.Size(101, 20);
this.txtTempoSaindoRua.TabIndex = 53;
this.txtTempoSaindoRua.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label139
//
this.label139.AutoSize = true;
this.label139.Location = new System.Drawing.Point(123, 481);
this.label139.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label139.Name = "label139";
this.label139.Size = new System.Drawing.Size(93, 13);
this.label139.TabIndex = 52;
this.label139.Text = "TempoSaindoRua";
//
// txtTempoCaminhandoRua
//
this.txtTempoCaminhandoRua.Location = new System.Drawing.Point(126, 459);
this.txtTempoCaminhandoRua.Margin = new System.Windows.Forms.Padding(2);
this.txtTempoCaminhandoRua.Name = "txtTempoCaminhandoRua";
this.txtTempoCaminhandoRua.ReadOnly = true;
this.txtTempoCaminhandoRua.Size = new System.Drawing.Size(101, 20);
this.txtTempoCaminhandoRua.TabIndex = 51;
this.txtTempoCaminhandoRua.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label140
//
this.label140.AutoSize = true;
this.label140.Location = new System.Drawing.Point(123, 443);
this.label140.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label140.Name = "label140";
this.label140.Size = new System.Drawing.Size(122, 13);
this.label140.TabIndex = 50;
this.label140.Text = "Tempo CaminhandoRua";
//
// txtTempoEntrandoRua
//
this.txtTempoEntrandoRua.Location = new System.Drawing.Point(126, 421);
this.txtTempoEntrandoRua.Margin = new System.Windows.Forms.Padding(2);
this.txtTempoEntrandoRua.Name = "txtTempoEntrandoRua";
this.txtTempoEntrandoRua.ReadOnly = true;
this.txtTempoEntrandoRua.Size = new System.Drawing.Size(101, 20);
this.txtTempoEntrandoRua.TabIndex = 49;
this.txtTempoEntrandoRua.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label141
//
this.label141.AutoSize = true;
this.label141.Location = new System.Drawing.Point(123, 405);
this.label141.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label141.Name = "label141";
this.label141.Size = new System.Drawing.Size(106, 13);
this.label141.TabIndex = 48;
this.label141.Text = "Tempo EntrandoRua";
//
// chbDesenharCorredor
//
this.chbDesenharCorredor.AutoSize = true;
@ -4970,6 +5114,25 @@
this.dtComandosMov.Size = new System.Drawing.Size(465, 150);
this.dtComandosMov.TabIndex = 0;
//
// tabMPC
//
this.tabMPC.Controls.Add(this.tvwMPC);
this.tabMPC.Location = new System.Drawing.Point(4, 22);
this.tabMPC.Name = "tabMPC";
this.tabMPC.Padding = new System.Windows.Forms.Padding(3);
this.tabMPC.Size = new System.Drawing.Size(496, 522);
this.tabMPC.TabIndex = 13;
this.tabMPC.Text = "MPC";
this.tabMPC.UseVisualStyleBackColor = true;
//
// tvwMPC
//
this.tvwMPC.Dock = System.Windows.Forms.DockStyle.Fill;
this.tvwMPC.Location = new System.Drawing.Point(3, 3);
this.tvwMPC.Name = "tvwMPC";
this.tvwMPC.Size = new System.Drawing.Size(490, 516);
this.tvwMPC.TabIndex = 0;
//
// panel6
//
this.panel6.Controls.Add(this.pnlInformacoesOperacao);
@ -5623,25 +5786,6 @@
this.btnPlay.UseVisualStyleBackColor = true;
this.btnPlay.Click += new System.EventHandler(this.btnPlay_Click);
//
// tabMPC
//
this.tabMPC.Controls.Add(this.tvwMPC);
this.tabMPC.Location = new System.Drawing.Point(4, 22);
this.tabMPC.Name = "tabMPC";
this.tabMPC.Padding = new System.Windows.Forms.Padding(3);
this.tabMPC.Size = new System.Drawing.Size(496, 522);
this.tabMPC.TabIndex = 13;
this.tabMPC.Text = "MPC";
this.tabMPC.UseVisualStyleBackColor = true;
//
// tvwMPC
//
this.tvwMPC.Dock = System.Windows.Forms.DockStyle.Fill;
this.tvwMPC.Location = new System.Drawing.Point(3, 3);
this.tvwMPC.Name = "tvwMPC";
this.tvwMPC.Size = new System.Drawing.Size(490, 516);
this.tvwMPC.TabIndex = 0;
//
// frmResultadosOperacao
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -5763,11 +5907,11 @@
((System.ComponentModel.ISupportInitialize)(this.dtComandosAtu)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dtComandosDir)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dtComandosMov)).EndInit();
this.tabMPC.ResumeLayout(false);
this.panel6.ResumeLayout(false);
this.pnlInformacoesOperacao.ResumeLayout(false);
this.pnlInformacoesOperacao.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picCameraCaminho)).EndInit();
this.tabMPC.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@ -6159,20 +6303,20 @@
private System.Windows.Forms.Label label72;
private System.Windows.Forms.TextBox txtDIR_Status_DF;
private System.Windows.Forms.Label label122;
private System.Windows.Forms.TextBox txtDIR_AgPot_DF;
private System.Windows.Forms.Label lblDIR_AgPot_DF;
private System.Windows.Forms.TextBox txtDIR_Folga_DF;
private System.Windows.Forms.Label lblDIR_Folga_DF;
private System.Windows.Forms.TextBox txtDIR_Status_EF;
private System.Windows.Forms.Label label78;
private System.Windows.Forms.TextBox txtDIR_AgPot_EF;
private System.Windows.Forms.Label lblDIR_AgPot_EF;
private System.Windows.Forms.TextBox txtDIR_Folga_EF;
private System.Windows.Forms.Label lblDIR_Folga_EF;
private System.Windows.Forms.TextBox txtDIR_Status_DT;
private System.Windows.Forms.Label label126;
private System.Windows.Forms.TextBox txtDIR_AgPot_DT;
private System.Windows.Forms.Label lblDIR_AgPot_DT;
private System.Windows.Forms.TextBox txtDIR_Folga_DT;
private System.Windows.Forms.Label lblDIR_Folga_DT;
private System.Windows.Forms.TextBox txtDIR_Status_ET;
private System.Windows.Forms.Label label124;
private System.Windows.Forms.TextBox txtDIR_AgPot_ET;
private System.Windows.Forms.Label lblDIR_AgPot_ET;
private System.Windows.Forms.TextBox txtDIR_Folga_ET;
private System.Windows.Forms.Label lblDIR_Folga_ET;
private System.Windows.Forms.FlowLayoutPanel flwCameras;
private System.Windows.Forms.TabPage tabCameras;
private System.Windows.Forms.GroupBox gpbCameras_Analise;
@ -6231,5 +6375,17 @@
private System.Windows.Forms.DataGridView dtComandosAtu;
private System.Windows.Forms.TabPage tabMPC;
private System.Windows.Forms.TreeView tvwMPC;
private System.Windows.Forms.TextBox txtTempoManobrando;
private System.Windows.Forms.Label label142;
private System.Windows.Forms.TextBox txtTempoDirecionando;
private System.Windows.Forms.Label label143;
private System.Windows.Forms.TextBox txtTempoParado;
private System.Windows.Forms.Label label144;
private System.Windows.Forms.TextBox txtTempoSaindoRua;
private System.Windows.Forms.Label label139;
private System.Windows.Forms.TextBox txtTempoCaminhandoRua;
private System.Windows.Forms.Label label140;
private System.Windows.Forms.TextBox txtTempoEntrandoRua;
private System.Windows.Forms.Label label141;
}
}

View File

@ -1287,6 +1287,8 @@ namespace AgroBase.Forms.Operacoes
txtSentido.Text = (Log?.Sentido ?? Enums.Sentido.Parado).ToString();
TextBox txtVelocidade = FuncoesGlobais.FindControlRecursive<TextBox>(tabDirecional, "txtDIR_Velocidade_" + ID);
txtVelocidade.Text = (Log?.Velocidade ?? 0).ToString();
TextBox txtFolga = FuncoesGlobais.FindControlRecursive<TextBox>(tabDirecional, "txtDIR_Folga_" + ID);
txtFolga.Text = (Log?.FolgaMecanica ?? 0).ToString();
TextBox txtControlar = FuncoesGlobais.FindControlRecursive<TextBox>(tabDirecional, "txtDIR_Controlar_" + ID);
txtControlar.Text = (Log?.Controlar ?? false) ? "Sim" : "Não";
TextBox txtStatus = FuncoesGlobais.FindControlRecursive<TextBox>(tabDirecional, "txtDIR_Status_" + ID);
@ -1528,6 +1530,13 @@ namespace AgroBase.Forms.Operacoes
txtCamCaminhoErroLateral.Text = (Log.OperadorVisual?.Analises?.segmentacao?.erro_lateral_pct ?? 0).ToString("0.00");
txtCamCaminhoStatusCarro.Text = (Log.OperadorVisual?.Analises?.segmentacao?.status_corredor ?? Enums.StatusCarroMapa.Parado).ToString();
txtTempoEntrandoRua.Text = Log.Trajetoria.CorredorAtual.TempoPorStatus.FirstOrDefault(x => x.Key == Enums.StatusCarroMapa.EntrandoRua).Value.ToString("0.00") + " s";
txtTempoCaminhandoRua.Text = Log.Trajetoria.CorredorAtual.TempoPorStatus.FirstOrDefault(x => x.Key == Enums.StatusCarroMapa.CaminhandoRua).Value.ToString("0.00") + " s";
txtTempoSaindoRua.Text = Log.Trajetoria.CorredorAtual.TempoPorStatus.FirstOrDefault(x => x.Key == Enums.StatusCarroMapa.SaindoRua).Value.ToString("0.00") + " s";
txtTempoParado.Text = Log.Trajetoria.CorredorAtual.TempoPorStatus.FirstOrDefault(x => x.Key == Enums.StatusCarroMapa.Parado).Value.ToString("0.00") + " s";
txtTempoDirecionando.Text = Log.Trajetoria.CorredorAtual.TempoPorStatus.FirstOrDefault(x => x.Key == Enums.StatusCarroMapa.Direcionando).Value.ToString("0.00") + " s";
txtTempoManobrando.Text = Log.Trajetoria.CorredorAtual.TempoPorStatus.FirstOrDefault(x => x.Key == Enums.StatusCarroMapa.Manobrando).Value.ToString("0.00") + " s";
pnlCaminho.BackgroundImage = CarregarImagemCamera(pathImagensCaminho, "_segmentacao");
pnlCaminho.BackgroundImageLayout = ImageLayout.Zoom;
pnlCaminho.Invalidate();
@ -1635,7 +1644,7 @@ namespace AgroBase.Forms.Operacoes
var errs = angNode.Nodes.Add("Erros");
errs.Nodes.Add($"Posição={m.erro_posicao:0.00000} Normalizado={m.erro_posicao_n:0.00000}");
errs.Nodes.Add($"Orientação={m.erro_orientacao:0.00000} Normalizado={m.erro_orientacao_n:0.00000}");
errs.Nodes.Add($"Suavização={m.erro_orientacao:0.00000}");
errs.Nodes.Add($"Suavização={m.erro_suavizacao:0.00000}");
errs.Nodes.Add($"Ré={m.erro_re:0.00000}");
errs.Nodes.Add($"Lateral={m.erro_lateral:0.00000} Normalizado={m.erro_lateral_n:0.00000}");

View File

@ -183,6 +183,8 @@ namespace AgroBase
}
catch
{
EnviaComandoMotor(Keys.Escape, T_Code.Mov, true);
EnviaComandoMotor(Keys.Escape, T_Code.Dir, true);
AtualizaDispositivo();
return;
}

View File

@ -179,13 +179,11 @@ namespace AgroBase.Models
// 1) centro em pixels (seu “centro de giro” no painel)
PointF pCtr = LatLonToPanel(_posicaoAtual.Latitude, _posicaoAtual.Longitude, centerX, centerY);
// 2) antenas (corrigida e bruta)
double latCorr = _posicaoAtual.Latitude; // já com lever arm aplicado
double lonCorr = _posicaoAtual.Longitude;
double latBrut = _posicaoAtual.LatitudeAnt; // GNGGA bruto
double lonBrut = _posicaoAtual.LongitudeAnt;
AntenaDiagPx diag = DrawRobotAndAntennaDiagnostics(
g,
pCtr.X, pCtr.Y,
@ -195,7 +193,6 @@ namespace AgroBase.Models
latBrut, lonBrut,
Color.ForestGreen
);
// Se quiser logar os offsets em px:
var offPrev_vs_Corr = new PointF(diag.Corrigida.X - diag.Prevista.X, diag.Corrigida.Y - diag.Prevista.Y);
var offPrev_vs_Brut = new PointF(diag.Bruta.X - diag.Prevista.X, diag.Bruta.Y - diag.Prevista.Y);
@ -240,8 +237,11 @@ namespace AgroBase.Models
{
var trajPoint = trajectory[i];
// Calcule a posição no panel
float x = centerX + (float)((trajPoint.Posicao.Longitude - _posicaoAtual.Longitude) * _zoom);
float y = centerY - (float)((trajPoint.Posicao.Latitude - _posicaoAtual.Latitude) * _zoom);
//float x = centerX + (float)((trajPoint.Posicao.Longitude - _posicaoAtual.Longitude) * _zoom);
//float y = centerY - (float)((trajPoint.Posicao.Latitude - _posicaoAtual.Latitude) * _zoom);
PointF p = LatLonToPanel(trajPoint.Posicao.Latitude, trajPoint.Posicao.Longitude, centerX, centerY);
float x = p.X;
float y = p.Y;
if (drawMargin && trajPoint.Tipo != Enums.TipoPontoRua.Indefinido)
{
@ -272,8 +272,11 @@ namespace AgroBase.Models
if (i > 0)
{
var prevPoint = trajectory[i - 1];
float prevX = centerX + (float)((prevPoint.Posicao.Longitude - _posicaoAtual.Longitude) * _zoom);
float prevY = centerY - (float)((prevPoint.Posicao.Latitude - _posicaoAtual.Latitude) * _zoom);
//float prevX = centerX + (float)((prevPoint.Posicao.Longitude - _posicaoAtual.Longitude) * _zoom);
//float prevY = centerY - (float)((prevPoint.Posicao.Latitude - _posicaoAtual.Latitude) * _zoom);
PointF pv = LatLonToPanel(prevPoint.Posicao.Latitude, prevPoint.Posicao.Longitude, centerX, centerY);
float prevX = pv.X;
float prevY = pv.Y;
g.DrawLine(linePen, prevX, prevY, x, y);
}
@ -616,6 +619,9 @@ namespace AgroBase.Models
private PointF LatLonToPanel(double lat, double lon, float centerX, float centerY)
{
float x = centerX + (float)((lon - _posicaoAtual.Lon0) * _zoom);
float y = centerY - (float)((lat - _posicaoAtual.Lat0) * _zoom);
// Usa a mesma origem ENU do GeoLeverArm
var (xE, yN) = GeoLeverArm.GeodeticToENU(lat, lon, _posicaoAtual.Lat0, _posicaoAtual.Lon0);
float scale = (float)_zoom / 1e7f;
@ -623,7 +629,7 @@ namespace AgroBase.Models
float px = centerX + (float)(xE * scale); // Leste para +X
float py = centerY - (float)(yN * scale); // Norte para -Y (tela cresce para baixo)
return new PointF(px, py);
return new PointF(x, y);
}
}

View File

@ -299,7 +299,7 @@ namespace AgroBase.Models.Modules
}
else
{
Angulo_SP = _Controle.Angulo;
Angulo_SP = _Controle.Angulo + (FolgaMecanica / 2.0);
}
if (Comandar)
@ -375,7 +375,7 @@ namespace AgroBase.Models.Modules
_sentido = _sentido == Sentido.Horario ? Sentido.Antihorario : Sentido.Horario;
Console.WriteLine($"[DIR {Mod_ID}] - Invertendo Sentido de Giro para {_sentido.ToString()}");
_anguloSP = CalcularCentroCompensado(AnguloEntrada, AnguloSaida, FolgaMecanica, _sentido);
_anguloSP = CalcularCentroCompensado(AnguloEntrada, AnguloSaida, _sentido);
}
verificacoesAngulo++;
@ -405,23 +405,26 @@ namespace AgroBase.Models.Modules
return VelocidadeGiro;
}
private double CalcularCentroCompensado(double entrada, double saida, double folga, Sentido sentido)
private double CalcularCentroCompensado(double entrada, double saida, Sentido sentido)
{
double centro = (entrada + saida) / 2.0;
double folga = Math.Abs(entrada - saida);
// Determina o sentido do giro baseado na diferença
double direcao = sentido == Sentido.Horario ? -1 : 1;
double compensacao = (folga / 2.0) * direcao;
double compensacao = 0; // (folga / 2.0) * direcao;
double centroCompensado = centro + compensacao;
Console.WriteLine($"[DIR {Mod_ID}] - Folga: {FolgaMecanica}, Entrada: {entrada}, Saida: {saida}, Centro: {centro}, Compensacao: {compensacao}, Centro Compensado: {centroCompensado}");
Console.WriteLine($"[DIR {Mod_ID}] - Folga: {folga}, Entrada: {entrada}, Saida: {saida}, Centro: {centro}, Compensacao: {compensacao}, Centro Compensado: {centroCompensado}");
FolgaMecanica = folga;
return centroCompensado;
}
private async Task SetZero()
public async Task SetZero()
{
MKS057DCanService.SetZero(_EnderecoCAN_Tx, _EnderecoCAN_Rx);
@ -431,7 +434,7 @@ namespace AgroBase.Models.Modules
bool NovoDado() => MKS057DCanService.DadosLeitura.Any(x => x.EnderecoRx == _EnderecoCAN_Rx && x.UltimoComandoRecebido > Inicio);
await FuncoesGlobais.AguardarCondicaoAsync(NovoDado, 500, 100);
if (FuncoesMatematicas.ValorEstaEntre(Angulo, 0, 1))
if (FuncoesMatematicas.ValorEstaEntre(Angulo, -1, 1))
{
Console.WriteLine($"[DIR {Mod_ID}] - Set Zero");
break;

View File

@ -325,21 +325,27 @@ namespace AgroBase.Models
new OperacaoControleTipoModel()
{
Tipo = T_Code.Mov,
DelayEnvioComandoBase = 10,
DelayEnvioComando = 10,
DelayEnvioComandoExtra = 0,
Comandos = new List<string>(),
UltimoComando = DateTime.Now
},
new OperacaoControleTipoModel()
{
Tipo = T_Code.Dir,
DelayEnvioComandoBase = 10,
DelayEnvioComando = 10,
DelayEnvioComandoExtra = 0,
Comandos = new List<string>(),
UltimoComando = DateTime.Now
},
new OperacaoControleTipoModel()
{
Tipo = T_Code.Atu,
DelayEnvioComandoBase = 10,
DelayEnvioComando = 10,
DelayEnvioComandoExtra = 0,
Comandos = new List<string>(),
UltimoComando = DateTime.Now
},
@ -403,21 +409,27 @@ namespace AgroBase.Models
new OperacaoControleTipoModel()
{
Tipo = T_Code.Mov,
DelayEnvioComandoBase = 500,
DelayEnvioComando = 500,
DelayEnvioComandoExtra = 0,
Comandos = new List<string>(),
UltimoComando = DateTime.Now
},
new OperacaoControleTipoModel()
{
Tipo = T_Code.Dir,
DelayEnvioComandoBase = 300,
DelayEnvioComando = 300,
DelayEnvioComandoExtra = 0,
Comandos = new List<string>(),
UltimoComando = DateTime.Now
},
new OperacaoControleTipoModel()
{
Tipo = T_Code.Atu,
DelayEnvioComandoBase = 200,
DelayEnvioComando = 200,
DelayEnvioComandoExtra = 0,
Comandos = new List<string>(),
UltimoComando = DateTime.Now
},
@ -504,21 +516,27 @@ namespace AgroBase.Models
new OperacaoControleTipoModel()
{
Tipo = T_Code.Mov,
DelayEnvioComandoBase = 500,
DelayEnvioComando = 500,
DelayEnvioComandoExtra = 0,
Comandos = new List<string>(),
UltimoComando = DateTime.Now
},
new OperacaoControleTipoModel()
{
Tipo = T_Code.Dir,
DelayEnvioComandoBase = 1000,
DelayEnvioComando = 1000,
DelayEnvioComandoExtra = 0,
Comandos = new List<string>(),
UltimoComando = DateTime.Now
},
new OperacaoControleTipoModel()
{
Tipo = T_Code.Atu,
DelayEnvioComandoBase = 500,
DelayEnvioComando = 500,
DelayEnvioComandoExtra = 0,
Comandos = new List<string>(),
UltimoComando = DateTime.Now
},
@ -607,14 +625,18 @@ namespace AgroBase.Models
new OperacaoControleTipoModel()
{
Tipo = T_Code.Mov,
DelayEnvioComandoBase = 500,
DelayEnvioComando = 500,
DelayEnvioComandoExtra = 0,
Comandos = new List<string>(),
UltimoComando = DateTime.Now
},
new OperacaoControleTipoModel()
{
Tipo = T_Code.Dir,
DelayEnvioComandoBase = 200,
DelayEnvioComando = 200,
DelayEnvioComandoExtra = 0,
Comandos = new List<string>(),
UltimoComando = DateTime.Now
}
@ -952,6 +974,8 @@ namespace AgroBase.Models
{
var Protocolos = EnviarProtocoloComando(Ctrl.Tipo, ForcarEnvio);
Ctrl.UltimoComando = Agora;
Ctrl.DelayEnvioComando = Ctrl.DelayEnvioComandoBase + Ctrl.DelayEnvioComandoExtra;
Ctrl.DelayEnvioComandoExtra = 0;
Ctrl.Comandos.AddRange(Protocolos);
}
}
@ -1228,6 +1252,7 @@ namespace AgroBase.Models
Sentido = Modulo.DirMotor.Sentido,
SentidoReal = Modulo.DirMotor.SentidoReal,
Velocidade = (Modulo.DirMotor.Velocidade / Modulo.DirMotor.Velocidade_Max) * 100.0,
FolgaMecanica = Modulo.DirMotor.FolgaMecanica,
UltimoComandoRespondido = Modulo.DirMotor.Leitura?.UltimoComandoRecebido ?? DateTime.MinValue,
};
SalvarLog(T_Code.Dir.ToString(), logDir, false);
@ -1675,7 +1700,9 @@ namespace AgroBase.Models
public class OperacaoControleTipoModel
{
public T_Code Tipo { get; set; }
public int DelayEnvioComandoBase { get; set; }
public int DelayEnvioComando { get; set; }
public int DelayEnvioComandoExtra { get; set; }
public DateTime UltimoComando { get; set; }
public List<string> Comandos { get; set; }
public Direcao UltimaDirecao { get; set; } = Direcao.Parado;
@ -2151,6 +2178,7 @@ namespace AgroBase.Models
public Sentido Sentido { get; set; }
public Sentido SentidoReal { get; set; }
public double Velocidade { get; set; }
public double FolgaMecanica { get; set; }
public DateTime UltimoComandoRespondido { get; set; }
}

View File

@ -541,6 +541,7 @@ namespace AgroBase.Models.Operadores
public class VisualWorkerMessageSegmentacaoSemanticaModel
{
public double timestamp { get; set; }
public int height { get; set; }
public int width { get; set; }
public double erro_angular { get; set; }
@ -553,6 +554,7 @@ namespace AgroBase.Models.Operadores
{
return new VisualWorkerMessageSegmentacaoSemanticaModel()
{
timestamp = timestamp,
height = height,
width = width,
erro_angular = erro_angular,

View File

@ -7,7 +7,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using static AgroBase.Models.Enums;
using static OpenTK.Graphics.OpenGL.GL;
namespace AgroBase.Models
{
@ -334,7 +333,8 @@ namespace AgroBase.Models
}
else
{
ProximoPonto = _TrajetoriaFixa[PontoAtual.idxPonto + 1];
int idx = _TrajetoriaFixa.IndexOf(PontoAtual) + 1;
ProximoPonto = _TrajetoriaFixa[idx];
}
/*// Busca eficiente: percorre do começo ao fim para achar o primeiro não visitado
@ -630,7 +630,7 @@ namespace AgroBase.Models
{
if (CorredorAtual == null) return;
bool abrirCurva = false;
bool abrirCurva = true;
double limiarDistanciaMargem = 20.0;
double distanciaRestanteCorredor = CorredorAtual.DistanciaRestante;
double distanciaUltimoPontoCorredor = GPSUtils.DistanciaEntrePontos(Variaveis.OperacaoEmAndamento.Sensoriamento.Gps, CorredorAtual.Pontos.LastOrDefault().Posicao);
@ -654,42 +654,31 @@ namespace AgroBase.Models
}
CorredorAtual.UltimoTempoStatus = DateTime.Now;
double TempoTotalContagem = CorredorAtual.TempoPorStatus.Sum(x => x.Value);
double TempoMovimento = CorredorAtual.TempoPorStatus.Where(x => x.Key != StatusCarroMapa.Parado).Sum(x => x.Value);
CorredorAtual.TempoPorStatus.TryGetValue(StatusCarroMapa.CaminhandoRua, out double TempoCaminhandoRua);
CorredorAtual.TempoPorStatus.TryGetValue(StatusCarroMapa.EntrandoRua, out double TempoEntrandoRua);
CorredorAtual.TempoPorStatus.TryGetValue(StatusCarroMapa.SaindoRua, out double TempoSaindoRua);
CorredorAtual.TempoPorStatus.TryGetValue(StatusCarroMapa.Direcionando, out double TempoDirecionando);
double PercentualTempoCaminhandoRua = TempoCaminhandoRua / TempoTotalContagem;
double PercentualTempoDirecionando = TempoDirecionando / TempoTotalContagem;
double TempoDentroRua = TempoEntrandoRua + TempoCaminhandoRua + TempoSaindoRua;
double PercentualTempoComCana = TempoMovimento == 0 ? 0 : TempoDentroRua / TempoMovimento;
double PercentualTempoSemCana = TempoMovimento == 0 ? 0 : TempoDirecionando / TempoMovimento;
double ts_agora = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() / 1000.0;
if (
PercentualTempoCaminhandoRua > 0.4 && // Esteve a pelo menos 40% do tempo do corredor com cana dos dois lados
PercentualTempoDirecionando < 0.5 && // Esteve ate no maximo 50% do tempo fora do corredor
((Variaveis.OperacaoEmAndamento.Simulando ||
(ts_agora - DadosSegmentacao.timestamp < 2.0 && // Ultima analise de segmentacao nos ultimos 2 segundos
PercentualTempoComCana > 0.4 && // Esteve a pelo menos 40% do tempo em movimento com presenca de cana
PercentualTempoSemCana < 0.5))) && // Esteve ate no maximo 50% do tempo em movimento sem presenca de cana)
distanciaRestanteCorredor < limiarDistanciaMargem && // Esta a pelo menos x metros do final do corredor
distanciaUltimoPontoCorredor < limiarDistanciaMargem && // Esta a pelo menos x metros do ultimo ponto do corredor
statusCarro == StatusCarroMapa.Direcionando && // Carro esta fora do corredor
statusCarroAnt != statusCarro
|| (Variaveis.OperacaoEmAndamento.Simulando && distanciaRestanteCorredor < limiarDistanciaMargem && distanciaUltimoPontoCorredor < limiarDistanciaMargem && statusCarro == StatusCarroMapa.Direcionando && statusCarroAnt != statusCarro)
)
{
PontoTrajetoriaModel pontoEntrada = null;
double anguloControle = Variaveis.OperacaoEmAndamento.Controle.Angulo;
if (abrirCurva && !CorredorAtual.Ultimo)
{
double anguloProjetar = GPSUtils.CalcularOrientacao(PontoAtual.Posicao, ProximoPonto.Posicao);
double anguloAcrescentar = CorredorAtual.idxRuaDireita % 2 == 0 && CorredorAtual.Pontos.First().Direcao == DirecaoCarroRua.Ida ? 45 : -45;
anguloProjetar += anguloAcrescentar;
double percentualAcrescimoPontoAberturaCurva = 1.1;
GPSModel posicao = GPSUtils.ProjetarPontoDeslocado(PontoAtual.Posicao, DistanciaProjecaoRua * percentualAcrescimoPontoAberturaCurva, anguloProjetar);
pontoEntrada = new PontoTrajetoriaModel(TipoPontoRua.LigacaoEntrada)
{
Visitado = false,
idxCorredor = CorredorAtual.Idx + 1,
idxPonto = 0,
idxPontoCorredor = 0,
Direcao = PontoAtual.Direcao,
LarguraCorredor = PontoAtual.LarguraCorredor,
Orientacao = PontoAtual.Orientacao,
Posicao = posicao
};
anguloControle = CorredorAtual.idxRuaDireita % 2 == 0 && CorredorAtual.Pontos.First().Direcao == DirecaoCarroRua.Ida ? Variaveis.OperacaoEmAndamento.Controle.Angulo_Max : Variaveis.OperacaoEmAndamento.Controle.Angulo_Min;
}
int pontosMarcar = 0;
@ -713,13 +702,16 @@ namespace AgroBase.Models
AtualizarTrajetoriaJanela();
DefinirPontoAtual();
if (abrirCurva && pontoEntrada != null)
if (abrirCurva)
{
pontoEntrada.idxPonto = PontoAtual.idxPonto + 1;
CorredorAtual.Pontos.Insert(pontosMarcar, pontoEntrada);
_TrajetoriaFixa.Insert(pontoEntrada.idxPonto, pontoEntrada);
DefinirPontoAtual();
DefinirProximoPonto();
Console.WriteLine($"Angulo de controle definido de {Variaveis.OperacaoEmAndamento.Controle.Angulo} para {anguloControle}");
Variaveis.OperacaoEmAndamento.Controle.Angulo = anguloControle;
Variaveis.OperacaoEmAndamento.Controle.PercentualVelocidadeSP = Variaveis.OperacaoEmAndamento.Controle.PercentualVelocidadeMin;
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = TipoMovimentoDirecional.MovimentoArco;
Variaveis.OperacaoEmAndamento.Controle.TiposControle.FirstOrDefault(x => x.Tipo == T_Code.Dir).DelayEnvioComandoExtra = 1500;
Variaveis.OperacaoEmAndamento.Controle.TiposControle.FirstOrDefault(x => x.Tipo == T_Code.Mov).DelayEnvioComandoExtra = 2000;
Variaveis.OperacaoEmAndamento.AtualizarDadosControle(true, new List<T_Code>() { T_Code.Mov, T_Code.Dir });
}
}
}
@ -1499,8 +1491,8 @@ namespace AgroBase.Models
}
}
DistanciaRestante = DistanciaTotal - DistanciaPercorridaTotal;
Progresso = (DistanciaTotal > 0) ? FuncoesMatematicas.Clamp((DistanciaPercorridaTotal / DistanciaTotal) * 100.0, 0, 100) : 0;
DistanciaRestante = DistanciaTotal - DistanciaPercorridaCorredor;
Progresso = (DistanciaTotal > 0) ? FuncoesMatematicas.Clamp((DistanciaPercorridaCorredor / DistanciaTotal) * 100.0, 0, 100) : 0;
Concluido = !Pontos.Any(x => !x.Visitado);
}

View File

@ -372,10 +372,10 @@ namespace AgroBase.Models
if (Math.Abs(tr) < 1e-6) tr = 0;
double kappa = 0; // 1/m
if (tipoMovimento == TipoMovimentoDirecional.RodasDianteiras) kappa = tf / L;
if (tipoMovimento == TipoMovimentoDirecional.RodasDianteiras) kappa = tf / L;
else if (tipoMovimento == TipoMovimentoDirecional.RodasTraseiras) kappa = tr / L;
else if (tipoMovimento == TipoMovimentoDirecional.MovimentoArco) kappa = (tf - tr) / L;
else /*Diagonal*/ kappa = 0;
else if (tipoMovimento == TipoMovimentoDirecional.MovimentoArco) kappa = (tf - tr) / L;
else /*Diagonal,Lateral*/ kappa = 0;
// Correção dinâmica (opcional)
double Ku = 2.5; // ajuste fino em campo
@ -388,7 +388,7 @@ namespace AgroBase.Models
theta += dtheta;
double heading = theta;
if (tipoMovimento == TipoMovimentoDirecional.MovimentoDiagonal)
if (new List<TipoMovimentoDirecional>() { TipoMovimentoDirecional.MovimentoDiagonal, TipoMovimentoDirecional.MovimentoLateral }.Contains(tipoMovimento))
heading = theta + dfDeg * Math.PI / 180.0; // crab: desloca na direção do steering
// >>> mesma convenção do Python: 0=Norte

View File

@ -1706,10 +1706,10 @@ namespace AgroBase.Services
public class GeoLeverArm
{
const double R = 6378137.0; // WGS84
public static double xB = 0.0; // +frente (m)
public static double yB = 0.2; // +direita (m)
public static bool invertHeading = true;
public static bool mirrorLateral = true;
public static double xB = 1.0; // +frente (m)
public static double yB = 0.0; // +direita (m)
public static bool invertHeading = false;
public static bool mirrorLateral = false;
static double ToRad(double deg) => deg * Math.PI / 180.0;
static double ToDeg(double rad) => rad * 180.0 / Math.PI;
@ -1752,8 +1752,6 @@ namespace AgroBase.Services
public static (double lat, double lon) FixLeverArmLatLon_Fast(double latAnt_deg, double lonAnt_deg, double headingDeg)
{
invertHeading = false;
mirrorLateral = false;
if (mirrorLateral) yB = -yB; // espelha lateral (D<->E)
double th = headingDeg * Math.PI / 180.0;
@ -1766,7 +1764,6 @@ namespace AgroBase.Services
double dE = xB * fE + yB * rE; // body -> ENU
double dN = xB * fN + yB * rN;
const double R = 6378137.0;
double latRad = latAnt_deg * Math.PI / 180.0;
double dLat_deg = (dN / R) * 180.0 / Math.PI;
double dLon_deg = (dE / (R * Math.Cos(latRad))) * 180.0 / Math.PI;

View File

@ -265,6 +265,14 @@ namespace AgroBase.Services
return valor * 360.0 / 16384.0;
}
private void VerificarAnguloZero(MKS057DModel item, bool estadoAnterior)
{
if (item.EntradaIN1.valor != estadoAnterior && item.AnguloPulsos > 5)
{
Task.Run(async () => await Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.FirstOrDefault(x => x.DirMotor._EnderecoCAN_Tx == item.EnderecoTx)?.DirMotor?.SetZero());
}
}
private MKS057DModel ObterOuCriar(byte idTx, byte idRx)
{
lock (DadosLeitura)
@ -346,8 +354,12 @@ namespace AgroBase.Services
item.Saidas[0] = (status & 0b00000100) != 0;
item.Saidas[1] = (status & 0b00001000) != 0;
bool estadoAnterior = item.EntradaIN1.valor;
item.EntradaIN1.valor = item.Entradas[0];
//VerificarAnguloZero(item, estadoAnterior);
//Console.WriteLine($"[DIR {Variaveis.OperacaoEmAndamento.DispMvd?.Dados?.Modulos?.FirstOrDefault(x => (x?.DirMotor?._EnderecoCAN_Tx ?? 0x00) == item.EnderecoTx)?.DirMotor?.Mod_ID ?? item.EnderecoTx.ToString()}] IO atual");
}
break;

View File

@ -141,6 +141,7 @@ namespace AgroBase.Services.Operadores
dist_esq = _t.DistanciaEsquerda,
dist_dir = _t.DistanciaDireita,
angulo = _t.AnguloMedioCorredor,
pontos_restantes = _t.CorredorAtual.QtdPontos - pontoComparar.idxPontoCorredor,
},
} : null
),

View File

@ -1,12 +1,5 @@
{
"epochs": [ {
"calculation_time": "13401214743883964",
"config_version": 0,
"model_version": "0",
"padded_top_topics_start_index": 0,
"taxonomy_version": 0,
"top_topics_and_observing_domains": [ ]
}, {
"calculation_time": "13401820180888621",
"config_version": 0,
"model_version": "0",
@ -27,7 +20,14 @@
"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": [ ]
} ],
"hex_encoded_hmac_key": "40F346D3248C3AFDF2BEE1FE496DBD32F7CED6E5AE98B881ABC421AA7E7B5642",
"next_scheduled_calculation_time": "13403636820471023"
"next_scheduled_calculation_time": "13404243798816092"
}

View File

@ -1,3 +1,3 @@
2025/09/29-10:01:16.906 2c18 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
2025/09/29-10:01:16.915 2c18 Recovering log #3
2025/09/29-10:01:16.918 2c18 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/000003.log
2025/10/02-10:29:09.769 2320 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
2025/10/02-10:29:09.777 2320 Recovering log #3
2025/10/02-10:29:09.780 2320 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/09/29-09:56:13.780 6138 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
2025/09/29-09:56:13.789 6138 Recovering log #3
2025/09/29-09:56:13.792 6138 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/000003.log
2025/10/02-09:55:01.847 4cb4 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
2025/10/02-09:55:01.856 4cb4 Recovering log #3
2025/10/02-09:55:01.860 4cb4 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":"13403710893015464","port":443,"protocol_str":"quic"}],"anonymization":["DAAAAAcAAABmaWxlOi8vAA==",false,0],"network_stats":{"srtt":159598},"server":"https://tile.openstreetmap.org","supports_spdy":true}],"supports_quic":{"address":"2804:d78:678:7800:a470:6a2a:c4f8:2741","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":"13403971755511605","port":443,"protocol_str":"quic"}],"anonymization":["DAAAAAcAAABmaWxlOi8vAA==",false,0],"network_stats":{"srtt":11255},"server":"https://tile.openstreetmap.org","supports_spdy":true}],"supports_quic":{"address":"2804:d78:678:7800:f48c:982:27a5:3fb2","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":1790686574.188502,"host":"bWGAftl61rqoc0YzqPncsLvQQh/iC2Bdp3ejUeGC83w=","mode":"force-https","sts_include_subdomains":true,"sts_observed":1759150574.18851}],"version":2}
{"sts":[{"expiry":1790947754.085631,"host":"bWGAftl61rqoc0YzqPncsLvQQh/iC2Bdp3ejUeGC83w=","mode":"force-https","sts_include_subdomains":true,"sts_observed":1759411754.085639}],"version":2}

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,3 @@
2025/09/29-10:23:05.989 2c18 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
2025/09/29-10:23:05.991 2c18 Recovering log #3
2025/09/29-10:23:05.995 2c18 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/000003.log
2025/10/02-10:49:08.501 2320 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
2025/10/02-10:49:08.502 2320 Recovering log #3
2025/10/02-10:49:08.505 2320 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/09/29-10:00:49.743 6138 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
2025/09/29-10:00:49.744 6138 Recovering log #3
2025/09/29-10:00:49.747 6138 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/000003.log
2025/10/02-09:59:33.196 4cb4 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
2025/10/02-09:59:33.197 4cb4 Recovering log #3
2025/10/02-09:59:33.200 4cb4 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/09/29-10:01:16.830 1b54 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
2025/09/29-10:01:16.833 1b54 Recovering log #7
2025/09/29-10:01:16.833 1b54 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/000007.log
2025/10/02-10:29:09.700 5528 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
2025/10/02-10:29:09.702 5528 Recovering log #7
2025/10/02-10:29:09.702 5528 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/09/29-09:56:13.706 272c Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
2025/09/29-09:56:13.708 272c Recovering log #7
2025/09/29-09:56:13.708 272c Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/000007.log
2025/10/02-09:55:01.768 1f58 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
2025/10/02-09:55:01.770 1f58 Recovering log #7
2025/10/02-09:55:01.770 1f58 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/000007.log

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"hashes":{"000ac7dc9366969db9d1e41810a3a27c747a7623535d856eecc2de86cfed80c7":{"appid":"eeobbhfgfagbclfofmgbdfoicabjdbkn","fp":""},"00AF3F07B5ABB71F6D30337E1EEF62FA280F06EF19485C0CF6B72171F92CCC0A":{"appid":"kpfehajjjbbcifeehjgfgnabifknmdad","fp":"1.00AF3F07B5ABB71F6D30337E1EEF62FA280F06EF19485C0CF6B72171F92CCC0A"},"452064dcff76e03e0e81b4bb3c48ab1c432e040094f7546c7261a90d4a1c1bbf":{"appid":"fgbafbciocncjfbbonhocjaohoknlaco","fp":""},"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":""},"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"},"b987bdc4f2ad2a409b964921d4a5db1cdbe07f9c98f868293b4cc32acdc42cec":{"appid":"alpjnmnfbgfkmmpcfpejmmoebdndedno","fp":""},"bcb93cba8636743d1fbd32be3bd8ce8ff602323895bf4d136c26b9bc64b0a6a4":{"appid":"ndikpojcjlepofdkaaldkinkjbeeebkl","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

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_094a1d2cc67a698de1583e83f72ba778 {
#map_9e36f5ca41cb68cc441656f7b2cdf5f4 {
position: relative;
width: 100.0%;
height: 100.0%;
@ -54,14 +54,14 @@
<body>
<div class="folium-map" id="map_094a1d2cc67a698de1583e83f72ba778" ></div>
<div class="folium-map" id="map_9e36f5ca41cb68cc441656f7b2cdf5f4" ></div>
</body>
<script>
var map_094a1d2cc67a698de1583e83f72ba778 = L.map(
"map_094a1d2cc67a698de1583e83f72ba778",
var map_9e36f5ca41cb68cc441656f7b2cdf5f4 = L.map(
"map_9e36f5ca41cb68cc441656f7b2cdf5f4",
{
center: [0.0, 0.0],
crs: L.CRS.EPSG3857,
@ -77,26 +77,6 @@
var tile_layer_897decfc0132c82ed0e60422f9aea75c = L.tileLayer(
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
{
"minZoom": 0,
"maxZoom": 19,
"maxNativeZoom": 19,
"noWrap": false,
"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors",
"subdomains": "abc",
"detectRetina": false,
"tms": false,
"opacity": 1,
}
);
tile_layer_897decfc0132c82ed0e60422f9aea75c.addTo(map_094a1d2cc67a698de1583e83f72ba778);
</script>
<script>
@ -116,7 +96,7 @@
}
trajeto_json_add({"features": []});
trajeto_json.addTo(map_094a1d2cc67a698de1583e83f72ba778);
trajeto_json.addTo(map_9e36f5ca41cb68cc441656f7b2cdf5f4);
function adicionarGeometria(novaGeometria) {
trajeto_json.addData(novaGeometria);
@ -179,9 +159,9 @@
var marcadorEquipamento = L.marker([0, 0], {
icon: customIcon
}).addTo(map_094a1d2cc67a698de1583e83f72ba778);
}).addTo(map_9e36f5ca41cb68cc441656f7b2cdf5f4);
var marcadorBase = L.marker([0, 0], {}).addTo(map_094a1d2cc67a698de1583e83f72ba778);
var marcadorBase = L.marker([0, 0], {}).addTo(map_9e36f5ca41cb68cc441656f7b2cdf5f4);
var icon = L.AwesomeMarkers.icon(
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
);
@ -246,7 +226,7 @@
}
if (foco) {
map_094a1d2cc67a698de1583e83f72ba778.setView(novaPosicao, map_094a1d2cc67a698de1583e83f72ba778.getZoom());
map_9e36f5ca41cb68cc441656f7b2cdf5f4.setView(novaPosicao, map_9e36f5ca41cb68cc441656f7b2cdf5f4.getZoom());
}
}
@ -268,7 +248,7 @@
marcadorDinamico.setRotationAngle(angulo);
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
map_094a1d2cc67a698de1583e83f72ba778.setView(novaPosicao, map_094a1d2cc67a698de1583e83f72ba778.getZoom());*/
map_9e36f5ca41cb68cc441656f7b2cdf5f4.setView(novaPosicao, map_9e36f5ca41cb68cc441656f7b2cdf5f4.getZoom());*/
});
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {

File diff suppressed because one or more lines are too long

View File

@ -46,8 +46,9 @@ def definir_comando(parada_necessaria: bool, frear: bool, erro: bool, filtro_vel
ervas_no_radar = _dados_ww.get("ervas_no_radar", False)
percentual_ervas_no_radar = (_dados_ww.get("estatisticas", {}).get("erva", {}) or {}).get("ema_global", 0.0)
pontos_min = 3
vel_min = 15
ervas_min_percenet = 0.005
ervas_min_percenet = 0.005 # 5%
vel_com_ervas = _operacao.get("Mov", {}).get("percent_vel_min", 0)
vel_sem_ervas = _operacao.get("Mov", {}).get("percent_vel_max", 100)
ang_max = _operacao.get("Dir", {}).get("angulo_max", 30)
@ -56,12 +57,14 @@ def definir_comando(parada_necessaria: bool, frear: bool, erro: bool, filtro_vel
erro = 0
manobrando = False
reduzir_para_pulverizar = False
pontos_fim_corredor = -1
if op_modo == ModoOperacao.MapaGPS:
_trajetoria = _contexto.get("Trajetoria", {})
status_carro = StatusCarroMapa(_trajetoria.get("status", StatusCarroMapa.Parado.value))
erro = _trajetoria.get("erro_angular", 0)
manobrando = _trajetoria.get("manobrando", False)
pontos_fim_corredor = _trajetoria.get("CorredorAtual", {}).get("pontos_restantes", -1)
elif op_modo == ModoOperacao.MapeamentoVisual:
status_carro = StatusCarroMapa(_dados_vw.get("segmentacao", {}).get("status_corredor", StatusCarroMapa.Parado.value))
erro = _dados_vw.get("segmentacao", {}).get("erro_angular", 0)
@ -79,7 +82,8 @@ def definir_comando(parada_necessaria: bool, frear: bool, erro: bool, filtro_vel
velocidade_sp = min(vel_min, vel_com_ervas)
elif status_carro == StatusCarroMapa.CaminhandoRua:
reduzir_para_pulverizar = pulverizador_automatico and ervas_no_radar and percentual_ervas_no_radar > ervas_min_percenet
if reduzir_para_pulverizar:
reduzir_para_manobrar = -1 < pontos_fim_corredor <= pontos_min
if reduzir_para_pulverizar or reduzir_para_manobrar:
velocidade_sp = vel_com_ervas
else:
velocidade_sp = calcular_velocidade_relativa(vel_com_ervas, vel_sem_ervas, ang_max, erro)

View File

@ -107,38 +107,41 @@ class ControladorMPC:
self._mg_nodes = mg_nodes
def cross_track_error_point(self, x, y):
"""
Retorna:
e_lat -> erro lateral assinado (m; + à esquerda da tangente do segmento)
s_proj -> coordenada curvilínea ao longo da linha (m)
i_seg -> índice do segmento mais próximo usado na projeção
proj -> ponto projetado (2,)
theta_path -> orientação do caminho (rad) naquele segmento
margem_interp -> margem interpolada (m) naquele s
"""
if self._seg_p0 is None or self._seg_p0.shape[0] == 0:
return 0.0, 0.0, 0, np.array([x, y], float), 0.0, 0.7
try:
"""
Retorna:
e_lat -> erro lateral assinado (m; + à esquerda da tangente do segmento)
s_proj -> coordenada curvilínea ao longo da linha (m)
i_seg -> índice do segmento mais próximo usado na projeção
proj -> ponto projetado (2,)
theta_path -> orientação do caminho (rad) naquele segmento
margem_interp -> margem interpolada (m) naquele s
"""
if self._seg_p0 is None or self._seg_p0.shape[0] == 0:
return 0.0, 0.0, 0, np.array([x, y], float), 0.0, 0.7
P = np.array([x, y], float)
w = P - self._seg_p0 # (M,2)
L2 = (self._seg_L ** 2) # (M,)
t = np.clip(np.sum(w * self._seg_v, axis=1) / L2, 0.0, 1.0) # (M,)
proj = self._seg_p0 + t[:, None] * self._seg_v # (M,2)
d2 = np.sum((proj - P)**2, axis=1) # (M,)
i = int(np.argmin(d2))
P = np.array([x, y], float)
w = P - self._seg_p0 # (M,2)
L2 = (self._seg_L ** 2) # (M,)
t = np.clip(np.sum(w * self._seg_v, axis=1) / L2, 0.0, 1.0) # (M,)
proj = self._seg_p0 + t[:, None] * self._seg_v # (M,2)
d2 = np.sum((proj - P)**2, axis=1) # (M,)
i = int(np.argmin(d2))
# projeção escolhida
proj_i = proj[i]
e_lat = float(np.dot(P - proj_i, self._seg_n_hat[i])) # sinal pela normal esquerda
s_proj = float(self._s_nodes[i] + t[i] * self._seg_L[i])
theta_path = float(np.arctan2(self._seg_t_hat[i,0], self._seg_t_hat[i,1])) # 0=Norte se (x=E,y=N)
# projeção escolhida
proj_i = proj[i]
e_lat = float(np.dot(P - proj_i, self._seg_n_hat[i])) # sinal pela normal esquerda
s_proj = float(self._s_nodes[i] + t[i] * self._seg_L[i])
theta_path = float(np.arctan2(self._seg_t_hat[i,0], self._seg_t_hat[i,1])) # 0=Norte se (x=E,y=N)
# margem interpolada entre nós i e i+1
mg0 = self._mg_nodes[i]
mg1 = self._mg_nodes[i+1] if (i+1) < self._mg_nodes.size else mg0
margem = float((1.0 - t[i]) * mg0 + t[i] * mg1)
# margem interpolada entre nós i e i+1
mg0 = self._mg_nodes[i]
mg1 = self._mg_nodes[i+1] if (i+1) < self._mg_nodes.size else mg0
margem = float((1.0 - t[i]) * mg0 + t[i] * mg1)
return e_lat, s_proj, i, proj_i, theta_path, margem
return e_lat, s_proj, i, proj_i, theta_path, margem
except Exception as e:
mostrar_log(f"Erro ao calcular erro lateral: {e}")
def _ensure_luts(self, dados_matriz_custo, largura_equip, L):
if not dados_matriz_custo or dados_matriz_custo.get("Custo") is None:
@ -169,11 +172,7 @@ class ControladorMPC:
self._lut_tipo = {}
self._lut_tipo_sig = {}
def _ensure_lut_geom_por_tipo(
self, dados, largura_equip, tipo,
*, L, ang_min, ang_max, passo,
k_r=0.5, crab_in_phase=False, beta_crab_deg=4.0
):
def _ensure_lut_geom_por_tipo(self, dados, largura_equip, tipo, *, L, ang_min, ang_max, passo, k_r=0.5, crab_in_phase=False, beta_crab_deg=4.0):
if not hasattr(self, "_lut_tipo"):
self._lut_tipo, self._lut_tipo_sig = {}, {}
@ -246,9 +245,7 @@ class ControladorMPC:
# NADA de construir LUT por tipo aqui — isso é função do _ensure_lut_geom_por_tipo
self._lut_pronto = True
def _build_lut_geom_por_tipo(self, dados, tipo,
ang_min=-30.0, ang_max=30.0, passo=1.0,
L=1.0, k_r=0.5, crab_in_phase=False, beta_crab_deg=4.0):
def _build_lut_geom_por_tipo(self, dados, tipo, ang_min=-30.0, ang_max=30.0, passo=1.0, L=1.0, k_r=0.5, crab_in_phase=False, beta_crab_deg=4.0):
C = dados["Custo"]; W = int(C.shape[1])
escx = np.asarray(dados["EscalasX"][::-1], dtype=np.float32) # [H]
dist = np.asarray(dados["DistanciasRef"][::-1], dtype=np.float32) # [H]
@ -258,17 +255,26 @@ class ControladorMPC:
ang_grid_deg = np.arange(ang_min, ang_max + 1e-6, passo, dtype=np.float32) # [K]
ang_grid_rad = np.deg2rad(ang_grid_deg)
if crab_in_phase:
modo_diagonal = (tipo in [TipoMovimentoDirecional.MovimentoDiagonal])
if crab_in_phase or modo_diagonal:
# κ = 0; deslocamento lateral linear com a inclinação
# DIAGONAL: beta por-ângulo (usa a grade)
# crab “fixo”: mantém compatibilidade usando beta constante
if modo_diagonal:
beta_vec = ang_grid_rad # [K] — varia com a grade
else:
beta_vec = np.full_like(ang_grid_rad, np.deg2rad(beta_crab_deg))
kappa = np.zeros_like(ang_grid_rad)
beta = float(np.deg2rad(beta_crab_deg))
else:
kappa = np.array([self._kappa_from_angle(tipo, a, L=L, k_r=k_r) for a in ang_grid_rad], dtype=np.float32)
y = dist[:, None] # [H,1]
k = kappa[None, :] # [1,K]
if crab_in_phase:
x = y * math.tan(beta)
if crab_in_phase or modo_diagonal:
# X(H,K) = Y(H,1) * tan(beta(K))
x = y * np.tan(beta_vec[None, :])
else:
ky = k * y
x = np.where(
@ -310,11 +316,37 @@ class ControladorMPC:
return 0.0 # tratamos crab fora (x ≈ y * tan(beta_crab))
if tipo == TipoMovimentoDirecional.RodasDianteiras:
return math.tan(a_rad) / L
if tipo == TipoMovimentoDirecional.RodasTraseiras:
return math.tan(a_rad) / L
elif tipo == TipoMovimentoDirecional.MovimentoArco:
return math.tan((1.0 - k_r) * a_rad) / L
elif tipo == TipoMovimentoDirecional.MovimentoDiagonal:
return 0.0
elif tipo == TipoMovimentoDirecional.MovimentoLateral:
return 0.0
else:
return math.tan(a_rad) / L # default
def _calcula_erro_posicao(self, x, y, ponto_alvo, d_sat=3.0):
try:
erro_pos = float(np.hypot(x - ponto_alvo[0], y - ponto_alvo[1]))
d_norm = (erro_pos / d_sat)
return (d_norm, erro_pos)
except Exception as e:
mostrar_log(f"Erro ao calcular erro de posicao: {e}")
def _calcula_erro_orientacao(self, x, y, theta, ponto_alvo, angulo_caminho, peso_proximo_ponto=0.5):
try:
orient_sim = self.gps_handler.calcular_orientacao((x, y), ponto_alvo)
orient_sim = (orient_sim + np.pi) % (2 * np.pi)
erro_ori_sim = self.gps_handler.erro_angular(orient_sim, theta, angulo_caminho, peso_proximo_ponto)
#erro_ori_sim = abs(self._wrap_pi(orient_sim - theta_sim))
#erro_ori_sim = abs(self._wrap_pi(theta_path - theta_sim))
o_norm = (erro_ori_sim / np.pi)
erro_ori_sim = np.degrees(erro_ori_sim)
return (o_norm, erro_ori_sim)
except Exception as e:
mostrar_log(f"Erro ao calcular erro de orientacao: {e}")
# UTILS
@ -408,38 +440,74 @@ class ControladorMPC:
break
return self._proximo_nao_visitado(pontos_visitados)
def _calcular_pesos_movimento(self, contexto, erro_ori_rad):
def _calcular_pesos_movimento(self, contexto, erro_ori_graus, erro_lat_m):
# helpers simples
def _clamp(x, lo, hi):
return lo if x < lo else hi if x > hi else x
def _smoothstep01(t):
# suaviza transição (0..1) sem precisar de EMA
t = _clamp(t, 0.0, 1.0)
return t * t * (3 - 2 * t)
def _w_from_err(erro, w_min, w_max, deadband, tol, power=1.0, smooth=True):
"""
Mapeia erro absoluto -> peso em [w_min, w_max].
- deadband: abaixo disso, ignora (peso ~ w_min)
- tol: acima disso, satura (peso ~ w_max)
- power>1 deixa o crescimento mais "nervoso" quando erro aumenta
- smooth usa smoothstep pra transição mais macia
"""
e = abs(erro)
if e <= deadband:
t = 0.0
else:
t = (e - deadband) / max(1e-6, (tol - deadband))
t = _clamp(t, 0.0, 1.0)
if smooth:
t = _smoothstep01(t)
if power != 1.0:
t = t ** power
return w_min + (w_max - w_min) * t
def _w_from_err_inv(erro, w_min, w_max, deadband, tol, power=1.0, smooth=True):
# inverso: quanto maior o erro, menor o peso
w = _w_from_err(erro, w_min=w_min, w_max=w_max,
deadband=deadband, tol=tol,
power=power, smooth=smooth)
# espelha em torno do meio do intervalo
return w_min + w_max - w
try:
CARRO = contexto.get("Carro", {})
status = StatusCarroMapa(CARRO.get("Status", StatusCarroMapa.Parado.value))
dentro = CARRO.get("DentroCorredor", False)
manobrando = CARRO.get("ManobrandoEntreRuas", False)
velocidade = CARRO.get("Velocidade", self.velocidade_min)
peso_erro_pos = 1.2 # 0
peso_erro_ori = 4.5 # 1
peso_suavidade = 0.2 # 2
peso_fator_re = 0.05 # 3
peso_ideal = 0.4 # 4
peso_lateral = 3.8 if dentro else 0.0 # 5
peso_erro_pos = 1.2 # 0 1.2
peso_erro_ori = 2.2 # 1 2.2
peso_suavidade = _w_from_err_inv(erro_lat_m, w_min=0.5, w_max=3.6, deadband=0.05, tol=0.25, power=1.3, smooth=True)
peso_fator_re = 0.05 # 3 0.05
peso_ideal = 1.4 # 4 1.4
peso_lateral = _w_from_err(erro_lat_m, w_min=1.8, w_max=8.5, deadband=0.05, tol=0.7, power=1.3, smooth=True) if dentro else 0.0
# Penalidade proporcional à velocidade
penalidade_por_velocidade = (velocidade / self.velocidade_max) / 10.0
erro_ori_deg = np.degrees(erro_ori_rad)
erro_ori_clipped = max(min(erro_ori_deg, self.angulo_max_graus), -self.angulo_max_graus)
erro_ori_norm = abs(erro_ori_clipped / self.angulo_max_graus)
custo_movimento = {
TipoMovimentoDirecional.RodasDianteiras: 0.0,
TipoMovimentoDirecional.MovimentoArco: 0.0
TipoMovimentoDirecional.MovimentoArco: 0.0,
TipoMovimentoDirecional.MovimentoDiagonal: 0.0
}
if manobrando or status in [ StatusCarroMapa.EntrandoRua, StatusCarroMapa.SaindoRua, StatusCarroMapa.Manobrando ]:
if status in [ StatusCarroMapa.EntrandoRua, StatusCarroMapa.SaindoRua, StatusCarroMapa.Manobrando ]:
custo_movimento[TipoMovimentoDirecional.MovimentoArco] += 0.0
custo_movimento[TipoMovimentoDirecional.RodasDianteiras] += 1.0
custo_movimento[TipoMovimentoDirecional.MovimentoDiagonal] += 2.0
else:
custo_movimento[TipoMovimentoDirecional.MovimentoArco] += 0.0 if erro_ori_norm >= 0.4 else 1.0
custo_movimento[TipoMovimentoDirecional.RodasDianteiras] += 1.2 if erro_ori_norm >= 0.4 else 0.0
custo_movimento[TipoMovimentoDirecional.MovimentoArco] += 0.0 if erro_ori_graus >= 10.0 else 1.0
custo_movimento[TipoMovimentoDirecional.RodasDianteiras] += 1.2 if erro_ori_graus >= 10.0 else 0.0
custo_movimento[TipoMovimentoDirecional.MovimentoDiagonal] += 0.0 if erro_ori_graus <= 2.0 and erro_lat_m <= 0.4 else 2.0
return (peso_erro_pos, peso_erro_ori, peso_suavidade, peso_fator_re, peso_ideal, peso_lateral, custo_movimento)
except Exception as e:
@ -1019,7 +1087,7 @@ class ControladorMPC:
cmd_seq = None
x, y, theta, self.visitados_execucao = self.corrigir_pose_por_latencia(
x, y, theta, self.visitados_execucao,
0.0, #latency_s=min(pos_latencia + self.tempo_execucao_local, LAT_MAX),
latency_s=min(pos_latencia + self.tempo_execucao_local, LAT_MAX),
dt=self.dt,
nova_posicao_fn=self._nova_posicao,
u_hold=u_hold,
@ -1336,14 +1404,18 @@ class ControladorMPC:
angulo_ideal_deg = float(np.degrees(angulo_ideal_rad))
#print(f"Orient: {np.degrees(orient)}, delta theta: {np.degrees(delta_theta)}, angulo ideal: {angulo_ideal_deg}")
e_lat, _, _, _, theta_path, _ = self.cross_track_error_point(ponto_atual[0], ponto_atual[1])
(_, e_ori) = self._calcula_erro_orientacao(ponto_atual[0], ponto_atual[1], ponto_atual[2], ponto_alvo["xy"], theta_path, 0.5)
# 2) Tipos válidos conforme contexto
CARRO = contexto.get("Carro", {})
status = CARRO.get("Status", 0)
manobrando = CARRO.get("ManobrandoEntreRuas", False)
if manobrando or status in [StatusCarroMapa.EntrandoRua, StatusCarroMapa.SaindoRua, StatusCarroMapa.Manobrando]:
if status in [StatusCarroMapa.EntrandoRua, StatusCarroMapa.SaindoRua, StatusCarroMapa.Manobrando]:
tipos_validos = [TipoMovimentoDirecional.MovimentoArco]
elif abs(np.degrees(delta_theta)) > 15.0:
elif abs(e_ori) > 15.0:
tipos_validos = [TipoMovimentoDirecional.RodasDianteiras, TipoMovimentoDirecional.MovimentoArco]
elif abs(e_ori <= 3.0 and e_lat <= 0.2):
tipos_validos = [TipoMovimentoDirecional.MovimentoDiagonal]
else:
tipos_validos = [TipoMovimentoDirecional.RodasDianteiras]
@ -1378,6 +1450,11 @@ class ControladorMPC:
ang_min=ang_min, ang_max=ang_max, passo=passo,
k_r=0.5, crab_in_phase=False
)
elif t == TipoMovimentoDirecional.MovimentoDiagonal:
self._ensure_lut_geom_por_tipo(
dados_matriz_custo, largura, t, L=L,
ang_min=ang_min, ang_max=ang_max, passo=passo,
crab_in_phase=True) # beta será por-ângulo
else:
self._ensure_lut_geom_por_tipo(
dados_matriz_custo, largura, t, L=L,
@ -1474,6 +1551,8 @@ class ControladorMPC:
deadline=deadline,
margem_ms=float(margem_ms),
permitidos=permitidos, # <- NOVO (pode ser None)
e_lat=e_lat,
e_ori=e_ori
)
# 6) Uniformização ao redor do ideal (rad) com N limite
@ -1546,6 +1625,8 @@ class ControladorMPC:
deadline: float | None = None,
margem_ms: float = 20.0,
permitidos=None,
e_lat=0.0,
e_ori=0.0
):
"""
Seleciona e avalia candidatos (tipo, ângulo) contra a matriz de custo.
@ -1572,7 +1653,7 @@ class ControladorMPC:
try:
# ---- pesos heurísticos (erro ao ideal)
peso_angulo_ideal = float(self._calcular_pesos_movimento(contexto, abs(angulo_ideal_rad))[4])
peso_angulo_ideal = float(self._calcular_pesos_movimento(contexto, e_ori, e_lat)[4])
# ---- dados da matriz / ensure LUTs (idempotente)
dados_matriz_custo = contexto.get("VisualWorker", {}).get("MatrizCusto", {})
@ -2180,11 +2261,6 @@ class ControladorMPC:
prev_tipo = comando_anterior.get("tipo", TipoMovimentoDirecional.RodasDianteiras.value)
pontos_visitados = visitados.copy()
# Contexto usado no custo (mantido)
angulo_caminho = np.radians(contexto.get("Carro", {}).get("AnguloCaminho", 0.0))
status_carro = StatusCarroMapa(contexto.get("Carro", {}).get("Status", StatusCarroMapa.Parado.value))
dentro_corredor = bool(contexto.get("Carro", {}).get("DentroCorredor", False))
# omega e sub-stepping
omega_const = self.gps_handler.calcular_omega(v_planejado, angulo_testado, tipo)
@ -2222,24 +2298,17 @@ class ControladorMPC:
# ERROS / CUSTOS
# --------------------------
# posição (mantido)
D_sat = 10.0 # metros (ajuste)
erro_pos = float(np.hypot(x_sim - ponto_alvo_sim[0], y_sim - ponto_alvo_sim[1]))
d_norm = np.clip(erro_pos / D_sat, 0.0, 1.0)
(d_norm, erro_pos) = self._calcula_erro_posicao(x_sim, y_sim, ponto_alvo_sim)
# --- PATCH A: usa theta do CAMINHO (segmento projetado) como referência
# e usa também margem local pra normalização do custo lateral
e_lat, _, _, _, theta_path, margem = self.cross_track_error_point(x_sim, y_sim)
# erro de orientação
orient_sim = self.gps_handler.calcular_orientacao((x_sim, y_sim), ponto_alvo_sim)
orient_sim = (orient_sim + np.pi) % (2 * np.pi)
erro_ori_sim = self.gps_handler.erro_angular(orient_sim, theta_sim, theta_path, 0.5)
#erro_ori_sim = abs(self._wrap_pi(orient_sim - theta_sim))
#erro_ori_sim = abs(self._wrap_pi(theta_path - theta_sim))
o_norm = np.clip(erro_ori_sim / np.pi, 0.0, 1.0)
(o_norm, erro_ori_sim) = self._calcula_erro_orientacao(x_sim, y_sim, theta_sim, ponto_alvo_sim, theta_path, 0.5)
# pesos dinâmicos (mantido)
pesos = self._calcular_pesos_movimento(contexto, erro_ori_sim)
pesos = self._calcular_pesos_movimento(contexto, erro_ori_sim, e_lat)
(peso_erro_pos, peso_erro_ori, peso_suavidade, peso_fator_re, peso_ideal, peso_lateral, peso_movimento) = pesos
# ângulo relativo ao alvo e suavidade (parcialmente mantido)
@ -2389,17 +2458,42 @@ class ControladorMPC:
mostrar_log(f"Erro ao simular passo para {tipo.name} | angulo: {np.degrees(angulo_testado):.2f}: {e}")
return float('inf'), [(0.0, 0.0, 0.0)], False, visitados
def _nova_posicao(self, x, y, theta, omega, velocidade, tipo, angulo_rad, dt=None):
def _nova_posicao_old(self, x, y, theta, omega, velocidade, tipo, angulo_rad, dt=None):
"""
Atualiza a pose integrando por 'dt' (se None, cai em self.dt).
Mantém a ordem dos parâmetros antigos para não quebrar chamadas existentes.
"""
dt_use = self.dt if (dt is None) else float(dt)
distancia_m = velocidade * dt_use
theta_sim = theta + (omega * dt_use)
x_sim = x + (np.sin(theta_sim) * distancia_m)
y_sim = y + (np.cos(theta_sim) * distancia_m)
return x_sim, y_sim, theta_sim
def _nova_posicao(self, x, y, theta, omega, velocidade, tipo, angulo_rad, dt=None):
dt_use = self.dt if (dt is None) else float(dt)
theta_next = theta + omega * dt_use # orientação do corpo (no diagonal, ω≈0 → mantém)
# Escolhe a direção do deslocamento:
if tipo in [TipoMovimentoDirecional.MovimentoDiagonal, TipoMovimentoDirecional.MovimentoLateral]:
# 4WS em fase: transladar na direção θ+α, mantendo θ
direcao = theta_next + angulo_rad
else:
# modos "normais": desloca ao longo do eixo do corpo
direcao = theta_next
# ► Escolha como interpretar "velocidade" (deixe a A como padrão):
# A) velocidade = módulo do deslocamento (padrão anterior)
distancia_m = velocidade * dt_use
# B) (opcional) velocidade = componente longitudinal do corpo:
# mantém avanço "pra frente" igual à velocidade e adiciona drift lateral.
# use no lugar da linha acima se preferir esse comportamento:
#distancia_m = (velocidade * dt_use) / max(np.cos(angulo_rad), 1e-6)
x_sim = x + np.sin(direcao) * distancia_m
y_sim = y + np.cos(direcao) * distancia_m
theta_sim = theta_next # não soma α aqui!
return x_sim, y_sim, theta_sim

View File

@ -11,7 +11,8 @@ class GPSHandler:
def converter_latlon_para_xz(self, lat, lon):
dlat = np.radians(lat - self.lat0)
dlon = np.radians(lon - self.lon0)
x = self.raio_terra * dlon * np.cos(np.radians((lat + self.lat0) / 2))
#x = self.raio_terra * dlon * np.cos(np.radians((lat + self.lat0) / 2))
x = self.raio_terra * dlon * np.cos(np.radians(self.lat0))
z = self.raio_terra * dlat
return x, z
@ -67,7 +68,8 @@ class GPSHandler:
df = angulo_rad
dr = -angulo_rad
elif tipo == TipoMovimentoDirecional.MovimentoDiagonal:
# crab: sem guinada
return 0.0
elif tipo == TipoMovimentoDirecional.MovimentoLateral:
return 0.0
tf = np.tan(df)

View File

@ -543,6 +543,7 @@ class SegmentacaoManager:
self._last_status = status_final
return {
"timestamp": time.time(),
"height": H,
"width": W,
"erro_angular": ang_out,