From 7065fb797fb9b727d0cfd891ee406717122b5f22 Mon Sep 17 00:00:00 2001 From: u02 Date: Tue, 12 Dec 2023 12:31:12 +0300 Subject: [PATCH] fix: update AsvMavlinkVersion and validate azimuth values Updated AsvMavlinkVersion in Asv.Drones.Gui.Custom.props from 3.6.0-alpha08 to 3.6.0-alpha11 for supporting the latest features and bug fixes. In VorAzimuthTaskViewModel, added validation before setting StartAzimuthString and StopAzimuthString. Ensured StartAzimuth and StopAzimuth values are positive and less than 360. This is because, in some cases, supplying out of range or negative direction values can cause errors in the system. Removed unnecessary methods from MissionItemHelper for cleaner codebase as these methods were outdated and replaced in the Mavlink ecosystem. Asana: https://app.asana.com/0/1203851531040615/1206117606525836/f --- .../Map/Planing/Mission/MissionItemHelper.cs | 78 ------------------- src/Asv.Drones.Gui.Custom.props | 4 +- 2 files changed, 2 insertions(+), 80 deletions(-) diff --git a/src/Asv.Drones.Gui.Core/Shell/Pages/Map/Planing/Mission/MissionItemHelper.cs b/src/Asv.Drones.Gui.Core/Shell/Pages/Map/Planing/Mission/MissionItemHelper.cs index f249a59c..5cf5377e 100644 --- a/src/Asv.Drones.Gui.Core/Shell/Pages/Map/Planing/Mission/MissionItemHelper.cs +++ b/src/Asv.Drones.Gui.Core/Shell/Pages/Map/Planing/Mission/MissionItemHelper.cs @@ -6,84 +6,6 @@ namespace Asv.Drones.Gui.Core; public static class MissionItemHelper { - //TODO: Add or replace in Mavlink AddNavMissionItem, AddTakeOffMissionItem, AddLandMissionItem, AddRoiMissionItem. - - /// - /// Adds navigation waypoint to MissionClients collection - /// - /// vehicle client - /// item location - /// time in seconds - /// radius in meters - /// radius in meters - /// angle in degrees - /// MissionItem creation result - public static MissionItem AddNavMissionItem(this IMissionClientEx vehicle, GeoPoint point, - float holdTime = 0, float acceptRadius = 0, float passRadius = 0, float yawAngle = float.NaN) - { - MissionItem missionItem = vehicle.Create(); - missionItem.Location.OnNext(point); - missionItem.AutoContinue.OnNext(true); - missionItem.Command.OnNext(MavCmd.MavCmdNavWaypoint); - missionItem.Current.OnNext(false); - missionItem.Frame.OnNext(MavFrame.MavFrameGlobalInt); - missionItem.MissionType.OnNext(MavMissionType.MavMissionTypeMission); - missionItem.Param1.OnNext(holdTime); - missionItem.Param2.OnNext(acceptRadius); - missionItem.Param3.OnNext(passRadius); - missionItem.Param4.OnNext(yawAngle); - return missionItem; - } - - public static MissionItem AddTakeOffMissionItem(this IMissionClientEx vehicle, GeoPoint point, float pitch = 0, float yawAngle = float.NaN) - { - MissionItem missionItem = vehicle.Create(); - missionItem.Location.OnNext(point); - missionItem.AutoContinue.OnNext(true); - missionItem.Command.OnNext(MavCmd.MavCmdNavTakeoff); - missionItem.Current.OnNext(false); - missionItem.Frame.OnNext(MavFrame.MavFrameGlobalInt); - missionItem.MissionType.OnNext(MavMissionType.MavMissionTypeMission); - missionItem.Param1.OnNext(pitch); - missionItem.Param2.OnNext(0.0f); - missionItem.Param3.OnNext(0.0f); - missionItem.Param4.OnNext(yawAngle); - return missionItem; - } - - public static MissionItem AddLandMissionItem(this IMissionClientEx vehicle, GeoPoint point, float abortAltitude = 0, - PrecisionLandMode landMode = PrecisionLandMode.PrecisionLandModeDisabled, float yawAngle = float.NaN) - { - MissionItem missionItem = vehicle.Create(); - missionItem.Location.OnNext(point); - missionItem.AutoContinue.OnNext(true); - missionItem.Command.OnNext(MavCmd.MavCmdNavLand); - missionItem.Current.OnNext(false); - missionItem.Frame.OnNext(MavFrame.MavFrameGlobalInt); - missionItem.MissionType.OnNext(MavMissionType.MavMissionTypeMission); - missionItem.Param1.OnNext(abortAltitude); - missionItem.Param2.OnNext((float)landMode); - missionItem.Param3.OnNext(0.0f); - missionItem.Param4.OnNext(yawAngle); - return missionItem; - } - - public static MissionItem AddRoiMissionItem(this IMissionClientEx vehicle, GeoPoint point, MavRoi roiMode = MavRoi.MavRoiLocation, float wpIndex = 0, float roiIndex = 0) - { - MissionItem missionItem = vehicle.Create(); - missionItem.Location.OnNext(point); - missionItem.AutoContinue.OnNext(true); - missionItem.Command.OnNext(MavCmd.MavCmdDoSetRoi); - missionItem.Current.OnNext(false); - missionItem.Frame.OnNext(MavFrame.MavFrameGlobalInt); - missionItem.MissionType.OnNext(MavMissionType.MavMissionTypeMission); - missionItem.Param1.OnNext((float)roiMode); - missionItem.Param2.OnNext(wpIndex); - missionItem.Param3.OnNext(roiIndex); - missionItem.Param4.OnNext(0.0f); - return missionItem; - } - public static PlaningMissionPointModel TransformMissionItemToPointModel(this MissionItem missionItem) { var pointType = GetMissionPointTypeFromMavlinkCommand(missionItem.Command.Value); diff --git a/src/Asv.Drones.Gui.Custom.props b/src/Asv.Drones.Gui.Custom.props index 69f5e045..62b85fed 100644 --- a/src/Asv.Drones.Gui.Custom.props +++ b/src/Asv.Drones.Gui.Custom.props @@ -5,9 +5,9 @@ enable 0.2.1 - 11.0.5 + 11.0.5ы 1.13.1 - 3.6.0-alpha09 + 3.6.0-alpha11 2.0.0 19.3.3 2.0.1