Skip to content

Commit

Permalink
fix (uav): fix anchor angle if vehicle is a plane
Browse files Browse the repository at this point in the history
  • Loading branch information
asv-soft-u01 committed Nov 30, 2023
1 parent ef90275 commit ce7a03d
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ce7a03d

Please sign in to comment.