Skip to content

Commit

Permalink
feat: add support for Rsga devices
Browse files Browse the repository at this point in the history
Added functionality for Rsga devices in the Mavlink helper and devices service. This includes methods to get Rsga device by ID and observe changes on Rsga devices. Also updated the project to use the upgraded Mavlink version 3.10.0 and target framework net8.0.
  • Loading branch information
asvol committed Jul 3, 2024
1 parent 4a7a259 commit bfe867a
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/.run/Linux-arm64.run.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Linux-arm64" type="DotNetFolderPublish" factoryName="Publish to folder">
<riderPublish configuration="Release" delete_existing_files="true" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" runtime="linux-arm64" self_contained="true" target_folder="$PROJECT_DIR$/../publish/linux-arm64/app" target_framework="net7.0" uuid_high="-6069974389149972757" uuid_low="-5498245974063364756" />
<riderPublish configuration="Release" delete_existing_files="true" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" runtime="linux-arm64" self_contained="true" target_folder="$PROJECT_DIR$/../publish/linux-arm64/app" target_framework="net8.0" uuid_high="-6069974389149972757" uuid_low="-5498245974063364756" />
<method v="2" />
</configuration>
</component>
6 changes: 3 additions & 3 deletions src/Asv.Drones.Gui.Api/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Asv.Drones.Gui.Api.IMavlinkDevicesService.GetRfsaByFullId(System.UInt16)</Target>
<DiagnosticId>CP0006</DiagnosticId>
<Target>M:Asv.Drones.Gui.Api.IMavlinkDevicesService.GetRsgaByFullId(System.UInt16)</Target>
<Left>lib/net8.0/Asv.Drones.Gui.Api.dll</Left>
<Right>lib/net8.0/Asv.Drones.Gui.Api.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0006</DiagnosticId>
<Target>M:Asv.Drones.Gui.Api.IMavlinkDevicesService.GetRfsaByFullId(System.UInt16)</Target>
<Target>P:Asv.Drones.Gui.Api.IMavlinkDevicesService.RsgaDevices</Target>
<Left>lib/net8.0/Asv.Drones.Gui.Api.dll</Left>
<Right>lib/net8.0/Asv.Drones.Gui.Api.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,8 @@ public interface IMavlinkDevicesService
IAdsbClientDevice? GetAdsbVehicleByFullId(ushort id);
IObservable<IChangeSet<IRfsaClientDevice, ushort>> RfsaDevices { get; }
IRfsaClientDevice? GetRfsaByFullId(ushort id);
IObservable<IChangeSet<IRsgaClientDevice, ushort>> RsgaDevices { get; }
IRsgaClientDevice? GetRsgaByFullId(ushort id);

}
}
1 change: 1 addition & 0 deletions src/Asv.Drones.Gui.Api/Services/Mavlink/MavlinkHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public static MaterialIconKind GetIcon(DeviceClass type)
DeviceClass.GbsRtk => MaterialIconKind.RouterWireless,
DeviceClass.Adsb => MaterialIconKind.Radar,
DeviceClass.Rfsa => MaterialIconKind.Waveform,
DeviceClass.Rsga => MaterialIconKind.CellphoneWireless,
_ => MaterialIconKind.HelpNetworkOutline,
};
}
Expand Down
28 changes: 27 additions & 1 deletion src/Asv.Drones.Gui/Services/Mavlink/MavlinkDevicesService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class MavlinkDeviceServiceConfig
public AdsbClientDeviceConfig Adsb { get; set; } = new();
public bool WrapToV2ExtensionEnabled { get; set; } = true;
public RfsaClientDeviceConfig Rfsa { get; set; } = new();
public RfsaClientDeviceConfig Rsga { get; set; } = new();
}

[Export(typeof(IMavlinkDevicesService))]
Expand Down Expand Up @@ -163,11 +164,17 @@ public MavlinkDevicesService(IConfiguration config, IPacketSequenceCalculator se
.Transform(CreateRfsaDevice)
.DisposeMany()
.RefCount();
RsgaDevices = Devices
.Filter(d => d.Type == (MavType)Mavlink.V2.AsvRsga.MavType.MavTypeAsvRsga)
.Transform(CreateRsgaDevice)
.DisposeMany()
.RefCount();

AllDevices = Vehicles.Transform(x => (IClientDevice)x)
.MergeChangeSets(BaseStations.Transform(x => (IClientDevice)x))
.MergeChangeSets(Payloads.Transform(x => (IClientDevice)x))
.MergeChangeSets(RfsaDevices.Transform(x => (IClientDevice)x))
.MergeChangeSets(RsgaDevices.Transform(x => (IClientDevice)x))
.MergeChangeSets(AdsbDevices.Transform(x => (IClientDevice)x));

#endregion
Expand All @@ -191,6 +198,18 @@ public MavlinkDevicesService(IConfiguration config, IPacketSequenceCalculator se
#endregion
}



private IRsgaClientDevice CreateRsgaDevice(IMavlinkDevice device)
{
return new RsgaClientDevice(Router, new MavlinkClientIdentity
{
TargetSystemId = device.SystemId,
TargetComponentId = device.ComponentId,
SystemId = _systemId.Value,
ComponentId = _componentId.Value,
}, InternalGetConfig(c => c.Rsga), _sequenceCalculator, RxApp.MainThreadScheduler);
}
private IRfsaClientDevice CreateRfsaDevice(IMavlinkDevice device)
{
return new RfsaClientDevice(Router, new MavlinkClientIdentity
Expand Down Expand Up @@ -323,7 +342,14 @@ private string TryGetName(StatustextPacket pkt)
using var autoDispose = RfsaDevices.BindToObservableList(out var list).Subscribe();
return list.Items.FirstOrDefault(d => d.FullId == id);
}


public IObservable<IChangeSet<IRsgaClientDevice, ushort>> RsgaDevices { get; }
public IRsgaClientDevice? GetRsgaByFullId(ushort id)
{
using var autoDispose = RsgaDevices.BindToObservableList(out var list).Subscribe();
return list.Items.FirstOrDefault(d => ((IClientDevice)d).FullId == id);
}

private IVehicleClient? CreateVehicle(IMavlinkDevice device)
{
//if (device.Autopilot == MavAutopilot.MavAutopilotArdupilotmega)
Expand Down
8 changes: 4 additions & 4 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project>
<PropertyGroup>
<ProductVersion>1.0.0</ProductVersion>
<ApiVersion>1.0.0</ApiVersion>
<ApiPrevVersion>0.3.6</ApiPrevVersion>
<ProductVersion>1.0.1</ProductVersion>
<ApiVersion>1.0.1</ApiVersion>
<ApiPrevVersion>1.0.0</ApiPrevVersion>
<AvaloniaVersion>11.0.6</AvaloniaVersion>
<AsvCommonVersion>2.0.2</AsvCommonVersion>
<AsvAvaloniaToolkitVersion>1.0.1</AsvAvaloniaToolkitVersion>
<AsvAvaloniaMapVersion>2.0.5</AsvAvaloniaMapVersion>
<AsvMavlinkVersion>3.9.2</AsvMavlinkVersion>
<AsvMavlinkVersion>3.10.0</AsvMavlinkVersion>
<FluentAvaloniaUIVersion>2.0.5</FluentAvaloniaUIVersion>
<ReactiveUIVersion>19.5.41</ReactiveUIVersion>
<SystemReactiveVersion>6.0.0</SystemReactiveVersion>
Expand Down

0 comments on commit bfe867a

Please sign in to comment.