diff --git a/Plane.FormationCreator/Formation/FlightTaskManager.cs b/Plane.FormationCreator/Formation/FlightTaskManager.cs index 3b961ce..f4cef25 100644 --- a/Plane.FormationCreator/Formation/FlightTaskManager.cs +++ b/Plane.FormationCreator/Formation/FlightTaskManager.cs @@ -492,10 +492,19 @@ namespace Plane.FormationCreator.Formation } else { - //用前一个任务目标位置 - lat = Tasks[SelectedTaskIndex-1].SingleCopterInfos[j].TargetLat; - lng = Tasks[SelectedTaskIndex-1].SingleCopterInfos[j].TargetLng; + //返航点直接设置起飞位置 + if (Tasks[SelectedTaskIndex - 1].SingleCopterInfos[j].IsLandWaypoint) + { + lat = Tasks[0].SingleCopterInfos[j].TargetLat; + lng = Tasks[0].SingleCopterInfos[j].TargetLng; + } + else + { + //用前一个任务目标位置 + lat = Tasks[SelectedTaskIndex - 1].SingleCopterInfos[j].TargetLat; + lng = Tasks[SelectedTaskIndex - 1].SingleCopterInfos[j].TargetLng; + } //如果前一个是起飞任务,没有目标高度,用当前的 if (Tasks[SelectedTaskIndex - 1].TaskType == FlightTaskType.TakeOff) @@ -529,7 +538,7 @@ namespace Plane.FormationCreator.Formation public async Task ResetTasks() { var copters = _copterManager.Copters; - + if (Tasks.Count == 0) return; if (TaskState == TasksStatus.Running) { diff --git a/Plane.FormationCreator/Formation/FlightTask_Land.cs b/Plane.FormationCreator/Formation/FlightTask_Land.cs index b0721da..1717240 100644 --- a/Plane.FormationCreator/Formation/FlightTask_Land.cs +++ b/Plane.FormationCreator/Formation/FlightTask_Land.cs @@ -36,8 +36,34 @@ namespace Plane.FormationCreator.Formation DateTime dtLastTime = DateTime.Now; TimeSpan ts = dtNow - dtLastTime; int waittime = (int)info.LandWaitTime * 1000; - await Task.Delay(waittime).ConfigureAwait(false); + + while (ts.TotalMilliseconds < waittime) + { + if (_flightTaskManager.IsPaused == true) + { + await info.Copter.HoverAsync(); + return; + + } + await Task.Delay(100).ConfigureAwait(true); + + dtNow = DateTime.Now; + ts = dtNow - dtLastTime; + } await info.Copter.LandAsync(); + while ((info.Copter.Altitude>0.0f)) + { + if (_flightTaskManager.IsPaused == true) + { + await info.Copter.HoverAsync(); + return; + + } + await Task.Delay(100).ConfigureAwait(true); + + } + + } } } diff --git a/Plane.FormationCreator/SplashScreen1.png b/Plane.FormationCreator/SplashScreen1.png index 3cf4b61..f3782cb 100644 Binary files a/Plane.FormationCreator/SplashScreen1.png and b/Plane.FormationCreator/SplashScreen1.png differ diff --git a/Plane.FormationCreator/ViewModels/View3DViewModel.cs b/Plane.FormationCreator/ViewModels/View3DViewModel.cs index 35a340e..76b1307 100644 --- a/Plane.FormationCreator/ViewModels/View3DViewModel.cs +++ b/Plane.FormationCreator/ViewModels/View3DViewModel.cs @@ -133,6 +133,7 @@ namespace Plane.FormationCreator.ViewModels var meshBuilderwaypoint = new MeshBuilder(false, false); //meshBuilderwaypoint.AddTriangle(new Point3D(-0.1, -0.1, 0), new Point3D(0.1, -0.1, 0), new Point3D(0, 0.2, 0)); + //飞机点的大小形状 meshBuilderwaypoint.AddSphere(new Point3D(0, 0, 0), 0.3); var meshwaypoint = meshBuilderwaypoint.ToMesh(true); @@ -178,7 +179,13 @@ namespace Plane.FormationCreator.ViewModels if (copter.LEDColor != null && copter.LEDColor != "") { - Color color = (Color)ColorConverter.ConvertFromString("#" + copter.LEDColor); + + Color color; + //3D在地面不能显示黑色,要不看不清楚 + if (copter.Altitude==0.0f) + color = (Color)ColorConverter.ConvertFromString("#FFFFFF"); + else + color = (Color)ColorConverter.ConvertFromString("#" + copter.LEDColor); panle3D.Material = MaterialHelper.CreateMaterial(color); panle3D.BackMaterial = MaterialHelper.CreateMaterial(color); } diff --git a/Plane.FormationCreator/Views/TaskBarView.xaml b/Plane.FormationCreator/Views/TaskBarView.xaml index e2654f9..776300f 100644 --- a/Plane.FormationCreator/Views/TaskBarView.xaml +++ b/Plane.FormationCreator/Views/TaskBarView.xaml @@ -21,15 +21,15 @@ Command="{Binding RunTasksCommand}"> - - @@ -37,7 +37,7 @@ - + @@ -51,20 +51,20 @@ Command="{Binding PauseTasksCommand}"> - - -