ajustes para fixacao via survery in
This commit is contained in:
parent
a8f9bf9817
commit
7a6707d0ef
|
|
@ -259,25 +259,26 @@ namespace OperationControl.Services
|
||||||
if (!fixar)
|
if (!fixar)
|
||||||
{
|
{
|
||||||
Models.Variaveis.MostrarLog("Configurando módulo como rover parado...");
|
Models.Variaveis.MostrarLog("Configurando módulo como rover parado...");
|
||||||
await BaseFix.ConfigurarComoRoverParadoAsync(
|
await BaseFix.ConfigurarComoRoverParadoAsync(portaUsb: portaUsb, portaEntrada: portaEntrada);
|
||||||
portaUsb: portaUsb,
|
|
||||||
portaEntrada: portaEntrada);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sucesso = false;
|
bool sucesso = false;
|
||||||
string mensagem = "";
|
string mensagem = "";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
BaseFix.fimProcesso = null;
|
BaseFix.fimProcesso = null;
|
||||||
BaseFix.inicioProcesso = DateTime.UtcNow;
|
BaseFix.inicioProcesso = DateTime.UtcNow;
|
||||||
BaseFix.inicioFix = DateTime.UtcNow;
|
BaseFix.inicioFix = DateTime.UtcNow;
|
||||||
|
BaseFix.CorrecaoEmAndamento = true;
|
||||||
|
|
||||||
Models.Variaveis.MostrarLog($"Aplicando posição fixa da base com o método {metodo}...");
|
Models.Variaveis.MostrarLog($"Aplicando posição fixa da base com o método {metodo}...");
|
||||||
|
|
||||||
switch (metodo)
|
switch (metodo)
|
||||||
{
|
{
|
||||||
case MetodoFixacaoBase.Ntrip:
|
case MetodoFixacaoBase.Ntrip:
|
||||||
|
BaseFix.DefinirTempos(segsFixEstavel: TempoSurveryIn, segsJanelaSegs: 600, metodo: metodo);
|
||||||
sucesso = await BaseFix.FixarBaseViaNtripAsync(
|
sucesso = await BaseFix.FixarBaseViaNtripAsync(
|
||||||
portaUsb: portaUsb,
|
portaUsb: portaUsb,
|
||||||
portaSaida: portaSaida,
|
portaSaida: portaSaida,
|
||||||
|
|
@ -294,31 +295,46 @@ namespace OperationControl.Services
|
||||||
Models.Variaveis.MostrarLog("Parando correção NTRIP...");
|
Models.Variaveis.MostrarLog("Parando correção NTRIP...");
|
||||||
CorrecaoRTK_Ntrip = false;
|
CorrecaoRTK_Ntrip = false;
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
},
|
}
|
||||||
segsFixEstavel: TempoSurveryIn
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MetodoFixacaoBase.SurveyIn:
|
case MetodoFixacaoBase.SurveyIn:
|
||||||
|
BaseFix.DefinirTempos(segsFixEstavel: TempoSurveryIn, segsJanelaSegs: TempoSurveryIn + 10, metodo: metodo);
|
||||||
await ConfigurarModuloBase(tempo_fixacao: TempoSurveryIn, porta_usb: portaUsb, porta_saida: portaSaida);
|
await ConfigurarModuloBase(tempo_fixacao: TempoSurveryIn, porta_usb: portaUsb, porta_saida: portaSaida);
|
||||||
while (UltimaLeitura.QualidadeFix != TiposCorrecaoGPS.BaseFix && BaseFix.inicioFix != null && (DateTime.UtcNow - BaseFix.inicioFix).Value.TotalSeconds < TempoSurveryIn)
|
while (UltimaLeitura.QualidadeFix != TiposCorrecaoGPS.BaseFix && BaseFix.inicioFix != null && (DateTime.UtcNow - BaseFix.inicioFix).Value.TotalSeconds < TempoSurveryIn)
|
||||||
|
{
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
|
}
|
||||||
|
sucesso = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MetodoFixacaoBase.Manual:
|
case MetodoFixacaoBase.Manual:
|
||||||
if (lat.HasValue && lon.HasValue && alt.HasValue)
|
if (lat.HasValue && lon.HasValue && alt.HasValue)
|
||||||
|
{
|
||||||
|
BaseFix.DefinirTempos(segsFixEstavel: 10, segsJanelaSegs: 10, metodo: metodo);
|
||||||
await BaseFix.AplicarBaseFixAsync(portaUsb, portaSaida, baseId, lat.Value, lon.Value, alt.Value);
|
await BaseFix.AplicarBaseFixAsync(portaUsb, portaSaida, baseId, lat.Value, lon.Value, alt.Value);
|
||||||
|
sucesso = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aguarda 10 segundos para ver se o UM982 pegou o BaseFix
|
// Aguarda 10 segundos para ver se o UM982 pegou o BaseFix
|
||||||
while (sucesso && UltimaLeitura.QualidadeFix != TiposCorrecaoGPS.BaseFix && BaseFix.inicioFix != null && (DateTime.UtcNow - BaseFix.inicioFix).Value.TotalSeconds < 10)
|
DateTime fimFix = DateTime.UtcNow;
|
||||||
|
while (sucesso && UltimaLeitura.QualidadeFix != TiposCorrecaoGPS.BaseFix && BaseFix.inicioFix != null && (DateTime.UtcNow - fimFix).TotalSeconds < 10)
|
||||||
{
|
{
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Models.Variaveis.MostrarLog($"Erro ao definir posicao da base: {ex.Message}");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
BaseFix.fimProcesso = DateTime.UtcNow;
|
BaseFix.fimProcesso = DateTime.UtcNow;
|
||||||
BaseFix.FixLiberado = false;
|
BaseFix.FixLiberado = false;
|
||||||
|
BaseFix.CorrecaoEmAndamento = false;
|
||||||
|
|
||||||
sucesso = UltimaLeitura.QualidadeFix == TiposCorrecaoGPS.BaseFix;
|
sucesso = UltimaLeitura.QualidadeFix == TiposCorrecaoGPS.BaseFix;
|
||||||
mensagem = sucesso ? $"Posição da base aplicada com sucesso com o método {metodo}." : $"Falha ao aplicar posição da base com o método {metodo}.";
|
mensagem = sucesso ? $"Posição da base aplicada com sucesso com o método {metodo}." : $"Falha ao aplicar posição da base com o método {metodo}.";
|
||||||
|
|
@ -330,7 +346,7 @@ namespace OperationControl.Services
|
||||||
BaseFix.AltitudeElpsoidalFix = UltimaLeitura.AltitudeElipsoidal;
|
BaseFix.AltitudeElpsoidalFix = UltimaLeitura.AltitudeElipsoidal;
|
||||||
BaseFix.OrientacaoFix = UltimaLeitura.OrientacaoReal;
|
BaseFix.OrientacaoFix = UltimaLeitura.OrientacaoReal;
|
||||||
|
|
||||||
if (AppShell.Mock)
|
if (AppShell.Mock && lat.HasValue && lon.HasValue && alt.HasValue)
|
||||||
{
|
{
|
||||||
UltimaLeitura.Latitude = lat.Value;
|
UltimaLeitura.Latitude = lat.Value;
|
||||||
UltimaLeitura.Longitude = lon.Value;
|
UltimaLeitura.Longitude = lon.Value;
|
||||||
|
|
@ -342,6 +358,7 @@ namespace OperationControl.Services
|
||||||
Models.Variaveis.MostrarLog(mensagem);
|
Models.Variaveis.MostrarLog(mensagem);
|
||||||
Models.Variaveis.Dock?._vm?.FinalizarFixacaoBase(sucesso, mensagem);
|
Models.Variaveis.Dock?._vm?.FinalizarFixacaoBase(sucesso, mensagem);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task ConfigurarModuloBase(string porta_usb = "com3", string porta_saida = "com2", int tempo_fixacao = 60)
|
private async Task ConfigurarModuloBase(string porta_usb = "com3", string porta_saida = "com2", int tempo_fixacao = 60)
|
||||||
{
|
{
|
||||||
|
|
@ -1226,6 +1243,7 @@ namespace OperationControl.Services
|
||||||
public DateTime? fimProcesso = null;
|
public DateTime? fimProcesso = null;
|
||||||
private int segundosFixEstavel = 120;
|
private int segundosFixEstavel = 120;
|
||||||
private int maxJanelaSegundos = 120;
|
private int maxJanelaSegundos = 120;
|
||||||
|
private MetodoFixacaoBase metodo = MetodoFixacaoBase.Ntrip;
|
||||||
public double Progresso
|
public double Progresso
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -1253,7 +1271,7 @@ namespace OperationControl.Services
|
||||||
string progresso = "";
|
string progresso = "";
|
||||||
if (CorrecaoEmAndamento)
|
if (CorrecaoEmAndamento)
|
||||||
{
|
{
|
||||||
progresso = $"Recebendo correção RTK via Ntrip. Progresso geral: {ProgressoGeral:F2}%, Progresso correção: {Progresso:F2}%";
|
progresso = $"Recebendo correção RTK via {metodo}. Progresso geral: {ProgressoGeral:F2}%, Progresso correção: {Progresso:F2}%";
|
||||||
}
|
}
|
||||||
else if (PosicaoBaseFixada && CorrecaoAbsoluta && inicioProcesso.HasValue && fimProcesso.HasValue)
|
else if (PosicaoBaseFixada && CorrecaoAbsoluta && inicioProcesso.HasValue && fimProcesso.HasValue)
|
||||||
{
|
{
|
||||||
|
|
@ -1283,6 +1301,12 @@ namespace OperationControl.Services
|
||||||
public double AltitudeElpsoidalFix { get; set; }
|
public double AltitudeElpsoidalFix { get; set; }
|
||||||
public double OrientacaoFix { get; set; }
|
public double OrientacaoFix { get; set; }
|
||||||
|
|
||||||
|
public void DefinirTempos(int segsFixEstavel, int segsJanelaSegs, MetodoFixacaoBase metodo)
|
||||||
|
{
|
||||||
|
segundosFixEstavel = segsFixEstavel;
|
||||||
|
maxJanelaSegundos = segsJanelaSegs;
|
||||||
|
}
|
||||||
|
|
||||||
public void ReiniciarFix()
|
public void ReiniciarFix()
|
||||||
{
|
{
|
||||||
CorrecaoEmAndamento = false;
|
CorrecaoEmAndamento = false;
|
||||||
|
|
@ -1293,16 +1317,11 @@ namespace OperationControl.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===== 1) Função principal =====
|
// ===== 1) Função principal =====
|
||||||
public async Task<bool> FixarBaseViaNtripAsync(string portaUsb = "com3", string portaEntrada = "com2", string portaSaida = "com2", string baseId = "957", int segsFixEstavel = 120, int maxJanelaSegs = 600, double madK = 3.5, Func<Task> startNtrip = null, Func<Task> stopNtrip = null)
|
public async Task<bool> FixarBaseViaNtripAsync(string portaUsb = "com3", string portaEntrada = "com2", string portaSaida = "com2", string baseId = "957", double madK = 3.5, Func<Task> startNtrip = null, Func<Task> stopNtrip = null)
|
||||||
{
|
{
|
||||||
if (CorrecaoEmAndamento || !APIService.HasInternet)
|
if (!APIService.HasInternet)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CorrecaoEmAndamento = true;
|
|
||||||
|
|
||||||
segundosFixEstavel = segsFixEstavel;
|
|
||||||
maxJanelaSegundos = maxJanelaSegs;
|
|
||||||
|
|
||||||
// 1.1 Config temporária como rover parado + NMEA
|
// 1.1 Config temporária como rover parado + NMEA
|
||||||
await ConfigurarComoRoverParadoAsync(portaUsb, portaEntrada);
|
await ConfigurarComoRoverParadoAsync(portaUsb, portaEntrada);
|
||||||
|
|
||||||
|
|
@ -1342,7 +1361,6 @@ namespace OperationControl.Services
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (stopNtrip != null) await stopNtrip();
|
if (stopNtrip != null) await stopNtrip();
|
||||||
CorrecaoEmAndamento = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,7 @@ namespace OperationControl.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private double? _offsetFrontalBaseCm;
|
private double? _offsetFrontalBaseCm = 0;
|
||||||
public double? OffsetFrontalBaseCm
|
public double? OffsetFrontalBaseCm
|
||||||
{
|
{
|
||||||
get => _offsetFrontalBaseCm;
|
get => _offsetFrontalBaseCm;
|
||||||
|
|
@ -267,7 +267,7 @@ namespace OperationControl.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private double? _offsetLateralBaseCm;
|
private double? _offsetLateralBaseCm = 0;
|
||||||
public double? OffsetLateralBaseCm
|
public double? OffsetLateralBaseCm
|
||||||
{
|
{
|
||||||
get => _offsetLateralBaseCm;
|
get => _offsetLateralBaseCm;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue