Compare commits
10 Commits
1b574fa118
...
e770082c28
Author | SHA1 | Date | |
---|---|---|---|
e770082c28 | |||
bc9c48b676 | |||
69d36723d6 | |||
625bd3ade9 | |||
a5271518e5 | |||
f09fadd475 | |||
39a1002852 | |||
5bb0bd49ce | |||
5dc074fc0b | |||
412d0436bb |
@ -69,6 +69,7 @@ namespace Plane.FormationCreator
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_config!=null)
|
||||
_config.Center = $"{value.Lat},{value.Lng}";
|
||||
}
|
||||
}
|
||||
@ -89,7 +90,8 @@ namespace Plane.FormationCreator
|
||||
}
|
||||
set
|
||||
{
|
||||
_config.ZoomLevel = value;
|
||||
if (_config != null)
|
||||
_config.ZoomLevel = value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,7 +101,8 @@ namespace Plane.FormationCreator
|
||||
{
|
||||
Directory.CreateDirectory(_dirPath);
|
||||
}
|
||||
File.WriteAllText(_filePath, JsonConvert.SerializeObject(_config));
|
||||
if (_config != null)
|
||||
File.WriteAllText(_filePath, JsonConvert.SerializeObject(_config));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,6 +87,11 @@ namespace Plane.FormationCreator.Formation
|
||||
//}
|
||||
|
||||
|
||||
public bool shiftkeydown;
|
||||
|
||||
|
||||
|
||||
|
||||
public IEnumerable<ICopter> SelectedCopters { get { return _selectedCoptersGetter().Cast<ICopter>(); } }
|
||||
|
||||
/// <summary>
|
||||
|
@ -13,9 +13,9 @@ namespace Plane.FormationCreator.Formation
|
||||
static class Extensions
|
||||
{
|
||||
public const float GpsArrivedDis = 2.0f; //GPS模式下航点到达精度
|
||||
public const float RTKArrivedDis = 0.8f; //RTK模式航点达到精度
|
||||
public const float RTKArrivedDis = 1.5f; //RTK模式航点达到精度
|
||||
public const float GpsCloseDis = 2.0f; //GPS模式下碰撞检测最近距离
|
||||
public const float RTKClosedDis = 0.5f; //RTK模式下碰撞检测最近距离
|
||||
public const float RTKClosedDis = 1.0f; //RTK模式下碰撞检测最近距离
|
||||
|
||||
|
||||
public static LatLng? GetCenter(this IEnumerable<ICopter> copters)
|
||||
|
@ -224,7 +224,7 @@ namespace Plane.FormationCreator.Formation
|
||||
var newTask = new FlightTask(FlightTaskType.FlyTo);
|
||||
int coptindex = 0;
|
||||
|
||||
int colnum = 5; //自动生成列数=4
|
||||
int colnum = 4; //自动生成列数=4
|
||||
float coldis = 5;//列相距5米
|
||||
float rowdis = 5;//行相距5米
|
||||
float matrixdis = 20; //生成方阵距离30米
|
||||
@ -363,6 +363,7 @@ namespace Plane.FormationCreator.Formation
|
||||
public void RestoreFlyToTask(bool staggerRoutes, dynamic singleCopterInfos)
|
||||
{
|
||||
var copters = _copterManager.Copters;
|
||||
float tagalt = 15;
|
||||
if (!copters.Any()) return;
|
||||
AppEx.Current.AppMode = AppMode.ModifyingTask;
|
||||
var lastTask = Tasks.LastOrDefault();
|
||||
@ -371,11 +372,23 @@ namespace Plane.FormationCreator.Formation
|
||||
var center = nullableCenter.Value;
|
||||
var newTask = new FlightTask(FlightTaskType.FlyTo) { StaggerRoutes = staggerRoutes };
|
||||
// TODO: 林俊清, 20150801, 处理实际飞行器数目与记录中数目不一致的情况。
|
||||
for (int i = 0; i < copters.Count && i < singleCopterInfos.Count; i++)
|
||||
for (int i = 0; i < copters.Count; i++)
|
||||
{
|
||||
var copter = copters[i];
|
||||
var singleCopterInfoObj = singleCopterInfos[i];
|
||||
var newSingleCopterInfo = FlightTaskSingleCopterInfo.CreateForFlyToTask(copter, new LatLng((double)singleCopterInfoObj.latOffset, (double)singleCopterInfoObj.lngOffset), (float)singleCopterInfoObj.targetAlt,(bool)singleCopterInfoObj.showLED);
|
||||
FlightTaskSingleCopterInfo newSingleCopterInfo;
|
||||
if (i < singleCopterInfos.Count)
|
||||
{
|
||||
var singleCopterInfoObj = singleCopterInfos[i];
|
||||
tagalt = (float)singleCopterInfoObj.targetAlt;
|
||||
newSingleCopterInfo = FlightTaskSingleCopterInfo.CreateForFlyToTask(copter, new LatLng((double)singleCopterInfoObj.latOffset, (double)singleCopterInfoObj.lngOffset), (float)singleCopterInfoObj.targetAlt, (bool)singleCopterInfoObj.showLED);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
newSingleCopterInfo = FlightTaskSingleCopterInfo.CreateForFlyToTask
|
||||
(copter, (double)copter.Latitude, (double)copter.Longitude, tagalt, (bool)false);
|
||||
|
||||
}
|
||||
newTask.SingleCopterInfos.Add(newSingleCopterInfo);
|
||||
}
|
||||
Tasks.Add(newTask);
|
||||
@ -471,7 +484,7 @@ namespace Plane.FormationCreator.Formation
|
||||
// added by ZJF
|
||||
private void RestoreLoiterTimeTask(float LoiteTimeTmp, bool flashCheck, float flashCheckPeriod,
|
||||
bool oneByOneCheck, float oneByOneCheckPeriod, string flashNameArray, string flashIndexArray,
|
||||
bool ChangeYaw, float HeadYaw,
|
||||
bool ChangeYaw, float HeadYaw,bool numberShow,
|
||||
dynamic singleCopterInfos)
|
||||
{
|
||||
var copters = _copterManager.Copters;
|
||||
@ -491,14 +504,36 @@ namespace Plane.FormationCreator.Formation
|
||||
loiterTimeTask.flashCopterIndexArray = flashIndexArray;
|
||||
loiterTimeTask.ChangeYaw = ChangeYaw;
|
||||
loiterTimeTask.HeadYaw = HeadYaw;
|
||||
loiterTimeTask.numberShow = numberShow;
|
||||
|
||||
|
||||
// foreach (var copter in copters)
|
||||
for (int i=0; i < copters.Count && i < singleCopterInfos.Count; i++)
|
||||
for (int i=0; i < copters.Count ; i++)
|
||||
{
|
||||
var copter = copters[i];
|
||||
var singleCopterInfoObj = singleCopterInfos[i];
|
||||
var newSingleCopterInfo = FlightTaskSingleCopterInfo.CreateForLoiterTimeTask(copter, new LatLng((double)singleCopterInfoObj.latOffset, (double)singleCopterInfoObj.lngOffset), (float)singleCopterInfoObj.targetAlt);
|
||||
float tagalt = 15;
|
||||
|
||||
// var newSingleCopterInfo = FlightTaskSingleCopterInfo.CreateForLoiterTimeTask(copter, new LatLng((double)singleCopterInfoObj.latOffset, (double)singleCopterInfoObj.lngOffset), (float)singleCopterInfoObj.targetAlt);
|
||||
|
||||
FlightTaskSingleCopterInfo newSingleCopterInfo;
|
||||
if (i < singleCopterInfos.Count)
|
||||
{
|
||||
var singleCopterInfoObj = singleCopterInfos[i];
|
||||
tagalt = (float)singleCopterInfoObj.targetAlt;
|
||||
newSingleCopterInfo = FlightTaskSingleCopterInfo.CreateForLoiterTimeTask(copter, new LatLng((double)singleCopterInfoObj.latOffset, (double)singleCopterInfoObj.lngOffset), (float)singleCopterInfoObj.targetAlt);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
newSingleCopterInfo = FlightTaskSingleCopterInfo.CreateForLoiterTimeTask
|
||||
(copter, (double)copter.Latitude,
|
||||
(double)copter.Longitude, tagalt);
|
||||
|
||||
|
||||
}
|
||||
loiterTimeTask.SingleCopterInfos.Add(newSingleCopterInfo);
|
||||
|
||||
|
||||
}
|
||||
Tasks.Add(loiterTimeTask);
|
||||
TaskAdded?.Invoke(this, new FlightTaskAddedEventArgs { LastTask = lastTask, AddedTask = loiterTimeTask });
|
||||
@ -655,6 +690,7 @@ namespace Plane.FormationCreator.Formation
|
||||
flashIndexArray = task.flashCopterIndexArray,
|
||||
ChangeYaw = task.ChangeYaw,
|
||||
HeadYaw = task.HeadYaw,
|
||||
numberShow= task.numberShow,
|
||||
|
||||
|
||||
singleCopterInfos = task.SingleCopterInfos.Select(info =>
|
||||
@ -752,9 +788,15 @@ namespace Plane.FormationCreator.Formation
|
||||
RestoreCircleTask(task.singleCopterInfos);
|
||||
break;
|
||||
case FlightTaskType.Loiter:
|
||||
RestoreLoiterTimeTask((float)task.loiterTimeAttr, (bool)task.flashCheck, (float)task.flashCheckPeriod,
|
||||
(bool)task.oneByOneCheck, (float)task.oneByOneCheckPeriod, (string)task.flashNameArray,
|
||||
(string)task.flashIndexArray, (bool)task.ChangeYaw, (float)task.HeadYaw, task.singleCopterInfos);
|
||||
if (task.numberShow!=null)
|
||||
RestoreLoiterTimeTask((float)task.loiterTimeAttr, (bool)task.flashCheck, (float)task.flashCheckPeriod,
|
||||
(bool)task.oneByOneCheck, (float)task.oneByOneCheckPeriod, (string)task.flashNameArray,
|
||||
(string)task.flashIndexArray, (bool)task.ChangeYaw, (float)task.HeadYaw , (bool)task.numberShow, task.singleCopterInfos);
|
||||
else
|
||||
RestoreLoiterTimeTask((float)task.loiterTimeAttr, (bool)task.flashCheck, (float)task.flashCheckPeriod,
|
||||
(bool)task.oneByOneCheck, (float)task.oneByOneCheckPeriod, (string)task.flashNameArray,
|
||||
(string)task.flashIndexArray, (bool)task.ChangeYaw, (float)task.HeadYaw, false, task.singleCopterInfos);
|
||||
|
||||
|
||||
break;
|
||||
case FlightTaskType.SimpleCircle:
|
||||
@ -793,9 +835,14 @@ namespace Plane.FormationCreator.Formation
|
||||
RestoreCircleTask(task.singleCopterInfos);
|
||||
break;
|
||||
case FlightTaskType.Loiter:
|
||||
RestoreLoiterTimeTask( (float)task.loiterTimeAttr, (bool)task.flashCheck, (float)task.flashCheckPeriod,
|
||||
(bool)task.oneByOneCheck, (float)task.oneByOneCheckPeriod, (string)task.flashNameArray,
|
||||
(string)task.flashIndexArray, (bool)task.ChangeYaw, (float)task.HeadYaw, task.singleCopterInfos);
|
||||
if (task.numberShow != null)
|
||||
RestoreLoiterTimeTask((float)task.loiterTimeAttr, (bool)task.flashCheck, (float)task.flashCheckPeriod,
|
||||
(bool)task.oneByOneCheck, (float)task.oneByOneCheckPeriod, (string)task.flashNameArray,
|
||||
(string)task.flashIndexArray, (bool)task.ChangeYaw, (float)task.HeadYaw, (bool)task.numberShow, task.singleCopterInfos);
|
||||
else
|
||||
RestoreLoiterTimeTask((float)task.loiterTimeAttr, (bool)task.flashCheck, (float)task.flashCheckPeriod,
|
||||
(bool)task.oneByOneCheck, (float)task.oneByOneCheckPeriod, (string)task.flashNameArray,
|
||||
(string)task.flashIndexArray, (bool)task.ChangeYaw, (float)task.HeadYaw, false, task.singleCopterInfos);
|
||||
|
||||
break;
|
||||
case FlightTaskType.SimpleCircle:
|
||||
@ -815,10 +862,10 @@ namespace Plane.FormationCreator.Formation
|
||||
|
||||
// 在悬停任务时,左键waypoint为选中
|
||||
// 在悬停任务模式,且LED控制被选中时
|
||||
if ((this.SelectedTask.TaskType == FlightTaskType.Loiter) && (this.SelectedTask.flashAttr || this.SelectedTask.oneByOneAttr))
|
||||
if ((this.SelectedTask.TaskType == FlightTaskType.Loiter) && (this.SelectedTask.flashAttr || this.SelectedTask.oneByOneAttr || this.SelectedTask.numberShow))
|
||||
{
|
||||
string copterNameStr = this.SelectedTask.flashCopterNameArray;
|
||||
|
||||
|
||||
string[] copterArray = copterNameStr.Split(',');
|
||||
bool flag = false;
|
||||
for (int i = 0; i < copterArray.Length; i++)
|
||||
@ -836,15 +883,22 @@ namespace Plane.FormationCreator.Formation
|
||||
if (copterArray[0].Equals(""))
|
||||
{
|
||||
this.SelectedTask.flashCopterNameArray += copter.Name;
|
||||
SelectedTask.flashCopterIndexArray += Name2Index(copter.Name);
|
||||
// SelectedTask.flashCopterIndexArray += Name2Index(copter.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SelectedTask.flashCopterNameArray += "," + copter.Name;
|
||||
SelectedTask.flashCopterIndexArray += "," + Name2Index(copter.Name);
|
||||
// SelectedTask.flashCopterIndexArray += "," + Name2Index(copter.Name);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -985,9 +1039,9 @@ namespace Plane.FormationCreator.Formation
|
||||
//RTK
|
||||
if (gpstype == 15)
|
||||
{
|
||||
if (copter.GpsFixType != GpsFixType.RTKFIXED)
|
||||
if ((copter.GpsFixType != GpsFixType.RTKFIXED) && (copter.GpsFixType != GpsFixType.RTKFLOAT))
|
||||
{
|
||||
Message.Show(copter.Id+ ",是RTK定位,但未进入RTKFIX模式");
|
||||
Message.Show(copter.Id+ ",是RTK定位,但未进入RTKFIX或RTKFLOAT模式");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -18,5 +18,20 @@ namespace Plane.FormationCreator.Formation
|
||||
};
|
||||
return info;
|
||||
}
|
||||
|
||||
public static FlightTaskSingleCopterInfo CreateForLoiterTimeTask(ICopter copter, double targetLat, double targetLng, float targetAlt)
|
||||
{
|
||||
var info = new FlightTaskSingleCopterInfo(copter)
|
||||
{
|
||||
TargetLat = targetLat,
|
||||
TargetLng = targetLng,
|
||||
TargetAlt = targetAlt,
|
||||
};
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,8 @@ namespace Plane.FormationCreator.Formation
|
||||
{
|
||||
public partial class FlightTask
|
||||
{
|
||||
private bool _StaggerRoutes = true;
|
||||
//默认不开这个功能
|
||||
private bool _StaggerRoutes = false;
|
||||
|
||||
//是否有交错
|
||||
public bool StaggerRoutes
|
||||
@ -55,6 +56,18 @@ namespace Plane.FormationCreator.Formation
|
||||
var tasks = new Task[infos.Count];
|
||||
for (int i = 0; i < infos.Count; i++)
|
||||
{
|
||||
|
||||
var info = infos[i];
|
||||
|
||||
tasks[i] = await Task.Factory.StartNew(async () =>
|
||||
{
|
||||
var internalInfo = info;
|
||||
await FlyToTaskFlySingleCopterAsync(internalInfo);
|
||||
});
|
||||
|
||||
/*
|
||||
//检测交叉可能导致整个编队停主无法继续组队,前面飞机没到位后面就没法飞
|
||||
//如果后面要加,需要多测试解决前序飞机可靠到达和记录日志确认是这里导致任务暂定
|
||||
var info = infos[i];
|
||||
var copter = info.Copter;
|
||||
var i1 = i;
|
||||
@ -72,6 +85,7 @@ namespace Plane.FormationCreator.Formation
|
||||
}
|
||||
await FlyToTaskFlySingleCopterAsync(info);
|
||||
});
|
||||
*/
|
||||
}
|
||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
|
||||
|
@ -1,14 +1,18 @@
|
||||
using System;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using Plane.Windows.Messages;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Plane.FormationCreator.Formation
|
||||
{
|
||||
public partial class FlightTask
|
||||
{
|
||||
private float _LoiterTimeAttr = 0.0f;
|
||||
private bool numberisend = false;
|
||||
public float LoiterTimeAttr
|
||||
{
|
||||
get { return _LoiterTimeAttr; }
|
||||
@ -18,6 +22,95 @@ namespace Plane.FormationCreator.Formation
|
||||
}
|
||||
}
|
||||
|
||||
private ICommand _NumberCommand5;
|
||||
public ICommand NumberCommand5
|
||||
{
|
||||
get
|
||||
{
|
||||
return _NumberCommand5 ?? (_NumberCommand5 = new RelayCommand<double>(async param =>
|
||||
{
|
||||
await LEDNumberAsync(numberfive);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private ICommand _NumberCommand4;
|
||||
public ICommand NumberCommand4
|
||||
{
|
||||
get
|
||||
{
|
||||
return _NumberCommand4 ?? (_NumberCommand4 = new RelayCommand<double>(async param =>
|
||||
{
|
||||
await LEDNumberAsync(numberFour);
|
||||
}));
|
||||
}
|
||||
}
|
||||
private ICommand _NumberCommand3;
|
||||
public ICommand NumberCommand3
|
||||
{
|
||||
get
|
||||
{
|
||||
return _NumberCommand3 ?? (_NumberCommand3 = new RelayCommand<double>(async param =>
|
||||
{
|
||||
await LEDNumberAsync(numberthree);
|
||||
}));
|
||||
}
|
||||
}
|
||||
private ICommand _NumberCommand2;
|
||||
public ICommand NumberCommand2
|
||||
{
|
||||
get
|
||||
{
|
||||
return _NumberCommand2 ?? (_NumberCommand2 = new RelayCommand<double>(async param =>
|
||||
{
|
||||
await LEDNumberAsync(numbertwo);
|
||||
}));
|
||||
}
|
||||
}
|
||||
private ICommand _NumberCommand1;
|
||||
public ICommand NumberCommand1
|
||||
{
|
||||
get
|
||||
{
|
||||
return _NumberCommand1 ?? (_NumberCommand1 = new RelayCommand<double>(async param =>
|
||||
{
|
||||
await LEDNumberAsync(numberone);
|
||||
}));
|
||||
}
|
||||
}
|
||||
private ICommand _NumberCommand0;
|
||||
public ICommand NumberCommand0
|
||||
{
|
||||
get
|
||||
{
|
||||
return _NumberCommand0 ?? (_NumberCommand0 = new RelayCommand<double>(async param =>
|
||||
{
|
||||
await LEDNumberAsync(numberzero);
|
||||
await Task.Delay(200).ConfigureAwait(false);
|
||||
await LEDNumberFlashAsync(false);
|
||||
await Task.Delay(200).ConfigureAwait(false);
|
||||
await LEDNumberAsync(numberzero);
|
||||
await Task.Delay(200).ConfigureAwait(false);
|
||||
await LEDNumberFlashAsync(false);
|
||||
await Task.Delay(200).ConfigureAwait(false);
|
||||
await LEDNumberAsync(numberzero);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private ICommand _NumberCommandok;
|
||||
public ICommand NumberCommandok
|
||||
{
|
||||
get
|
||||
{
|
||||
return _NumberCommandok ?? (_NumberCommandok = new RelayCommand<double>(async param =>
|
||||
{
|
||||
await LEDNumberFlashAsync(true);
|
||||
numberisend = true;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -32,6 +125,20 @@ namespace Plane.FormationCreator.Formation
|
||||
}
|
||||
}
|
||||
|
||||
// 数字倒计时 要设定13架飞机
|
||||
private bool _numberShow = false;
|
||||
public bool numberShow
|
||||
{
|
||||
get { return _numberShow; }
|
||||
set
|
||||
{
|
||||
Set(nameof(numberShow), ref _numberShow, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 机头方向0为北,顺时针360
|
||||
private float _HeadYaw = 1.0f;
|
||||
public float HeadYaw
|
||||
@ -94,7 +201,10 @@ namespace Plane.FormationCreator.Formation
|
||||
|
||||
for (int i = 0; i < copterArray.Length; i++)
|
||||
{
|
||||
flashCopterIndexArray += Name2Index(copterArray[i])+',';
|
||||
flashCopterIndexArray += Name2Index(copterArray[i]);
|
||||
//最后一个编号不要加","
|
||||
if (i!= (copterArray.Length-1))
|
||||
flashCopterIndexArray += ',';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -167,9 +277,22 @@ namespace Plane.FormationCreator.Formation
|
||||
private int[] lineNine = { 20, 26 };
|
||||
private int[] lineTen = { 25 };
|
||||
|
||||
|
||||
private int[] numberfive = { 0, 1, 2, 4, 5, 6, 7, 8,10,11, 12 };
|
||||
private int[] numberFour = { 2, 4, 5, 6, 7,8, 9,10, 12 };
|
||||
private int[] numberthree = { 0, 1, 2, 4, 5, 6, 7, 9, 10, 11, 12 };
|
||||
private int[] numbertwo = { 0, 1, 2, 3, 5, 6, 7, 9, 10, 11, 12 };
|
||||
private int[] numberone = { 2, 4, 7, 9, 12 };
|
||||
private int[] numberzero = { 0, 1, 2, 3, 4,5, 7, 8,9, 10, 11, 12 };
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task RunLoiterTimeTaskAsync()
|
||||
{
|
||||
|
||||
numberisend = false;
|
||||
if (ChangeYaw)
|
||||
{
|
||||
await Task.WhenAll(SingleCopterInfos.Select(info => SetCopterYawAsync(info,HeadYaw)));
|
||||
@ -200,8 +323,6 @@ namespace Plane.FormationCreator.Formation
|
||||
await LEDFlashParaModifyPlanAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var infos = SingleCopterInfos;
|
||||
if (flashAttr) // LED闪烁显示效果
|
||||
{
|
||||
@ -232,8 +353,26 @@ namespace Plane.FormationCreator.Formation
|
||||
// LED灯全亮
|
||||
await Task.WhenAll(SingleCopterInfos.Select(info => LEDFlashTaskFlySingleCopterAsync(info, true)));
|
||||
//延时等待
|
||||
await Task.Delay((int)(LoiterTimeAttr * 1000)).ConfigureAwait(false);
|
||||
|
||||
//判断是否下一步
|
||||
DateTime start = DateTime.Now;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (_flightTaskManager.IsPaused == true)
|
||||
{
|
||||
await Task.WhenAll(SingleCopterInfos.Select(info => (info.Copter.HoverAsync())));
|
||||
return;
|
||||
}
|
||||
|
||||
DateTime end = DateTime.Now;
|
||||
TimeSpan ts = end - start;
|
||||
//等待指定时间
|
||||
if (ts.TotalMilliseconds > LoiterTimeAttr * 1000)
|
||||
return;
|
||||
await Task.Delay(20).ConfigureAwait(false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else if (oneByOneAttr) // LED走马灯显示效果
|
||||
@ -286,9 +425,63 @@ namespace Plane.FormationCreator.Formation
|
||||
// LED灯全亮
|
||||
await Task.WhenAll(SingleCopterInfos.Select(info => LEDFlashTaskFlySingleCopterAsync(info, true)));
|
||||
//延时等待
|
||||
await Task.Delay((int)(LoiterTimeAttr * 1000)).ConfigureAwait(false);
|
||||
|
||||
//判断是否下一步
|
||||
DateTime start = DateTime.Now;
|
||||
while (true)
|
||||
{
|
||||
if (_flightTaskManager.IsPaused == true)
|
||||
{
|
||||
await Task.WhenAll(SingleCopterInfos.Select(info => (info.Copter.HoverAsync())));
|
||||
return;
|
||||
}
|
||||
|
||||
DateTime end = DateTime.Now;
|
||||
TimeSpan ts = end - start;
|
||||
//等待指定时间
|
||||
if (ts.TotalMilliseconds> LoiterTimeAttr* 1000)
|
||||
return;
|
||||
await Task.Delay(20).ConfigureAwait(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
else if (numberShow) // LED数字倒计时,目前固定需要13架飞机,并且在跑马灯\数字顺序里设置13架飞机的顺序
|
||||
{
|
||||
if (flashCopterNameArray.Equals(""))
|
||||
return;
|
||||
string[] copterArray = flashCopterIndexArray.Split(',');
|
||||
//没有13架
|
||||
if (copterArray.Count()!=13)
|
||||
return;
|
||||
|
||||
|
||||
|
||||
|
||||
//LED全灭
|
||||
await Task.WhenAll(SingleCopterInfos.Select(info => LEDFlashTaskFlySingleCopterAsync(info, false)));
|
||||
await Task.Delay(100).ConfigureAwait(false);
|
||||
|
||||
//判断是否下一步
|
||||
while (! numberisend)
|
||||
{
|
||||
if (_flightTaskManager.IsPaused == true)
|
||||
{
|
||||
await Task.WhenAll(SingleCopterInfos.Select(info => (info.Copter.HoverAsync())));
|
||||
return;
|
||||
}
|
||||
await Task.Delay(25).ConfigureAwait(false); //判断是否下一步20hz
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
else // 没有LED显示效果只等待
|
||||
{
|
||||
await Task.Delay((int)(LoiterTimeAttr * 1000)).ConfigureAwait(false);
|
||||
@ -650,5 +843,87 @@ namespace Plane.FormationCreator.Formation
|
||||
await Task.WhenAll(tasks_selected).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
||||
// 显示LED数字
|
||||
private async Task LEDNumberAsync(int[] Ledshowarray)
|
||||
{
|
||||
List<int> numberfivenew = new List<int>();
|
||||
var infos = SingleCopterInfos;
|
||||
|
||||
if (flashCopterNameArray.Equals(""))
|
||||
return;
|
||||
string[] copterArray = flashCopterIndexArray.Split(',');
|
||||
//没有13架
|
||||
if (copterArray.Count() != 13)
|
||||
return;
|
||||
var tasks_selected = new Task[copterArray.Count()];
|
||||
|
||||
// 转换序号
|
||||
for (int i = 0; i < copterArray.Length; i++)
|
||||
{
|
||||
if (copterArray[i] == "") break;
|
||||
|
||||
|
||||
int index = int.Parse(copterArray[i]);
|
||||
var info = infos[index];
|
||||
|
||||
|
||||
if (Array.IndexOf(Ledshowarray, i) != -1)
|
||||
{
|
||||
|
||||
tasks_selected[i] = await Task.Factory.StartNew(async () =>
|
||||
{
|
||||
var internalInfo = info;
|
||||
await LEDFlashTaskFlySingleCopterAsync(internalInfo, true);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
tasks_selected[i] = await Task.Factory.StartNew(async () =>
|
||||
{
|
||||
var internalInfo = info;
|
||||
await LEDFlashTaskFlySingleCopterAsync(internalInfo, false);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
await Task.WhenAll(tasks_selected).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
||||
private async Task LEDNumberFlashAsync(bool isOn)
|
||||
{
|
||||
List<int> numberfivenew = new List<int>();
|
||||
var infos = SingleCopterInfos;
|
||||
|
||||
if (flashCopterNameArray.Equals(""))
|
||||
return;
|
||||
string[] copterArray = flashCopterIndexArray.Split(',');
|
||||
//没有13架
|
||||
if (copterArray.Count() != 13)
|
||||
return;
|
||||
var tasks_selected = new Task[copterArray.Count()];
|
||||
|
||||
// 转换序号
|
||||
for (int i = 0; i < copterArray.Length; i++)
|
||||
{
|
||||
if (copterArray[i] == "") break;
|
||||
|
||||
|
||||
int index = int.Parse(copterArray[i]);
|
||||
var info = infos[index];
|
||||
tasks_selected[i] = await Task.Factory.StartNew(async () =>
|
||||
{
|
||||
var internalInfo = info;
|
||||
await LEDFlashTaskFlySingleCopterAsync(internalInfo, isOn);
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
await Task.WhenAll(tasks_selected).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace Plane.FormationCreator.Formation
|
||||
{
|
||||
public partial class FlightTask
|
||||
{
|
||||
private float _RTLAlt = 15.0f;
|
||||
private float _RTLAlt = 20.0f;// 15.0f;
|
||||
public float RTLAlt
|
||||
{
|
||||
get { return _RTLAlt; }
|
||||
|
@ -227,7 +227,7 @@ namespace Plane.FormationCreator.Formation
|
||||
//执行第二第三阶段起飞任务-------------使用中
|
||||
private async Task TakeOffSecondTaskAsync(FlightTaskSingleCopterInfo info)
|
||||
{
|
||||
float takeOffAlt = 15;
|
||||
float takeOffAlt = 20;
|
||||
int copterIndex = SingleCopterInfos.IndexOf(info);
|
||||
var copterNextTask = _flightTaskManager.Tasks[1].SingleCopterInfos[copterIndex];
|
||||
|
||||
|
@ -107,7 +107,9 @@ namespace Plane.FormationCreator
|
||||
|
||||
case Key.LeftShift:
|
||||
{
|
||||
var copters = _copterManager.AcceptingControlCopters;
|
||||
Shiftkeydown = true;
|
||||
_copterManager.shiftkeydown = true;
|
||||
break;
|
||||
}
|
||||
//开关SHOWLED
|
||||
@ -359,6 +361,8 @@ namespace Plane.FormationCreator
|
||||
case Key.LeftShift:
|
||||
{
|
||||
Shiftkeydown = false;
|
||||
_copterManager.shiftkeydown = false;
|
||||
|
||||
break;
|
||||
}
|
||||
case Key.W:
|
||||
|
@ -196,7 +196,7 @@ namespace Plane.FormationCreator.ViewModels
|
||||
}));
|
||||
}
|
||||
}
|
||||
private string _RTKcomvalue = "COM3";
|
||||
private string _RTKcomvalue = "COM7";
|
||||
public string RTKcomvalue
|
||||
{
|
||||
get { return _RTKcomvalue; }
|
||||
|
@ -54,7 +54,7 @@ namespace Plane.FormationCreator.ViewModels
|
||||
var center = _mapManager.Center;
|
||||
string id;
|
||||
|
||||
int colnum = 5; //自动生成列数=4
|
||||
int colnum = 4; //自动生成列数=4
|
||||
float coldis = 5;//列相距5米
|
||||
float rowdis = 5;//行相距5米
|
||||
int currcol = 0; //当前列号
|
||||
|
@ -290,56 +290,60 @@ namespace Plane.FormationCreator.ViewModels
|
||||
|
||||
|
||||
var selectedCopter = _copterManager.SelectedCopters.FirstOrDefault();
|
||||
bool copterisselect;
|
||||
int selectednumber = _copterManager.SelectedCopters.Count() - 1;
|
||||
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
|
||||
if (_flightTaskManager.SelectedTask != null)
|
||||
{
|
||||
copterisselect = false;
|
||||
selectedCopter = _flightTaskManager.SelectedTask.SingleCopterInfos[i].Copter;
|
||||
foreach (var capter in _copterManager.SelectedCopters)
|
||||
bool copterisselect;
|
||||
int selectednumber = _copterManager.SelectedCopters.Count() - 1;
|
||||
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
|
||||
{
|
||||
if (capter == selectedCopter)
|
||||
copterisselect = true;
|
||||
copterisselect = false;
|
||||
selectedCopter = _flightTaskManager.SelectedTask.SingleCopterInfos[i].Copter;
|
||||
foreach (var capter in _copterManager.SelectedCopters)
|
||||
{
|
||||
if (capter == selectedCopter)
|
||||
copterisselect = true;
|
||||
|
||||
}
|
||||
if (copterisselect)
|
||||
{
|
||||
|
||||
tlng = _flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetLng;
|
||||
if (minlng == 0)
|
||||
minlng = tlng;
|
||||
if (tlng > maxlng)
|
||||
maxlng = tlng;
|
||||
else if (tlng < minlng)
|
||||
minlng = tlng;
|
||||
|
||||
}
|
||||
}
|
||||
if (copterisselect)
|
||||
avgl = (maxlng - minlng) / selectednumber;
|
||||
int coptnum = 0;
|
||||
|
||||
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
|
||||
{
|
||||
copterisselect = false;
|
||||
selectedCopter = _flightTaskManager.SelectedTask.SingleCopterInfos[i].Copter;
|
||||
foreach (var capter in _copterManager.SelectedCopters)
|
||||
{
|
||||
if (capter == selectedCopter)
|
||||
copterisselect = true;
|
||||
|
||||
tlng = _flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetLng;
|
||||
if (minlng == 0)
|
||||
minlng = tlng;
|
||||
if (tlng > maxlng)
|
||||
maxlng = tlng;
|
||||
else if (tlng < minlng)
|
||||
minlng = tlng;
|
||||
}
|
||||
if (copterisselect)
|
||||
{
|
||||
|
||||
_flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetLng = minlng + avgl * coptnum;
|
||||
coptnum++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
avgl = (maxlng - minlng) / selectednumber;
|
||||
int coptnum = 0;
|
||||
|
||||
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
|
||||
{
|
||||
copterisselect = false;
|
||||
selectedCopter = _flightTaskManager.SelectedTask.SingleCopterInfos[i].Copter;
|
||||
foreach (var capter in _copterManager.SelectedCopters)
|
||||
{
|
||||
if (capter == selectedCopter)
|
||||
copterisselect = true;
|
||||
|
||||
}
|
||||
if (copterisselect)
|
||||
{
|
||||
|
||||
_flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetLng = minlng + avgl * coptnum;
|
||||
coptnum++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////
|
||||
|
||||
// await Task.Delay(100); // 如果不等待一段时间,很可能会再触发 DataStreamReceived 事件导致飞行器重新出现在地图上。
|
||||
@ -371,56 +375,59 @@ namespace Plane.FormationCreator.ViewModels
|
||||
//////////////////////
|
||||
|
||||
var selectedCopter = _copterManager.SelectedCopters.FirstOrDefault();
|
||||
bool copterisselect;
|
||||
int selectednumber = _copterManager.SelectedCopters.Count() - 1;
|
||||
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
|
||||
if (_flightTaskManager.SelectedTask != null)
|
||||
{
|
||||
copterisselect = false;
|
||||
selectedCopter = _flightTaskManager.SelectedTask.SingleCopterInfos[i].Copter;
|
||||
foreach (var capter in _copterManager.SelectedCopters)
|
||||
bool copterisselect;
|
||||
int selectednumber = _copterManager.SelectedCopters.Count() - 1;
|
||||
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
|
||||
{
|
||||
if (capter == selectedCopter)
|
||||
copterisselect = true;
|
||||
copterisselect = false;
|
||||
selectedCopter = _flightTaskManager.SelectedTask.SingleCopterInfos[i].Copter;
|
||||
foreach (var capter in _copterManager.SelectedCopters)
|
||||
{
|
||||
if (capter == selectedCopter)
|
||||
copterisselect = true;
|
||||
|
||||
}
|
||||
if (copterisselect)
|
||||
{
|
||||
|
||||
tlat = _flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetLat;
|
||||
if (minlat == 0)
|
||||
minlat = tlat;
|
||||
if (tlat > maxlat)
|
||||
maxlat = tlat;
|
||||
else if (tlat < minlat)
|
||||
minlat = tlat;
|
||||
|
||||
}
|
||||
}
|
||||
if (copterisselect)
|
||||
avgl = (maxlat - minlat) / selectednumber;
|
||||
int coptnum = 0;
|
||||
|
||||
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
|
||||
{
|
||||
copterisselect = false;
|
||||
selectedCopter = _flightTaskManager.SelectedTask.SingleCopterInfos[i].Copter;
|
||||
foreach (var capter in _copterManager.SelectedCopters)
|
||||
{
|
||||
if (capter == selectedCopter)
|
||||
copterisselect = true;
|
||||
|
||||
tlat = _flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetLat;
|
||||
if (minlat == 0)
|
||||
minlat = tlat;
|
||||
if (tlat > maxlat)
|
||||
maxlat = tlat;
|
||||
else if (tlat < minlat)
|
||||
minlat = tlat;
|
||||
}
|
||||
if (copterisselect)
|
||||
{
|
||||
|
||||
_flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetLat = maxlat - avgl * coptnum;
|
||||
coptnum++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////
|
||||
|
||||
// await Task.Delay(100); // 如果不等待一段时间,很可能会再触发 DataStreamReceived 事件导致飞行器重新出现在地图上。
|
||||
}
|
||||
avgl = (maxlat - minlat) / selectednumber;
|
||||
int coptnum = 0;
|
||||
|
||||
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
|
||||
{
|
||||
copterisselect = false;
|
||||
selectedCopter = _flightTaskManager.SelectedTask.SingleCopterInfos[i].Copter;
|
||||
foreach (var capter in _copterManager.SelectedCopters)
|
||||
{
|
||||
if (capter == selectedCopter)
|
||||
copterisselect = true;
|
||||
|
||||
}
|
||||
if (copterisselect)
|
||||
{
|
||||
|
||||
_flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetLat = maxlat - avgl * coptnum;
|
||||
coptnum++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////
|
||||
|
||||
// await Task.Delay(100); // 如果不等待一段时间,很可能会再触发 DataStreamReceived 事件导致飞行器重新出现在地图上。
|
||||
}
|
||||
}));
|
||||
}
|
||||
@ -442,6 +449,8 @@ namespace Plane.FormationCreator.ViewModels
|
||||
|
||||
|
||||
var selectedCopter = _copterManager.SelectedCopters.FirstOrDefault();
|
||||
if (_flightTaskManager.SelectedTask != null)
|
||||
{
|
||||
bool copterisselect;
|
||||
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
|
||||
{
|
||||
@ -482,13 +491,48 @@ namespace Plane.FormationCreator.ViewModels
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//await Task.Delay(100); // 如果不等待一段时间,很可能会再触发 DataStreamReceived 事件导致飞行器重新出现在地图上。
|
||||
|
||||
}));
|
||||
}
|
||||
else
|
||||
//调整飞机
|
||||
{
|
||||
//模拟飞机才能调整
|
||||
if (selectedCopter is FakeCopter)
|
||||
{
|
||||
foreach (var capter in _copterManager.SelectedCopters)
|
||||
{
|
||||
tlat = capter.Latitude;
|
||||
if (tlat > maxlat)
|
||||
maxlat = tlat;
|
||||
}
|
||||
|
||||
foreach (var capter in _copterManager.SelectedCopters)
|
||||
{
|
||||
var copterfk = (FakeCopter)capter;
|
||||
copterfk.SetProperties(
|
||||
latitude: maxlat,
|
||||
longitude: copterfk.Longitude);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@ -510,6 +554,8 @@ public ICommand VerticlAlignmentCommand
|
||||
double tlng = 0;
|
||||
var selectedCopter = _copterManager.SelectedCopters.FirstOrDefault();
|
||||
bool copterisselect;
|
||||
if (_flightTaskManager.SelectedTask != null)
|
||||
{
|
||||
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
|
||||
{
|
||||
copterisselect = false;
|
||||
@ -549,10 +595,33 @@ public ICommand VerticlAlignmentCommand
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//await Task.Delay(100); // 如果不等待一段时间,很可能会再触发 DataStreamReceived 事件导致飞行器重新出现在地图上。
|
||||
|
||||
}));
|
||||
//await Task.Delay(100); // 如果不等待一段时间,很可能会再触发 DataStreamReceived 事件导致飞行器重新出现在地图上。
|
||||
}
|
||||
else
|
||||
//调整飞机
|
||||
{
|
||||
//模拟飞机才能调整
|
||||
if (selectedCopter is FakeCopter)
|
||||
{
|
||||
foreach (var capter in _copterManager.SelectedCopters)
|
||||
{
|
||||
tlng = capter.Longitude;
|
||||
if (tlng > maxlng)
|
||||
maxlng = tlng;
|
||||
}
|
||||
|
||||
foreach (var capter in _copterManager.SelectedCopters)
|
||||
{
|
||||
var copterfk = (FakeCopter)capter;
|
||||
copterfk.SetProperties(
|
||||
latitude: copterfk.Latitude,
|
||||
longitude: maxlng );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@ -628,8 +697,11 @@ public ICommand VerticlAlignmentCommand
|
||||
double centlng = 0;
|
||||
double centlat = 0;
|
||||
var selectedCopter = _copterManager.SelectedCopters.FirstOrDefault();
|
||||
bool copterisselect;
|
||||
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
|
||||
if (_flightTaskManager.SelectedTask != null)
|
||||
{
|
||||
|
||||
bool copterisselect;
|
||||
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
|
||||
{
|
||||
copterisselect = false;
|
||||
selectedCopter = _flightTaskManager.SelectedTask.SingleCopterInfos[i].Copter;
|
||||
@ -690,7 +762,76 @@ public ICommand VerticlAlignmentCommand
|
||||
////
|
||||
await Task.Delay(100); // 如果不等待一段时间,很可能会再触发 DataStreamReceived 事件导致飞行器重新出现在地图上。
|
||||
|
||||
}));
|
||||
|
||||
}
|
||||
else
|
||||
//调整飞机
|
||||
{
|
||||
//模拟飞机才能调整
|
||||
if (selectedCopter is FakeCopter)
|
||||
{
|
||||
foreach (var capter in _copterManager.SelectedCopters)
|
||||
{
|
||||
lngsum += capter.Longitude;
|
||||
latsum += capter.Latitude;
|
||||
selectcount++;
|
||||
}
|
||||
|
||||
//计算旋转中心
|
||||
if (selectcount > 0)
|
||||
{
|
||||
centlng = lngsum / selectcount;
|
||||
centlat = latsum / selectcount;
|
||||
}
|
||||
else return;
|
||||
|
||||
foreach (var capter in _copterManager.SelectedCopters)
|
||||
{
|
||||
|
||||
|
||||
double lpDistance = CalculationLogLatDistance.GetDistanceOne(centlng, centlat,
|
||||
capter.Longitude,
|
||||
capter.Latitude);
|
||||
|
||||
CalculationLogLatDistance.MyLatLng mypos1, mypos2;
|
||||
mypos1 = new CalculationLogLatDistance.MyLatLng(centlng, centlat);
|
||||
mypos2 = new CalculationLogLatDistance.MyLatLng(
|
||||
capter.Longitude
|
||||
, capter.Latitude);
|
||||
double lpAzimuth = CalculationLogLatDistance.getAngle(mypos1, mypos2);
|
||||
double lng2 = 0;
|
||||
double lat2 = 0;
|
||||
CalculationLogLatDistance.ConvertDistanceToLogLat(centlng, centlat, lpDistance,
|
||||
lpAzimuth + (double)RotateLine, out lng2, out lat2);
|
||||
|
||||
var copterfk = (FakeCopter)capter;
|
||||
copterfk.SetProperties(
|
||||
latitude: lat2,
|
||||
longitude: lng2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@ -796,7 +937,9 @@ public ICommand VerticlAlignmentCommand
|
||||
double centlat = 0;
|
||||
double centalt = 0;
|
||||
var selectedCopter = _copterManager.SelectedCopters.FirstOrDefault();
|
||||
bool copterisselect;
|
||||
if (_flightTaskManager.SelectedTask != null)
|
||||
{
|
||||
bool copterisselect;
|
||||
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
|
||||
{
|
||||
copterisselect = false;
|
||||
@ -888,13 +1031,15 @@ public ICommand VerticlAlignmentCommand
|
||||
}
|
||||
}
|
||||
////
|
||||
|
||||
|
||||
|
||||
|
||||
await Task.Delay(100); // 如果不等待一段时间,很可能会再触发 DataStreamReceived 事件导致飞行器重新出现在地图上。
|
||||
|
||||
}));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace Plane.FormationCreator.Views
|
||||
|
||||
_copterManager.SetSelectionDelegates(
|
||||
() => lvwDrones.SelectedItems,
|
||||
copter => lvwDrones.SelectedItem = copter
|
||||
SelectitemMessage
|
||||
);
|
||||
lvwDrones.SelectionChanged += (sender, e) =>
|
||||
{
|
||||
@ -41,5 +41,14 @@ namespace Plane.FormationCreator.Views
|
||||
}
|
||||
|
||||
private CopterManager _copterManager = ServiceLocator.Current.GetInstance<CopterManager>();
|
||||
private void SelectitemMessage(ICopter copter)
|
||||
{
|
||||
|
||||
|
||||
if (!_copterManager.shiftkeydown)
|
||||
lvwDrones.SelectedItem = copter;
|
||||
else
|
||||
lvwDrones.SelectedItems.Add(copter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -345,6 +345,7 @@ namespace Plane.FormationCreator.Views
|
||||
private void RegisterEventHandlersForTaskInfo(Ellipse wp, int taskIndex)
|
||||
{
|
||||
var info = _flightTaskManager.Tasks[taskIndex].SingleCopterInfos.FirstOrDefault(i => i.Copter == this.Copter);
|
||||
if (info == null) return;
|
||||
info.PropertyChanged += (sender, e) =>
|
||||
{
|
||||
switch (e.PropertyName)
|
||||
|
@ -17,7 +17,7 @@
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
|
||||
<TextBlock Text="任务操作" FontWeight="Bold" />
|
||||
<TextBlock Text="任务操作" FontWeight="Bold" />
|
||||
|
||||
<StackPanel>
|
||||
|
||||
@ -266,7 +266,7 @@
|
||||
Grid.Column="1"
|
||||
Margin="0,5,10,0"
|
||||
Text="{Binding TargetAlt, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
@ -398,6 +398,7 @@
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
@ -422,8 +423,8 @@
|
||||
<TextBox Grid.Column="1" Grid.Row="0"
|
||||
Text="{Binding flashPeriodAttr, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="走马灯: " />
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="走马灯/数字顺序: " />
|
||||
<Grid Grid.Row="2" Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
@ -452,6 +453,77 @@
|
||||
IsChecked="{Binding ChangeYaw, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBox Grid.Column="1" Grid.Row="0"
|
||||
Text="{Binding HeadYaw, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</Grid>
|
||||
<Grid Grid.Row="5" Grid.Column="0" Margin="0,0,28,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox Grid.Row="0" Grid.Column="0"
|
||||
IsChecked="{Binding numberShow, UpdateSourceTrigger=PropertyChanged}" Margin="0,5,0,0" />
|
||||
</Grid>
|
||||
|
||||
|
||||
<Grid Grid.Row="5" Grid.ColumnSpan="2" Margin="19,0,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="0" Content="5"
|
||||
Margin="0,5,0,0"
|
||||
Command="{Binding NumberCommand5}" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="1" Content="4"
|
||||
Margin="0,5,0,0"
|
||||
Command="{Binding NumberCommand4}" />
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="2" Content="3"
|
||||
Margin="0,5,0,0"
|
||||
Command="{Binding NumberCommand3}" />
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="3" Content="2"
|
||||
Margin="0,5,0,0"
|
||||
Command="{Binding NumberCommand2}" />
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="4" Content="1"
|
||||
Margin="0,5,0,0"
|
||||
Command="{Binding NumberCommand1}" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="5" Content="0"
|
||||
Margin="0,5,0,0"
|
||||
Command="{Binding NumberCommand0}"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="6" Content="N"
|
||||
Margin="0,5,0,0"
|
||||
Command="{Binding NumberCommandok}"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
Loading…
Reference in New Issue
Block a user