modelo segmentacao fast scnn

This commit is contained in:
Diego Freitas 2025-08-07 15:23:53 -03:00
parent 9f80418d9a
commit 25a822127a
127 changed files with 2182 additions and 187994 deletions

Binary file not shown.

View File

@ -91,15 +91,15 @@ namespace AgroBase.Forms.IHM
tmrLeitura = new AsyncTaskTimerModel("tmrLeitura", tmrLeitura_Tick, 500, this);
tmrLeitura.Start();
tkbAnguloDirecional.Minimum = 0;
tkbAnguloDirecional.Maximum = Convert.ToInt32(Variaveis.OperacaoEmAndamento.Controle.Angulo_Max);
Variaveis.OperacaoEmAndamento.Mapa = new MapasModel()
if (Variaveis.OperacaoEmAndamento.Mapa.pnlMapa == null)
{
pnlMapa = pnlMapa,
lblMapa = lblMapaCarregado
};
Variaveis.OperacaoEmAndamento.Mapa.CarregarMapaGPS();
Variaveis.OperacaoEmAndamento.Mapa = new MapasModel()
{
pnlMapa = pnlMapa,
lblMapa = lblMapaCarregado
};
Variaveis.OperacaoEmAndamento.Mapa.CarregarMapaGPS();
}
}
private void frmDialogoMapa_FormClosing(object sender, FormClosingEventArgs e)
@ -131,7 +131,7 @@ namespace AgroBase.Forms.IHM
if (_Trajetoria != null && _Trajetoria.CorredorAtual != null)
{
MapaDinamico.AtualizarDados(
KinectService.Iniciado && KinectService.Leitura.StatusDetecao ? KinectService.Leitura.ObstaculoCritico : null,
null,
(float)_Trajetoria.AnguloCaminho,
(float)_Sensoriamento.Gps.AnguloCarroDefinido,
_Sensoriamento.Gps,
@ -151,15 +151,8 @@ namespace AgroBase.Forms.IHM
var _Sensoriamento = Variaveis.OperacaoEmAndamento.Sensoriamento;
/*var ultimaLeitura = Variaveis.OperacaoEmAndamento.CamerasSolo.OrderByDescending(x => x.Leitura.timestamp).FirstOrDefault();
if (ultimaLeitura != null)
{
lblUltimaLeituraSolo.Text = "Última Leitura Solo: " + FuncoesGlobais.TimestampToDate(ultimaLeitura.Leitura.timestamp);
}
if (Variaveis.OperacaoEmAndamento.CameraCaminho != null)
{
lblUltimaLeituraCaminho.Text = "Última Leitura Caminho: " + FuncoesGlobais.TimestampToDate(Variaveis.OperacaoEmAndamento.CameraCaminho.Leitura.timestamp);
}*/
lblUltimaLeituraSolo.Text = "Última Leitura Solo: " + Variaveis.OperacaoEmAndamento.Sensoriamento.OperadorErvas.UltimaMensagem.ToString("HH:mm:ss.fff");
lblUltimaLeituraCaminho.Text = "Última Leitura Caminho: " + Variaveis.OperacaoEmAndamento.Sensoriamento.OperadorVisual.UltimaMensagem.ToString("HH:mm:ss.fff");
lblPerformance.Text = _Sensoriamento.DadosPerformance.PerformanceStr;
lblMapaCarregado.Text = "Operação: " + Variaveis.OperacaoEmAndamento.Descricao;
@ -205,6 +198,8 @@ namespace AgroBase.Forms.IHM
tkbVelocidade.Value = Convert.ToInt32(_Sensoriamento.Controle.PercentualVelocidadeSP);
tkbAnguloDirecional.Minimum = 0;
tkbAnguloDirecional.Maximum = Convert.ToInt32(_Sensoriamento.Controle.Angulo_Max);
tkbAnguloDirecional.Value = Math.Abs(Convert.ToInt32(_Sensoriamento.Controle.Angulo));
}
@ -232,35 +227,53 @@ namespace AgroBase.Forms.IHM
}
if (!ReqFrameCam)
{
Task.Run(async () =>
{
ReqFrameCam = true;
OAKCameraFrameModel frame = await WeedWorkerService.GetCameraFrame(CameraFrameType.Rgb);
pnlCameraSolo0.BackgroundImage?.Dispose();
try { pnlCameraSolo0.BackgroundImage = frame?.image(); } catch { }
ReqFrameCam = false;
});
}
_ = AtualizarCameraSolo();
if (!ReqFrameSnr)
_ = AtualizarCameraCaminho();
}
private async Task AtualizarCameraSolo()
{
ReqFrameCam = true;
try
{
Task.Run(async () =>
{
ReqFrameSnr = true;
OAKCameraFrameModel frame = await VisualWorkerService.GetCameraFrame(CameraFrameType.Rgb);
pnlCameraCaminho.BackgroundImage?.Dispose();
try { pnlCameraCaminho.BackgroundImage = frame?.image(); } catch { }
lblUltimaLeituraCaminho.Text = $"Última Leitura Caminho: " + frame?.timestamp.ToString("HH:mm:ss");
OAKCameraFrameModel frame2 = await VisualWorkerService.GetCameraFrame(CameraFrameType.Segmentacao);
pnlCameraCaminhoSeg.BackgroundImage?.Dispose();
try { pnlCameraCaminhoSeg.BackgroundImage = frame2?.image(); } catch { }
ReqFrameSnr = false;
});
var frame = await WeedWorkerService.GetCameraFrame(CameraFrameType.Rgb);
AtualizarImagemPainel(pnlCameraSolo0, frame?.image());
}
finally
{
ReqFrameCam = false;
}
}
private async Task AtualizarCameraCaminho()
{
ReqFrameSnr = true;
try
{
var frameRgb = await VisualWorkerService.GetCameraFrame(CameraFrameType.Rgb);
AtualizarImagemPainel(pnlCameraCaminho, frameRgb?.image());
var frameSeg = await VisualWorkerService.GetCameraFrame(CameraFrameType.Segmentacao);
AtualizarImagemPainel(pnlCameraCaminhoSeg, frameSeg?.image());
}
finally
{
ReqFrameSnr = false;
}
}
private void AtualizarImagemPainel(Panel panel, Image novaImagem)
{
if (panel.InvokeRequired)
{
panel.BeginInvoke(new Action(() => AtualizarImagemPainel(panel, novaImagem)));
return;
}
panel.BackgroundImage?.Dispose();
panel.BackgroundImage = novaImagem;
}
private void pnlOrientacao_Paint(object sender, PaintEventArgs e)

View File

@ -208,6 +208,9 @@ namespace AgroBase.Forms.Operacoes
{
try
{
frmDialogo = new frmDialogoMapa();
frmDialogo.Show();
frmDialogo.Hide();
(bool sucesso, List<string> ruas) = Variaveis.OperacaoEmAndamento.CarregarParametrizacaoOperacao(frmDialogo.pnlMapa, frmDialogo.lblMapaCarregado, path);
bool condicaoOperacaoCarregada() => Variaveis.OperacaoEmAndamento.Trajetoria?.CorredorAtual != null;
@ -311,7 +314,6 @@ namespace AgroBase.Forms.Operacoes
FuncoesGlobais.ExecutarMetodoComVerificacaoCrossThreadAsync(fpnlPastas, async () =>
{
frmDialogo = new frmDialogoMapa();
this.Cursor = Cursors.WaitCursor;
await CarregarDadosOperacao(path);
((FlowLayoutPanel)fpnlPastas.Controls.Find(pnlNome, false).First()).BorderStyle = BorderStyle.FixedSingle;

View File

@ -171,41 +171,58 @@ namespace AgroBase.Forms.Operacoes
}
if (!ReqFrameCam)
{
Task.Run(async () =>
{
ReqFrameCam = true;
OAKCameraFrameModel frame = await WeedWorkerService.GetCameraFrame(CameraFrameType.Rgb);
Panel pnl = FuncoesGlobais.FindControlRecursive<Panel>(flwCamerasSolo, "pnlCamSolo_" + Variaveis.OperacaoEmAndamento.DispSen.Dados.CamerasSolo[0].Name);
if (pnl != null)
{
pnl.BackgroundImage?.Dispose();
try { pnl.BackgroundImage = frame?.image(); } catch { }
}
ReqFrameCam = false;
});
}
_ = AtualizarCameraSolo();
if (!ReqFrameSnr)
_ = AtualizarCameraCaminho();
}
private async Task AtualizarCameraSolo()
{
ReqFrameCam = true;
try
{
Task.Run(async () =>
{
ReqFrameSnr = true;
OAKCameraFrameModel frame = await VisualWorkerService.GetCameraFrame(CameraFrameType.Rgb);
pnlCameraRua.BackgroundImage?.Dispose();
try { pnlCameraRua.BackgroundImage = frame?.image(); } catch { }
OAKCameraFrameModel frame2 = await VisualWorkerService.GetCameraFrame(CameraFrameType.Segmentacao);
pnlDeteccoesRua.BackgroundImage?.Dispose();
try { pnlDeteccoesRua.BackgroundImage = frame2?.image(); } catch { }
ReqFrameSnr = false;
});
var frame = await WeedWorkerService.GetCameraFrame(CameraFrameType.Rgb);
Panel pnl = FuncoesGlobais.FindControlRecursive<Panel>(flwCamerasSolo, "pnlCamSolo_" + Variaveis.OperacaoEmAndamento.DispSen.Dados.CamerasSolo[0].Name);
AtualizarImagemPainel(pnl, frame?.image());
}
finally
{
ReqFrameCam = false;
}
}
private async Task AtualizarCameraCaminho()
{
ReqFrameSnr = true;
try
{
var frameRgb = await VisualWorkerService.GetCameraFrame(CameraFrameType.Rgb);
AtualizarImagemPainel(pnlCameraRua, frameRgb?.image());
var frameSeg = await VisualWorkerService.GetCameraFrame(CameraFrameType.Segmentacao);
AtualizarImagemPainel(pnlDeteccoesRua, frameSeg?.image());
}
finally
{
ReqFrameSnr = false;
}
}
private void AtualizarImagemPainel(Panel panel, Image novaImagem)
{
if (panel.InvokeRequired)
{
panel.BeginInvoke(new Action(() => AtualizarImagemPainel(panel, novaImagem)));
return;
}
panel.BackgroundImage?.Dispose();
panel.BackgroundImage = novaImagem;
}
@ -640,7 +657,6 @@ namespace AgroBase.Forms.Operacoes
private void chbPulverizador_CheckedChanged(object sender, EventArgs e)
{
Variaveis.OperacaoEmAndamento.Controle.PulverizadorAutomatico = ((CheckBox)sender).Checked;
HealthWorkerService.AtualizarDadosControleOperacao();
}
private void chbSonarAtivado_CheckedChanged(object sender, EventArgs e)

View File

@ -1419,8 +1419,8 @@ namespace AgroBase.Forms.Operacoes
var Log = LogsOperacao.FirstOrDefault(x => x.Momento == MomentoAtual).OperadorVisual;
//txtEspacoLivreEsquerda.Text = Log.Leitura.obj.radar_2d.analise.corredor_perfil[1].esquerda_m.ToString("0.00");
//txtEspacoLivreDireita.Text = Log.Leitura.obj.radar_2d.analise.corredor_perfil[1].direita_m.ToString("0.00");
txtDesvioNecessario.Text = (Log?.Resumo?.DesvioNecessario ?? false) ? "Sim" : "Não";
txtDirecaoDesvio.Text = (Log?.Resumo?.DirecaoDesvio ?? Enums.Direcao.Parado).ToString();
//txtDesvioNecessario.Text = (Log?.Resumo?.DesvioNecessario ?? false) ? "Sim" : "Não";
//txtDirecaoDesvio.Text = (Log?.Resumo?.DirecaoDesvio ?? Enums.Direcao.Parado).ToString();
if (gridObstaculos.Columns.Count == 0)
{
@ -1437,7 +1437,7 @@ namespace AgroBase.Forms.Operacoes
gridObstaculos.Rows.Clear();
if (Log != null)
/*if (Log != null)
{
foreach (var obstaculo in Log?.Resumo?.Obstaculos?.Where(x => x.DesvioNecessario)?.OrderBy(x => x.DistanciaMedia_mm))
{
@ -1452,7 +1452,7 @@ namespace AgroBase.Forms.Operacoes
obstaculo.DirecaoDesvio.ToString()
);
}
}
}*/
picMapaCalor.Image = CarregarImagemCamera(pathImagensCaminho, "_heatmap");

View File

@ -212,6 +212,7 @@ namespace AgroBase.Forms
DataHora = GPSService.UltimaLeitura.DataHora,
Longitude = GPSService.UltimaLeitura.Longitude,
Latitude = GPSService.UltimaLeitura.Latitude,
Heartbeat = GPSService.UltimaLeitura.Heartbeat,
};
if (!GPSService.Iniciado || (txtLongitude.Text != "" && txtLatitude.Text != ""))
@ -221,6 +222,7 @@ namespace AgroBase.Forms
DataHora = DateTime.Now,
Longitude = double.Parse(txtLongitude.Text.Replace(".", ",")),
Latitude = double.Parse(txtLatitude.Text.Replace(".", ",")),
Heartbeat = GPSService.UltimaLeitura.Heartbeat
};
}

View File

@ -48,6 +48,7 @@ namespace AgroBase.Models
public List<GPSSatelitesEmVistaModel> SatelitesEmVista { get; set; } = new List<GPSSatelitesEmVistaModel>();
public DateTime UltimoComandoRespondido { get; set; }
public double AnguloCarroDefinido { get; set; }
public int Heartbeat { get; set; } = 0;
public GPSModel Clone()
{
@ -71,7 +72,8 @@ namespace AgroBase.Models
TipoOrientacao = TipoOrientacao,
UltimoComandoRespondido = UltimoComandoRespondido,
OrientacaoMovimento = OrientacaoMovimento,
AnguloCarroDefinido = AnguloCarroDefinido
AnguloCarroDefinido = AnguloCarroDefinido,
Heartbeat = Heartbeat,
};
}
}

View File

@ -755,7 +755,7 @@ namespace AgroBase
{
List<Keys> ComandosImpedidos = new List<Keys>();
var Sonar = Variaveis.OperacaoEmAndamento.Sensoriamento.OperadorVisual;
/*var Sonar = Variaveis.OperacaoEmAndamento.Sensoriamento.OperadorVisual;
if (Sonar.Iniciado && Variaveis.OperacaoEmAndamento.Controle.SonarAtivado && Sonar.Resumo.DesvioNecessario)
{
switch (Sonar.Resumo.DirecaoDesvio)
@ -770,7 +770,7 @@ namespace AgroBase
ComandosImpedidos.Add(Keys.Left);
break;
}
}
}*/
if (UltrasonicA05Service.Iniciado)
{

View File

@ -122,8 +122,9 @@ namespace AgroBase.Models
return;
}
}
// Processo finalizado ou não associado
pnlMapa.Controls.Remove(picLoading);
picLoading.Visible = false;
mapaService.Carregado = true;

View File

@ -304,7 +304,7 @@ namespace AgroBase.Models.Modules
if (Comandar)
{
Variaveis.OperacaoEmAndamento.SimulacaoAnguloControle = Angulo_SP;
Variaveis.OperacaoEmAndamento.SimulacaoAnguloControle = Variaveis.OperacaoEmAndamento.Controle.Angulo;
//Console.WriteLine($"[{Mod_ID}] Angulo Atualizado para {Variaveis.OperacaoEmAndamento.SimulacaoAnguloControle}");
}
@ -347,7 +347,7 @@ namespace AgroBase.Models.Modules
double _anguloSP = 360 * (_sentido == Sentido.Antihorario ? -1 : 1);
double _anguloSpAnterior = 0;
while (!Sucesso && TimeoutGeral > DateTime.Now)
while (!Sucesso && TimeoutGeral > DateTime.Now && Inicializado)
{
int VelocidadeGiro = DefineVelocidadeReferenciamento();

View File

@ -211,14 +211,14 @@ namespace AgroBase.Models.Modules
(_Controle.TipoMovimento == TipoMovimentoDirecional.RodasDianteiras && Mod_ID.Contains("F")) ||
(_Controle.TipoMovimento == TipoMovimentoDirecional.RodasTraseiras && Mod_ID.Contains("T"));
bool emCurva = _ControleDir.UltimaDirecao != Direcao.Parado;
double anguloDir = Variaveis.OperacaoEmAndamento.DispMvd?.Dados?.Modulos?.FirstOrDefault(x => x.Modulo_ID == Mod_ID)?.DirMotor?.Angulo_SP ?? 0;
bool direcionalAtuado = anguloDir != 0;
double anguloDir = Math.Abs(Variaveis.OperacaoEmAndamento.DispMvd?.Dados?.Modulos?.FirstOrDefault(x => x.Modulo_ID == Mod_ID)?.DirMotor?.Angulo_SP ?? 0);
bool direcionalAtuado = anguloDir > 0.0;
if (movimentoCompensado && emCurva && direcionalAtuado)
{
if (
(_ControleDir.UltimaDirecao == Direcao.Esquerda && Mod_ID.Contains("E")) ||
(_ControleDir.UltimaDirecao == Direcao.Direita && Mod_ID.Contains("D"))
(_ControleDir.UltimaDirecao == Direcao.Esquerda && Mod_ID.Contains("D")) ||
(_ControleDir.UltimaDirecao == Direcao.Direita && Mod_ID.Contains("E"))
)
{
return true;
@ -236,7 +236,8 @@ namespace AgroBase.Models.Modules
{
if (CompensacaoNecessaria)
{
double compensacao = 1 - FuncoesMatematicas.Map(Math.Abs(Variaveis.OperacaoEmAndamento.Controle.Angulo), 0.0, 45.0, 0.0, 0.7);
//double compensacao = 1 + FuncoesMatematicas.Map(Math.Abs(Variaveis.OperacaoEmAndamento.Controle.Angulo), 0.0, Variaveis.OperacaoEmAndamento.Controle.Angulo_Max, 0.0, 0.3);
double compensacao = MovimentacaoMovimentoCompensadoModel.compensacoes[Mod_ID];
return (float)compensacao;
}
else
@ -245,7 +246,14 @@ namespace AgroBase.Models.Modules
}
}
}
private float FatorCompensacaoCurvasAnterior { get; set; } = 1.0f;
public bool NovoRPMNecessario
{
get
{
return FatorCompensacaoCurvas != FatorCompensacaoCurvasAnterior;
}
}
public Dictionary<TipoMovimentoDirecional, ConfiguracaoSentidoMotor> ConfigSentidos { get; set; }
public List<FuncoesPinout> Funcoes { get; set; }
@ -377,9 +385,12 @@ namespace AgroBase.Models.Modules
DirecaoAtual == Direcao.Parado || Freado ? 0 :
RPM_SP_Controle;
RPM_SP = Convert.ToInt32(RPM_SP * FatorCompensacaoCurvas);
int RpmCorrigido = Math.Min((int)(VariaveisEquipamento.RPM_Max_Roda * VariaveisEquipamento.RelacaoRPM), Math.Max(RPM_SP != 0 ? (int)(VariaveisEquipamento.RPM_Min_Roda * VariaveisEquipamento.RelacaoRPM) : 0, Convert.ToInt32(RPM_SP * FatorCompensacaoCurvas)));
//Console.WriteLine($"[{Mod_ID}] Direcao: {DirecaoAtual}, RPM_SP: {RPM_SP / VariaveisEquipamento.RelacaoRPM}, FC: {FatorCompensacaoCurvas.ToString("0.00")}, Novo RPM: {RpmCorrigido / VariaveisEquipamento.RelacaoRPM}");
RPM_SP = RpmCorrigido;
FatorCompensacaoCurvasAnterior = FatorCompensacaoCurvas;
Variaveis.OperacaoEmAndamento.SimulacaoRpmControle = Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.Average(x => x.MovMotor.RPM_SP) / VariaveisEquipamento.RelacaoRPM;
Variaveis.OperacaoEmAndamento.SimulacaoRpmControle = Variaveis.OperacaoEmAndamento.Controle.PercentualVelocidadeSP;
//Console.WriteLine($"RPM Atualizado para {Variaveis.OperacaoEmAndamento.SimulacaoRpmControle}");
switch (DirecaoAtual)
@ -438,6 +449,11 @@ namespace AgroBase.Models.Modules
}
}
}
public class MvdServoFreioModel
@ -564,4 +580,197 @@ namespace AgroBase.Models.Modules
public double CicloTrabalho { get; set; }
}
public class MovimentacaoMovimentoCompensadoModel
{
static List<TipoMovimentoDirecional> MovimentosCompensar = new List<TipoMovimentoDirecional>() { TipoMovimentoDirecional.RodasDianteiras, TipoMovimentoDirecional.RodasTraseiras, TipoMovimentoDirecional.MovimentoArco };
static GeometriaRobo g = new GeometriaRobo { L = VariaveisEquipamento.DistanciaEntreEixos / 100.0, W = VariaveisEquipamento.LarguraEquipamentoMm / 1000.0 };
public static Dictionary<string, double> compensacoes { get; set; } = new Dictionary<string, double>();
public static Dictionary<string, double> _compAnt { get; set; }
public static void AtualizarDados()
{
var ctrl = Variaveis.OperacaoEmAndamento?.Controle;
var disp = Variaveis.OperacaoEmAndamento?.DispMvd?.Dados?.Modulos;
if (Variaveis.OperacaoEmAndamento.StatusAtual == StatusOperacao.EmAndamento && ctrl == null || disp == null || !MovimentosCompensar.Contains(ctrl.TipoMovimento))
{
compensacoes = (disp ?? Enumerable.Empty<ModuloMvdModel>()).ToDictionary(x => x.Modulo_ID, x => 1.0);
return;
}
// Coleta ângulos dos módulos
var frente = disp.Where(m => m.Modulo_ID?.Contains("F") == true).Select(m => (double)(m.DirMotor?.Angulo_SP ?? 0) * (m.DirMotor.Sentido_SP == Sentido.Antihorario ? -1 : 1));
var tras = disp.Where(m => m.Modulo_ID?.Contains("T") == true).Select(m => (double)(m.DirMotor?.Angulo_SP ?? 0) * (m.DirMotor.Sentido_SP == Sentido.Antihorario ? 1 : -1));
// Ângulo equivalente do eixo (média em tan-space)
double angFrenteDeg = EqAngleEixo(frente);
double angTrasDeg = EqAngleEixo(tras);
compensacoes = FatoresVelocidade(
ctrl.TipoMovimento,
angFrenteDeg,
angTrasDeg,
g,
PoliticaFator.ReferenciaNoCentro,
fatorMaximo: 1.6
);
const double alpha = 0.2;
if (_compAnt != null && _compAnt.Count == compensacoes.Count)
compensacoes = compensacoes.ToDictionary(kv => kv.Key,
kv => _compAnt.TryGetValue(kv.Key, out var prev) ? prev * (1 - alpha) + kv.Value * alpha : kv.Value);
_compAnt = new Dictionary<string, double>(compensacoes);
}
public struct GeometriaRobo
{
public double L; // entre-eixos (m)
public double W; // bitola (m)
}
// assuma ângulos em graus no seu sistema
static double Deg2Rad(double deg) => deg * Math.PI / 180.0;
static double EqAngleEixo(IEnumerable<double> angsDeg)
{
// Trata sequência vazia
if (angsDeg == null) return 0;
var list = angsDeg.ToList();
if (list.Count == 0) return 0;
// média de tan e volta pra graus
double mediaTan = list.Select(a => Math.Tan(a * Math.PI / 180.0)).Average();
return Math.Atan(mediaTan) * 180.0 / Math.PI;
}
static bool TryCalcularRaioCentro(TipoMovimentoDirecional modo, double deltaFrontDeg, double deltaRearDeg, GeometriaRobo g, out double Rc)
{
double tf = Math.Tan(Deg2Rad(deltaFrontDeg));
double tr = Math.Tan(Deg2Rad(deltaRearDeg));
Rc = double.PositiveInfinity;
switch (modo)
{
case TipoMovimentoDirecional.RodasDianteiras:
if (Math.Abs(tf) < 1e-6) return false; // reta
Rc = g.L / tf;
return true;
case TipoMovimentoDirecional.RodasTraseiras:
if (Math.Abs(tr) < 1e-6) return false;
Rc = g.L / tr;
return true;
case TipoMovimentoDirecional.MovimentoArco:
// uso geral: Rc = L / (tan(df) - tan(dr))
double denom = (tf - tr);
if (Math.Abs(denom) < 1e-6) return false;
Rc = g.L / denom;
return true;
default:
return false;
}
}
// Raio de trajetória por roda para curva à esquerda (Rc > 0) ou direita (Rc < 0)
// Posições das rodas em relação ao centro do chassi: x = ±L/2, y = ±W/2
static void CalcularRaiosPorRoda(TipoMovimentoDirecional modo, double Rc, GeometriaRobo g, out double rFL, out double rFR, out double rRL, out double rRR)
{
// Por simplicidade, tratamos três casos:
// 1) Dianteiras: ICC está sobre a linha do eixo traseiro
// 2) Traseiras: ICC está sobre a linha do eixo dianteiro
// 3) ArcoOposto (simétrico): ICC está próximo ao centro; distância axial = L/2 para ambos
double ay = Math.Abs(Rc); // magnitude do Rc; sinal define esquerda/direita
if (modo == TipoMovimentoDirecional.RodasDianteiras)
{
// Traseiro: raio = Rc ± W/2
rRL = Math.Max(1e-6, ay - g.W / 2.0);
rRR = Math.Max(1e-6, ay + g.W / 2.0);
// Dianteiro: distância diagonal até ICC (pitágoras)
rFL = Math.Sqrt(Math.Pow(ay - g.W / 2.0, 2) + Math.Pow(g.L, 2));
rFR = Math.Sqrt(Math.Pow(ay + g.W / 2.0, 2) + Math.Pow(g.L, 2));
}
else if (modo == TipoMovimentoDirecional.RodasTraseiras)
{
// Dianteiro: raio = Rc ± W/2
rFL = Math.Max(1e-6, ay - g.W / 2.0);
rFR = Math.Max(1e-6, ay + g.W / 2.0);
// Traseiro: distância diagonal
rRL = Math.Sqrt(Math.Pow(ay - g.W / 2.0, 2) + Math.Pow(g.L, 2));
rRR = Math.Sqrt(Math.Pow(ay + g.W / 2.0, 2) + Math.Pow(g.L, 2));
}
else // Arco (simétrico)
{
// Ambos eixos a L/2 do centro
double a = g.L / 2.0;
rFL = Math.Sqrt(Math.Pow(ay - g.W / 2.0, 2) + a * a);
rFR = Math.Sqrt(Math.Pow(ay + g.W / 2.0, 2) + a * a);
rRL = Math.Sqrt(Math.Pow(ay - g.W / 2.0, 2) + a * a);
rRR = Math.Sqrt(Math.Pow(ay + g.W / 2.0, 2) + a * a);
}
// Observação: sinal de Rc indica sentido da curva:
// Rc > 0 -> curva à esquerda (rodas esquerdas são internas)
// Rc < 0 -> curva à direita (troque "interna"↔"externa")
// Aqui usamos |Rc|; para decidir quem é interna/externa, use o sinal fora daqui.
}
// Retorna fatores por roda. Modo "SomenteAumentarExterna" mantém a interna em 1.0
public enum PoliticaFator { ReferenciaNoCentro, SomenteAumentarExterna }
public static Dictionary<string, double> FatoresVelocidade(TipoMovimentoDirecional modo, double deltaFrontDeg, double deltaRearDeg, GeometriaRobo g, PoliticaFator politica, double fatorMaximo = 1.5)
{
if (!TryCalcularRaioCentro(modo, deltaFrontDeg, deltaRearDeg, g, out double Rc))
return Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.ToDictionary(x => x.Modulo_ID, x => 1.0);
CalcularRaiosPorRoda(modo, Rc, g, out var rFL, out var rFR, out var rRL, out var rRR);
// Centro do robô percorre raio |Rc|
double RcAbs = Math.Abs(Rc);
// Descobrir lado interno pela curva (sinal de Rc)
bool esquerda = Variaveis.OperacaoEmAndamento.Controle.TiposControle.FirstOrDefault(x => x.Tipo == T_Code.Dir).UltimaDirecao == Direcao.Esquerda; // Rc > 0;
double rIntFront = esquerda ? rFL : rFR;
double rExtFront = esquerda ? rFR : rFL;
double rIntRear = esquerda ? rRL : rRR;
double rExtRear = esquerda ? rRR : rRL;
double fFL, fFR, fRL, fRR;
if (politica == PoliticaFator.ReferenciaNoCentro)
{
fFL = rIntFront / RcAbs;
fFR = rExtFront / RcAbs;
fRL = rIntRear / RcAbs;
fRR = rExtRear / RcAbs;
}
else // SomenteAumentarExterna
{
fFL = 1.0;
fFR = rExtFront / rIntFront;
fRL = 1.0;
fRR = rExtRear / rIntRear;
}
if (!esquerda)
{
// Inverte se curva é para direita
(fFL, fFR) = (fFR, fFL);
(fRL, fRR) = (fRR, fRL);
}
// Saturação e leve suavização (ex: EMA) podem ser aplicadas aqui
fFL = Math.Min(fatorMaximo, fFL);
fFR = Math.Min(fatorMaximo, fFR);
fRL = Math.Min(fatorMaximo, fRL);
fRR = Math.Min(fatorMaximo, fRR);
return Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.ToDictionary(x => x.Modulo_ID, x => (double)(x.Modulo_ID == "ET" ? fRL : x.Modulo_ID == "DT" ? fRR : x.Modulo_ID == "EF" ? fFL : x.Modulo_ID == "DF" ? fFR : 1.0));
}
}
}

View File

@ -157,11 +157,6 @@ namespace AgroBase.Models.Modules
return new List<(int, CanMessagePosicaoDados, byte[])>();
}
public void RecebeProtocoloModulo(string Protocolo)
{
}
public void RegistrarLogMov(ModuloMvdModel Modulo)
{
Modulo.MovMotor.LogGrafico.Add(new MvdMotorMOVSensorimanetoGrafico()
@ -306,8 +301,10 @@ namespace AgroBase.Models.Modules
foreach (var Modulo in Modulos.Where(x => x.DirMotor.Inicializado))
{
MKS057DCanService.RequisitarDado(Modulo.DirMotor._EnderecoCAN_Tx, Modulo.DirMotor._EnderecoCAN_Rx, MKS057DCanService.MksHandler.MksFuncCode.PulsosRecebidos);
MKS057DCanService.RequisitarDado(Modulo.DirMotor._EnderecoCAN_Tx, Modulo.DirMotor._EnderecoCAN_Rx, MKS057DCanService.MksHandler.MksFuncCode.IO);
byte addrTx = Modulo.DirMotor._EnderecoCAN_Tx;
byte addrRx = Modulo.DirMotor._EnderecoCAN_Rx;
MKS057DCanService.RequisitarDado(addrTx, addrRx, MKS057DCanService.MksHandler.MksFuncCode.PulsosRecebidos);
MKS057DCanService.RequisitarDado(addrTx, addrRx, MKS057DCanService.MksHandler.MksFuncCode.IO);
// Verifica se o angulo de set point do motor em questao e diferente do angulo atual, e se for, reenvia o comando para garantir que o motor esteja coerente com o set point
if (!MKS057DCanService.Referenciando && (Modulo.DirMotor.UltimoComandoEnviado.AddMilliseconds(MKS057DCanService.TaxaAmostragem) < DateTime.Now) && !Modulo.DirMotor.AtingiuAnguloSP)

View File

@ -236,7 +236,11 @@ namespace AgroBase.Models
TipoControleDirecional = Parametros.DirTipoMovimento,
PulverizadorAutomatico = Parametros.PulverizadorAutomatico,
MovimentoAutomatico = Parametros.MovimentoAutomatico,
TipoMovimento = TipoMovimentoDirecional.RodasDianteiras,
TipoMovimento = Variaveis.OperacaoEmAndamento.Controle.TipoMovimento,
heartbeat = 0,
SimulacaoMPC = new List<MPCSimulacaoModel>(),
BicosAtuados = Variaveis.OperacaoEmAndamento.DispAtu?.Dados?.BicosPulverizadores?.Select(x => x.Clone())?.ToList() ?? new List<AtuadorBicoModel>(),
ticks_sem_resposta = DateTime.MinValue,
};
Variaveis.OperacaoEmAndamento.Descricao = Parametros.Descricao;
@ -404,7 +408,7 @@ namespace AgroBase.Models
new OperacaoControleTipoModel()
{
Tipo = T_Code.Dir,
DelayEnvioComando = 500,
DelayEnvioComando = 300,
Comandos = new List<string>(),
UltimoComando = DateTime.Now
},
@ -664,9 +668,6 @@ namespace AgroBase.Models
}
}
Variaveis.OperacaoEmAndamento.Controle.Angulo = Variaveis.OperacaoEmAndamento.Controle.Angulo_Max;
Variaveis.OperacaoEmAndamento.Controle.PercentualVelocidadeSP = Variaveis.OperacaoEmAndamento.Controle.PercentualVelocidadeMin;
RedisService.AtualizarCampos(CtxKey.DadosOperacao, ("configurado", false));
Variaveis.OperacaoEmAndamento.Sensoriamento.AtualizarDados();
@ -687,7 +688,7 @@ namespace AgroBase.Models
DataFim = DateTime.MinValue;
idxLog = 0;
ID = DataInicio.ToString("dd_MM_yyyy_HH_mm_ss");
ID = DataInicio.ToString("dd_MM_yyyy_HH_mm_ss") + "_" + Modo.ToString();
Directory.CreateDirectory(Variaveis.CaminhoOperacoes + ID + "/");
Sensoriamento.AtualizarDados();
@ -700,10 +701,19 @@ namespace AgroBase.Models
WeedWorkerService.ReiniciarLeituraAnalise();
VisualWorkerService.ReiniciarLeituraAnalise();
Controle.Angulo = 0;
Controle.PercentualVelocidadeSP = 0;
if (Controle.MovimentoAutomatico)
{
Controle.Angulo = 0;
Controle.PercentualVelocidadeSP = 0;
}
else
{
Controle.Angulo = Controle.Angulo_Max;
Controle.PercentualVelocidadeSP = Controle.PercentualVelocidadeMin;
}
ControleAnterior.Angulo = 0;
ControleAnterior.PercentualVelocidadeSP = 0;
Controle.TiposControle.ForEach(x => x.UltimaDirecao = Direcao.Parado);
Controle.TipoMovimento = TipoMovimentoDirecional.RodasDianteiras;
Controle.BicosAtuados = DispAtu?.Dados?.BicosPulverizadores?.Select(x => x.Clone())?.ToList() ?? new List<AtuadorBicoModel>();
Controle.BicosAtuados.ForEach(x => x.ComandoAtuar = false);
ControleAnterior.BicosAtuados = Controle.BicosAtuados.Select(x => x.Clone()).ToList();
@ -711,17 +721,6 @@ namespace AgroBase.Models
GPSTrajetoria = new List<GPSModel>();
await RealizarCalibragemInicialAsync();
if (Modo == ModoOperacao.Manual)
{
await Task.Run(async () =>
{
await Task.Delay(3000);
Controle.Angulo = 25;
Controle.PercentualVelocidadeSP = 25;
});
}
}
public async Task FinalizarOperacao()
@ -754,6 +753,8 @@ namespace AgroBase.Models
Variaveis.OperacaoEmAndamento.Calibrando = true;
RedisService.AtualizarCampos(CtxKey.DadosOperacao, ("calibrando", Variaveis.OperacaoEmAndamento.Calibrando));
TipoMovimentoDirecional tipoControle = Variaveis.OperacaoEmAndamento.Controle.TipoMovimento;
var DispAtu = Variaveis.OperacaoEmAndamento.DispAtu;
var DispMvd = Variaveis.OperacaoEmAndamento.DispMvd;
@ -764,6 +765,7 @@ namespace AgroBase.Models
if (tasks.Count == 0)
{
Console.WriteLine("Nenhuma calibragem foi iniciada.");
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = tipoControle;
Variaveis.OperacaoEmAndamento.Calibrando = false;
return;
}
@ -786,7 +788,7 @@ namespace AgroBase.Models
{
Console.WriteLine($"Erro durante calibragem: {ex.Message}");
}
Variaveis.OperacaoEmAndamento.Controle.TipoMovimento = tipoControle;
Variaveis.OperacaoEmAndamento.Calibrando = false;
RedisService.AtualizarCampos(CtxKey.DadosOperacao, ("calibrando", Variaveis.OperacaoEmAndamento.Calibrando));
}
@ -963,9 +965,14 @@ namespace AgroBase.Models
_Controle.Direcao = Direcao.Frente;
}
if (ForcarEnvio || _Controle.RPM_SP != _ControleAnterior.RPM_SP)
var modsAtualizar = Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.Where(Mod => Mod.MovMotor.NovoRPMNecessario).Select(x => x.Modulo_ID).ToList();
bool envioNecessario = ForcarEnvio || _Controle.RPM_SP != _ControleAnterior.RPM_SP;
if (envioNecessario || modsAtualizar.Any())
{
Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.ForEach(Mod => Mod.MovMotor.EnviarComandoControle(_Controle.Direcao));
foreach (var Mod in Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.Where(x => envioNecessario ? true : modsAtualizar.Contains(x.Modulo_ID)))
{
Mod.MovMotor.EnviarComandoControle(_Controle.Direcao);
}
_Controle.TiposControle.FirstOrDefault(x => x.Tipo == Tipo).UltimaDirecao = _Controle.Direcao;
}
@ -975,7 +982,7 @@ namespace AgroBase.Models
Protocolos = new List<string>()
{
Tipo.ToString() + ";" + _Controle.Direcao.ToString() + ";" + _Controle.RPM_SP.ToString() + ";" + _Controle.Angulo.ToString()
_Controle.Direcao.ToString() + ";" + _Controle.RPM_SP.ToString()
};
break;
}
@ -994,10 +1001,14 @@ namespace AgroBase.Models
_Controle.Direcao = Direcao.Parado;
}
// Só enviar comando se a direção realmente mudou
if (ForcarEnvio || _Controle.Angulo != _ControleAnterior.Angulo)
bool envioNecessario = ForcarEnvio || _Controle.Angulo != _ControleAnterior.Angulo || _Controle.TipoMovimento != _ControleAnterior.TipoMovimento;
var modsAtualizar = Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.Where(Mod => !Mod.DirMotor.AtingiuAnguloSP).Select(x => x.Modulo_ID).ToList();
if (!MKS057DCanService.Referenciando && (envioNecessario || modsAtualizar.Any()))
{
Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.ForEach(Mod => Mod.DirMotor.EnviarComandoControle(_Controle.Direcao));
foreach (var Mod in Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.Where(x => envioNecessario ? true : modsAtualizar.Contains(x.Modulo_ID)))
{
Mod.DirMotor.EnviarComandoControle(_Controle.Direcao);
}
_Controle.TiposControle.FirstOrDefault(x => x.Tipo == Tipo).UltimaDirecao = _Controle.Direcao;
}
@ -1007,7 +1018,7 @@ namespace AgroBase.Models
Protocolos = new List<string>()
{
Tipo.ToString() + ";" + _Controle.Direcao.ToString() + ";" + _Controle.RPM_SP.ToString() + ";" + _Controle.Angulo.ToString()
_Controle.Direcao.ToString() + ";" + _Controle.Angulo.ToString()
};
break;
}
@ -1024,7 +1035,7 @@ namespace AgroBase.Models
Protocolos = new List<string>()
{
Tipo.ToString() + ";" + string.Join(";", _Controle.BicosAtuados.Select(x => x.ComandoAtuar ? "1" : "0"))
string.Join(";", _Controle.BicosAtuados.Select(x => x.ComandoAtuar ? "1" : "0"))
};
break;
}
@ -1106,6 +1117,7 @@ namespace AgroBase.Models
OperacaoSensoriamentoLogModel logGeral = Variaveis.OperacaoEmAndamento.Sensoriamento.Clone();
logGeral.Momento = Agora;
SalvarLog("operacao", logGeral, Fim);
Variaveis.OperacaoEmAndamento.Controle.TiposControle.ForEach(x => x.Comandos.Clear());
Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.ForEach(Modulo =>
{
@ -1293,7 +1305,7 @@ namespace AgroBase.Models
string nome = Variaveis.OperacaoEmAndamento.idxLog.ToString();
Camera.SaveFrames(new List<CameraFrameType>() { CameraFrameType.Rgb, CameraFrameType.Heatmap, CameraFrameType.RadarTopDown, CameraFrameType.Segmentacao }, nome, Caminho);
Camera.SaveFrames(new List<CameraFrameType>() { CameraFrameType.Rgb, CameraFrameType.Segmentacao }, nome, Caminho); // CameraFrameType.Heatmap, CameraFrameType.RadarTopDown
var cam_data = JsonConvert.DeserializeObject<Dictionary<string, object>>(RedisService.Get(CtxKey.DadosCameras));
if (cam_data.ContainsKey(Camera.Id))
@ -1424,11 +1436,8 @@ namespace AgroBase.Models
public double Angulo_Max { get; set; } = 30;
public double Angulo_Min { get; set; } = -30;
public double VelocidadeMP { get; set; } = 50;
private double _angulo_sp = 0.0;
public double Angulo { get; set; }
public int heartbeat { get; set; } = 1;
//public int ticks_sem_resposta { get; set; } = 0;
public DateTime ticks_sem_resposta { get; set; } = DateTime.MinValue;
public int RPM_SP
{
@ -1461,7 +1470,7 @@ namespace AgroBase.Models
}
}
public Direcao Direcao { get; set; } = Direcao.Parado;
private TipoMovimentoDirecional _tipoMovimento;
private TipoMovimentoDirecional _tipoMovimento = TipoMovimentoDirecional.Diagnostico;
public TipoMovimentoDirecional TipoMovimento
{
get
@ -1475,6 +1484,7 @@ namespace AgroBase.Models
{
if (value != _tipoMovimento)
{
var _Controle = Variaveis.OperacaoEmAndamento.Controle;
switch (value)
{
case TipoMovimentoDirecional.RodasDianteiras:
@ -1482,6 +1492,7 @@ namespace AgroBase.Models
{
x.MovMotor.Comandar = true;
x.DirMotor.Comandar = x.Modulo_ID.Contains("F");
x.DirMotor.Angulo_SP = x.DirMotor.Comandar ? _Controle.Angulo : 0;
});
break;
case TipoMovimentoDirecional.RodasTraseiras:
@ -1489,6 +1500,7 @@ namespace AgroBase.Models
{
x.MovMotor.Comandar = true;
x.DirMotor.Comandar = x.Modulo_ID.Contains("T");
x.DirMotor.Angulo_SP = x.DirMotor.Comandar ? _Controle.Angulo : 0;
});
break;
default:
@ -1496,6 +1508,7 @@ namespace AgroBase.Models
{
x.MovMotor.Comandar = true;
x.DirMotor.Comandar = true;
x.DirMotor.Angulo_SP = _Controle.Angulo;
});
break;
}
@ -1512,8 +1525,7 @@ namespace AgroBase.Models
public List<OperacaoControleTipoModel> TiposControle { get; set; } = new List<OperacaoControleTipoModel>();
public bool SonarAtivado { get; set; } = true;
public bool MovimentoAutomatico { get; set; }
private bool _pulverizadorAutomatico = false;
private bool _pulverizadorAutomatico;
public bool PulverizadorAutomatico
{
get
@ -1522,14 +1534,16 @@ namespace AgroBase.Models
}
set
{
_pulverizadorAutomatico = value;
if (!_pulverizadorAutomatico)
if (value != _pulverizadorAutomatico && !value)
{
Variaveis.OperacaoEmAndamento.Controle.BicosAtuados.ForEach(bico => bico.ComandoAtuar = false);
Variaveis.OperacaoEmAndamento.AtualizarDadosControle(true, new List<T_Code>() { T_Code.Atu });
}
_pulverizadorAutomatico = value;
}
}
//public bool MovimentoAutomatico { get; set; }
public bool MovimentoAutomatico { get; set; }
public TiposControladorDirecional TipoControleDirecional { get; set; } = TiposControladorDirecional.PID;
public List<MPCSimulacaoModel> SimulacaoMPC { get; set; } = new List<MPCSimulacaoModel>();
@ -1556,7 +1570,10 @@ namespace AgroBase.Models
TiposControle = new List<OperacaoControleTipoModel>(TiposControle),
VelocidadeMP = VelocidadeMP,
SimulacaoMPC = new List<MPCSimulacaoModel>(SimulacaoMPC),
PulverizadorAutomatico = PulverizadorAutomatico
PulverizadorAutomatico = PulverizadorAutomatico,
MovimentoAutomatico = MovimentoAutomatico,
heartbeat = heartbeat,
ticks_sem_resposta = ticks_sem_resposta
};
}
}
@ -1703,6 +1720,8 @@ namespace AgroBase.Models
Variaveis.OperacaoEmAndamento.DadosPerformance.AtualizarDadosPerformance();
MovimentacaoMovimentoCompensadoModel.AtualizarDados();
// Soma total de atuações para todas as ervas de todos os bicos
int totalAtuacoes = 0;
@ -1714,7 +1733,7 @@ namespace AgroBase.Models
var sIMU = VisualWorkerService.DadosLeitura.Imu;
var dadosIMU = sIMU != null ? new OperacaoSensoriamentoLogImuModel()
{
Iniciado = sIMU.timestamp > 0,
Iniciado = sIMU.timestamp > 0 && HealthWorkerService.ModulosSaude.FirstOrDefault(x => x.modulo == T_Code.Imu)?.status != StatusModulo.Desconectado,
InclinacaoLateral = sIMU.roll,
InclinacaoFrontal = sIMU.pitch,
Rotacao = sIMU.yaw,

View File

@ -14,10 +14,8 @@ namespace AgroBase.Models.Operadores
public DateTime ProntoEm { get; set; }
public DateTime UltimaMensagem { get; set; }
public Dictionary<CameraFrameType, OAKCameraFrameModel> CameraFrames { get; set; } = new Dictionary<CameraFrameType, OAKCameraFrameModel>();
//public WorkerMessageModel<VisualWorkerMessageResponseModel> Leitura { get; set; } = new WorkerMessageModel<VisualWorkerMessageResponseModel>();
public VisualWorkerMessageAnaliseModel Analises { get; set; } = new VisualWorkerMessageAnaliseModel();
public VisualWorkerMessageIMUModel Imu { get; set; } = new VisualWorkerMessageIMUModel();
public VisualWorkerDadosModel Resumo { get; set; } = new VisualWorkerDadosModel();
public VisualWorkerModel Clone()
{
@ -30,8 +28,7 @@ namespace AgroBase.Models.Operadores
CameraFrames = new Dictionary<CameraFrameType, OAKCameraFrameModel>(CameraFrames ?? new Dictionary<CameraFrameType, OAKCameraFrameModel>()),
Analises = Analises.Clone(),
Imu = Imu.Clone(),
//Leitura = Leitura.Clone(),
Resumo = Resumo.Clone(),
UltimaMensagem = UltimaMensagem,
};
}
@ -44,8 +41,6 @@ namespace AgroBase.Models.Operadores
CameraFrames = new Dictionary<CameraFrameType, OAKCameraFrameModel>();
Analises = new VisualWorkerMessageAnaliseModel();
Imu = new VisualWorkerMessageIMUModel();
//Leitura = new WorkerMessageModel<VisualWorkerMessageResponseModel>();
Resumo = new VisualWorkerDadosModel();
}
}

View File

@ -24,7 +24,8 @@ namespace AgroBase.Models.Operadores
Pronto = Pronto,
ProntoEm = ProntoEm,
CameraFrames = new Dictionary<CameraFrameType, OAKCameraFrameModel>(CameraFrames ?? new Dictionary<CameraFrameType, OAKCameraFrameModel>()),
Analise = Analise.Clone()
Analise = Analise.Clone(),
UltimaMensagem = UltimaMensagem,
};
}

View File

@ -54,7 +54,8 @@ namespace AgroBase.Models
CPU_load,
RAM_usage,
GPU_temp,
CPU_temp
CPU_temp,
HDD_load
);
}
}

View File

@ -1013,7 +1013,7 @@ namespace AgroBase.Models
int idxEsq = 0;
int idxDir = 0;
double anguloAcrescentar = idxDir % 2 == 0 && direcaoAtual == DirecaoCarroRua.Ida ? 20 : -20;
double anguloAcrescentar = idxDir % 2 == 0 && direcaoAtual == DirecaoCarroRua.Ida ? 45 : -45;
for (int idx = 0; idx < Corredores.Count(); idx++)
{
@ -1053,15 +1053,6 @@ namespace AgroBase.Models
double anguloProjetar1 = GPSUtils.CalcularOrientacao(CorredorAtual.Skip(1).First(), CorredorAtual.First());
GPSModel PrimeiroPonto = GPSUtils.ProjetarPontoDeslocado(CorredorAtual.First(), DistanciaProjecaoRua, anguloProjetar1);
double anguloProjetar2 = GPSUtils.CalcularOrientacao(CorredorAtual.Skip(CorredorAtual.Count() - 2).First(), CorredorAtual.Last());
// Realiza um acréscimo no angulo à projetar, permitindo que o equipamento faça uma curva mais aberta entre corredores
if (!ultimoCorredor && !_FatorLarguraElevado)
{
anguloProjetar2 += anguloAcrescentar;
anguloAcrescentar *= -1;
}
GPSModel UltimoPonto = GPSUtils.ProjetarPontoDeslocado(CorredorAtual.Last(), !ultimoCorredor ? DistanciaProjecaoRua : (DistanciaProjecaoRua * 2.0), anguloProjetar2);
var ultimoPontoTrajetoria = _trajetoriaFixa.LastOrDefault();
PontoTrajetoriaModel PontoInicial = new PontoTrajetoriaModel(TipoPontoRua.LigacaoEntrada)
@ -1115,7 +1106,7 @@ namespace AgroBase.Models
Direcao = pontoLigacao ? direcaoAtual : DirecaoCarroRua.Manobra,
Orientacao = GPSUtils.CalcularOrientacao(_trajetoriaFixa.Last().Posicao, ponto),
Visitado = false,
LarguraCorredor = larguraCorredorMenor
LarguraCorredor = larguraCorredorMenor * 0.9
});
}
@ -1151,6 +1142,15 @@ namespace AgroBase.Models
_trajetoriaFixa.Add(PontoTrajetoria);
}
double anguloProjetar2 = GPSUtils.CalcularOrientacao(CorredorAtual.Skip(CorredorAtual.Count() - 2).First(), CorredorAtual.Last());
// Realiza um acréscimo no angulo à projetar, permitindo que o equipamento faça uma curva mais aberta entre corredores
if (!ultimoCorredor && !_FatorLarguraElevado)
{
anguloProjetar2 += anguloAcrescentar;
anguloAcrescentar *= -1;
}
GPSModel UltimoPonto = GPSUtils.ProjetarPontoDeslocado(CorredorAtual.Last(), !ultimoCorredor ? (DistanciaProjecaoRua * 1.5) : (DistanciaProjecaoRua * 2.0), anguloProjetar2);
PontoTrajetoriaModel PontoFinal = new PontoTrajetoriaModel(TipoPontoRua.LigacaoSaida)
{
idxCorredor = idx,
@ -1160,7 +1160,7 @@ namespace AgroBase.Models
Direcao = direcaoAtual,
Orientacao = GPSUtils.CalcularOrientacao(_trajetoriaFixa.Last().Posicao, UltimoPonto),
Visitado = false,
LarguraCorredor = larguraCorredorMenor
LarguraCorredor = ultimoCorredor ? larguraCorredorMenor : (larguraCorredorMenor * 0.8)
};
_trajetoriaFixa.Add(PontoFinal);
@ -1262,7 +1262,7 @@ namespace AgroBase.Models
public static List<GPSModel> GerarCurvaConexao(GPSModel ultimoPontoRuaAtual, GPSModel primeiroPontoProximaRua, GPSModel pontoControle, int numeroPontos)
{
List<GPSModel> pontosCurva = new List<GPSModel>();
for (int i = 0; i <= numeroPontos; i++)
for (int i = 2; i <= numeroPontos; i++)
{
double t = i / (double)numeroPontos;
pontosCurva.Add(CalcularBezierQuadratica(ultimoPontoRuaAtual, pontoControle, primeiroPontoProximaRua, t));

View File

@ -109,13 +109,14 @@ namespace AgroBase.Models
return ((LarguraEsquerda + LarguraDireita + 10.0) * 10.0);
}
}
public static double TensaoMinimaBateria { get; set; } = 20.0;
public static double TensaoMaximaBateria { get; set; } = 20.0;
public static double TensaoMinimaBateria { get; set; } = 30.0;
public static double TensaoMaximaBateria { get; set; } = 42.0;
public static double CorrenteMaximaBateria { get; set; } = 20.0;
public static double PercentualTensaoBateriaMin { get; set; } = 25.0;
public static double PercentualReservatorioMin { get; set; } = 5.0;
public static double PercentualToleranciaPressaoLinha { get; set; } = 0.15;
public static double ReducaoDirecional { get; set; } = 20.0;
public static int RPM_Min_Roda { get; set; } = 15;
public static int RPM_Max_Roda
{
get
@ -183,6 +184,8 @@ namespace AgroBase.Models
{ TipoMovimentoDirecional.MovimentoLateral, 90 },
{ TipoMovimentoDirecional.Diagnostico, 25 },
};
public static double AnguloInclinacaoRollMax { get; set; } = 15.0;
public static double AnguloInclinacaoPitchMax { get; set; } = 30.0;
public static SensorSinaleiroComportamentoModel ComportamentoPorStatus(StatusOperacao? _status = null)
{
@ -263,7 +266,7 @@ namespace AgroBase.Models
}
public static GPSModel SimularNovaPosicao(TipoMovimentoDirecional tipoMovimento, double anguloControle, double velocidadeMs, double tempoDelta, double anguloAtual, GPSModel PosicaoAtual)
public static GPSModel SimularNovaPosicao_bkp(TipoMovimentoDirecional tipoMovimento, double anguloControle, double velocidadeMs, double tempoDelta, double anguloAtual, GPSModel PosicaoAtual)
{
// Fator de correção da curva
double k = 1.35 + 0.5 * Math.Exp(-Math.Abs(anguloControle) / 15.0);
@ -346,6 +349,73 @@ namespace AgroBase.Models
return novoPonto;
}
public static GPSModel SimularNovaPosicao(TipoMovimentoDirecional tipoMovimento, double anguloControleDeg, double velocidadeMs, double tempoDelta, double anguloAtualDeg, GPSModel pos)
{
double L = DistanciaEntreEixos / 100.0;
// Defina deltas por modo
double dfDeg = 0, drDeg = 0;
switch (tipoMovimento)
{
case TipoMovimentoDirecional.RodasDianteiras: dfDeg = anguloControleDeg; drDeg = 0; break;
case TipoMovimentoDirecional.RodasTraseiras: dfDeg = 0; drDeg = anguloControleDeg; break;
case TipoMovimentoDirecional.MovimentoArco: dfDeg = anguloControleDeg; drDeg = -anguloControleDeg; break;
case TipoMovimentoDirecional.MovimentoDiagonal: dfDeg = anguloControleDeg; drDeg = anguloControleDeg; break;
}
// Curvatura geométrica
double tf = Math.Tan(dfDeg * Math.PI / 180.0);
double tr = Math.Tan(drDeg * Math.PI / 180.0);
if (Math.Abs(tf) < 1e-6) tf = 0;
if (Math.Abs(tr) < 1e-6) tr = 0;
double kappa = 0; // 1/m
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;
// Correção dinâmica (opcional)
double Ku = 2.5; // ajuste fino em campo
double kappaEf = kappa / (1 + Ku * velocidadeMs * velocidadeMs);
// Integração
double theta = anguloAtualDeg * Math.PI / 180.0;
double omega = -velocidadeMs * kappaEf; // rad/s
double dtheta = omega * tempoDelta;
double moveHeading = theta; // direção de deslocamento
if (tipoMovimento == TipoMovimentoDirecional.MovimentoDiagonal)
moveHeading = theta + dfDeg * Math.PI / 180.0; // translada na direção do steering, sem girar
double dx, dy;
if (tipoMovimento == TipoMovimentoDirecional.MovimentoDiagonal || Math.Abs(omega) < 1e-6)
{
dx = velocidadeMs * tempoDelta * Math.Cos(moveHeading);
dy = velocidadeMs * tempoDelta * Math.Sin(moveHeading);
}
else
{
dx = (velocidadeMs / omega) * (Math.Sin(theta + dtheta) - Math.Sin(theta));
dy = (velocidadeMs / omega) * (-Math.Cos(theta + dtheta) + Math.Cos(theta));
theta += dtheta; // atualiza yaw
}
// Atualiza posição geográfica (aproximação local)
double R_earth = GPSUtils.RaioDaTerra;
double dLat = (dy / R_earth) * 180.0 / Math.PI;
double dLon = (dx / (R_earth * Math.Cos(pos.Latitude * Math.PI / 180.0))) * 180.0 / Math.PI;
return new GPSModel
{
Momento = DateTime.Now,
Latitude = pos.Latitude + dLat,
Longitude = pos.Longitude + dLon,
OrientacaoReal = GPSUtils.NormalizarAngulo(theta * 180.0 / Math.PI),
Distancia = velocidadeMs * tempoDelta,
Velocidade = velocidadeMs
};
}
}
@ -1057,9 +1127,10 @@ namespace AgroBase.Models
public static string MontarStringPerformance(float? gpuLoad, float? cpuLoad, float? ramUsage, float? cpuTemp, float? gpuTemp)
public static string MontarStringPerformance(float? gpuLoad, float? cpuLoad, float? ramUsage, float? cpuTemp, float? gpuTemp, float? hddLoad)
{
return $"GPU: {gpuLoad?.ToString("0.0") ?? "N/A"}% " +
return $"HDD: {hddLoad?.ToString("0.0") ?? "N/A"}% " +
$"GPU: {gpuLoad?.ToString("0.0") ?? "N/A"}% " +
$"CPU: {cpuLoad?.ToString("0.0") ?? "N/A"}% " +
$"RAM: {ramUsage?.ToString("0.0") ?? "N/A"}% " +
$"Temp CPU: {cpuTemp?.ToString("0.0") ?? "N/A"}°C " +

View File

@ -1,5 +1,4 @@
using AgroBase.Models;
using Emgu.CV.Structure;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@ -162,6 +161,7 @@ namespace AgroBase.Services
private static void ProcessarDadosNMEA(string nmeaData)
{
DateTime Agora = DateTime.Now;
var linhas = nmeaData.Split('\n');
foreach (var linha in linhas)
{
@ -210,7 +210,7 @@ namespace AgroBase.Services
}
PenultimaLeitura.UltimoComandoRespondido = UltimaLeitura.UltimoComandoRespondido;
UltimaLeitura.UltimoComandoRespondido = DateTime.Now;
UltimaLeitura.UltimoComandoRespondido = Agora;
}
private static void ProcessarGPGGA(string sentenca)
@ -559,6 +559,9 @@ namespace AgroBase.Services
return;
}
PenultimaLeitura.Heartbeat = UltimaLeitura.Heartbeat;
UltimaLeitura.Heartbeat = (UltimaLeitura.Heartbeat + 1) % 10;
DefinirAnguloCarroGPS();
AtualizaDadosRedis();
@ -695,7 +698,8 @@ namespace AgroBase.Services
{
// ✅ Obtém os últimos pontos, respeitando o número mínimo de leituras
var pontos = GPSTrajetoria
.OrderByDescending(x => x.DataHora)
.OrderByDescending(x => x.Momento)
.ThenByDescending(x => x.DataHora)
.Take(Math.Min(PontosConsiderarAngulo, GPSTrajetoria.Count))
.ToList();
@ -875,7 +879,8 @@ namespace AgroBase.Services
("rtk", UltimoEnvioCorrecaoRTK.AddSeconds(10) > DateTime.Now),
("hAcc", UltimaLeitura.PrecisaoCm),
("nSatelites", UltimaLeitura.NumeroSatelites.valor),
("freq", UltimaLeitura.NumeroSatelites.frequencia)
("freq", UltimaLeitura.NumeroSatelites.frequencia),
("heartbeat", UltimaLeitura.Heartbeat)
);
}

View File

@ -159,7 +159,10 @@ namespace AgroBase.Services.Operadores
("camera_caminho_id", Variaveis.OperacaoEmAndamento.DispSen?.Dados?.CameraCaminho?.Id ?? ""),
("camera_solo_id", Variaveis.OperacaoEmAndamento.DispSen?.Dados?.CamerasSolo?.FirstOrDefault()?.Id ?? ""),
("path_ia_model_ruas", VersionamentoService.ArquivoModeloStreetDetector.CaminhoCompleto),
("path_ia_model_ervas", VersionamentoService.ArquivoModeloWeedDetector.CaminhoCompleto)
("path_ia_model_ervas", VersionamentoService.ArquivoModeloWeedDetector.CaminhoCompleto),
("path_ia_labelmap_ervas", VersionamentoService.ArquivoModeloLabelmapWeedDetector.CaminhoCompleto),
("angulo_roll_max", VariaveisEquipamento.AnguloInclinacaoRollMax),
("angulo_pitch_max", VariaveisEquipamento.AnguloInclinacaoPitchMax)
);
}
@ -221,10 +224,10 @@ namespace AgroBase.Services.Operadores
("Atu", new
{
qtd_bicos = Variaveis.OperacaoEmAndamento.DispAtu.Dados.QuantidadeBicos,
percent_vertical_deteccao = _Controle.PercentualInicioPulverizacao,
tempo_atuacao = _Controle.TempoAtuacao,
capacidade_reservatorio = Variaveis.OperacaoEmAndamento.CapacidadeReservatorio,
pressao_linha = _Controle.PressaoLinha
pressao_linha = _Controle.PressaoLinha,
percent_vertical_deteccao = _Controle.PercentualInicioPulverizacao,
}
),
("Snr", new

View File

@ -42,6 +42,16 @@ namespace AgroBase.Services
}
}
}
public static VersaoArquivoModel ArquivoModeloLabelmapWeedDetector
{
get
{
lock (_ArquivoLock)
{
return _ArquivosVersionados.Skip(1).FirstOrDefault(x => x.TipoArquivo == TipoArquivoVersionado.ModeloIA_WeedDetector);
}
}
}
public static VersaoArquivoModel ArquivoParametros(T_Code Dispositivo)
{
lock (_ArquivoLock)

View File

@ -29,5 +29,5 @@
"top_topics_and_observing_domains": [ ]
} ],
"hex_encoded_hmac_key": "40F346D3248C3AFDF2BEE1FE496DBD32F7CED6E5AE98B881ABC421AA7E7B5642",
"next_scheduled_calculation_time": "13399060328664266"
"next_scheduled_calculation_time": "13399060328666305"
}

View File

@ -1,3 +1,3 @@
2025/08/01-17:32:12.527 3f40 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
2025/08/01-17:32:12.532 3f40 Recovering log #3
2025/08/01-17:32:12.536 3f40 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/000003.log
2025/08/06-10:48:40.356 1270 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
2025/08/06-10:48:40.362 1270 Recovering log #3
2025/08/06-10:48:40.365 1270 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/08/01-16:44:45.942 d8c Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
2025/08/01-16:44:45.947 d8c Recovering log #3
2025/08/01-16:44:45.950 d8c Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/000003.log
2025/08/06-10:45:42.987 5bbc Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
2025/08/06-10:45:42.993 5bbc Recovering log #3
2025/08/06-10:45:42.995 5bbc 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":"13398640396216877","port":443,"protocol_str":"quic"}],"anonymization":["DAAAAAcAAABmaWxlOi8vAA==",false,0],"network_stats":{"srtt":12790},"server":"https://tile.openstreetmap.org","supports_spdy":true}],"supports_quic":{"address":"2804:d78:609:f200:8962:ca52:629b:6eab","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":"13399048123791313","port":443,"protocol_str":"quic"}],"anonymization":["DAAAAAcAAABmaWxlOi8vAA==",false,0],"network_stats":{"srtt":33724},"server":"https://tile.openstreetmap.org","supports_spdy":true}],"supports_quic":{"address":"192.168.26.32","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":1785612686.323915,"host":"bWGAftl61rqoc0YzqPncsLvQQh/iC2Bdp3ejUeGC83w=","mode":"force-https","sts_include_subdomains":true,"sts_observed":1754076686.32392}],"version":2}
{"sts":[{"expiry":1786019258.180145,"host":"bWGAftl61rqoc0YzqPncsLvQQh/iC2Bdp3ejUeGC83w=","mode":"force-https","sts_include_subdomains":true,"sts_observed":1754483258.180153}],"version":2}

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,3 @@
2025/08/01-17:55:22.636 3f40 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
2025/08/01-17:55:22.637 3f40 Recovering log #3
2025/08/01-17:55:22.640 3f40 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/000003.log
2025/08/06-14:23:57.026 1270 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
2025/08/06-14:23:57.027 1270 Recovering log #3
2025/08/06-14:23:57.030 1270 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/08/01-16:47:06.152 d8c Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
2025/08/01-16:47:06.153 d8c Recovering log #3
2025/08/01-16:47:06.158 d8c Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/000003.log
2025/08/06-10:48:33.159 5bbc Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
2025/08/06-10:48:33.160 5bbc Recovering log #3
2025/08/06-10:48:33.163 5bbc 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/08/01-17:32:12.462 5618 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
2025/08/01-17:32:12.463 5618 Recovering log #7
2025/08/01-17:32:12.463 5618 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/000007.log
2025/08/06-10:48:40.290 5f3c Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
2025/08/06-10:48:40.291 5f3c Recovering log #7
2025/08/06-10:48:40.292 5f3c 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/08/01-16:44:45.861 6538 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
2025/08/01-16:44:45.862 6538 Recovering log #7
2025/08/01-16:44:45.863 6538 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/000007.log
2025/08/06-10:45:42.911 3124 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroBase\bin\x64\Debug\AgroBase.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
2025/08/06-10:45:42.912 3124 Recovering log #7
2025/08/06-10:45:42.912 3124 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 +0,0 @@
1.455D1A3B5F7FA199F27CB165FA6F54DF7972FBB6C62D422A14C2415791175931

View File

@ -1,6 +0,0 @@
{
"description" : "Domain Actions URL List that can work with experiment buckets.",
"listFormat" : 2,
"name" : "DomainActions",
"version" : "3.0.0.14"
}

File diff suppressed because one or more lines are too long

View File

@ -1,383 +0,0 @@
EasyList Repository Licences
Unless otherwise noted, the contents of the EasyList repository
(https://github.com/easylist) is dual licensed under the GNU General
Public License version 3 of the License, or (at your option) any later
version, and Creative Commons Attribution-ShareAlike 3.0 Unported, or
(at your option) any later version. You may use and/or modify the files
as permitted by either licence; if required, "The EasyList authors
(https://easylist.to/)" should be attributed as the source of the
material. All relevant licence files are included in the repository.
Please be aware that files hosted externally and referenced in the
repository, including but not limited to subscriptions other than
EasyList, EasyPrivacy, EasyList Germany and EasyList Italy, may be
available under other conditions; permission must be granted by the
respective copyright holders to authorise the use of their material.
Creative Commons Attribution-ShareAlike 3.0 Unported
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO
WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS
LIABILITY FOR DAMAGES RESULTING FROM ITS USE.
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS
CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS
PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK
OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS
PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND
AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS
LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE
RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS
AND CONDITIONS.
1. Definitions
a. "Adaptation" means a work based upon the Work, or upon the Work and
other pre-existing works, such as a translation, adaptation,
derivative work, arrangement of music or other alterations of a
literary or artistic work, or phonogram or performance and includes
cinematographic adaptations or any other form in which the Work may
be recast, transformed, or adapted including in any form
recognizably derived from the original, except that a work that
constitutes a Collection will not be considered an Adaptation for
the purpose of this License. For the avoidance of doubt, where the
Work is a musical work, performance or phonogram, the
synchronization of the Work in timed-relation with a moving image
("synching") will be considered an Adaptation for the purpose of
this License.
b. "Collection" means a collection of literary or artistic works, such
as encyclopedias and anthologies, or performances, phonograms or
broadcasts, or other works or subject matter other than works
listed in Section 1(f) below, which, by reason of the selection and
arrangement of their contents, constitute intellectual creations,
in which the Work is included in its entirety in unmodified form
along with one or more other contributions, each constituting
separate and independent works in themselves, which together are
assembled into a collective whole. A work that constitutes a
Collection will not be considered an Adaptation (as defined below)
for the purposes of this License.
c. "Creative Commons Compatible License" means a license that is
listed at https://creativecommons.org/compatiblelicenses that has
been approved by Creative Commons as being essentially equivalent
to this License, including, at a minimum, because that license: (i)
contains terms that have the same purpose, meaning and effect as
the License Elements of this License; and, (ii) explicitly permits
the relicensing of adaptations of works made available under that
license under this License or a Creative Commons jurisdiction
license with the same License Elements as this License.
d. "Distribute" means to make available to the public the original and
copies of the Work or Adaptation, as appropriate, through sale or
other transfer of ownership.
e. "License Elements" means the following high-level license
attributes as selected by Licensor and indicated in the title of
this License: Attribution, ShareAlike.
f. "Licensor" means the individual, individuals, entity or entities
that offer(s) the Work under the terms of this License.
g. "Original Author" means, in the case of a literary or artistic
work, the individual, individuals, entity or entities who created
the Work or if no individual or entity can be identified, the
publisher; and in addition (i) in the case of a performance the
actors, singers, musicians, dancers, and other persons who act,
sing, deliver, declaim, play in, interpret or otherwise perform
literary or artistic works or expressions of folklore; (ii) in the
case of a phonogram the producer being the person or legal entity
who first fixes the sounds of a performance or other sounds; and,
(iii) in the case of broadcasts, the organization that transmits
the broadcast.
h. "Work" means the literary and/or artistic work offered under the
terms of this License including without limitation any production
in the literary, scientific and artistic domain, whatever may be
the mode or form of its expression including digital form, such as
a book, pamphlet and other writing; a lecture, address, sermon or
other work of the same nature; a dramatic or dramatico-musical
work; a choreographic work or entertainment in dumb show; a musical
composition with or without words; a cinematographic work to which
are assimilated works expressed by a process analogous to
cinematography; a work of drawing, painting, architecture,
sculpture, engraving or lithography; a photographic work to which
are assimilated works expressed by a process analogous to
photography; a work of applied art; an illustration, map, plan,
sketch or three-dimensional work relative to geography, topography,
architecture or science; a performance; a broadcast; a phonogram; a
compilation of data to the extent it is protected as a
copyrightable work; or a work performed by a variety or circus
performer to the extent it is not otherwise considered a literary
or artistic work.
i. "You" means an individual or entity exercising rights under this
License who has not previously violated the terms of this License
with respect to the Work, or who has received express permission
from the Licensor to exercise rights under this License despite a
previous violation.
j. "Publicly Perform" means to perform public recitations of the Work
and to communicate to the public those public recitations, by any
means or process, including by wire or wireless means or public
digital performances; to make available to the public Works in such
a way that members of the public may access these Works from a
place and at a place individually chosen by them; to perform the
Work to the public by any means or process and the communication to
the public of the performances of the Work, including by public
digital performance; to broadcast and rebroadcast the Work by any
means including signs, sounds or images.
k. "Reproduce" means to make copies of the Work by any means including
without limitation by sound or visual recordings and the right of
fixation and reproducing fixations of the Work, including storage
of a protected performance or phonogram in digital form or other
electronic medium.
2. Fair Dealing Rights. Nothing in this License is intended to reduce,
limit, or restrict any uses free from copyright or rights arising from
limitations or exceptions that are provided for in connection with the
copyright protection under copyright law or other applicable laws.
3. License Grant. Subject to the terms and conditions of this License,
Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
perpetual (for the duration of the applicable copyright) license to
exercise the rights in the Work as stated below:
a. to Reproduce the Work, to incorporate the Work into one or more
Collections, and to Reproduce the Work as incorporated in the
Collections;
b. to create and Reproduce Adaptations provided that any such
Adaptation, including any translation in any medium, takes
reasonable steps to clearly label, demarcate or otherwise identify
that changes were made to the original Work. For example, a
translation could be marked "The original work was translated from
English to Spanish," or a modification could indicate "The original
work has been modified.";
c. to Distribute and Publicly Perform the Work including as
incorporated in Collections; and,
d. to Distribute and Publicly Perform Adaptations.
e. For the avoidance of doubt:
i. Non-waivable Compulsory License Schemes. In those
jurisdictions in which the right to collect royalties through
any statutory or compulsory licensing scheme cannot be waived,
the Licensor reserves the exclusive right to collect such
royalties for any exercise by You of the rights granted under
this License;
ii. Waivable Compulsory License Schemes. In those jurisdictions in
which the right to collect royalties through any statutory or
compulsory licensing scheme can be waived, the Licensor waives
the exclusive right to collect such royalties for any exercise
by You of the rights granted under this License; and,
iii. Voluntary License Schemes. The Licensor waives the right to
collect royalties, whether individually or, in the event that
the Licensor is a member of a collecting society that
administers voluntary licensing schemes, via that society,
from any exercise by You of the rights granted under this
License.
The above rights may be exercised in all media and formats whether now
known or hereafter devised. The above rights include the right to make
such modifications as are technically necessary to exercise the rights
in other media and formats. Subject to Section 8(f), all rights not
expressly granted by Licensor are hereby reserved.
4. Restrictions. The license granted in Section 3 above is expressly
made subject to and limited by the following restrictions:
a. You may Distribute or Publicly Perform the Work only under the
terms of this License. You must include a copy of, or the Uniform
Resource Identifier (URI) for, this License with every copy of the
Work You Distribute or Publicly Perform. You may not offer or
impose any terms on the Work that restrict the terms of this
License or the ability of the recipient of the Work to exercise the
rights granted to that recipient under the terms of the License.
You may not sublicense the Work. You must keep intact all notices
that refer to this License and to the disclaimer of warranties with
every copy of the Work You Distribute or Publicly Perform. When You
Distribute or Publicly Perform the Work, You may not impose any
effective technological measures on the Work that restrict the
ability of a recipient of the Work from You to exercise the rights
granted to that recipient under the terms of the License. This
Section 4(a) applies to the Work as incorporated in a Collection,
but this does not require the Collection apart from the Work itself
to be made subject to the terms of this License. If You create a
Collection, upon notice from any Licensor You must, to the extent
practicable, remove from the Collection any credit as required by
Section 4(c), as requested. If You create an Adaptation, upon
notice from any Licensor You must, to the extent practicable,
remove from the Adaptation any credit as required by Section 4(c),
as requested.
b. You may Distribute or Publicly Perform an Adaptation only under the
terms of: (i) this License; (ii) a later version of this License
with the same License Elements as this License; (iii) a Creative
Commons jurisdiction license (either this or a later license
version) that contains the same License Elements as this License
(e.g., Attribution-ShareAlike 3.0 US)); (iv) a Creative Commons
Compatible License. If you license the Adaptation under one of the
licenses mentioned in (iv), you must comply with the terms of that
license. If you license the Adaptation under the terms of any of
the licenses mentioned in (i), (ii) or (iii) (the "Applicable
License"), you must comply with the terms of the Applicable License
generally and the following provisions: (I) You must include a copy
of, or the URI for, the Applicable License with every copy of each
Adaptation You Distribute or Publicly Perform; (II) You may not
offer or impose any terms on the Adaptation that restrict the terms
of the Applicable License or the ability of the recipient of the
Adaptation to exercise the rights granted to that recipient under
the terms of the Applicable License; (III) You must keep intact all
notices that refer to the Applicable License and to the disclaimer
of warranties with every copy of the Work as included in the
Adaptation You Distribute or Publicly Perform; (IV) when You
Distribute or Publicly Perform the Adaptation, You may not impose
any effective technological measures on the Adaptation that
restrict the ability of a recipient of the Adaptation from You to
exercise the rights granted to that recipient under the terms of
the Applicable License. This Section 4(b) applies to the Adaptation
as incorporated in a Collection, but this does not require the
Collection apart from the Adaptation itself to be made subject to
the terms of the Applicable License.
c. If You Distribute, or Publicly Perform the Work or any Adaptations
or Collections, You must, unless a request has been made pursuant
to Section 4(a), keep intact all copyright notices for the Work and
provide, reasonable to the medium or means You are utilizing: (i)
the name of the Original Author (or pseudonym, if applicable) if
supplied, and/or if the Original Author and/or Licensor designate
another party or parties (e.g., a sponsor institute, publishing
entity, journal) for attribution ("Attribution Parties") in
Licensor's copyright notice, terms of service or by other
reasonable means, the name of such party or parties; (ii) the title
of the Work if supplied; (iii) to the extent reasonably
practicable, the URI, if any, that Licensor specifies to be
associated with the Work, unless such URI does not refer to the
copyright notice or licensing information for the Work; and (iv) ,
consistent with Ssection 3(b), in the case of an Adaptation, a
credit identifying the use of the Work in the Adaptation (e.g.,
"French translation of the Work by Original Author," or "Screenplay
based on original Work by Original Author"). The credit required by
this Section 4(c) may be implemented in any reasonable manner;
provided, however, that in the case of a Adaptation or Collection,
at a minimum such credit will appear, if a credit for all
contributing authors of the Adaptation or Collection appears, then
as part of these credits and in a manner at least as prominent as
the credits for the other contributing authors. For the avoidance
of doubt, You may only use the credit required by this Section for
the purpose of attribution in the manner set out above and, by
exercising Your rights under this License, You may not implicitly
or explicitly assert or imply any connection with, sponsorship or
endorsement by the Original Author, Licensor and/or Attribution
Parties, as appropriate, of You or Your use of the Work, without
the separate, express prior written permission of the Original
Author, Licensor and/or Attribution Parties.
d. Except as otherwise agreed in writing by the Licensor or as may be
otherwise permitted by applicable law, if You Reproduce, Distribute
or Publicly Perform the Work either by itself or as part of any
Adaptations or Collections, You must not distort, mutilate, modify
or take other derogatory action in relation to the Work which would
be prejudicial to the Original Author's honor or reputation.
Licensor agrees that in those jurisdictions (e.g. Japan), in which
any exercise of the right granted in Section 3(b) of this License
(the right to make Adaptations) would be deemed to be a distortion,
mutilation, modification or other derogatory action prejudicial to
the Original Author's honor and reputation, the Licensor will waive
or not assert, as appropriate, this Section, to the fullest extent
permitted by the applicable national law, to enable You to
reasonably exercise Your right under Section 3(b) of this License
(right to make Adaptations) but not otherwise.
5. Representations, Warranties and Disclaimer
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR
OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE,
INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY,
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF
LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF
ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW
THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO
YOU.
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE
LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR
ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR
HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. Termination
a. This License and the rights granted hereunder will terminate
automatically upon any breach by You of the terms of this License.
Individuals or entities who have received Adaptations or
Collections from You under this License, however, will not have
their licenses terminated provided such individuals or entities
remain in full compliance with those licenses. Sections 1, 2, 5, 6,
7, and 8 will survive any termination of this License.
b. Subject to the above terms and conditions, the license granted here
is perpetual (for the duration of the applicable copyright in the
Work). Notwithstanding the above, Licensor reserves the right to
release the Work under different license terms or to stop
distributing the Work at any time; provided, however that any such
election will not serve to withdraw this License (or any other
license that has been, or is required to be, granted under the
terms of this License), and this License will continue in full
force and effect unless terminated as stated above.
8. Miscellaneous
a. Each time You Distribute or Publicly Perform the Work or a
Collection, the Licensor offers to the recipient a license to the
Work on the same terms and conditions as the license granted to You
under this License.
b. Each time You Distribute or Publicly Perform an Adaptation,
Licensor offers to the recipient a license to the original Work on
the same terms and conditions as the license granted to You under
this License.
c. If any provision of this License is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability
of the remainder of the terms of this License, and without further
action by the parties to this agreement, such provision shall be
reformed to the minimum extent necessary to make such provision
valid and enforceable.
d. No term or provision of this License shall be deemed waived and no
breach consented to unless such waiver or consent shall be in
writing and signed by the party to be charged with such waiver or
consent.
e. This License constitutes the entire agreement between the parties
with respect to the Work licensed here. There are no
understandings, agreements or representations with respect to the
Work not specified here. Licensor shall not be bound by any
additional provisions that may appear in any communication from
You. This License may not be modified without the mutual written
agreement of the Licensor and You.
f. The rights granted under, and the subject matter referenced, in
this License were drafted utilizing the terminology of the Berne
Convention for the Protection of Literary and Artistic Works (as
amended on September 28, 1979), the Rome Convention of 1961, the
WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms
Treaty of 1996 and the Universal Copyright Convention (as revised
on July 24, 1971). These rights and subject matter take effect in
the relevant jurisdiction in which the License terms are sought to
be enforced according to the corresponding provisions of the
implementation of those treaty provisions in the applicable
national law. If the standard suite of rights granted under
applicable copyright law includes additional rights not granted
under this License, such additional rights are deemed to be
included in the License; this License is not intended to restrict
the license of any rights under applicable law.
Creative Commons Notice
Creative Commons is not a party to this License, and makes no
warranty whatsoever in connection with the Work. Creative Commons
will not be liable to You or any party on any legal theory for any
damages whatsoever, including without limitation any general,
special, incidental or consequential damages arising in connection
to this license. Notwithstanding the foregoing two (2) sentences, if
Creative Commons has expressly identified itself as the Licensor
hereunder, it shall have all rights and obligations of Licensor.
Except for the limited purpose of indicating to the public that the
Work is licensed under the CCPL, Creative Commons does not authorize
the use by either party of the trademark "Creative Commons" or any
related trademark or logo of Creative Commons without the prior
written consent of Creative Commons. Any permitted use will be in
compliance with Creative Commons' then-current trademark usage
guidelines, as may be published on its website or otherwise made
available upon request from time to time. For the avoidance of
doubt, this trademark restriction does not form part of the License.
Creative Commons may be contacted at https://creativecommons.org/.

View File

@ -1,383 +0,0 @@
EasyList Repository Licences
Unless otherwise noted, the contents of the EasyList repository
(https://github.com/easylist) is dual licensed under the GNU General
Public License version 3 of the License, or (at your option) any later
version, and Creative Commons Attribution-ShareAlike 3.0 Unported, or
(at your option) any later version. You may use and/or modify the files
as permitted by either licence; if required, "The EasyList authors
(https://easylist.to/)" should be attributed as the source of the
material. All relevant licence files are included in the repository.
Please be aware that files hosted externally and referenced in the
repository, including but not limited to subscriptions other than
EasyList, EasyPrivacy, EasyList Germany and EasyList Italy, may be
available under other conditions; permission must be granted by the
respective copyright holders to authorise the use of their material.
Creative Commons Attribution-ShareAlike 3.0 Unported
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO
WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS
LIABILITY FOR DAMAGES RESULTING FROM ITS USE.
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS
CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS
PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK
OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS
PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND
AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS
LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE
RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS
AND CONDITIONS.
1. Definitions
a. "Adaptation" means a work based upon the Work, or upon the Work and
other pre-existing works, such as a translation, adaptation,
derivative work, arrangement of music or other alterations of a
literary or artistic work, or phonogram or performance and includes
cinematographic adaptations or any other form in which the Work may
be recast, transformed, or adapted including in any form
recognizably derived from the original, except that a work that
constitutes a Collection will not be considered an Adaptation for
the purpose of this License. For the avoidance of doubt, where the
Work is a musical work, performance or phonogram, the
synchronization of the Work in timed-relation with a moving image
("synching") will be considered an Adaptation for the purpose of
this License.
b. "Collection" means a collection of literary or artistic works, such
as encyclopedias and anthologies, or performances, phonograms or
broadcasts, or other works or subject matter other than works
listed in Section 1(f) below, which, by reason of the selection and
arrangement of their contents, constitute intellectual creations,
in which the Work is included in its entirety in unmodified form
along with one or more other contributions, each constituting
separate and independent works in themselves, which together are
assembled into a collective whole. A work that constitutes a
Collection will not be considered an Adaptation (as defined below)
for the purposes of this License.
c. "Creative Commons Compatible License" means a license that is
listed at https://creativecommons.org/compatiblelicenses that has
been approved by Creative Commons as being essentially equivalent
to this License, including, at a minimum, because that license: (i)
contains terms that have the same purpose, meaning and effect as
the License Elements of this License; and, (ii) explicitly permits
the relicensing of adaptations of works made available under that
license under this License or a Creative Commons jurisdiction
license with the same License Elements as this License.
d. "Distribute" means to make available to the public the original and
copies of the Work or Adaptation, as appropriate, through sale or
other transfer of ownership.
e. "License Elements" means the following high-level license
attributes as selected by Licensor and indicated in the title of
this License: Attribution, ShareAlike.
f. "Licensor" means the individual, individuals, entity or entities
that offer(s) the Work under the terms of this License.
g. "Original Author" means, in the case of a literary or artistic
work, the individual, individuals, entity or entities who created
the Work or if no individual or entity can be identified, the
publisher; and in addition (i) in the case of a performance the
actors, singers, musicians, dancers, and other persons who act,
sing, deliver, declaim, play in, interpret or otherwise perform
literary or artistic works or expressions of folklore; (ii) in the
case of a phonogram the producer being the person or legal entity
who first fixes the sounds of a performance or other sounds; and,
(iii) in the case of broadcasts, the organization that transmits
the broadcast.
h. "Work" means the literary and/or artistic work offered under the
terms of this License including without limitation any production
in the literary, scientific and artistic domain, whatever may be
the mode or form of its expression including digital form, such as
a book, pamphlet and other writing; a lecture, address, sermon or
other work of the same nature; a dramatic or dramatico-musical
work; a choreographic work or entertainment in dumb show; a musical
composition with or without words; a cinematographic work to which
are assimilated works expressed by a process analogous to
cinematography; a work of drawing, painting, architecture,
sculpture, engraving or lithography; a photographic work to which
are assimilated works expressed by a process analogous to
photography; a work of applied art; an illustration, map, plan,
sketch or three-dimensional work relative to geography, topography,
architecture or science; a performance; a broadcast; a phonogram; a
compilation of data to the extent it is protected as a
copyrightable work; or a work performed by a variety or circus
performer to the extent it is not otherwise considered a literary
or artistic work.
i. "You" means an individual or entity exercising rights under this
License who has not previously violated the terms of this License
with respect to the Work, or who has received express permission
from the Licensor to exercise rights under this License despite a
previous violation.
j. "Publicly Perform" means to perform public recitations of the Work
and to communicate to the public those public recitations, by any
means or process, including by wire or wireless means or public
digital performances; to make available to the public Works in such
a way that members of the public may access these Works from a
place and at a place individually chosen by them; to perform the
Work to the public by any means or process and the communication to
the public of the performances of the Work, including by public
digital performance; to broadcast and rebroadcast the Work by any
means including signs, sounds or images.
k. "Reproduce" means to make copies of the Work by any means including
without limitation by sound or visual recordings and the right of
fixation and reproducing fixations of the Work, including storage
of a protected performance or phonogram in digital form or other
electronic medium.
2. Fair Dealing Rights. Nothing in this License is intended to reduce,
limit, or restrict any uses free from copyright or rights arising from
limitations or exceptions that are provided for in connection with the
copyright protection under copyright law or other applicable laws.
3. License Grant. Subject to the terms and conditions of this License,
Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
perpetual (for the duration of the applicable copyright) license to
exercise the rights in the Work as stated below:
a. to Reproduce the Work, to incorporate the Work into one or more
Collections, and to Reproduce the Work as incorporated in the
Collections;
b. to create and Reproduce Adaptations provided that any such
Adaptation, including any translation in any medium, takes
reasonable steps to clearly label, demarcate or otherwise identify
that changes were made to the original Work. For example, a
translation could be marked "The original work was translated from
English to Spanish," or a modification could indicate "The original
work has been modified.";
c. to Distribute and Publicly Perform the Work including as
incorporated in Collections; and,
d. to Distribute and Publicly Perform Adaptations.
e. For the avoidance of doubt:
i. Non-waivable Compulsory License Schemes. In those
jurisdictions in which the right to collect royalties through
any statutory or compulsory licensing scheme cannot be waived,
the Licensor reserves the exclusive right to collect such
royalties for any exercise by You of the rights granted under
this License;
ii. Waivable Compulsory License Schemes. In those jurisdictions in
which the right to collect royalties through any statutory or
compulsory licensing scheme can be waived, the Licensor waives
the exclusive right to collect such royalties for any exercise
by You of the rights granted under this License; and,
iii. Voluntary License Schemes. The Licensor waives the right to
collect royalties, whether individually or, in the event that
the Licensor is a member of a collecting society that
administers voluntary licensing schemes, via that society,
from any exercise by You of the rights granted under this
License.
The above rights may be exercised in all media and formats whether now
known or hereafter devised. The above rights include the right to make
such modifications as are technically necessary to exercise the rights
in other media and formats. Subject to Section 8(f), all rights not
expressly granted by Licensor are hereby reserved.
4. Restrictions. The license granted in Section 3 above is expressly
made subject to and limited by the following restrictions:
a. You may Distribute or Publicly Perform the Work only under the
terms of this License. You must include a copy of, or the Uniform
Resource Identifier (URI) for, this License with every copy of the
Work You Distribute or Publicly Perform. You may not offer or
impose any terms on the Work that restrict the terms of this
License or the ability of the recipient of the Work to exercise the
rights granted to that recipient under the terms of the License.
You may not sublicense the Work. You must keep intact all notices
that refer to this License and to the disclaimer of warranties with
every copy of the Work You Distribute or Publicly Perform. When You
Distribute or Publicly Perform the Work, You may not impose any
effective technological measures on the Work that restrict the
ability of a recipient of the Work from You to exercise the rights
granted to that recipient under the terms of the License. This
Section 4(a) applies to the Work as incorporated in a Collection,
but this does not require the Collection apart from the Work itself
to be made subject to the terms of this License. If You create a
Collection, upon notice from any Licensor You must, to the extent
practicable, remove from the Collection any credit as required by
Section 4(c), as requested. If You create an Adaptation, upon
notice from any Licensor You must, to the extent practicable,
remove from the Adaptation any credit as required by Section 4(c),
as requested.
b. You may Distribute or Publicly Perform an Adaptation only under the
terms of: (i) this License; (ii) a later version of this License
with the same License Elements as this License; (iii) a Creative
Commons jurisdiction license (either this or a later license
version) that contains the same License Elements as this License
(e.g., Attribution-ShareAlike 3.0 US)); (iv) a Creative Commons
Compatible License. If you license the Adaptation under one of the
licenses mentioned in (iv), you must comply with the terms of that
license. If you license the Adaptation under the terms of any of
the licenses mentioned in (i), (ii) or (iii) (the "Applicable
License"), you must comply with the terms of the Applicable License
generally and the following provisions: (I) You must include a copy
of, or the URI for, the Applicable License with every copy of each
Adaptation You Distribute or Publicly Perform; (II) You may not
offer or impose any terms on the Adaptation that restrict the terms
of the Applicable License or the ability of the recipient of the
Adaptation to exercise the rights granted to that recipient under
the terms of the Applicable License; (III) You must keep intact all
notices that refer to the Applicable License and to the disclaimer
of warranties with every copy of the Work as included in the
Adaptation You Distribute or Publicly Perform; (IV) when You
Distribute or Publicly Perform the Adaptation, You may not impose
any effective technological measures on the Adaptation that
restrict the ability of a recipient of the Adaptation from You to
exercise the rights granted to that recipient under the terms of
the Applicable License. This Section 4(b) applies to the Adaptation
as incorporated in a Collection, but this does not require the
Collection apart from the Adaptation itself to be made subject to
the terms of the Applicable License.
c. If You Distribute, or Publicly Perform the Work or any Adaptations
or Collections, You must, unless a request has been made pursuant
to Section 4(a), keep intact all copyright notices for the Work and
provide, reasonable to the medium or means You are utilizing: (i)
the name of the Original Author (or pseudonym, if applicable) if
supplied, and/or if the Original Author and/or Licensor designate
another party or parties (e.g., a sponsor institute, publishing
entity, journal) for attribution ("Attribution Parties") in
Licensor's copyright notice, terms of service or by other
reasonable means, the name of such party or parties; (ii) the title
of the Work if supplied; (iii) to the extent reasonably
practicable, the URI, if any, that Licensor specifies to be
associated with the Work, unless such URI does not refer to the
copyright notice or licensing information for the Work; and (iv) ,
consistent with Ssection 3(b), in the case of an Adaptation, a
credit identifying the use of the Work in the Adaptation (e.g.,
"French translation of the Work by Original Author," or "Screenplay
based on original Work by Original Author"). The credit required by
this Section 4(c) may be implemented in any reasonable manner;
provided, however, that in the case of a Adaptation or Collection,
at a minimum such credit will appear, if a credit for all
contributing authors of the Adaptation or Collection appears, then
as part of these credits and in a manner at least as prominent as
the credits for the other contributing authors. For the avoidance
of doubt, You may only use the credit required by this Section for
the purpose of attribution in the manner set out above and, by
exercising Your rights under this License, You may not implicitly
or explicitly assert or imply any connection with, sponsorship or
endorsement by the Original Author, Licensor and/or Attribution
Parties, as appropriate, of You or Your use of the Work, without
the separate, express prior written permission of the Original
Author, Licensor and/or Attribution Parties.
d. Except as otherwise agreed in writing by the Licensor or as may be
otherwise permitted by applicable law, if You Reproduce, Distribute
or Publicly Perform the Work either by itself or as part of any
Adaptations or Collections, You must not distort, mutilate, modify
or take other derogatory action in relation to the Work which would
be prejudicial to the Original Author's honor or reputation.
Licensor agrees that in those jurisdictions (e.g. Japan), in which
any exercise of the right granted in Section 3(b) of this License
(the right to make Adaptations) would be deemed to be a distortion,
mutilation, modification or other derogatory action prejudicial to
the Original Author's honor and reputation, the Licensor will waive
or not assert, as appropriate, this Section, to the fullest extent
permitted by the applicable national law, to enable You to
reasonably exercise Your right under Section 3(b) of this License
(right to make Adaptations) but not otherwise.
5. Representations, Warranties and Disclaimer
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR
OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE,
INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY,
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF
LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF
ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW
THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO
YOU.
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE
LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR
ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR
HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. Termination
a. This License and the rights granted hereunder will terminate
automatically upon any breach by You of the terms of this License.
Individuals or entities who have received Adaptations or
Collections from You under this License, however, will not have
their licenses terminated provided such individuals or entities
remain in full compliance with those licenses. Sections 1, 2, 5, 6,
7, and 8 will survive any termination of this License.
b. Subject to the above terms and conditions, the license granted here
is perpetual (for the duration of the applicable copyright in the
Work). Notwithstanding the above, Licensor reserves the right to
release the Work under different license terms or to stop
distributing the Work at any time; provided, however that any such
election will not serve to withdraw this License (or any other
license that has been, or is required to be, granted under the
terms of this License), and this License will continue in full
force and effect unless terminated as stated above.
8. Miscellaneous
a. Each time You Distribute or Publicly Perform the Work or a
Collection, the Licensor offers to the recipient a license to the
Work on the same terms and conditions as the license granted to You
under this License.
b. Each time You Distribute or Publicly Perform an Adaptation,
Licensor offers to the recipient a license to the original Work on
the same terms and conditions as the license granted to You under
this License.
c. If any provision of this License is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability
of the remainder of the terms of this License, and without further
action by the parties to this agreement, such provision shall be
reformed to the minimum extent necessary to make such provision
valid and enforceable.
d. No term or provision of this License shall be deemed waived and no
breach consented to unless such waiver or consent shall be in
writing and signed by the party to be charged with such waiver or
consent.
e. This License constitutes the entire agreement between the parties
with respect to the Work licensed here. There are no
understandings, agreements or representations with respect to the
Work not specified here. Licensor shall not be bound by any
additional provisions that may appear in any communication from
You. This License may not be modified without the mutual written
agreement of the Licensor and You.
f. The rights granted under, and the subject matter referenced, in
this License were drafted utilizing the terminology of the Berne
Convention for the Protection of Literary and Artistic Works (as
amended on September 28, 1979), the Rome Convention of 1961, the
WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms
Treaty of 1996 and the Universal Copyright Convention (as revised
on July 24, 1971). These rights and subject matter take effect in
the relevant jurisdiction in which the License terms are sought to
be enforced according to the corresponding provisions of the
implementation of those treaty provisions in the applicable
national law. If the standard suite of rights granted under
applicable copyright law includes additional rights not granted
under this License, such additional rights are deemed to be
included in the License; this License is not intended to restrict
the license of any rights under applicable law.
Creative Commons Notice
Creative Commons is not a party to this License, and makes no
warranty whatsoever in connection with the Work. Creative Commons
will not be liable to You or any party on any legal theory for any
damages whatsoever, including without limitation any general,
special, incidental or consequential damages arising in connection
to this license. Notwithstanding the foregoing two (2) sentences, if
Creative Commons has expressly identified itself as the Licensor
hereunder, it shall have all rights and obligations of Licensor.
Except for the limited purpose of indicating to the public that the
Work is licensed under the CCPL, Creative Commons does not authorize
the use by either party of the trademark "Creative Commons" or any
related trademark or logo of Creative Commons without the prior
written consent of Creative Commons. Any permitted use will be in
compliance with Creative Commons' then-current trademark usage
guidelines, as may be published on its website or otherwise made
available upon request from time to time. For the avoidance of
doubt, this trademark restriction does not form part of the License.
Creative Commons may be contacted at https://creativecommons.org/.

View File

@ -1 +0,0 @@
(()=>{function e(){"undefined"!=typeof videoAdsBlockerNativeHandler&&videoAdsBlockerNativeHandler.logBlockSuccess()}function t(t,n){if(!t)throw new Error("[override-property-read snippet]: No property to override.");if(void 0===n)throw new Error("[override-property-read snippet]: No value to override with.");let l;if("false"===n)l=!1;else if("true"===n)l=!0;else if("null"===n)l=null;else if("noopFunc"===n)l=()=>{};else if("trueFunc"===n)l=()=>!0;else if("falseFunc"===n)l=()=>!1;else if(/^\d+$/.test(n))l=parseFloat(n);else if(""===n)l=n;else if("undefined"!==n)throw new Error(`[override-property-read snippet]: Value "${n}" is not valid.`);r(window,t,{get:()=>(e(),l),set(){}})}function r(e,t,n){let l=t.indexOf(".");if(-1==l){let r=Object.getOwnPropertyDescriptor(e,t);if(r&&!r.configurable)return;let l=Object.assign({},n,{configurable:!0});if(!r&&!l.get&&l.set){let r=e[t];l.get=()=>r}return void Object.defineProperty(e,t,l)}let o=t.slice(0,l);t=t.slice(l+1);let s=e[o];!s||"object"!=typeof s&&"function"!=typeof s||r(s,t,n);let i=Object.getOwnPropertyDescriptor(e,o);i&&!i.configurable||Object.defineProperty(e,o,{get:()=>s,set:e=>{s=e,!e||"object"!=typeof e&&"function"!=typeof s||r(e,t,n)},configurable:!0})}let n={isOwnProperty:Object.prototype.hasOwnProperty};t("playerResponse.adPlacements","undefined"),t("ytInitialPlayerResponse.adPlacements","undefined"),function(t,r=""){if(!t)throw new Error("Missing paths to prune");let l=t.split(/ +/),o=""!==r?r.split(/ +/):[],s=JSON.parse,i={value(...t){let r;if(r=s.apply(this,t),o.length>0&&o.some((e=>!p(r,e))))return r;for(let t of l){let n=p(r,t);void 0!==n&&(e(),delete n[0][n[1]])}return r}};function p(e,t){if(!(e instanceof window.Object))return;let r=e,l=t.split(".");if(0===l.length)return;for(let e=0;e<l.length-1;e++){let t=l[e];if(!n.isOwnProperty.call(r,t))return;if(r=r[t],!(r instanceof window.Object))return}let o=l[l.length-1];return n.isOwnProperty.call(r,o)?[r,o]:void 0}Object.defineProperty(JSON,"parse",i)}("0.playerResponse.adPlacements 0.playerResponse.playerAds 1.playerResponse.adPlacements 1.playerResponse.playerAds 2.playerResponse.adPlacements 2.playerResponse.playerAds playerResponse.adPlacements playerResponse.playerAds ytInitialPlayerResponse.adPlacements ytInitialPlayerResponse.playerAds adPlacements playerAds adSlots")})();

View File

@ -1 +0,0 @@
1.5110A67904F33F66A66CC9BE4DD3DA419A596DE32DAAE8F62BAA998D3BE5CA83

View File

@ -1,6 +0,0 @@
{
"manifest_version": 2,
"name": "Subresource Filter Rules",
"ruleset_format": 1,
"version": "10.34.0.80"
}

View File

@ -1 +1 @@
{"user_experience_metrics.stability.exited_cleanly":true,"variations_crash_streak":0}
{"user_experience_metrics.stability.exited_cleanly":true,"variations_crash_streak":1}

View File

@ -1 +1 @@
{"hashes":{"00AF3F07B5ABB71F6D30337E1EEF62FA280F06EF19485C0CF6B72171F92CCC0A":{"appid":"kpfehajjjbbcifeehjgfgnabifknmdad","fp":"1.00AF3F07B5ABB71F6D30337E1EEF62FA280F06EF19485C0CF6B72171F92CCC0A"},"1AB07E887ACCA305058EEAB9053C96DC531C2C5C067AB4F30AFA2B31F1EDD966":{"appid":"oankkpibpaokgecfckkdkgaoafllipag","fp":"1.1AB07E887ACCA305058EEAB9053C96DC531C2C5C067AB4F30AFA2B31F1EDD966"},"455D1A3B5F7FA199F27CB165FA6F54DF7972FBB6C62D422A14C2415791175931":{"appid":"pghocgajpebopihickglahgebcmkcekh","fp":"1.455D1A3B5F7FA199F27CB165FA6F54DF7972FBB6C62D422A14C2415791175931"},"4B81B4DF3AD971287E1AE02C449344FCFA5D20431DE17B2BA8854CC9CDCE4089":{"appid":"ahmaebgpfccdhgidjaidaoojjcijckba","fp":"1.4B81B4DF3AD971287E1AE02C449344FCFA5D20431DE17B2BA8854CC9CDCE4089"},"5110A67904F33F66A66CC9BE4DD3DA419A596DE32DAAE8F62BAA998D3BE5CA83":{"appid":"ndikpojcjlepofdkaaldkinkjbeeebkl","fp":"1.5110A67904F33F66A66CC9BE4DD3DA419A596DE32DAAE8F62BAA998D3BE5CA83"},"6B1561D18D6D7D238C1FA4FB8AEF54E1F1E6B574D958BC0A41CA955F90AFD7DC":{"appid":"fgbafbciocncjfbbonhocjaohoknlaco","fp":"1.6B1561D18D6D7D238C1FA4FB8AEF54E1F1E6B574D958BC0A41CA955F90AFD7DC"},"95FD9D48E4FC245A3F3A99A3A16ECD1355050BA3F4AFC555F19A97C7F9B49677":{"appid":"ohckeflnhegojcjlcpbfpciadgikcohk","fp":"1.95FD9D48E4FC245A3F3A99A3A16ECD1355050BA3F4AFC555F19A97C7F9B49677"},"A81D1959892AE4180554347DF1B97834ABBA2E1A5E6B9AEBA000ECEA26EABECC":{"appid":"fppmbhmldokgmleojlplaaodlkibgikh","fp":"1.A81D1959892AE4180554347DF1B97834ABBA2E1A5E6B9AEBA000ECEA26EABECC"},"A99D66CFCE8CA170740CE0403956F4DFAF4683829A89F4B7AD9C95303871E284":{"appid":"eeobbhfgfagbclfofmgbdfoicabjdbkn","fp":"1.A99D66CFCE8CA170740CE0403956F4DFAF4683829A89F4B7AD9C95303871E284"},"b987bdc4f2ad2a409b964921d4a5db1cdbe07f9c98f868293b4cc32acdc42cec":{"appid":"alpjnmnfbgfkmmpcfpejmmoebdndedno","fp":""}}}
{"hashes":{"00AF3F07B5ABB71F6D30337E1EEF62FA280F06EF19485C0CF6B72171F92CCC0A":{"appid":"kpfehajjjbbcifeehjgfgnabifknmdad","fp":"1.00AF3F07B5ABB71F6D30337E1EEF62FA280F06EF19485C0CF6B72171F92CCC0A"},"1AB07E887ACCA305058EEAB9053C96DC531C2C5C067AB4F30AFA2B31F1EDD966":{"appid":"oankkpibpaokgecfckkdkgaoafllipag","fp":"1.1AB07E887ACCA305058EEAB9053C96DC531C2C5C067AB4F30AFA2B31F1EDD966"},"4B81B4DF3AD971287E1AE02C449344FCFA5D20431DE17B2BA8854CC9CDCE4089":{"appid":"ahmaebgpfccdhgidjaidaoojjcijckba","fp":"1.4B81B4DF3AD971287E1AE02C449344FCFA5D20431DE17B2BA8854CC9CDCE4089"},"6B1561D18D6D7D238C1FA4FB8AEF54E1F1E6B574D958BC0A41CA955F90AFD7DC":{"appid":"fgbafbciocncjfbbonhocjaohoknlaco","fp":"1.6B1561D18D6D7D238C1FA4FB8AEF54E1F1E6B574D958BC0A41CA955F90AFD7DC"},"89f43cb3df807293de2772d5f01ac2fc1482b38ccc8fdaee859b80642b7a0487":{"appid":"pghocgajpebopihickglahgebcmkcekh","fp":""},"95FD9D48E4FC245A3F3A99A3A16ECD1355050BA3F4AFC555F19A97C7F9B49677":{"appid":"ohckeflnhegojcjlcpbfpciadgikcohk","fp":"1.95FD9D48E4FC245A3F3A99A3A16ECD1355050BA3F4AFC555F19A97C7F9B49677"},"A81D1959892AE4180554347DF1B97834ABBA2E1A5E6B9AEBA000ECEA26EABECC":{"appid":"fppmbhmldokgmleojlplaaodlkibgikh","fp":"1.A81D1959892AE4180554347DF1B97834ABBA2E1A5E6B9AEBA000ECEA26EABECC"},"A99D66CFCE8CA170740CE0403956F4DFAF4683829A89F4B7AD9C95303871E284":{"appid":"eeobbhfgfagbclfofmgbdfoicabjdbkn","fp":"1.A99D66CFCE8CA170740CE0403956F4DFAF4683829A89F4B7AD9C95303871E284"},"b987bdc4f2ad2a409b964921d4a5db1cdbe07f9c98f868293b4cc32acdc42cec":{"appid":"alpjnmnfbgfkmmpcfpejmmoebdndedno","fp":""},"bcb93cba8636743d1fbd32be3bd8ce8ff602323895bf4d136c26b9bc64b0a6a4":{"appid":"ndikpojcjlepofdkaaldkinkjbeeebkl","fp":""}}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,10 +3,10 @@
"id": 1,
"Arquivo": "model",
"Diretorio": "C:\\AgroBaseModels\\Ervas\\",
"Extensao": ".onnx",
"Extensao": ".blob",
"Versao": "2_1",
"TipoArquivo": 1,
"ArquivoDownload": "weed_detector_model-2_1.onnx"
"ArquivoDownload": "weed_detector_model-2_1.blob"
},
{
"id": 2,

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_d4ee5bbe6ad99a733fb2854c99929025 {
#map_71c541743f0c8faef84495db1742d718 {
position: relative;
width: 100.0%;
height: 100.0%;
@ -54,14 +54,14 @@
<body>
<div class="folium-map" id="map_d4ee5bbe6ad99a733fb2854c99929025" ></div>
<div class="folium-map" id="map_71c541743f0c8faef84495db1742d718" ></div>
</body>
<script>
var map_d4ee5bbe6ad99a733fb2854c99929025 = L.map(
"map_d4ee5bbe6ad99a733fb2854c99929025",
var map_71c541743f0c8faef84495db1742d718 = L.map(
"map_71c541743f0c8faef84495db1742d718",
{
center: [0.0, 0.0],
crs: L.CRS.EPSG3857,
@ -78,7 +78,7 @@
var tile_layer_7671b7be998bb4614c50936cac747db4 = L.tileLayer(
var tile_layer_44cd6f7e825210da22334b9c0a7d73f9 = L.tileLayer(
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
{
"minZoom": 0,
@ -95,7 +95,7 @@
);
tile_layer_7671b7be998bb4614c50936cac747db4.addTo(map_d4ee5bbe6ad99a733fb2854c99929025);
tile_layer_44cd6f7e825210da22334b9c0a7d73f9.addTo(map_71c541743f0c8faef84495db1742d718);
</script>
@ -116,7 +116,7 @@
}
trajeto_json_add({"features": []});
trajeto_json.addTo(map_d4ee5bbe6ad99a733fb2854c99929025);
trajeto_json.addTo(map_71c541743f0c8faef84495db1742d718);
function adicionarGeometria(novaGeometria) {
trajeto_json.addData(novaGeometria);
@ -179,9 +179,9 @@
var marcadorEquipamento = L.marker([0, 0], {
icon: customIcon
}).addTo(map_d4ee5bbe6ad99a733fb2854c99929025);
}).addTo(map_71c541743f0c8faef84495db1742d718);
var marcadorBase = L.marker([0, 0], {}).addTo(map_d4ee5bbe6ad99a733fb2854c99929025);
var marcadorBase = L.marker([0, 0], {}).addTo(map_71c541743f0c8faef84495db1742d718);
var icon = L.AwesomeMarkers.icon(
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
);
@ -246,7 +246,7 @@
}
if (foco) {
map_d4ee5bbe6ad99a733fb2854c99929025.setView(novaPosicao, map_d4ee5bbe6ad99a733fb2854c99929025.getZoom());
map_71c541743f0c8faef84495db1742d718.setView(novaPosicao, map_71c541743f0c8faef84495db1742d718.getZoom());
}
}
@ -268,7 +268,7 @@
marcadorDinamico.setRotationAngle(angulo);
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
map_d4ee5bbe6ad99a733fb2854c99929025.setView(novaPosicao, map_d4ee5bbe6ad99a733fb2854c99929025.getZoom());*/
map_71c541743f0c8faef84495db1742d718.setView(novaPosicao, map_71c541743f0c8faef84495db1742d718.getZoom());*/
});
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {

File diff suppressed because one or more lines are too long

View File

@ -7,8 +7,9 @@ from shared.enums import StatusModulo, T_Code
from shared.contexto_global_redis import ContextoGlobalRedis, CtxKey
class CameraOak:
def __init__(self, mostrar_log, mx_id):
def __init__(self, mostrar_log, mx_id, modelo_ia_onboard=None):
self.mostrar_log = mostrar_log
self.modelo_ia_onboard = modelo_ia_onboard
disp_list = dai.Device.getAllAvailableDevices()
disp_info = next((d for d in disp_list if d.getMxId() == mx_id), None)
@ -79,6 +80,9 @@ class CameraOak:
self.q_imu = self.device.getOutputQueue(name="imu", maxSize=50, blocking=False)
self.imu = IMUCamera(self.q_imu)
if self.modelo_ia_onboard is not None:
self.q_nn = self.device.getOutputQueue(name="nn", maxSize=1, blocking=False)
if self.dispositivo == T_Code.Snr:
dadosSnr = ContextoGlobalRedis.get_operacao().get("Snr", {})
self.parametros = {
@ -184,6 +188,38 @@ class CameraOak:
except Exception as e:
self.mostrar_log(f"[WARN] Falha ao montar pipeline imu: {e}")
if self.modelo_ia_onboard is not None:
from shared.utils import carregar_labelmap_completo
# Carregar mapa de cores
labelmap_path = self.modelo_ia_onboard["ia_labelmap_path"]
self.cor_para_id, self.colormap_rgb, self.classes, self.ignore_rgb = carregar_labelmap_completo(labelmap_path)
RESOLUCAO = self.modelo_ia_onboard["ia_resolution"]
ROI_INICIO = self.modelo_ia_onboard["ia_roi_begin"]
ROI_TAMANHO = self.modelo_ia_onboard["ia_roi_size"]
blob_path = self.modelo_ia_onboard["ia_model_path"]
y1 = 1.0 - (ROI_INICIO + ROI_TAMANHO)
y2 = 1.0 - ROI_INICIO
manip = pipeline.create(dai.node.ImageManip)
manip.initialConfig.setCropRect(0.0, y1, 1.0, y2)
manip.initialConfig.setResize(RESOLUCAO[1], RESOLUCAO[0])
manip.initialConfig.setFrameType(dai.RawImgFrame.Type.RGB888p)
cam.preview.link(manip.inputImage)
nn = pipeline.create(dai.node.NeuralNetwork)
nn.setBlobPath(blob_path)
manip.out.link(nn.input)
xout_nn = pipeline.create(dai.node.XLinkOut)
xout_nn.setStreamName("nn")
nn.out.link(xout_nn.input)
self.mostrar_log("Pipeline de segmentação onboard criado")
return pipeline
def _set_calib(self):
@ -250,6 +286,23 @@ class CameraOak:
"frame_valido": False
}
def requisitar_segmentacao(self):
if not hasattr(self, "q_nn"):
return None, {"erro": "Segmentação não disponível", "duracao": 0, "frame_valido": False}
start = time.time()
try:
in_nn = self.q_nn.get()
out = in_nn.getFirstLayerFp16()
h, w = self.modelo_ia_onboard["ia_resolution"]
out_np = np.array(out, dtype=np.float32).reshape((len(self.classes), h, w))
pred_ids = np.argmax(out_np, axis=0).astype(np.uint8)
dur = time.time() - start
self.timestamp_ultima_segmentacao = time.time()
return pred_ids, {"erro": None, "duracao": dur, "frame_valido": True}
except Exception as e:
dur = time.time() - start
return None, {"erro": str(e), "duracao": dur, "frame_valido": False}
def atualizar_saude(self):
#print("Atualizando saude")

View File

@ -7,7 +7,7 @@ from shared.contexto_global_redis import ContextoGlobalRedis
class ModuloMovimentacaoPadroes():
def __init__(self):
self.padrao_tensao = PadraoDinamico("tensao", faixa_inicial=(38, 42))
self.padrao_tensao = PadraoDinamico("tensao", faixa_inicial=(30, 42))
self.padrao_corrente_motor = PadraoDinamico("corrente_motor", faixa_inicial=(0, 45))
self.padrao_corrente_barramento = PadraoDinamico("corrente_barramento", faixa_inicial=(0, 15))
self.padrao_temperatura_motor = PadraoDinamico("temperatura_motor", faixa_inicial=(10, 60))

View File

@ -14,6 +14,13 @@ from manager_worker.processadores._6_concluido import ProcessadorConcluido
class ManagerWorker:
def __init__(self):
self.processador = None
self.processador_0 = ProcessadorNaoIniciado()
self.processador_1 = ProcessadorParametrizando()
self.processador_2 = ProcessadorCalibrando()
self.processador_3 = ProcessadorAguardando()
self.processador_4 = ProcessadorEmAndamento()
self.processador_5 = ProcessadorParado()
self.processador_6 = ProcessadorConcluido()
def executar(self, envia_resposta):
t0 = time.time()
@ -36,18 +43,18 @@ class ManagerWorker:
_operacao = ContextoGlobalRedis.get_operacao()
status = StatusOperacao(_operacao.get("status", StatusOperacao.NaoIniciado.value))
if status == StatusOperacao.NaoIniciado:
self.processador = ProcessadorNaoIniciado()
elif status == StatusOperacao.Parado:
self.processador = ProcessadorParado()
elif status == StatusOperacao.Calibrando:
self.processador = ProcessadorCalibrando()
self.processador = self.processador_0
elif status == StatusOperacao.Parametrizando:
self.processador = ProcessadorParametrizando()
self.processador = self.processador_1
elif status == StatusOperacao.Calibrando:
self.processador = self.processador_2
elif status == StatusOperacao.Aguardando:
self.processador = ProcessadorAguardando()
self.processador = self.processador_3
elif status == StatusOperacao.EmAndamento:
self.processador = ProcessadorEmAndamento()
self.processador = self.processador_4
elif status == StatusOperacao.Parado:
self.processador = self.processador_5
elif status == StatusOperacao.Concluido:
self.processador = ProcessadorConcluido()
self.processador = self.processador_6
else:
self.processador = None

View File

@ -60,9 +60,10 @@ def main():
if acao == ManagerWorkerCommandType.IniciarMPC:
parametros = dados.get("params", {}).get("parametros")
mapa = dados.get("params", {}).get("mapa")
iniciar_operacao = dados.get("params", {}).get("iniciar_operacao", False)
if parametros is not None:
p_ref = ContextoGlobalRedis.get_operacao().get("ponto_mapa_ref", [])
iniciar_mpc(parametros, mapa, p_ref)
iniciar_mpc(parametros, mapa, p_ref, iniciar_operacao)
elif acao == ManagerWorkerCommandType.AtualizarDadosControle:
#mostrar_log("Adicionado na fila")
fila.adicionar(acao)

View File

@ -16,6 +16,17 @@ def definir_comando(pid: PIDAdaptativo):
_dados_vw = ContextoGlobalRedis.get(CtxKey.DadosVisualWorker, {})
_trajetoria = _contexto.get("Trajetoria", {})
visual_worker_operante = (_snr.get("saude", {}).get("status", StatusModulo.DESCONECTADO.value)) == StatusModulo.OPERANTE.value
_gps_pos_atualizada = _gps.get("heartbeat", 0) != _gps.get("old_heartbeat", 0)
_gps_passos_travados = 0
if not _gps_pos_atualizada:
_gps_passos_travados = _gps.get("pass_locked", 0) + 1
ContextoGlobalRedis.atualizar_ctx_dict(
ContextoGlobalRedis.ModKey(T_Code.Gps),
old_heartbeat=_gps.get("heartbeat", 0),
pass_locked=_gps_passos_travados
)
contexto = {
"Operacao": {
"Status": _operacao.get("status"),
@ -25,6 +36,7 @@ def definir_comando(pid: PIDAdaptativo):
"Latitude": _gps.get("lat", 0),
"Longitude": _gps.get("lon", 0),
"AnguloCarro": _gps.get("theta", 0),
"PassosAtraso": _gps_passos_travados
},
"Carro": {
#"Velocidade": 1.0,
@ -59,10 +71,11 @@ def definir_comando(pid: PIDAdaptativo):
"Equipamento": {
"largura": _equipamento.get("largura", 0.85),
"entre_eixos": _equipamento.get("distancia_entre_eixos", 0.92),
"angulo_roll_max": _equipamento.get("angulo_roll_max", 15.0),
"angulo_pitch_max": _equipamento.get("angulo_pitch_max", 30.0),
}
}
if _tipo_controle == TiposControladorDirecional.MPC:
comando = _regras_taticas(contexto)
@ -136,12 +149,14 @@ def _regras_taticas(contexto):
vw_operante = contexto.get("VisualWorker", {}).get("Operante", False)
if vw_ativado and not vw_operante:
mostrar_log("⚠️ Sensores principais inativos. Rodando controle no modo básico.")
#mostrar_log("⚠️ Sensores principais inativos. Rodando controle no modo básico.")
return _comando_direcional_parado(False)
imu = ContextoGlobalRedis.get_modulo(T_Code.Imu)
if imu is not None and imu.get("saude", {}).get("status", StatusModulo.DESCONECTADO.value) == StatusModulo.OPERANTE.value:
if abs(imu.get("pitch", 0.0)) > 30.0 or abs(imu.get("roll", 0.0)) > 15.0:
ang_roll_max = contexto.get("Equipamento", {}).get("angulo_roll_max", 15.0)
ang_pitch_max = contexto.get("Equipamento", {}).get("angulo_pitch_max", 30.0)
if abs(imu.get("pitch", 0.0)) > ang_pitch_max or abs(imu.get("roll", 0.0)) > ang_roll_max:
mostrar_log(f"🟥 Inclinação perigosa detectada. Parando movimentação. roll: {imu.get('roll')}, pitch: {imu.get('pitch')}, yaw: {imu.get('yaw')}")
return _comando_direcional_parado(True)
@ -168,8 +183,10 @@ def _comando_mapa_gps_mpc(contexto):
mpc = get_mpc()
if mpc is None:
mostrar_log("⚠️ MPC ainda não inicializado.")
ContextoGlobalRedis._atualizar_mpc()
return
ContextoGlobalRedis._atualizar_mpc(do_manager=True, iniciar_operacao=True)
mpc = get_mpc()
if mpc is None:
return
_controle = ContextoGlobalRedis.get_controle()

View File

@ -12,13 +12,17 @@ from shared.gps_handler import GPSHandler
#from shared.visualizador_trajetoria import VisualizadorTrajetoria
_mpc = None
_iniciado = False
def inicializar(parametros, mapa, p_ref):
global _mpc
_mpc = ControladorMPC(parametros_mpc=parametros, pontos_mapa=mapa, p_ref=p_ref)
mostrar_log(f"MPC iniciado! Trajetoria com {len(_mpc.pontos_info)} pontos")
def inicializar(parametros, mapa, p_ref, forcar):
global _mpc, _iniciado
if not _iniciado or len(_mpc.pontos_info) != len(mapa) or forcar:
_mpc = ControladorMPC(parametros_mpc=parametros, pontos_mapa=mapa, p_ref=p_ref)
mostrar_log(f"MPC iniciado! Trajetoria com {len(_mpc.pontos_info)} pontos")
_iniciado = True
def get_mpc():
global _mpc
return _mpc
def comando_parado():
@ -48,6 +52,8 @@ class ControladorMPC:
if pontos_mapa:
self.visitados_execucao = [False] * len(self.pontos_info)
self.executor = ThreadPoolExecutor(max_workers=20)
except Exception as e:
mostrar_log(f"Erro ao inicializar MPC: {e}")
@ -1052,13 +1058,14 @@ class ControladorMPC:
comando = self._processar_mpc_receding(contexto, comando_anterior)
t_exec = max((time.time() - self.ultima_atualizacao), 1e-3)
mostrar_log(f"🧭 Direcional MPC | Parada: {comando['parada_necessaria']} | Movimento: {TipoMovimentoDirecional(comando['tipo']).name} | Ângulo: {comando['angulo']}° | Horizonte: {len(comando['simulacao'])} | dt: {_dt:.2f} s | freq = {(freq_tick):.2f} Hz | t_exec: {t_exec:.2} s | f_exec: {(1.0 / t_exec):.2f} Hz")
#mostrar_log(f"🧭 Direcional MPC | Parada: {comando['parada_necessaria']} | Movimento: {TipoMovimentoDirecional(comando['tipo']).name} | Ângulo: {comando['angulo']}° | Horizonte: {len(comando['simulacao'])} | dt: {_dt:.2f} s | freq = {(freq_tick):.2f} Hz | t_exec: {t_exec:.2} s | f_exec: {(1.0 / t_exec):.2f} Hz")
return comando
except Exception as e:
mostrar_log(f"❌ Erro ao processar compute MPC: {e}")
def _processar_mpc_receding(self, contexto, comando_anterior):
t_init = time.time()
try:
if not self.pontos_info:
return None
@ -1067,6 +1074,10 @@ class ControladorMPC:
pos_lat = GPS.get("Latitude", 0)
pos_lon = GPS.get("Longitude", 0)
pos_theta = GPS.get("AnguloCarro", 0)
pos_passos_atraso = GPS.get("PassosAtraso", 0)
if (pos_passos_atraso > 0):
mostrar_log(f"[GPS] Atraso detectado: simulando {pos_passos_atraso} passos")
theta = np.radians(pos_theta)
velocidade = contexto.get("Carro", {}).get("Velocidade", 0)
x, y = self.gps_handler.converter_latlon_para_xz(pos_lat, pos_lon)
@ -1089,15 +1100,29 @@ class ControladorMPC:
self.passos_horizonte_local = 0
self.qtd_comandos_sucessivos = 0
t_0 = time.time()
passos_atraso = contexto.get("Carro", {}).get("PassosAtraso", 1)
for passo in range(passos_atraso):
angulo_anterior = np.radians(comando_anterior.get("angulo", 0))
tipo_anterior = TipoMovimentoDirecional(comando_anterior.get("tipo", TipoMovimentoDirecional.RodasDianteiras.value))
angulo_anterior = np.radians(comando_anterior.get("angulo", 0))
tipo_anterior = TipoMovimentoDirecional(comando_anterior.get("tipo", TipoMovimentoDirecional.RodasDianteiras.value))
max_simulacoes = min(passos_atraso + pos_passos_atraso, 5)
if max_simulacoes >= 5:
mostrar_log(f"[GPS] Grande atraso detectado: parando por fallback")
return self._comando_fallback_hot_stop(comando_anterior, True)
for passo in range(max_simulacoes):
if self._verifica_tempo_maximo_execucao(t_init, f"previsao_futura passo {passo}"):
return self._comando_fallback_hot_stop(comando_anterior)
_, posicao_futura, _ = self._simular_passo(x, y, theta, tipo_anterior, angulo_anterior, {}, { "tipo": tipo_anterior, "angulo": angulo_anterior }, contexto, deepcopy(self.visitados_execucao))
x, y, theta = posicao_futura[-1]
t_1 = time.time()
simulacao_latlon = []
idx_alvo_correcao = self._corrigir_pontos_visitados(x, y, self.visitados_execucao, idx_alvo_real) # marca pontos antigos como visitados
t_2 = time.time()
#mostrar_log(f"previsao_futura em {(t_1 - t_0):.4f}s, correcao_pontos_visitados em {(t_2 - t_1):.4f}")
if ultimo_ponto:
angulo_final, tipo_final = comando_parado()
parada_necessaria = True
@ -1105,7 +1130,7 @@ class ControladorMPC:
candidatos_ativos = [{
"x": x, "y": y, "theta": theta,
"custo": 0.0,
"comandos": [(TipoMovimentoDirecional(comando_anterior.get("tipo")), np.radians(comando_anterior.get("angulo")))],
"comandos": [(tipo_anterior, angulo_anterior)],
"trajetoria": [],
"visitados": deepcopy(self.visitados_execucao),
"inicial": True
@ -1113,9 +1138,13 @@ class ControladorMPC:
t0 = time.time()
for passo in range(self.qtd_comandos_sucessivos):
#mostrar_log(f"simulacao_horizonte passo {passo}")
if self._verifica_tempo_maximo_execucao(t_init, f"simulacao_horizonte passo {passo}"):
return self._comando_fallback_hot_stop(comando_anterior)
t1 = time.time()
novos_candidatos = []
for candidato in candidatos_ativos:
t1_0 = time.time()
x_atual, y_atual, theta_atual = candidato["x"], candidato["y"], candidato["theta"]
visitados = deepcopy(candidato["visitados"])
cmd_anterior = {
@ -1128,7 +1157,11 @@ class ControladorMPC:
tipos, angs, custos_candidatos = self._gerar_angulos_candidatos_receding(ponto_alvo, (x_atual, y_atual, theta_atual), (x, y, theta), contexto)
t3 = time.time()
#mostrar_log(f"corrigir_pontos_visitados em {(t2 - t1_0):.4f}s, gerar_angulos_candidatos em {(t3 - t2):.4f}s")
def simular_e_gerar(candidato, tipo, angulo):
if self._verifica_tempo_maximo_execucao(t_init, f"simular_e_gerar, tipo {tipo.name}, angulo {np.degrees(angulo):.2f}"):
return self._comando_fallback_hot_stop(comando_anterior)
try:
custo, sim, valido = self._simular_passo(x_atual, y_atual, theta_atual, tipo, angulo, custos_candidatos, cmd_anterior, contexto, deepcopy(visitados))
#print(f"{tipo.name} | angulo: {np.degrees(angulo):.2f} : Custo: {custo}")
@ -1148,17 +1181,26 @@ class ControladorMPC:
mostrar_log(f"Erro ao simular e gerar passo para {tipo.name} | {np.degrees(angulo):.2f}: {e}")
return None
with ThreadPoolExecutor(max_workers=20) as executor:
futures = [executor.submit(simular_e_gerar, candidato, tipo, angulo) for tipo in tipos for angulo in angs]
for fut in as_completed(futures):
novo = fut.result()
if novo is not None:
novos_candidatos.append(novo)
futures = [self.executor.submit(simular_e_gerar, candidato, tipo, angulo) for tipo in tipos for angulo in angs]
try:
for fut in as_completed(futures, timeout=0.3):
try:
novo = fut.result(timeout=0.05)
if novo:
novos_candidatos.append(novo)
except Exception as e:
mostrar_log(f"⚠️ Timeout ou erro em future: {e}")
except Exception as e:
mostrar_log(f"Uma tarefa estourou timeout durante o processo de simular passo no horizonte: {e}")
t4 = time.time()
# Filtro opcional: limitar para os N melhores candidatos
t5 = time.time()
candidatos_ativos = self._selecionar_melhores(novos_candidatos, N=5)
t6 = time.time()
candidatos_ativos = self._filtrar_por_margem_angular(candidatos_ativos, margem_graus=2.0)
t7 = time.time()
#mostrar_log(f"loop_candidatos em {(t5 - t1):.4f}s, melhores em {(t6 - t5):.4f}s, margem em {(t7 - t6):.4f}s")
#print("Melhores candidatos filtrados:")
#for i, c in enumerate(candidatos_ativos):
# comando = c["comandos"][-1] if c["comandos"] else ("-", 0)
@ -1205,6 +1247,25 @@ class ControladorMPC:
except Exception as e:
mostrar_log(f"❌ Erro ao processar MPC: {e}")
return self._comando_fallback_hot_stop(comando_anterior)
def _verifica_tempo_maximo_execucao(self, t_init, processo):
limite = 1.0 / 5.0
delta = time.time() - t_init
hot_stop = delta > limite
if hot_stop:
mostrar_log(f"🚨 Tempo maximo de execucao excedido: {delta}/{limite}, processo: {processo}")
self.executor.shutdown(wait=False)
self.executor = ThreadPoolExecutor(max_workers=20)
return hot_stop
def _comando_fallback_hot_stop(self, comando_anterior, parada_necessaria: bool = False):
return {
"angulo": comando_anterior.get("angulo", 0),
"tipo": comando_anterior.get("tipo", TipoMovimentoDirecional.RodasDianteiras.value),
"simulacao": [],
"parada_necessaria": parada_necessaria
}
def _gerar_angulos_candidatos_receding(self, ponto_alvo, ponto_atual, ponto_ref, contexto):
try:
@ -1330,19 +1391,24 @@ class ControladorMPC:
return tipo, ang, custo + custo_ideal
return None
with ThreadPoolExecutor(max_workers=20) as executor:
for tipo in tipos:
for ang in angulos_rad:
tarefas.append(executor.submit(avaliar, tipo, ang))
for tipo in tipos:
for ang in angulos_rad:
tarefas.append(self.executor.submit(avaliar, tipo, ang))
for fut in as_completed(tarefas):
res = fut.result()
if res:
tipo, ang, custo = res
tipos_validos.add(tipo)
angulos_validos.add(ang)
chave = (tipo.value, round(float(np.degrees(ang)), 2))
custos_candidatos[chave] = custo
try:
for fut in as_completed(tarefas, timeout=0.3):
try:
res = fut.result(timeout=0.05)
if res:
tipo, ang, custo = res
tipos_validos.add(tipo)
angulos_validos.add(ang)
chave = (tipo.value, round(float(np.degrees(ang)), 2))
custos_candidatos[chave] = custo
except Exception as e:
mostrar_log(f"⚠️ Timeout ou erro em future: {e}")
except Exception as e:
mostrar_log(f"Uma tarefa estourou timeout durante o processo de filtrar candidatos validos na matriz de custo: {e}")
return list(tipos_validos), list(angulos_validos), custos_candidatos
except Exception as e:
@ -1363,7 +1429,7 @@ class ControladorMPC:
passos = math.ceil(dist_min / distancia_m)
for _ in range(passos):
x_temp, y_temp, theta_temp = self._nova_posicao(x_temp, y_temp, theta_temp, omega, velocidade)
x_temp, y_temp, theta_temp = self._nova_posicao(x_temp, y_temp, theta_temp, omega, velocidade, tipo, angulo)
traj.append((x_temp, y_temp, theta_temp))
return traj
@ -1506,13 +1572,15 @@ class ControladorMPC:
angulo_caminho = np.radians(contexto.get("Carro", {}).get("AnguloCaminho", 0.0))
status_carro = StatusCarroMapa(contexto.get("Carro", {}).get("Status", StatusCarroMapa.Parado.value))
dentro_corredor = contexto.get("Carro", {}).get("DentroCorredor", False)
#omega_bkp = self.gps_handler.calcular_omega_bkp(velocidade, angulo_testado, tipo)
omega = self.gps_handler.calcular_omega(velocidade, angulo_testado, tipo)
#print(f"Omega novo: {omega}, Omega antigo: {omega_bkp}, Velocidade: {velocidade}, Angulo: {angulo_testado}, Tipo: {tipo.name}")
custo_visual_worker = custos_candidatos.get(chave, 0.0)
for passo in range(self.passos_horizonte_local):
try:
#old_theta = theta_sim
x_sim, y_sim, theta_sim = self._nova_posicao(x_sim, y_sim, theta_sim, omega, velocidade)
x_sim, y_sim, theta_sim = self._nova_posicao(x_sim, y_sim, theta_sim, omega, velocidade, tipo, angulo_testado)
simulacoes.append((x_sim, y_sim, theta_sim))
@ -1561,7 +1629,7 @@ 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)], False
def _nova_posicao(self, x, y, theta, omega, velocidade):
def _nova_posicao(self, x, y, theta, omega, velocidade, tipo, angulo_rad):
distancia_m = velocidade * self.dt
theta_sim = theta + (omega * self.dt)
@ -1569,3 +1637,35 @@ class ControladorMPC:
y_sim = y + (np.cos(theta_sim) * distancia_m)
return x_sim, y_sim, theta_sim
def _nova_posicao_new(self, x, y, theta, omega, velocidade, tipo, angulo_rad):
dt = self.dt
v = velocidade
distancia = v * dt
if tipo == TipoMovimentoDirecional.MovimentoDiagonal:
# crab: yaw não muda; desloca na direção (theta + steer)
move_heading = theta + angulo_rad
theta_sim = theta
dx = distancia * np.sin(move_heading) # Leste
dy = distancia * np.cos(move_heading) # Norte
x_sim = x + dx
y_sim = y + dy
return x_sim, y_sim, theta_sim
# Demais modos: pode ter guinada
if abs(omega) < 1e-6:
# reta
theta_sim = theta
dx = distancia * np.cos(theta_sim)
dy = distancia * np.sin(theta_sim)
x_sim = x - dx
y_sim = y - dy
return x_sim, y_sim, theta_sim
else:
# arco (uniciclo, 0=N, +θ horário)
dtheta = omega * dt
x_sim = x - (v / omega) * (np.cos(theta + dtheta) - np.cos(theta))
y_sim = y - (v / omega) * (-np.sin(theta + dtheta) + np.sin(theta))
theta_sim = theta + dtheta
return x_sim, y_sim, theta_sim

View File

@ -4,7 +4,13 @@ from manager_worker.config import mostrar_log
from shared.contexto_global_redis import ContextoGlobalRedis, CtxKey
def comando_controle(percentual_velocidade: float, angulo: float, tipo_movimento: int, simulacao = []):
heartbeat = 1 if ContextoGlobalRedis.get_controle().get("heartbeat", 0) == 0 else 0
hb_atual = ContextoGlobalRedis.get_controle().get("heartbeat", 0)
try:
hb_atual = int(hb_atual) % 10
except:
hb_atual = 0
heartbeat = (hb_atual + 1) % 10
ContextoGlobalRedis.atualizar_ctx_dict(
CtxKey.DadosControle,
angulo_sp=angulo,

View File

@ -6,6 +6,7 @@ import json
from enum import Enum
from shared.enums import ManagerWorkerCommandType, ModoOperacao, StatusModulo, StatusOperacao, T_Code, TiposControladorDirecional, WeedWorkerCommandType
from manager_worker.modulos.mpc import inicializar as iniciar_mpc
class CtxKey(str, Enum):
DadosCameras = "ctx:dados_cameras"
@ -304,7 +305,7 @@ class ContextoGlobalRedis:
return
# Verifica se ainda está aguardando tempo inicial
tempo_aguardando = _operacao.get("tempo_aguardando", 0)
tempo_aguardando = cls.get_operacao().get("tempo_aguardando", 0)
em_espera = (tempo_aguardando + _operacao.get("tempo_aguardar_inicio_operacao", 25)) > agora
if em_espera:
if status_atual != StatusOperacao.Aguardando:
@ -360,7 +361,7 @@ class ContextoGlobalRedis:
@classmethod
def _iniciar_operacao(cls):
cls.publicar_comando(CmdKey.WeedWorkerRx, { "cmd": WeedWorkerCommandType.ReiniciarDeteccoes.value })
cls._atualizar_mpc()
cls._atualizar_mpc(do_manager=False, iniciar_operacao=True)
cls.atualizar_ctx_dict(
CtxKey.DadosOperacao,
tempo_aguardando=time.time()
@ -371,12 +372,16 @@ class ContextoGlobalRedis:
cls.publicar_comando(CmdKey.ManagerWorkerTx, { "cmd": ManagerWorkerCommandType.FinalizarOperacao.value })
@classmethod
def _atualizar_mpc(cls):
def _atualizar_mpc(cls, do_manager=False, iniciar_operacao=False):
dados_dir = cls.get_operacao().get("Dir", {})
if (dados_dir.get("tipo_controle", TiposControladorDirecional.Manual.value) == TiposControladorDirecional.MPC.value):
dados_mpc = dados_dir.get("mpc", {})
mapa = cls.get_operacao().get("pontos_mapa", [])
cls.publicar_comando(CmdKey.ManagerWorkerRx, { "cmd": ManagerWorkerCommandType.IniciarMPC.value, "params": { "parametros": dados_mpc, "mapa": mapa } })
if do_manager:
p_ref = cls.get_operacao().get("ponto_mapa_ref", [])
iniciar_mpc(dados_mpc, mapa, p_ref, iniciar_operacao)
else:
cls.publicar_comando(CmdKey.ManagerWorkerRx, { "cmd": ManagerWorkerCommandType.IniciarMPC.value, "params": { "parametros": dados_mpc, "mapa": mapa, "iniciar_operacao": iniciar_operacao } })
@classmethod
def _atualizar_pontos_mapa(cls):
@ -406,7 +411,7 @@ class ContextoGlobalRedis:
)
if len(pontos_info) > 0:
cls._atualizar_mpc()
cls._atualizar_mpc(do_manager=False, iniciar_operacao=False)

View File

@ -1,6 +1,5 @@
import time
import numpy as np
from shared.enums import TipoMovimentoDirecional
class GPSHandler:
@ -37,7 +36,7 @@ class GPSHandler:
orient = np.arctan2(dx, dy)
return orient % (2 * np.pi)
def calcular_omega(self, v, angulo_rad, tipo):
def calcular_omega_bkp(self, v, angulo_rad, tipo):
tan_delta = np.tan(angulo_rad)
if abs(angulo_rad) < 0.01:
return 0.0
@ -53,6 +52,52 @@ class GPSHandler:
R *= k # Aplica fator de correção
return v / R
def calcular_omega(self, v, angulo_rad, tipo):
from shared.contexto_global_redis import ContextoGlobalRedis
L = ContextoGlobalRedis.get_equipamento().get("distancia_entre_eixos", 0.92)
# Define deltas por modo
df = 0.0
dr = 0.0
if tipo == TipoMovimentoDirecional.RodasDianteiras:
df = angulo_rad
elif tipo == TipoMovimentoDirecional.RodasTraseiras:
dr = angulo_rad
elif tipo == TipoMovimentoDirecional.MovimentoArco:
df = angulo_rad
dr = -angulo_rad
elif tipo == TipoMovimentoDirecional.MovimentoDiagonal:
# crab: sem guinada
return 0.0
tf = np.tan(df)
tr = np.tan(dr)
# deadband na tangente (evita jitter perto de zero)
if abs(tf) < 1e-6: tf = 0.0
if abs(tr) < 1e-6: tr = 0.0
# curvatura geométrica
if tipo == TipoMovimentoDirecional.RodasDianteiras:
kappa = tf / L
elif tipo == TipoMovimentoDirecional.RodasTraseiras:
kappa = tr / L
elif tipo == TipoMovimentoDirecional.MovimentoArco:
kappa = (tf - tr) / L
else:
kappa = 0.0
# understeer simples (opcional; ajuste Ku em campo)
Ku = 2.5 # s^2/m^2 (comece por ~0.050.2)
kappa_eff = kappa / (1.0 + Ku * v * v)
# CONVENÇÃO: 0 rad = Norte; +θ = horário => omega precisa do "-"
omega = v * kappa_eff
# clamp opcional (evita saltos com dt grande)
omega_max = 4.0 # rad/s (exemplo; ajuste)
if omega > omega_max: omega = omega_max
if omega < -omega_max: omega = -omega_max
return omega
def converter_trajetoria_para_latlon(self, trajetoria):
simulacao_latlon = []
try:

View File

@ -60,4 +60,115 @@ def analisar_linhas_por_profundidade(matriz, campo, fov_h):
return linhas_info
except Exception as e:
mostrar_log(f"❌ Erro ao analisar linhas por profundidade: {e}")
mostrar_log(f"❌ Erro ao analisar linhas por profundidade: {e}")
# ----------------------------
# Helpers LABELMAP
# ----------------------------
def carregar_labelmap_completo(caminho):
cor_para_id = {}
id_para_nome = {}
cores_rgb = []
with open(caminho, 'r') as arquivo:
idx = 0
for linha in arquivo:
if linha.startswith("#") or not linha.strip():
continue
partes = linha.strip().split(':')
if len(partes) >= 2:
nome_classe, cor_rgb_str = partes[0], partes[1]
r, g, b = map(int, cor_rgb_str.split(','))
cor_rgb = (r, g, b)
if nome_classe.lower() == "ignore":
ignore_rgb = cor_rgb
continue # NÃO adiciona ignore no LUT de classes
cor_para_id[cor_rgb] = idx
cores_rgb.append(cor_rgb)
id_para_nome[idx] = nome_classe
idx += 1
print(f"Mapa: {cor_para_id}")
print(f"Colormap RGB: {cores_rgb}")
print(f"Classes: {id_para_nome}")
print(f"Ignore RGB: {ignore_rgb}")
return cor_para_id, cores_rgb, id_para_nome, ignore_rgb
def converter_mask_rgb_para_ids(img_rgb, mapa_rgb, ignore_id):
h, w, _ = img_rgb.shape
mask = np.ones((h, w), dtype=np.uint8) * ignore_id # Inicializa como ignore
for cor, classe_id in mapa_rgb.items():
r, g, b = cor
cond = (img_rgb[:,:,0]==r) & (img_rgb[:,:,1]==g) & (img_rgb[:,:,2]==b)
mask[cond] = classe_id
# Pixels brancos (ou ignore_bgr) continuam como 255
return mask
def converter_mask_ids_para_rgb(mask_ids: np.ndarray, mapa_rgb: dict, ignore_id: int = 255) -> np.ndarray:
h, w = mask_ids.shape
rgb = np.zeros((h, w, 3), dtype=np.uint8)
for class_id, color in enumerate(mapa_rgb):
rgb[mask_ids == class_id] = color
rgb[mask_ids == ignore_id] = [255, 255, 255]
return rgb
def desenhar_legenda_vertical(colormap_rgb, classes, largura=200):
"""
Retorna uma imagem com a legenda das classes (cor + nome)
"""
nomes_classes = [classes[i] for i in range(len(classes))]
altura_por_classe = 30
altura_total = altura_por_classe * len(colormap_rgb)
legenda = np.ones((altura_total, largura, 3), dtype=np.uint8) * 255
for idx, (rgb, nome) in enumerate(zip(colormap_rgb, nomes_classes)):
y = idx * altura_por_classe
color = tuple(int(c) for c in rgb)
cv2.rectangle(legenda, (10, y + 5), (30, y + 25), color, -1)
cv2.putText(legenda, nome, (40, y + 20),
cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 0, 0), 1, cv2.LINE_AA)
return legenda
def desenhar_legenda_horizontal(colormap_rgb, classes, altura=30, largura_por_classe=120):
"""
Retorna uma imagem com a legenda das classes (cor + nome), em uma única linha horizontal
"""
nomes_classes = [classes[i] for i in range(len(classes))]
largura_total = largura_por_classe * len(colormap_rgb)
legenda = np.ones((altura, largura_total, 3), dtype=np.uint8) * 255 # faixa branca
for idx, (rgb, nome) in enumerate(zip(colormap_rgb, nomes_classes)):
x = idx * largura_por_classe
color = tuple(int(c) for c in rgb)
# Retângulo colorido
cv2.rectangle(legenda, (x + 10, 5), (x + 30, 25), color, -1)
# Texto da classe
cv2.putText(legenda, nome, (x + 35, 20),
cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 0, 0), 1, cv2.LINE_AA)
return legenda
# ----------------------------
# Helpers ROI
# ----------------------------
def compute_roi_indices(H: int, zona_inicio: float, faixa_atuacao: float):
y_inicio = int((1.0 - zona_inicio) * H)
y_fim = int((1.0 - (zona_inicio + faixa_atuacao)) * H)
y_fim = max(0, min(H, y_fim))
y_inicio = max(0, min(H, y_inicio))
if y_fim >= y_inicio:
y_fim = max(0, y_inicio - 1)
return y_fim, y_inicio
def resize_keep_width(img: np.ndarray, new_w: int, min_h: int) -> np.ndarray:
h, w = img.shape[:2]
new_h = int(round(new_w * (h / w)))
if min_h is not None and new_h < min_h:
new_h = min_h
return cv2.resize(img, (new_w, new_h), interpolation=cv2.INTER_AREA)

Some files were not shown because too many files have changed in this diff Show More