From bebb1f42c84fc03f4627f64a59e163c777292670 Mon Sep 17 00:00:00 2001 From: Diego Freitas Date: Tue, 7 Jul 2026 15:47:34 -0300 Subject: [PATCH] ajustado lever arm e mostrado inclinacao no attitude indicator --- AgroBase/AgroBase/Models/GPSModel.cs | 6 + .../Models/Operacoes/OperacaoModel.cs | 35 ++-- .../Operacoes/OperacaoParametrosModel.cs | 12 +- AgroBase/AgroBase/Services/GPSService.cs | 28 +++- .../Controls/AttitudeIndicator.xaml | 19 +++ .../Controls/AttitudeIndicator.xaml.cs | 26 ++- .../Controls/MapViewControl.xaml.cs | 157 +++++++++++++++++- .../Diagnostico/DiagnosticoOpcoesViewModel.cs | 33 +++- .../ViewModels/Windows/DockWindowViewModel.cs | 10 +- .../Monitoramento/DiagnosticoView.xaml | 4 +- 10 files changed, 280 insertions(+), 50 deletions(-) diff --git a/AgroBase/AgroBase/Models/GPSModel.cs b/AgroBase/AgroBase/Models/GPSModel.cs index f141f1603..be8f32b48 100644 --- a/AgroBase/AgroBase/Models/GPSModel.cs +++ b/AgroBase/AgroBase/Models/GPSModel.cs @@ -67,7 +67,9 @@ namespace AgroBase.Models public double AnguloCarroDefinido { get; set; } public int Heartbeat { get; set; } = 0; public double LeverArmLateral { get; set; } = 0; + public double LeverArmLateralOp { get; set; } = 0; public double LeverArmFrontal { get; set; } = 0; + public double LeverArmFrontalOp { get; set; } = 0; public GPSModel Clone() { @@ -108,7 +110,9 @@ namespace AgroBase.Models VDOP = VDOP, BaseID = BaseID, LeverArmFrontal = LeverArmFrontal, + LeverArmFrontalOp = LeverArmFrontalOp, LeverArmLateral = LeverArmLateral, + LeverArmLateralOp = LeverArmLateralOp, X = X, Y = Y }; @@ -123,9 +127,11 @@ namespace AgroBase.Models IdadeCorrecao = IdadeCorrecao, Iniciado = Inicializado, Latitude = Latitude, + LatitudeAnt = LatitudeAnt, LeverArmFrontal = LeverArmFrontal, LeverArmLateral= LeverArmLateral, Longitude = Longitude, + LongitudeAnt = LongitudeAnt, NtripAtivado = Ntrip_ativado, NumeroSatelites = NumeroSatelites, OrientacaoMovimento = OrientacaoMovimento, diff --git a/AgroBase/AgroBase/Models/Operacoes/OperacaoModel.cs b/AgroBase/AgroBase/Models/Operacoes/OperacaoModel.cs index 8127e96ff..05f0ab26b 100644 --- a/AgroBase/AgroBase/Models/Operacoes/OperacaoModel.cs +++ b/AgroBase/AgroBase/Models/Operacoes/OperacaoModel.cs @@ -2478,31 +2478,17 @@ namespace AgroBase.Models return; } - double? totalLateralCm = lever.Item1; - double? totalFrontalCm = lever.Item2; + double? campoLateralCm = lever.Item1; + double? campoFrontalCm = lever.Item2; - if (totalLateralCm == null && totalFrontalCm == null) + if (campoLateralCm == null && campoFrontalCm == null) return; - double totalAtualLateralCm = - GPSService.LeverArm?.LateralTotalCm ?? - VariaveisEquipamento.LeverArmLateralCm; + double novoLateralCm = campoLateralCm.HasValue ? campoLateralCm.Value : GPSService.LeverArm.LateralCampoCm; + double novoFrontalCm = campoFrontalCm.HasValue ? campoFrontalCm.Value : GPSService.LeverArm.FrontalCampoCm; - double totalAtualFrontalCm = - GPSService.LeverArm?.FrontalTotalCm ?? - VariaveisEquipamento.LeverArmFrontalCm; - - double novoTotalLateralCm = - totalLateralCm ?? totalAtualLateralCm; - - double novoTotalFrontalCm = - totalFrontalCm ?? totalAtualFrontalCm; - - double campoLateralCm = - novoTotalLateralCm - VariaveisEquipamento.LeverArmLateralCm; - - double campoFrontalCm = - novoTotalFrontalCm - VariaveisEquipamento.LeverArmFrontalCm; + double novoTotalLateralCm = VariaveisEquipamento.LeverArmLateralCm + novoLateralCm; + double novoTotalFrontalCm = VariaveisEquipamento.LeverArmFrontalCm + novoFrontalCm; Variaveis.MostrarLog( $"[ComandoBase][LeverArm] Total RX: frontal={novoTotalFrontalCm:0.##}cm, lateral={novoTotalLateralCm:0.##}cm | " + @@ -2513,8 +2499,11 @@ namespace AgroBase.Models GPSService.LeverArm = new GeoLeverArm( offsetFisicoFrontalCm: VariaveisEquipamento.LeverArmFrontalCm, offsetFisicoLateralCm: VariaveisEquipamento.LeverArmLateralCm, - offsetCampoFrontalCm: campoFrontalCm, - offsetCampoLateralCm: campoLateralCm + offsetCampoFrontalCm: novoFrontalCm, + offsetCampoLateralCm: novoLateralCm, + mirrL: true, + invF: true, + invH: false ); } diff --git a/AgroBase/AgroBase/Models/Operacoes/OperacaoParametrosModel.cs b/AgroBase/AgroBase/Models/Operacoes/OperacaoParametrosModel.cs index ed1c3b4b1..c3829738a 100644 --- a/AgroBase/AgroBase/Models/Operacoes/OperacaoParametrosModel.cs +++ b/AgroBase/AgroBase/Models/Operacoes/OperacaoParametrosModel.cs @@ -987,9 +987,11 @@ namespace AgroBase.Models.Operacoes Distancia = gps?.Distancia ?? 0, IdadeCorrecao = gps?.IdadeCorrecao ?? -1, Latitude = gps?.Latitude ?? 0, + LatitudeAnt = gps?.LatitudeAnt ?? 0, Longitude = gps?.Longitude ?? 0, - LeverArmFrontal = gps?.LeverArmFrontal ?? 0, - LeverArmLateral = gps?.LeverArmLateral ?? 0, + LongitudeAnt = gps?.LongitudeAnt ?? 0, + LeverArmFrontal = gps?.LeverArmFrontalOp ?? 0, + LeverArmLateral = gps?.LeverArmLateralOp ?? 0, NtripAtivado = gps?.Ntrip_ativado ?? false, NumeroSatelites = gps?.NumeroSatelites ?? 0, OrientacaoMovimento = gps?.OrientacaoMovimento ?? 0, @@ -1278,7 +1280,9 @@ namespace AgroBase.Models.Operacoes { Iniciado = src.Iniciado, Latitude = src.Latitude, + LatitudeAnt = src.LatitudeAnt, Longitude = src.Longitude, + LongitudeAnt = src.LongitudeAnt, Altitude = src.Altitude, Velocidade = src.Velocidade, Distancia = src.Distancia, @@ -1686,7 +1690,9 @@ namespace AgroBase.Models.Operacoes { public bool Iniciado { get; set; } public double Latitude { get; set; } + public double LatitudeAnt { get; set; } public double Longitude { get; set; } + public double LongitudeAnt { get; set; } public double Altitude { get; set; } public double Velocidade { get; set; } public double Distancia { get; set; } @@ -1708,7 +1714,9 @@ namespace AgroBase.Models.Operacoes { Inicializado = Iniciado, Latitude = Latitude, + LatitudeAnt = LatitudeAnt, Longitude = Longitude, + LongitudeAnt = LongitudeAnt, Altitude = Altitude, Velocidade = Velocidade, Distancia = Distancia, diff --git a/AgroBase/AgroBase/Services/GPSService.cs b/AgroBase/AgroBase/Services/GPSService.cs index 427d77378..009010738 100644 --- a/AgroBase/AgroBase/Services/GPSService.cs +++ b/AgroBase/AgroBase/Services/GPSService.cs @@ -70,7 +70,10 @@ namespace AgroBase.Services public static GeoLeverArm LeverArm = new GeoLeverArm( offsetFisicoFrontalCm: VariaveisEquipamento.LeverArmFrontalCm, - offsetFisicoLateralCm: VariaveisEquipamento.LeverArmLateralCm + offsetFisicoLateralCm: VariaveisEquipamento.LeverArmLateralCm, + mirrL: true, + invF: true, + invH: false ); public static Queue historicoPosicao = new Queue(); @@ -2125,11 +2128,15 @@ namespace AgroBase.Services PenultimaLeitura.Heartbeat = UltimaLeitura.Heartbeat; PenultimaLeitura.LeverArmFrontal = UltimaLeitura.LeverArmFrontal; PenultimaLeitura.LeverArmLateral = UltimaLeitura.LeverArmLateral; + PenultimaLeitura.LeverArmFrontalOp = UltimaLeitura.LeverArmFrontalOp; + PenultimaLeitura.LeverArmLateralOp = UltimaLeitura.LeverArmLateralOp; UltimaLeitura.Ntrip_ativado = CorrecaoRTK_Ntrip; UltimaLeitura.Heartbeat = (UltimaLeitura.Heartbeat + 1) % 10; UltimaLeitura.LeverArmFrontal = LeverArm != null ? LeverArm.FrontalTotalCm : 0; UltimaLeitura.LeverArmLateral = LeverArm != null ? LeverArm.LateralTotalCm : 0; + UltimaLeitura.LeverArmFrontalOp = LeverArm != null ? LeverArm.FrontalCampoCm : 0; + UltimaLeitura.LeverArmLateralOp = LeverArm != null ? LeverArm.LateralCampoCm : 0; UltimasLeituras.Add(UltimaLeitura.Clone()); @@ -3466,6 +3473,7 @@ namespace AgroBase.Services private readonly double yCampo; private readonly bool invertHeading; + private readonly bool invertFrontal; private readonly bool mirrorLateral; public GeoLeverArm( @@ -3474,7 +3482,9 @@ namespace AgroBase.Services double offsetCampoFrontalCm = 0, double offsetCampoLateralCm = 0, bool invH = false, - bool mirrL = false) + bool invF = false, + bool mirrL = false + ) { xFisico = offsetFisicoFrontalCm / 100.0; yFisico = offsetFisicoLateralCm / 100.0; @@ -3482,6 +3492,7 @@ namespace AgroBase.Services yCampo = offsetCampoLateralCm / 100.0; invertHeading = invH; + invertFrontal = invF; mirrorLateral = mirrL; } @@ -3500,6 +3511,16 @@ namespace AgroBase.Services get { return (yFisico + yCampo) * 100.0; } } + public double FrontalCampoCm + { + get { return (xCampo) * 100.0; } + } + + public double LateralCampoCm + { + get { return (yCampo) * 100.0; } + } + public (double lat, double lon) FixLeverArmLatLon_Fast(double latAnt_deg, double lonAnt_deg, double headingDeg, double headingFreq) { if (headingFreq < 1) @@ -3508,6 +3529,9 @@ namespace AgroBase.Services double xTotal = xFisico + xCampo; double yTotal = yFisico + yCampo; + if (invertFrontal) + xTotal = -xTotal; + if (mirrorLateral) yTotal = -yTotal; diff --git a/AgroBase/OperationControl/Controls/AttitudeIndicator.xaml b/AgroBase/OperationControl/Controls/AttitudeIndicator.xaml index cccbb3633..635d85146 100644 --- a/AgroBase/OperationControl/Controls/AttitudeIndicator.xaml +++ b/AgroBase/OperationControl/Controls/AttitudeIndicator.xaml @@ -108,6 +108,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/AgroBase/OperationControl/Controls/AttitudeIndicator.xaml.cs b/AgroBase/OperationControl/Controls/AttitudeIndicator.xaml.cs index d80ef6924..9e37f38b9 100644 --- a/AgroBase/OperationControl/Controls/AttitudeIndicator.xaml.cs +++ b/AgroBase/OperationControl/Controls/AttitudeIndicator.xaml.cs @@ -9,7 +9,7 @@ namespace OperationControl.Controls /// /// Interaction logic for AttitudeIndicator.xaml /// - public partial class AttitudeIndicator : UserControl + public partial class AttitudeIndicator : UserControl, INotifyPropertyChanged { public AttitudeIndicator() { @@ -47,8 +47,7 @@ namespace OperationControl.Controls typeof(AttitudeIndicator), new PropertyMetadata(0.0)); - public static readonly DependencyProperty PitchOffsetPxProperty = - PitchOffsetPxPropertyKey.DependencyProperty; + public static readonly DependencyProperty PitchOffsetPxProperty = PitchOffsetPxPropertyKey.DependencyProperty; public double PitchOffsetPx { @@ -105,8 +104,7 @@ namespace OperationControl.Controls typeof(AttitudeIndicator), new PropertyMetadata(0.0)); - public static readonly DependencyProperty LateralNormalizedProperty = - LateralNormalizedPropertyKey.DependencyProperty; + public static readonly DependencyProperty LateralNormalizedProperty = LateralNormalizedPropertyKey.DependencyProperty; public double LateralError { @@ -133,15 +131,31 @@ namespace OperationControl.Controls // Derivados public double MaxAbsAngle => Math.Max(Math.Abs(RollDeg), Math.Abs(PitchDeg)); + public string RollTexto => $"LAT {FormatSignedDeg(RollDeg)}"; + public string PitchTexto => $"FRT {FormatSignedDeg(PitchDeg)}"; + + private static string FormatSignedDeg(double value) + { + if (double.IsNaN(value) || double.IsInfinity(value)) + return "--.-°"; + + return value.ToString("+0.0;-0.0;0.0") + "°"; + } + public event PropertyChangedEventHandler PropertyChanged; void Raise(string n) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(n)); static void OnAngleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - var c = (AttitudeIndicator)d; // agora compila pois herda de UserControl + var c = (AttitudeIndicator)d; + c.PitchOffsetPx = -c.PitchDeg * c.PxPerDeg; + c.Raise(nameof(PitchOffsetPx)); c.Raise(nameof(MaxAbsAngle)); + c.Raise(nameof(RollTexto)); + c.Raise(nameof(PitchTexto)); + c.UpdateChrome(); } diff --git a/AgroBase/OperationControl/Controls/MapViewControl.xaml.cs b/AgroBase/OperationControl/Controls/MapViewControl.xaml.cs index 8e13654b2..2370c700f 100644 --- a/AgroBase/OperationControl/Controls/MapViewControl.xaml.cs +++ b/AgroBase/OperationControl/Controls/MapViewControl.xaml.cs @@ -1268,7 +1268,20 @@ namespace OperationControl.Controls } } - public void AddMarker(string id, bool isBase, double? lat = null, double? lon = null, double? heading = null, System.Windows.Media.Color? color = null, string? label = null, StatusOperacao? status = null, bool? pulv = null, bool center = false) + public void AddMarker( + string id, + bool isBase, + double? lat = null, + double? lon = null, + double? heading = null, + System.Windows.Media.Color? color = null, + string? label = null, + StatusOperacao? status = null, + bool? pulv = null, + bool center = false, + double? rawGnssLat = null, + double? rawGnssLon = null + ) { if (string.IsNullOrWhiteSpace(id)) return; @@ -1277,7 +1290,17 @@ namespace OperationControl.Controls var marker = _features.FirstOrDefault(x => x.Id == id); if (marker != null) { - marker.UpdateData(lat: lat, lon: lon, heading: heading, label: label, color: color, status: status, pulverizando: pulv); + marker.UpdateData( + lat: lat, + lon: lon, + heading: heading, + label: label, + color: color, + status: status, + pulverizando: pulv, + rawGnssLat: rawGnssLat, + rawGnssLon: rawGnssLon + ); } else { @@ -1287,13 +1310,15 @@ namespace OperationControl.Controls Features = new List(), Color = color ?? GetColorForMarker(id, isBase), Heading = heading ?? 0, - Lat = lat ?? 0, + Lat = lat ?? 0, Lon = lon ?? 0, + RawGnssLat = rawGnssLat, + RawGnssLon = rawGnssLon, Label = lbl, MarkerShapes = new List(), IsBase = isBase, - Status = status ?? StatusOperacao.NaoIniciado, - Pulverizando = pulv ?? false, + Status = status ?? StatusOperacao.NaoIniciado, + Pulverizando = pulv ?? false, Focused = false }; marker.CreateTrajectory(_map); @@ -1307,15 +1332,30 @@ namespace OperationControl.Controls _map.Map?.Navigator?.CenterOn(marker.Point.Point); } - public void UpdateMarkerPosition(string id, double? lat = null, double? lon = null, double? heading = null, List? predict = null) + public void UpdateMarkerPosition( + string id, + double? lat = null, + double? lon = null, + double? heading = null, + List? predict = null, + double? rawGnssLat = null, + double? rawGnssLon = null + ) { if (string.IsNullOrWhiteSpace(id)) return; var marker = _features.FirstOrDefault(x => x.Id == id); if (marker == null) return; - marker.UpdateData(lat: lat, lon: lon, heading: heading, predict: predict); - + marker.UpdateData( + lat: lat, + lon: lon, + heading: heading, + predict: predict, + rawGnssLat: rawGnssLat, + rawGnssLon: rawGnssLon + ); + UpdateFeatures(); } @@ -1385,6 +1425,9 @@ namespace OperationControl.Controls public double Lat { get; set; } public double Lon { get; set; } public double Heading { get; set; } + public double? RawGnssLat { get; set; } + public double? RawGnssLon { get; set; } + public bool MostrarPontosLeverArm { get; set; } = true; public string Label { get; set; } public System.Windows.Media.Color Color { get; set; } public StatusOperacao Status { get; set; } @@ -1393,12 +1436,25 @@ namespace OperationControl.Controls public Coordinate Position { get; set; } public List Predict { get; set; } - public void UpdateData(double? lat = null, double? lon = null, double? heading = null, string? label = null, System.Windows.Media.Color? color = null, bool? pulverizando = null, StatusOperacao? status = null, List? predict = null) + public void UpdateData( + double? lat = null, + double? lon = null, + double? heading = null, + string? label = null, + System.Windows.Media.Color? color = null, + bool? pulverizando = null, + StatusOperacao? status = null, + List? predict = null, + double? rawGnssLat = null, + double? rawGnssLon = null + ) { Features.Clear(); if (lat != null) Lat = (double)lat; if (lon != null) Lon = (double)lon; + if (rawGnssLat != null) RawGnssLat = rawGnssLat; + if (rawGnssLon != null) RawGnssLon = rawGnssLon; if (heading != null) Heading = (double)heading; if (label != null) Label = label; if (color != null) Color = (System.Windows.Media.Color)color; @@ -1524,6 +1580,7 @@ namespace OperationControl.Controls }); MarkerShapes.Add(triangle); + CreateLeverArmReferencePoints(centerWorld); if (Focused) { @@ -1714,6 +1771,88 @@ namespace OperationControl.Controls return (baseColor, glyph, back); } + private void CreateLeverArmReferencePoints(MPoint correctedWorld) + { + if (!MostrarPontosLeverArm) + return; + + if (!IsValidLatLon(RawGnssLat, RawGnssLon)) + return; + + var rawMercator = Mapsui.Projections.SphericalMercator.FromLonLat( + RawGnssLon!.Value, + RawGnssLat!.Value + ); + + var rawWorld = new MPoint(rawMercator.x, rawMercator.y); + + // Linha tracejada entre GNSS bruto e ponto corrigido + var line = new GeometryFeature + { + Geometry = new LineString(new[] + { + new Coordinate(rawWorld.X, rawWorld.Y), + new Coordinate(correctedWorld.X, correctedWorld.Y) + }) + }; + + line.Styles.Add(new VectorStyle + { + Line = new Pen + { + Color = new Mapsui.Styles.Color(255, 255, 255, 170), + Width = 1, + PenStyle = PenStyle.Dash + } + }); + + MarkerShapes.Add(line); + + // Ponto GNSS bruto: amarelo + var rawPoint = new PointFeature(rawWorld); + rawPoint["MarkerPart"] = "GnssBruto"; + rawPoint.Styles.Add(new SymbolStyle + { + SymbolType = SymbolType.Ellipse, + SymbolScale = 0.55, + Fill = new Brush(new Mapsui.Styles.Color(255, 215, 0, 255)), + Outline = new Pen(new Mapsui.Styles.Color(20, 20, 20, 230), 1) + }); + + MarkerShapes.Add(rawPoint); + + // Ponto corrigido: branco com contorno preto + var correctedPoint = new PointFeature(correctedWorld); + correctedPoint["MarkerPart"] = "GnssCorrigidoLeverArm"; + correctedPoint.Styles.Add(new SymbolStyle + { + SymbolType = SymbolType.Ellipse, + SymbolScale = 0.50, + Fill = new Brush(Mapsui.Styles.Color.White), + Outline = new Pen(new Mapsui.Styles.Color(20, 20, 20, 230), 1) + }); + + MarkerShapes.Add(correctedPoint); + } + + private bool IsValidLatLon(double? lat, double? lon) + { + if (!lat.HasValue || !lon.HasValue) + return false; + + if (lat.Value < -90 || lat.Value > 90) + return false; + + if (lon.Value < -180 || lon.Value > 180) + return false; + + // Evita desenhar ponto fake em 0,0 + if (Math.Abs(lat.Value) < 0.0000001 && Math.Abs(lon.Value) < 0.0000001) + return false; + + return true; + } + public void ClearTrajectory(bool clearPrediction = true) { diff --git a/AgroBase/OperationControl/ViewModels/Views/Operacao/Monitoramento/Diagnostico/DiagnosticoOpcoesViewModel.cs b/AgroBase/OperationControl/ViewModels/Views/Operacao/Monitoramento/Diagnostico/DiagnosticoOpcoesViewModel.cs index 24c25987f..6aa1291ee 100644 --- a/AgroBase/OperationControl/ViewModels/Views/Operacao/Monitoramento/Diagnostico/DiagnosticoOpcoesViewModel.cs +++ b/AgroBase/OperationControl/ViewModels/Views/Operacao/Monitoramento/Diagnostico/DiagnosticoOpcoesViewModel.cs @@ -6,6 +6,8 @@ using static AgroBase.Models.Enums; using System.Windows.Input; using OperationControl.Helpers; using static AgroBase.Services.CoolerControlService; +using AgroBase.Services; +using AgroBase.Models; namespace OperationControl.ViewModels.Views.Operacao.Monitoramento.Diagnostico { @@ -201,7 +203,7 @@ namespace OperationControl.ViewModels.Views.Operacao.Monitoramento.Diagnostico set { if (SetProperty(ref _gpsLeverArmLateral, value)) - GpsLeverArmLateralTexto = $"{value:0.##} cm"; + GpsLeverArmLateralTexto = $"{value:0} cm"; } } @@ -219,7 +221,7 @@ namespace OperationControl.ViewModels.Views.Operacao.Monitoramento.Diagnostico set { if (SetProperty(ref _gpsLeverArmFrontal, value)) - GpsLeverArmFrontalTexto = $"{value:0.##} cm"; + GpsLeverArmFrontalTexto = $"{value:0} cm"; } } @@ -822,6 +824,33 @@ namespace OperationControl.ViewModels.Views.Operacao.Monitoramento.Diagnostico lateral: GpsLeverArmLateral, frontal: GpsLeverArmFrontal ); + + if (AppShell.Mock && AppShell.AddRover) + { + var gnss = VariaveisControleOperacao.RoverEmFoco.DadosLeitura.Gnss; + gnss.LeverArmFrontal = GpsLeverArmFrontal; + gnss.LeverArmLateral = GpsLeverArmLateral; + + GeoLeverArm la = new GeoLeverArm( + offsetFisicoFrontalCm: VariaveisEquipamento.LeverArmFrontalCm, + offsetFisicoLateralCm: VariaveisEquipamento.LeverArmLateralCm, + offsetCampoFrontalCm: GpsLeverArmFrontal, + offsetCampoLateralCm: GpsLeverArmLateral, + mirrL: true, + invF: true, + invH: false + ); + + var corrigida = la.FixLeverArmLatLon_Fast( + gnss.LatitudeAnt, + gnss.LongitudeAnt, + gnss.OrientacaoReal, + 5 + ); + + gnss.Latitude = corrigida.lat; + gnss.Longitude = corrigida.lon; + } } } diff --git a/AgroBase/OperationControl/ViewModels/Windows/DockWindowViewModel.cs b/AgroBase/OperationControl/ViewModels/Windows/DockWindowViewModel.cs index 5a6eaffb0..756716ca9 100644 --- a/AgroBase/OperationControl/ViewModels/Windows/DockWindowViewModel.cs +++ b/AgroBase/OperationControl/ViewModels/Windows/DockWindowViewModel.cs @@ -726,7 +726,7 @@ namespace OperationControl.ViewModels _viewPreparacaoMapaTop?._vm?.AtualizarDados(dados); } CriarMarcadorBase(Mapa); - Mapa?.markers?.UpdateMarkerPosition(VariaveisControleOperacao.BaseMarkerID, lat: dados?.Latitude, lon: dados?.Longitude, heading: dados?.OrientacaoReal); + Mapa?.markers?.UpdateMarkerPosition(VariaveisControleOperacao.BaseMarkerID, lat: dados?.Latitude, lon: dados?.Longitude, heading: dados?.OrientacaoReal, rawGnssLat: dados?.LatitudeAnt, rawGnssLon: dados?.LongitudeAnt); } public void AtualizarParametrosRover(OperacaoParametrosModel? rover) @@ -805,7 +805,7 @@ namespace OperationControl.ViewModels if (fixar) { - _viewPreparacaoMapaBottom?._vm.IniciarFixacao(); + _viewPreparacaoMapaBottom?._vm?.IniciarFixacao(); await Models.Variaveis.GpsService.ConfigurarModulo(true, metodoFix, lat, lon, alt); } } @@ -884,7 +884,9 @@ namespace OperationControl.ViewModels false, lat: roverDados.DadosLeitura?.Gnss?.Latitude ?? 0, lon: roverDados.DadosLeitura?.Gnss?.Longitude ?? 0, - heading: roverDados.DadosLeitura?.Gnss?.OrientacaoReal ?? 0 + heading: roverDados.DadosLeitura?.Gnss?.OrientacaoReal ?? 0, + rawGnssLat: roverDados.DadosLeitura?.Gnss?.LatitudeAnt ?? 0, + rawGnssLon: roverDados.DadosLeitura?.Gnss?.LongitudeAnt ?? 0 ); } } @@ -899,7 +901,7 @@ namespace OperationControl.ViewModels // MAPA var simulacao = obj.Controle?.SimulacaoMPC?.Select(x => new double[] { x.longitude, x.latitude })?.ToList(); - _viewOperacaoCenter?.Mapa?.markers.UpdateMarkerPosition(rover.RoverId, lat: obj.Gnss?.Latitude, lon: obj.Gnss?.Longitude, heading: obj.Gnss?.OrientacaoReal, predict: simulacao); + _viewOperacaoCenter?.Mapa?.markers.UpdateMarkerPosition(rover.RoverId, lat: obj.Gnss?.Latitude, lon: obj.Gnss?.Longitude, heading: obj.Gnss?.OrientacaoReal, predict: simulacao, rawGnssLat: obj.Gnss?.LatitudeAnt, rawGnssLon: obj.Gnss?.LongitudeAnt); if (_viewOperacaoCenter?.Mapa?.chbAcompanhar.IsChecked ?? false) _viewOperacaoCenter?.Mapa?.SetView(obj.Gnss?.Latitude, obj.Gnss?.Longitude); _viewOperacaoCenter?.Mapa?.markers.UpdateMarkerInfo(rover.RoverId, status: obj.Operacao?.Status ?? AgroBase.Models.Enums.StatusOperacao.NaoIniciado); diff --git a/AgroBase/OperationControl/Views/Operacao/Monitoramento/DiagnosticoView.xaml b/AgroBase/OperationControl/Views/Operacao/Monitoramento/DiagnosticoView.xaml index 99a9f667f..38bbb6f5a 100644 --- a/AgroBase/OperationControl/Views/Operacao/Monitoramento/DiagnosticoView.xaml +++ b/AgroBase/OperationControl/Views/Operacao/Monitoramento/DiagnosticoView.xaml @@ -412,11 +412,11 @@