更新使用Vs2022编译
增加新的自动航线计算模块 任务时间检测调整
This commit is contained in:
parent
f8f3f36304
commit
ff37f4fa04
@ -28,6 +28,8 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "PlaneGcsSdk.Contract_Shared
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlightRoute", "..\FlyTest\FlightRoute\FlightRoute.csproj", "{705AAB55-ED7A-4856-8F7B-E7A78ED9E39A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlyBase", "..\FlyCube\FlyBase\FlyBase.csproj", "{626A9BFA-07DE-4063-A178-360EB7057ED6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
..\Plane.Sdk3\PlaneGcsSdk_Shared\PlaneGcsSdk_Shared.projitems*{0111eb6e-72e3-499c-a3ba-022f5bbc4caf}*SharedItemsImports = 4
|
||||
@ -114,6 +116,14 @@ Global
|
||||
{705AAB55-ED7A-4856-8F7B-E7A78ED9E39A}.v4.0-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{705AAB55-ED7A-4856-8F7B-E7A78ED9E39A}.v4.0-Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{705AAB55-ED7A-4856-8F7B-E7A78ED9E39A}.v4.0-Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{626A9BFA-07DE-4063-A178-360EB7057ED6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{626A9BFA-07DE-4063-A178-360EB7057ED6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{626A9BFA-07DE-4063-A178-360EB7057ED6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{626A9BFA-07DE-4063-A178-360EB7057ED6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{626A9BFA-07DE-4063-A178-360EB7057ED6}.v4.0-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{626A9BFA-07DE-4063-A178-360EB7057ED6}.v4.0-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{626A9BFA-07DE-4063-A178-360EB7057ED6}.v4.0-Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{626A9BFA-07DE-4063-A178-360EB7057ED6}.v4.0-Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1635,8 +1635,12 @@ namespace Plane.FormationCreator.Formation
|
||||
//起飞航点0需要单独计算
|
||||
//第一个航点1,是调整航点根据地面摆放情况调整,默认2+1秒
|
||||
//从2开始自动计算
|
||||
Tasks[1].FlytoTime = 2;
|
||||
for (int taskIndex = 2; taskIndex < Tasks.Count; taskIndex++)
|
||||
|
||||
|
||||
// Tasks[1].FlytoTime = 2;
|
||||
// Tasks[1].LoiterTime = 1;
|
||||
|
||||
for (int taskIndex = 0; taskIndex < Tasks.Count; taskIndex++)
|
||||
SetTaskFlytime(taskIndex);
|
||||
Message.Show($"任务时间计算执行完成----");
|
||||
}
|
||||
@ -1647,6 +1651,8 @@ namespace Plane.FormationCreator.Formation
|
||||
Alert.Show("不支持的功能", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
Alert.Show("检测2号航点后的所有飞行时间是否能飞到", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
|
||||
//第一个航点1,是调整航点根据地面摆放情况调整,默认2+1秒
|
||||
//从2开始检查
|
||||
for (int taskIndex = 2; taskIndex < Tasks.Count; taskIndex++)
|
||||
@ -1738,9 +1744,8 @@ namespace Plane.FormationCreator.Formation
|
||||
float defvel_xy, float defvel_up, float defvel_down,
|
||||
bool settime = true)
|
||||
{
|
||||
if ((taskIndex > 0) && (taskIndex < Tasks.Count) && (Tasks[taskIndex].TaskType == FlightTaskType.FlyTo))
|
||||
{
|
||||
if (_copterManager.Copters.Count() > 0)
|
||||
if (_copterManager.Copters.Count() == 0) return;
|
||||
if ((taskIndex < Tasks.Count))
|
||||
{
|
||||
string copterName = "";
|
||||
double maxDistance_xy = 0.0f;
|
||||
@ -1750,7 +1755,47 @@ namespace Plane.FormationCreator.Formation
|
||||
string copterName_xy = "";
|
||||
string copterName_up = "";
|
||||
string copterName_down = "";
|
||||
int flytimetype = getflytype(taskIndex);
|
||||
int flytimetype = 1; //默认同时计算加减速
|
||||
|
||||
if (Tasks[taskIndex].TaskType == FlightTaskType.TakeOff)
|
||||
{
|
||||
double tasktime = 0;
|
||||
double waittime = 0;
|
||||
double upflytime = 0;
|
||||
foreach (var copter in _copterManager.Copters)
|
||||
{
|
||||
var nextWaypoint = Tasks[taskIndex + 1].SingleCopterInfos.FirstOrDefault(c => c.Copter == copter);
|
||||
var curWaypoint = Tasks[taskIndex].SingleCopterInfos.FirstOrDefault(c => c.Copter == copter);
|
||||
|
||||
double copter_maxDistance_up = nextWaypoint.TargetAlt;
|
||||
double time_up = getMinfligthtime((float)copter_maxDistance_up, acc_z, defvel_up, flytimetype);
|
||||
double copter_tasktime = curWaypoint.TakeOffWaitTime + time_up;
|
||||
|
||||
if (copter_tasktime > tasktime)
|
||||
{
|
||||
tasktime = copter_tasktime;
|
||||
maxDistance_up = copter_maxDistance_up;
|
||||
copterName= copter.Name;
|
||||
waittime = curWaypoint.TakeOffWaitTime;
|
||||
upflytime = time_up;
|
||||
}
|
||||
}
|
||||
Message.Show($"起飞任务{taskIndex + 1}起飞高度:{Math.Round(maxDistance_up, 2)}米 " +
|
||||
$"最长耗时:{Math.Round(tasktime, 2)}秒({Math.Round(upflytime, 2)},{Math.Round(waittime, 2)}),编号:{copterName}"
|
||||
);
|
||||
if (settime)
|
||||
{
|
||||
if (tasktime > 255)
|
||||
{
|
||||
Alert.Show($"任务{taskIndex + 1}时间太长,目前{tasktime}秒不能超255秒,请调整高度或速度", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
} else
|
||||
Tasks[taskIndex].TakeOffTime = (byte)(int)Math.Ceiling(tasktime);
|
||||
}
|
||||
}
|
||||
else if (Tasks[taskIndex].TaskType == FlightTaskType.FlyTo)
|
||||
{
|
||||
flytimetype = getflytype(taskIndex);
|
||||
foreach (var copter in _copterManager.Copters)
|
||||
{
|
||||
var prevWaypoint = Tasks[taskIndex - 1].SingleCopterInfos.FirstOrDefault(c => c.Copter == copter);
|
||||
@ -1827,9 +1872,9 @@ namespace Plane.FormationCreator.Formation
|
||||
|
||||
public void SetTaskFlytime(int taskIndex, bool settime = true)
|
||||
{
|
||||
if (taskIndex <= 1)
|
||||
if (taskIndex== 1)
|
||||
{
|
||||
Message.Show($"无法估计起飞或2号任务飞行时间,请根据现场情况调整");
|
||||
Message.Show($"2号任务是调整航点,根据现场飞机摆放离设计位置偏差来调整");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -447,6 +447,10 @@
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\FlyCube\FlyBase\FlyBase.csproj">
|
||||
<Project>{626a9bfa-07de-4063-a178-360eb7057ed6}</Project>
|
||||
<Name>FlyBase</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\FlyTest\FlightRoute\FlightRoute.csproj">
|
||||
<Project>{705aab55-ed7a-4856-8f7b-e7a78ed9e39a}</Project>
|
||||
<Name>FlightRoute</Name>
|
||||
|
@ -925,7 +925,7 @@ namespace Plane.FormationCreator.ViewModels
|
||||
return _AutoWayPointAllTmCommand ?? (_AutoWayPointAllTmCommand = new RelayCommand<int>(async =>
|
||||
{
|
||||
|
||||
if (Alert.Show("本操作将导致2号任务以后所有任务飞行时间重新计算(不修改悬停时间),您确定要继续吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning)
|
||||
if (Alert.Show("本操作将导致除2号任务以外所有任务飞行时间重新计算(不修改悬停时间),您确定要继续吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning)
|
||||
== MessageBoxResult.OK)
|
||||
{
|
||||
_flightTaskManager.SetAllTaskFlytime();
|
||||
|
Loading…
Reference in New Issue
Block a user