From fb17c0a3f9d9068f4a03ef82dae3561249a74f1f Mon Sep 17 00:00:00 2001 From: pxzleo Date: Mon, 11 Sep 2017 03:57:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E4=B8=A4=E4=B8=AA=E5=8F=82?= =?UTF-8?q?=E6=95=B0=EF=BC=8C=E4=B8=80=E4=B8=AACopterLocationType=E5=9C=A8?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E5=90=8E=E5=8F=96=E4=B8=80=E6=AC=A1=EF=BC=8C?= =?UTF-8?q?=E7=A1=AE=E5=AE=9A=E9=A3=9E=E6=9C=BA=E7=9A=84=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=EF=BC=8C=E7=94=A8=E4=BA=8E=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=90=91=E5=AE=83=E5=8F=91=E9=80=81RTCM?= =?UTF-8?q?=E5=B7=AE=E5=88=86=E6=95=B0=E6=8D=AE=20=E4=B8=80=E4=B8=AAMissio?= =?UTF-8?q?nStatus=E5=8F=82=E6=95=B0=EF=BC=8C=E7=A1=AE=E5=AE=9A=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E9=A3=9E=E8=A1=8C=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E6=83=85=E5=86=B5=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=98=AF1?= =?UTF-8?q?=E5=B0=B1=E6=98=AF=E6=AD=A3=E5=9C=A8=E9=A3=9E=E8=A1=8C=E5=88=B0?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E8=88=AA=E7=82=B9=E4=B8=AD=EF=BC=8C=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E4=B8=8A=E9=A3=9E=E6=9C=BA=E5=9B=BE=E6=A0=87=E5=89=8D?= =?UTF-8?q?=E9=9D=A2=E4=BC=9A=E6=9C=89=E4=B8=AA=E5=B0=8F=E6=A0=87=E8=AF=86?= =?UTF-8?q?=EF=BC=8C=E5=88=B0=E8=BE=BE=E8=88=AA=E7=82=B9=E5=90=8E=E6=B6=88?= =?UTF-8?q?=E5=A4=B1=EF=BC=8C=E7=94=A8=E6=9D=A5=E4=BA=BA=E4=B8=BA=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E5=93=AA=E4=BA=9B=E9=A3=9E=E6=9C=BA=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=88=B0=E8=BE=BE=E8=88=AA=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Copters/ICopterStatus.cs | 10 ++++++++++ .../PlaneGcsSdk.Contract_Shared.projitems | 1 + .../Copters/CopterImplSharedPart.cs | 19 +++++++++++++++++++ PlaneGcsSdk_Shared/Copters/EmptyCopter.cs | 5 +++++ PlaneGcsSdk_Shared/Copters/FakeCopter.cs | 6 ++++++ PlaneGcsSdk_Shared/Copters/PLCopter.cs | 13 +++++++++++++ 6 files changed, 54 insertions(+) diff --git a/PlaneGcsSdk.Contract_Shared/Copters/ICopterStatus.cs b/PlaneGcsSdk.Contract_Shared/Copters/ICopterStatus.cs index e7a9a77..00292be 100644 --- a/PlaneGcsSdk.Contract_Shared/Copters/ICopterStatus.cs +++ b/PlaneGcsSdk.Contract_Shared/Copters/ICopterStatus.cs @@ -172,5 +172,15 @@ namespace Plane.Copters /// 获取当前电池电压,单位为伏特。 /// float Voltage { get; } + + //定位类型RTK,GPS + CopterLocationType LocationType { get; } + + + /// + /// MissionStatus=1表示正在飞向目标中,0标识达到目标 + /// + int MissionStatus { get; set; } + } } diff --git a/PlaneGcsSdk.Contract_Shared/PlaneGcsSdk.Contract_Shared.projitems b/PlaneGcsSdk.Contract_Shared/PlaneGcsSdk.Contract_Shared.projitems index 90ba7c6..7a3f02e 100644 --- a/PlaneGcsSdk.Contract_Shared/PlaneGcsSdk.Contract_Shared.projitems +++ b/PlaneGcsSdk.Contract_Shared/PlaneGcsSdk.Contract_Shared.projitems @@ -20,6 +20,7 @@ + diff --git a/PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs b/PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs index d822912..dd18bf6 100644 --- a/PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs +++ b/PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs @@ -155,8 +155,12 @@ namespace Plane.Copters private float _Voltage; + private CopterLocationType _LocationType= CopterLocationType.GPS; + private float _Yaw; + private int _MissionStatus; + #endregion Backing Fields public CopterImplSharedPart(SynchronizationContext uiSyncContext) : base(uiSyncContext) @@ -613,12 +617,27 @@ namespace Plane.Copters protected set { Set(nameof(Voltage), ref _Voltage, value); } } + + public CopterLocationType LocationType + { + get { return _LocationType; } + protected set { Set(nameof(LocationType), ref _LocationType, value); } + } + public float Yaw { get { return _Yaw; } protected set { Set(nameof(Yaw), ref _Yaw, value); } } + public int MissionStatus + { + get { return _MissionStatus; } + set { Set(nameof(MissionStatus), ref _MissionStatus, value); } + } + + + #if PRIVATE public #else diff --git a/PlaneGcsSdk_Shared/Copters/EmptyCopter.cs b/PlaneGcsSdk_Shared/Copters/EmptyCopter.cs index 1f7c642..5ac9007 100644 --- a/PlaneGcsSdk_Shared/Copters/EmptyCopter.cs +++ b/PlaneGcsSdk_Shared/Copters/EmptyCopter.cs @@ -84,6 +84,11 @@ namespace Plane.Copters return TaskUtils.CompletedTask; } + public Task InitAsync() + { + return TaskUtils.CompletedTask; + } + public Task StopPairingAsync() { return TaskUtils.CompletedTask; diff --git a/PlaneGcsSdk_Shared/Copters/FakeCopter.cs b/PlaneGcsSdk_Shared/Copters/FakeCopter.cs index d693bbd..6771e4b 100644 --- a/PlaneGcsSdk_Shared/Copters/FakeCopter.cs +++ b/PlaneGcsSdk_Shared/Copters/FakeCopter.cs @@ -343,6 +343,12 @@ namespace Plane.Copters return TaskUtils.CompletedTask; } + + public Task InitAsync() + { + return TaskUtils.CompletedTask; + } + public Task StopPairingAsync() { return TaskUtils.CompletedTask; diff --git a/PlaneGcsSdk_Shared/Copters/PLCopter.cs b/PlaneGcsSdk_Shared/Copters/PLCopter.cs index 2794b65..f675581 100644 --- a/PlaneGcsSdk_Shared/Copters/PLCopter.cs +++ b/PlaneGcsSdk_Shared/Copters/PLCopter.cs @@ -54,6 +54,8 @@ namespace Plane.Copters await _internalCopter.ConnectAsync().ConfigureAwait(false); IsConnected = _internalCopter.IsConnected; IsCheckingConnection = true; + //连接完成后做一些初始化的工作 + await InitAsync(); } public virtual async Task DisconnectAsync() @@ -248,6 +250,17 @@ namespace Plane.Copters await _internalCopter.GeneratePacketAsync(MAVLink.MAVLINK_MSG_ID_SET_PAIR, packet).ConfigureAwait(false); } + public async Task InitAsync() + { + float Gpstype= await _internalCopter.GetParamAsync("GPS_TYPE") ; + if (Gpstype == 15) + LocationType = CopterLocationType.RTK; + else + LocationType = CopterLocationType.GPS; + } + + + public async Task StopPairingAsync() { if (!IsPairing) return;