From 65e7394926c7bbe7f3aa7ae3874eb08357411d73 Mon Sep 17 00:00:00 2001 From: panxu Date: Mon, 30 Apr 2018 17:56:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=90=AF=E5=8A=A8=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Copters/ICopterActionsSharedByCopterManager.cs | 1 + .../CopterManagement/SingleCopterManager.cs | 4 ++++ PlaneGcsSdk_Shared/Copters/EmptyCopter.cs | 5 ++++- PlaneGcsSdk_Shared/Copters/FakeCopter.cs | 5 +++++ PlaneGcsSdk_Shared/Copters/PLCopter.cs | 8 +++++++- PlaneGcsSdk_Shared/Copters/PlaneCopter.cs | 6 +++++- 6 files changed, 26 insertions(+), 3 deletions(-) diff --git a/PlaneGcsSdk.Contract_Shared/Copters/ICopterActionsSharedByCopterManager.cs b/PlaneGcsSdk.Contract_Shared/Copters/ICopterActionsSharedByCopterManager.cs index 2f560aa..5805718 100644 --- a/PlaneGcsSdk.Contract_Shared/Copters/ICopterActionsSharedByCopterManager.cs +++ b/PlaneGcsSdk.Contract_Shared/Copters/ICopterActionsSharedByCopterManager.cs @@ -129,6 +129,7 @@ namespace Plane.Copters Task InjectGpsDataAsync(byte[] data, ushort length); + Task MissionStartAsync(int hour_utc, int minute_utc, int second_utc, double Missionlng, double Missionlat); } diff --git a/PlaneGcsSdk_Shared/CopterManagement/SingleCopterManager.cs b/PlaneGcsSdk_Shared/CopterManagement/SingleCopterManager.cs index 10cce52..1b382b0 100644 --- a/PlaneGcsSdk_Shared/CopterManagement/SingleCopterManager.cs +++ b/PlaneGcsSdk_Shared/CopterManagement/SingleCopterManager.cs @@ -147,6 +147,10 @@ namespace Plane.CopterManagement { return Copter.StartEmergencyHoverAsync(); } + public Task MissionStartAsync(int hour_utc, int minute_utc, int second_utc, double Missionlng, double Missionlat) + { + return Copter.MissionStartAsync(hour_utc, minute_utc, second_utc, Missionlng, Missionlat); + } public void StartMobileControl(int? millisecondsInterval = default(int?)) { diff --git a/PlaneGcsSdk_Shared/Copters/EmptyCopter.cs b/PlaneGcsSdk_Shared/Copters/EmptyCopter.cs index 1f7c642..6af04e8 100644 --- a/PlaneGcsSdk_Shared/Copters/EmptyCopter.cs +++ b/PlaneGcsSdk_Shared/Copters/EmptyCopter.cs @@ -93,7 +93,10 @@ namespace Plane.Copters { return TaskUtils.CompletedTask; } - + public Task MissionStartAsync(int hour_utc, int minute_utc, int second_utc, double Missionlng, double Missionlat) + { + return TaskUtils.CompletedTask; + } public Task UnlockAsync() { return TaskUtils.CompletedTask; diff --git a/PlaneGcsSdk_Shared/Copters/FakeCopter.cs b/PlaneGcsSdk_Shared/Copters/FakeCopter.cs index d693bbd..203b91c 100644 --- a/PlaneGcsSdk_Shared/Copters/FakeCopter.cs +++ b/PlaneGcsSdk_Shared/Copters/FakeCopter.cs @@ -354,6 +354,11 @@ namespace Plane.Copters _takeOffTargetAltitude = (int)alt; await TakeOffAsync().ConfigureAwait(false); } + public Task MissionStartAsync(int hour_utc, int minute_utc, int second_utc, double Missionlng, double Missionlat) + { + return TaskUtils.CompletedTask; + } + public async Task UnlockAsync() { diff --git a/PlaneGcsSdk_Shared/Copters/PLCopter.cs b/PlaneGcsSdk_Shared/Copters/PLCopter.cs index 2794b65..ea28c49 100644 --- a/PlaneGcsSdk_Shared/Copters/PLCopter.cs +++ b/PlaneGcsSdk_Shared/Copters/PLCopter.cs @@ -84,7 +84,13 @@ namespace Plane.Copters await _internalCopter.DoARMAsync(false).ConfigureAwait(false); } } - + public async Task MissionStartAsync(int hour_utc, int minute_utc, int second_utc, double Missionlng, double Missionlat) + { + if (IsUnlocked) + { + await _internalCopter.DoMissionStartAsync(hour_utc, minute_utc, second_utc, Missionlng, Missionlat).ConfigureAwait(false); + } + } public override async Task SetChannelsAsync() { await _internalCopter.SetChannelsAsync( diff --git a/PlaneGcsSdk_Shared/Copters/PlaneCopter.cs b/PlaneGcsSdk_Shared/Copters/PlaneCopter.cs index dd92578..e48a757 100644 --- a/PlaneGcsSdk_Shared/Copters/PlaneCopter.cs +++ b/PlaneGcsSdk_Shared/Copters/PlaneCopter.cs @@ -607,7 +607,11 @@ namespace Plane.Copters /// Takeoff from ground / hand |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Empty| Yaw angle (if magnetometer present), ignored without magnetometer| Latitude| Longitude| Altitude| return await DoCommandAsync(MAVLink.MAV_CMD.TAKEOFF, 0, 0, 0, -1, 0, 0, 15); } - + public async Task DoMissionStartAsync(int hour_utc, int minute_utc, int second_utc, double Missionlng, double Missionlat) + { + /// Takeoff from ground / hand |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Empty| Yaw angle (if magnetometer present), ignored without magnetometer| Latitude| Longitude| Altitude| + return await DoCommandAsync(MAVLink.MAV_CMD.MISSION_START, hour_utc, minute_utc, second_utc, (float)Missionlng, (float)Missionlat, 0, 0); + } public async Task DoCommandAsync(MAVLink.MAV_CMD actionid, float p1, float p2, float p3, float p4, float p5, float p6, float p7) { giveComport = true;