Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update AsvMavlinkVersion and validate azimuth values #256

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,84 +6,6 @@ namespace Asv.Drones.Gui.Core;

public static class MissionItemHelper
{
//TODO: Add or replace in Mavlink AddNavMissionItem, AddTakeOffMissionItem, AddLandMissionItem, AddRoiMissionItem.

/// <summary>
/// Adds navigation waypoint to MissionClients collection
/// </summary>
/// <param name="vehicle">vehicle client</param>
/// <param name="point">item location</param>
/// <param name="holdTime">time in seconds</param>
/// <param name="acceptRadius">radius in meters</param>
/// <param name="passRadius">radius in meters</param>
/// <param name="yawAngle">angle in degrees</param>
/// <returns>MissionItem creation result</returns>
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);
Expand Down
4 changes: 2 additions & 2 deletions src/Asv.Drones.Gui.Custom.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<PropertyGroup>
<Nullable>enable</Nullable>
<ProductVersion>0.2.1</ProductVersion>
<AvaloniaVersion>11.0.5</AvaloniaVersion>
<AvaloniaVersion>11.0.5</AvaloniaVersion>ы
<AsvCommonVersion>1.13.1</AsvCommonVersion>
<AsvMavlinkVersion>3.6.0-alpha09</AsvMavlinkVersion>
<AsvMavlinkVersion>3.6.0-alpha11</AsvMavlinkVersion>
<FluentAvaloniaUIVersion>2.0.0</FluentAvaloniaUIVersion>
<ReactiveUIVersion>19.3.3</ReactiveUIVersion>
<MaterialIconsAvaloniaVersion>2.0.1</MaterialIconsAvaloniaVersion>
Expand Down