From ce7a03dffc6a0f4f1ec2a2db92c44912d1409e89 Mon Sep 17 00:00:00 2001 From: burlakov Date: Thu, 30 Nov 2023 10:16:29 +0300 Subject: [PATCH] fix (uav): fix anchor angle if vehicle is a plane Asana: https://app.asana.com/0/1203851531040615/1206062814171957/f --- .../Layers/Anchors/UavAnchor/FlightUavAnchor.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Asv.Drones.Gui.Uav/Shell/Pages/Flight/Layers/Anchors/UavAnchor/FlightUavAnchor.cs b/src/Asv.Drones.Gui.Uav/Shell/Pages/Flight/Layers/Anchors/UavAnchor/FlightUavAnchor.cs index 8d6e0c02..7f6af9d5 100644 --- a/src/Asv.Drones.Gui.Uav/Shell/Pages/Flight/Layers/Anchors/UavAnchor/FlightUavAnchor.cs +++ b/src/Asv.Drones.Gui.Uav/Shell/Pages/Flight/Layers/Anchors/UavAnchor/FlightUavAnchor.cs @@ -34,7 +34,17 @@ public FlightUavAnchor(IVehicleClient vehicle,ILocalizationService loc,IEnumerab IsVisible = true; Icon = MavlinkHelper.GetIcon(vehicle.Class); vehicle.Position.Current.Subscribe(_ => Location = _).DisposeItWith(Disposable); - vehicle.Position.Yaw.Select(_ => Math.Round(_, 0)).DistinctUntilChanged().Subscribe(_ => RotateAngle = _).DisposeItWith(Disposable); + vehicle.Position.Yaw.Select(_ => Math.Round(_, 0)).DistinctUntilChanged().Subscribe(v => + { + if (vehicle.Class == DeviceClass.Plane) + { + RotateAngle = v - 45; + } + else + { + RotateAngle = v; + } + }).DisposeItWith(Disposable); Title = vehicle.Name.Value; vehicle.Name.Subscribe(_ => Title = _).DisposeItWith(Disposable); vehicle.Position.Current.Subscribe(_ => UpdateDescription()).DisposeItWith(Disposable);